@microsoft/fast-element
Advanced tools
Comparing version 2.0.0-beta.3 to 2.0.0-beta.4
@@ -5,2 +5,83 @@ { | ||
{ | ||
"date": "Mon, 18 Jul 2022 21:10:01 GMT", | ||
"tag": "@microsoft/fast-element_v2.0.0-beta.4", | ||
"version": "2.0.0-beta.4", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "f9fb9c88902bd81233fb927a7357d4bca7634f29", | ||
"comment": "feat: extract all error messages from context and DI" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "27dc848327b25328e428f67505684d2171b58711", | ||
"comment": "feat: introduce new binding API" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "7f4d6b5587f6eff52e5b7f414e27543bb4d7772d", | ||
"comment": "Enabled DOM Container fallback functions when a container cannot be located." | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "0f57d55822bbf97ab69f90efc0a0d100b27e10eb", | ||
"comment": "feat: add render directive, renderWith decorator, and RenderInstruction" | ||
}, | ||
{ | ||
"author": "prudepixie@users.noreply.github.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "94e6b0a0e7e1fd1167bd6453c3f7b27efdc91804", | ||
"comment": "only store removed views if it can't be reused right away" | ||
}, | ||
{ | ||
"author": "32497422+KingOfTac@users.noreply.github.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "11d5b4075118456b2e7c2a4f32a415eeea94ed7f", | ||
"comment": "fix: enable createElementTemplate to have undefined attributes" | ||
}, | ||
{ | ||
"author": "prudepixie@users.noreply.github.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "31296ea2be3981d25f5feb773b2895dbedfaf2c2", | ||
"comment": "use index to track reusable views" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "4567188a47598b3d2589b05f039bea695f2b8875", | ||
"comment": "feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "f164aa75e62ed71c9386902051c021f1fdfba364", | ||
"comment": "fix: FASTElementDefinition#isDefined should be true only after define" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "aacfde6d1f52a20af5511c5e792f730bd091d452", | ||
"comment": "feat: move testing and dependency injection to fast-element" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "04c51a17dde6d03dc2e2a4de3666cbbec950d900", | ||
"comment": "fix: warn when host bindings are accidentally applied on non CE views" | ||
}, | ||
{ | ||
"author": "roeisenb@microsoft.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "b32eb1004960da95b74dba7f111ee859b6655896", | ||
"comment": "feat: perf and safety improvements to fast element definition" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 22 Jun 2022 20:17:50 GMT", | ||
@@ -7,0 +88,0 @@ "tag": "@microsoft/fast-element_v2.0.0-beta.3", |
# Change Log - @microsoft/fast-element | ||
This log was last generated on Wed, 22 Jun 2022 20:17:50 GMT and should not be manually modified. | ||
This log was last generated on Mon, 18 Jul 2022 21:10:01 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 2.0.0-beta.4 | ||
Mon, 18 Jul 2022 21:10:01 GMT | ||
### Changes | ||
- feat: extract all error messages from context and DI (roeisenb@microsoft.com) | ||
- feat: introduce new binding API (roeisenb@microsoft.com) | ||
- Enabled DOM Container fallback functions when a container cannot be located. (roeisenb@microsoft.com) | ||
- feat: add render directive, renderWith decorator, and RenderInstruction (roeisenb@microsoft.com) | ||
- only store removed views if it can't be reused right away (prudepixie@users.noreply.github.com) | ||
- fix: enable createElementTemplate to have undefined attributes (32497422+KingOfTac@users.noreply.github.com) | ||
- use index to track reusable views (prudepixie@users.noreply.github.com) | ||
- feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings (roeisenb@microsoft.com) | ||
- fix: FASTElementDefinition#isDefined should be true only after define (roeisenb@microsoft.com) | ||
- feat: move testing and dependency injection to fast-element (roeisenb@microsoft.com) | ||
- fix: warn when host bindings are accidentally applied on non CE views (roeisenb@microsoft.com) | ||
- feat: perf and safety improvements to fast element definition (roeisenb@microsoft.com) | ||
## 2.0.0-beta.3 | ||
@@ -8,0 +27,0 @@ |
@@ -40,3 +40,3 @@ import { Constructable } from "../interfaces.js"; | ||
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> { | ||
private observedAttributes; | ||
private platformDefined; | ||
/** | ||
@@ -82,10 +82,4 @@ * The type this element definition describes. | ||
readonly elementOptions?: ElementDefinitionOptions; | ||
private constructor(); | ||
/** | ||
* Creates an instance of FASTElementDefinition. | ||
* @param type - The type this definition is being created for. | ||
* @param nameOrConfig - The name of the element to define or a config object | ||
* that describes the element to define. | ||
*/ | ||
constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string); | ||
/** | ||
* Defines a custom element based on this definition. | ||
@@ -98,2 +92,9 @@ * @param registry - The element registry to define the element in. | ||
/** | ||
* Creates an instance of FASTElementDefinition. | ||
* @param type - The type this definition is being created for. | ||
* @param nameOrDef - The name of the element to define or a config object | ||
* that describes the element to define. | ||
*/ | ||
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>; | ||
/** | ||
* Gets the element definition associated with the specified type. | ||
@@ -100,0 +101,0 @@ * @param type - The custom element type to retrieve the definition for. |
@@ -1,2 +0,2 @@ | ||
import type { Constructable } from "../interfaces.js"; | ||
import { Constructable } from "../interfaces.js"; | ||
import { Controller } from "./controller.js"; | ||
@@ -48,2 +48,6 @@ import { FASTElementDefinition, PartialFASTElementDefinition } from "./fast-definitions.js"; | ||
} | ||
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>; | ||
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>; | ||
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType; | ||
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType; | ||
/** | ||
@@ -70,9 +74,8 @@ * A minimal base class for FASTElements that also provides | ||
*/ | ||
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType; | ||
define: typeof define; | ||
/** | ||
* Defines metadata for a FASTElement which can be used to later define the element. | ||
* IMPORTANT: This API will be renamed to "compose" in a future beta. | ||
* @public | ||
*/ | ||
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>; | ||
compose: typeof compose; | ||
}; | ||
@@ -86,1 +89,2 @@ /** | ||
export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import type { Constructable } from "./interfaces.js"; | ||
import { Constructable } from "./interfaces.js"; | ||
/** | ||
@@ -3,0 +3,0 @@ * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes. |
@@ -1,2 +0,2 @@ | ||
import { BindingObserver } from "./observation/observable.js"; | ||
import { ExpressionNotifier } from "./observation/observable.js"; | ||
/** | ||
@@ -20,2 +20,2 @@ * Functions used for getting and setting a stateful value. | ||
*/ | ||
export declare function useEffect(action: () => void): BindingObserver; | ||
export declare function useEffect(action: () => void): ExpressionNotifier; |
@@ -17,2 +17,16 @@ /** | ||
/** | ||
* Represents a class. | ||
* @public | ||
*/ | ||
export declare type Class<T, C = {}> = C & { | ||
/** | ||
* The class's prototype; | ||
*/ | ||
readonly prototype: T; | ||
/** | ||
* The class's constructor. | ||
*/ | ||
new (...args: any[]): T; | ||
}; | ||
/** | ||
* Provides a mechanism for releasing resources. | ||
@@ -81,14 +95,17 @@ * @public | ||
* @param code - The warning code to send. | ||
* @param args - Args relevant for the warning. | ||
* @param values - Values relevant for the warning message. | ||
*/ | ||
warn(code: number, ...args: any[]): void; | ||
warn(code: number, values?: Record<string, any>): void; | ||
/** | ||
* Creates an error. | ||
* @param code - The error code to send. | ||
* @param args - Args relevant for the error. | ||
* @param values - Values relevant for the error message. | ||
*/ | ||
error(code: number, ...args: any[]): Error; | ||
error(code: number, values?: Record<string, any>): Error; | ||
/** | ||
* Adds debug messages for errors and warnings. | ||
* @param messages - The message dictionary to add. | ||
* @remarks | ||
* Message can include placeholders like $\{name\} which can be | ||
* replaced by values passed at runtime. | ||
*/ | ||
@@ -106,4 +123,3 @@ addMessages(messages: Record<number, string>): void; | ||
elementRegistry = 4, | ||
styleSheetStrategy = 5, | ||
developerChannel = 6 | ||
styleSheetStrategy = 5 | ||
} | ||
@@ -161,3 +177,18 @@ /** | ||
twoWayBindingRequiresObservables = 1203, | ||
missingElementDefinition = 1401 | ||
hostBindingWithoutHost = 1204, | ||
unsupportedBindingBehavior = 1205, | ||
missingElementDefinition = 1401, | ||
noRegistrationForContext = 1501, | ||
noFactoryForResolver = 1502, | ||
invalidResolverStrategy = 1503, | ||
cannotAutoregisterDependency = 1504, | ||
cannotResolveKey = 1505, | ||
cannotConstructNativeFunction = 1506, | ||
cannotJITRegisterNonConstructor = 1507, | ||
cannotJITRegisterIntrinsic = 1508, | ||
cannotJITRegisterInterface = 1509, | ||
invalidResolver = 1510, | ||
invalidKey = 1511, | ||
noDefaultResolver = 1512, | ||
cyclicDependency = 1513 | ||
} | ||
@@ -164,0 +195,0 @@ /** |
@@ -26,6 +26,6 @@ import { Disposable } from "../interfaces.js"; | ||
* The signature of an arrow function capable of being evaluated | ||
* as part of a template binding update. | ||
* against source data and within an execution context. | ||
* @public | ||
*/ | ||
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn; | ||
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn; | ||
/** | ||
@@ -46,15 +46,21 @@ * A record of observable property access. | ||
/** | ||
* Enables evaluation of and subscription to a binding. | ||
* Observes a binding for changes. | ||
* | ||
* @public | ||
*/ | ||
export interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable { | ||
export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable { | ||
/** | ||
* Begins observing the binding for the source and returns the current value. | ||
* @param source - The source that the binding is based on. | ||
* @param context - The execution context to execute the binding within. | ||
* @returns The value of the binding. | ||
* Begins observing the binding. | ||
* @param source - The source to pass to the binding. | ||
* @param context - The context to pass to the binding. | ||
*/ | ||
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn; | ||
} | ||
/** | ||
* Enables evaluation of and subscription to a binding. | ||
* @public | ||
*/ | ||
export interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> { | ||
/** | ||
* Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver} | ||
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier} | ||
* is observing. | ||
@@ -119,4 +125,4 @@ */ | ||
/** | ||
* Creates a {@link BindingObserver} that can watch the | ||
* provided {@link Binding} for changes. | ||
* Creates a {@link ExpressionNotifier} that can watch the | ||
* provided {@link Expression} for changes. | ||
* @param binding - The binding to observe. | ||
@@ -126,3 +132,3 @@ * @param initialSubscriber - An initial subscriber to changes in the binding value. | ||
*/ | ||
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>; | ||
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>; | ||
/** | ||
@@ -133,3 +139,3 @@ * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated | ||
*/ | ||
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean; | ||
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean; | ||
}>; | ||
@@ -136,0 +142,0 @@ /** |
@@ -62,2 +62,8 @@ import type { Behavior } from "../observation/behavior.js"; | ||
/** | ||
* Normalizes a set of composable style options. | ||
* @param styles - The style options to normalize. | ||
* @returns A singular ElementStyles instance or undefined. | ||
*/ | ||
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined; | ||
/** | ||
* Indicates whether the DOM supports the adoptedStyleSheets feature. | ||
@@ -64,0 +70,0 @@ */ |
@@ -1,26 +0,8 @@ | ||
import type { Binding, ExecutionContext } from "../observation/observable.js"; | ||
import { BindingConfig, UpdateBinding } from "./binding.js"; | ||
import type { ViewBehaviorTargets } from "./html-directive.js"; | ||
/** | ||
* A binding behavior for signal bindings. | ||
* @public | ||
*/ | ||
export declare class SignalBinding extends UpdateBinding { | ||
private handlerProperty; | ||
import type { Expression } from "../observation/observable.js"; | ||
import type { Subscriber } from "../observation/notifier.js"; | ||
import { Binding } from "./html-directive.js"; | ||
export declare const Signal: Readonly<{ | ||
subscribe(signal: string, subscriber: Subscriber): void; | ||
unsubscribe(signal: string, subscriber: Subscriber): void; | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
private getSignal; | ||
/** | ||
* Sends the specified signal to signaled bindings. | ||
@@ -30,6 +12,7 @@ * @param signal - The signal to send. | ||
*/ | ||
static send(signal: string): void; | ||
} | ||
send(signal: string): void; | ||
}>; | ||
/** | ||
* Creates a signal binding configuration with the supplied options. | ||
* @param binding - The binding to refresh when signaled. | ||
* @param options - The signal name or a binding to use to retrieve the signal name. | ||
@@ -39,2 +22,2 @@ * @returns A binding configuration. | ||
*/ | ||
export declare const signal: <T = any>(options: string | Binding<T, any, any>) => BindingConfig<string | Binding<T, any, any>>; | ||
export declare function signal<T = any>(binding: Expression<T>, options: string | Expression<T>): Binding<T>; |
@@ -1,5 +0,13 @@ | ||
import type { ExecutionContext } from "../observation/observable.js"; | ||
import { BindingConfig, ChangeBinding, DefaultBindingOptions, HTMLBindingDirective } from "./binding.js"; | ||
import type { ViewBehaviorTargets } from "./html-directive.js"; | ||
import { Expression } from "../observation/observable.js"; | ||
import type { HTMLBindingDirective } from "./binding.js"; | ||
import { Binding } from "./html-directive.js"; | ||
/** | ||
* The twoWay binding options. | ||
* @public | ||
*/ | ||
export declare type TwoWayBindingOptions = { | ||
changeEvent?: string; | ||
fromView?: (value: any) => any; | ||
}; | ||
/** | ||
* The settings required to enable two-way binding. | ||
@@ -17,41 +25,8 @@ * @public | ||
/** | ||
* A binding behavior for bindings that update in two directions. | ||
* Creates a default binding. | ||
* @param binding - The binding to refresh when changed. | ||
* @param isBindingVolatile - Indicates whether the binding is volatile or not. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export declare class TwoWayBinding extends ChangeBinding { | ||
private changeEvent; | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
/** @internal */ | ||
handleEvent(event: Event): void; | ||
/** | ||
* Configures two-way binding. | ||
* @param settings - The settings to use for the two-way binding system. | ||
*/ | ||
static configure(settings: TwoWaySettings): void; | ||
} | ||
/** | ||
* The default twoWay binding options. | ||
* @public | ||
*/ | ||
export declare type DefaultTwoWayBindingOptions = DefaultBindingOptions & { | ||
changeEvent?: string; | ||
fromView?: (value: any) => any; | ||
}; | ||
/** | ||
* The default twoWay binding configuration. | ||
* @public | ||
*/ | ||
export declare const twoWay: BindingConfig<DefaultTwoWayBindingOptions> & import("./binding.js").BindingConfigResolver<DefaultTwoWayBindingOptions>; | ||
export declare function twoWay<T = any>(binding: Expression<T>, optionsOrChangeEvent?: TwoWayBindingOptions | string, isBindingVolatile?: boolean): Binding<T>; |
@@ -1,55 +0,4 @@ | ||
import { Binding, BindingObserver, ExecutionContext } from "../observation/observable.js"; | ||
import { AddViewBehaviorFactory, Aspect, Aspected, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js"; | ||
import type { CaptureType } from "./template.js"; | ||
import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js"; | ||
import { AddViewBehaviorFactory, Aspect, Aspected, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js"; | ||
/** | ||
* Describes how aspects of an HTML element will be affected by bindings. | ||
* @public | ||
*/ | ||
export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>; | ||
/** | ||
* Describes how aspects of an HTML element will be affected by bindings. | ||
* @public | ||
*/ | ||
export declare const BindingMode: Readonly<{ | ||
/** | ||
* Creates a binding mode based on the supplied behavior types. | ||
* @param UpdateType - The base behavior type used to update aspects. | ||
* @param EventType - The base behavior type used to respond to events. | ||
* @returns A new binding mode. | ||
*/ | ||
define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode; | ||
}>; | ||
/** | ||
* Describes the configuration for a binding expression. | ||
* @public | ||
*/ | ||
export interface BindingConfig<T = any> { | ||
/** | ||
* The binding mode to configure the binding with. | ||
*/ | ||
mode: BindingMode; | ||
/** | ||
* Options to be supplied to the binding behaviors. | ||
*/ | ||
options: T; | ||
} | ||
/** | ||
* Creates a new binding configuration based on the supplied options. | ||
* @public | ||
*/ | ||
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>; | ||
/** | ||
* Describes the configuration for a binding expression. | ||
* @public | ||
*/ | ||
export declare const BindingConfig: Readonly<{ | ||
/** | ||
* Creates a binding configuration based on the provided mode and options. | ||
* @param mode - The mode to use for the configuration. | ||
* @param defaultOptions - The default options to use for the configuration. | ||
* @returns A new binding configuration. | ||
*/ | ||
define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>; | ||
}>; | ||
/** | ||
* The "this" context for an update target function. | ||
@@ -76,46 +25,36 @@ * @public | ||
/** | ||
* A base binding behavior for DOM updates. | ||
* A simple View that can be interpolated into HTML content. | ||
* @public | ||
*/ | ||
export declare class UpdateBinding implements ViewBehavior { | ||
readonly directive: HTMLBindingDirective; | ||
protected updateTarget: UpdateTarget; | ||
export interface ContentView { | ||
/** | ||
* Creates an instance of UpdateBinding. | ||
* @param directive - The directive that has the configuration for this behavior. | ||
* @param updateTarget - The function used to update the target with the latest value. | ||
* Binds a view's behaviors to its binding source. | ||
* @param source - The binding source for the view's binding behaviors. | ||
* @param context - The execution context to run the view within. | ||
*/ | ||
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget); | ||
bind(source: any, context: ExecutionContext): void; | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
* Unbinds a view's behaviors from its binding source and context. | ||
*/ | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
unbind(): void; | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
* Inserts the view's DOM nodes before the referenced node. | ||
* @param node - The node to insert the view's DOM before. | ||
*/ | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
insertBefore(node: Node): void; | ||
/** | ||
* Creates a behavior. | ||
* @param targets - The targets available for behaviors to be attached to. | ||
* Removes the view's DOM nodes. | ||
* The nodes are not disposed and the view can later be re-inserted. | ||
*/ | ||
createBehavior(targets: ViewBehaviorTargets): ViewBehavior; | ||
remove(): void; | ||
} | ||
/** | ||
* A binding behavior for one-time bindings. | ||
* A simple template that can create ContentView instances. | ||
* @public | ||
*/ | ||
export declare class OneTimeBinding extends UpdateBinding { | ||
export interface ContentTemplate { | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
* Creates a simple content view instance. | ||
*/ | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
create(): ContentView; | ||
} | ||
@@ -126,4 +65,5 @@ /** | ||
*/ | ||
export declare class ChangeBinding extends UpdateBinding { | ||
private isBindingVolatile; | ||
export declare class BindingBehavior implements ViewBehavior { | ||
readonly directive: HTMLBindingDirective; | ||
protected updateTarget: UpdateTarget; | ||
private observerProperty; | ||
@@ -137,8 +77,2 @@ /** | ||
/** | ||
* Returns the binding observer used to update the node. | ||
* @param target - The target node. | ||
* @returns A BindingObserver. | ||
*/ | ||
protected getObserver(target: Node): BindingObserver; | ||
/** | ||
* Bind this behavior to the source. | ||
@@ -158,9 +92,33 @@ * @param source - The source to bind to. | ||
/** @internal */ | ||
handleChange(binding: Binding, observer: BindingObserver): void; | ||
handleChange(binding: Expression, observer: ExpressionObserver): void; | ||
/** | ||
* Returns the binding observer used to update the node. | ||
* @param target - The target node. | ||
* @returns A BindingObserver. | ||
*/ | ||
protected getObserver(target: Node): ExpressionObserver; | ||
/** | ||
* Creates a behavior. | ||
* @param targets - The targets available for behaviors to be attached to. | ||
*/ | ||
createBehavior(targets: ViewBehaviorTargets): ViewBehavior; | ||
} | ||
/** | ||
* A special binding behavior that can bind node content. | ||
* @public | ||
*/ | ||
export declare class ContentBehavior extends BindingBehavior { | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
} | ||
/** | ||
* A binding behavior for handling events. | ||
* @public | ||
*/ | ||
export declare class EventBinding { | ||
export declare class EventBehavior { | ||
readonly directive: HTMLBindingDirective; | ||
@@ -199,17 +157,2 @@ private contextProperty; | ||
/** | ||
* The default binding options. | ||
* @public | ||
*/ | ||
export declare type DefaultBindingOptions = AddEventListenerOptions; | ||
/** | ||
* The default onChange binding configuration. | ||
* @public | ||
*/ | ||
export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>; | ||
/** | ||
* The default onTime binding configuration. | ||
* @public | ||
*/ | ||
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>; | ||
/** | ||
* A directive that applies bindings. | ||
@@ -219,5 +162,3 @@ * @public | ||
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected { | ||
binding: Binding; | ||
mode: BindingMode; | ||
options: any; | ||
dataBinding: Binding; | ||
private factory; | ||
@@ -246,7 +187,5 @@ /** | ||
* Creates an instance of HTMLBindingDirective. | ||
* @param binding - The binding to apply. | ||
* @param mode - The binding mode to use when applying the binding. | ||
* @param options - The options to configure the binding with. | ||
* @param dataBinding - The binding configuration to apply. | ||
*/ | ||
constructor(binding: Binding, mode: BindingMode, options: any); | ||
constructor(dataBinding: Binding); | ||
/** | ||
@@ -264,8 +203,30 @@ * Creates HTML to be used within a template. | ||
/** | ||
* Creates a binding directive with the specified configuration. | ||
* @param binding - The binding expression. | ||
* @param config - The binding configuration. | ||
* @returns A binding directive. | ||
* Creates an standard binding. | ||
* @param binding - The binding to refresh when changed. | ||
* @param isVolatile - Indicates whether the binding is volatile or not. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>; | ||
export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>; | ||
/** | ||
* Creates a one time binding | ||
* @param binding - The binding to refresh when signaled. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>; | ||
/** | ||
* Creates an event listener binding. | ||
* @param binding - The binding to invoke when the event is raised. | ||
* @param options - Event listener options. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>; | ||
/** | ||
* Normalizes the input value into a binding. | ||
* @param value - The value to create the default binding for. | ||
* @returns A binding configuration for the provided value. | ||
* @public | ||
*/ | ||
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>; |
import type { Constructable } from "../interfaces.js"; | ||
import type { Behavior } from "../observation/behavior.js"; | ||
import type { Binding, ExecutionContext } from "../observation/observable.js"; | ||
import type { Subscriber } from "../observation/notifier.js"; | ||
import type { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js"; | ||
/** | ||
@@ -117,2 +118,27 @@ * The target nodes available to a behavior. | ||
/** | ||
* Captures a binding expression along with related information and capabilities. | ||
* | ||
* @public | ||
*/ | ||
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> { | ||
/** | ||
* Options associated with the binding. | ||
*/ | ||
options?: any; | ||
/** | ||
* Whether or not the binding is volatile. | ||
*/ | ||
isVolatile?: boolean; | ||
/** | ||
* Evaluates the binding expression. | ||
*/ | ||
evaluate: Expression<TSource, TReturn, TParent>; | ||
/** | ||
* Creates an observer capable of notifying a subscriber when the output of a binding changes. | ||
* @param directive - The HTML Directive to create the observer for. | ||
* @param subscriber - The subscriber to changes in the binding. | ||
*/ | ||
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>; | ||
} | ||
/** | ||
* The type of HTML aspect to target. | ||
@@ -184,3 +210,3 @@ * @public | ||
*/ | ||
binding?: Binding; | ||
dataBinding?: Binding; | ||
} | ||
@@ -187,0 +213,0 @@ /** |
import type { Behavior } from "../observation/behavior.js"; | ||
import type { Subscriber } from "../observation/notifier.js"; | ||
import { Binding, ExecutionContext } from "../observation/observable.js"; | ||
import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js"; | ||
import { Splice } from "../observation/arrays.js"; | ||
import { AddViewBehaviorFactory, HTMLDirective, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js"; | ||
import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js"; | ||
import type { CaptureType, SyntheticViewTemplate, ViewTemplate } from "./template.js"; | ||
@@ -26,6 +26,4 @@ /** | ||
export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber { | ||
private directive; | ||
private location; | ||
private itemsBinding; | ||
private templateBinding; | ||
private options; | ||
private source; | ||
@@ -44,3 +42,3 @@ private views; | ||
* @param location - The location in the DOM to render the repeat. | ||
* @param itemsBinding - The array to render. | ||
* @param dataBinding - The array to render. | ||
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies. | ||
@@ -51,3 +49,3 @@ * @param templateBinding - The template to render for each item. | ||
*/ | ||
constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions); | ||
constructor(directive: RepeatDirective, location: Node); | ||
/** | ||
@@ -69,3 +67,3 @@ * Bind this behavior to the source. | ||
*/ | ||
handleChange(source: any, args: Splice[]): void; | ||
handleChange(source: any, args: Splice[] | ExpressionObserver): void; | ||
private observeItems; | ||
@@ -81,7 +79,5 @@ private updateViews; | ||
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory { | ||
readonly itemsBinding: Binding; | ||
readonly dataBinding: Binding<TSource>; | ||
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>; | ||
readonly options: RepeatOptions; | ||
private isItemsBindingVolatile; | ||
private isTemplateBindingVolatile; | ||
/** | ||
@@ -102,7 +98,7 @@ * The unique id of the factory. | ||
* Creates an instance of RepeatDirective. | ||
* @param itemsBinding - The binding that provides the array to render. | ||
* @param dataBinding - The binding that provides the array to render. | ||
* @param templateBinding - The template binding used to obtain a template to render for each item in the array. | ||
* @param options - Options used to turn on special repeat features. | ||
*/ | ||
constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions); | ||
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions); | ||
/** | ||
@@ -116,4 +112,4 @@ * Creates a behavior for the provided target node. | ||
* A directive that enables list rendering. | ||
* @param itemsBinding - The array to render. | ||
* @param templateOrTemplateBinding - The template or a template binding used obtain a template | ||
* @param items - The array to render. | ||
* @param template - The template or a template binding used obtain a template | ||
* to render for each item in the array. | ||
@@ -123,2 +119,2 @@ * @param options - Options used to turn on special repeat features. | ||
*/ | ||
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>; | ||
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>; |
@@ -1,3 +0,3 @@ | ||
import { Binding, ExecutionContext } from "../observation/observable.js"; | ||
import { HTMLDirective, ViewBehaviorFactory } from "./html-directive.js"; | ||
import { ExecutionContext, Expression } from "../observation/observable.js"; | ||
import { Binding, HTMLDirective, ViewBehaviorFactory } from "./html-directive.js"; | ||
import type { ElementView, HTMLView, SyntheticView } from "./view.js"; | ||
@@ -90,3 +90,3 @@ /** | ||
*/ | ||
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>; | ||
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>; | ||
/** | ||
@@ -93,0 +93,0 @@ * Transforms a template literal string into a ViewTemplate. |
@@ -1,6 +0,6 @@ | ||
import type { Binding } from "../observation/observable.js"; | ||
import type { Expression } from "../observation/observable.js"; | ||
import type { CaptureType, SyntheticViewTemplate } from "./template.js"; | ||
/** | ||
* A directive that enables basic conditional rendering in a template. | ||
* @param binding - The condition to test for rendering. | ||
* @param condition - The condition to test for rendering. | ||
* @param templateOrTemplateBinding - The template or a binding that gets | ||
@@ -10,2 +10,2 @@ * the template to render when the condition is true. | ||
*/ | ||
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>; | ||
export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>; |
@@ -14,9 +14,4 @@ import { isString } from "../interfaces.js"; | ||
export class FASTElementDefinition { | ||
/** | ||
* Creates an instance of FASTElementDefinition. | ||
* @param type - The type this definition is being created for. | ||
* @param nameOrConfig - The name of the element to define or a config object | ||
* that describes the element to define. | ||
*/ | ||
constructor(type, nameOrConfig = type.definition) { | ||
this.platformDefined = false; | ||
if (isString(nameOrConfig)) { | ||
@@ -28,2 +23,3 @@ nameOrConfig = { name: nameOrConfig }; | ||
this.template = nameOrConfig.template; | ||
const proto = type.prototype; | ||
const attributes = AttributeDefinition.collect(type, nameOrConfig.attributes); | ||
@@ -38,5 +34,9 @@ const observedAttributes = new Array(attributes.length); | ||
attributeLookup[current.attribute] = current; | ||
Observable.defineProperty(proto, current); | ||
} | ||
Reflect.defineProperty(type, "observedAttributes", { | ||
value: observedAttributes, | ||
enumerable: true, | ||
}); | ||
this.attributes = attributes; | ||
this.observedAttributes = observedAttributes; | ||
this.propertyLookup = propertyLookup; | ||
@@ -54,10 +54,4 @@ this.attributeLookup = attributeLookup; | ||
: Object.assign(Object.assign({}, defaultElementOptions), nameOrConfig.elementOptions); | ||
this.styles = | ||
nameOrConfig.styles === void 0 | ||
? void 0 | ||
: Array.isArray(nameOrConfig.styles) | ||
? new ElementStyles(nameOrConfig.styles) | ||
: nameOrConfig.styles instanceof ElementStyles | ||
? nameOrConfig.styles | ||
: new ElementStyles([nameOrConfig.styles]); | ||
this.styles = ElementStyles.normalize(nameOrConfig.styles); | ||
fastElementRegistry.register(this); | ||
} | ||
@@ -68,3 +62,3 @@ /** | ||
get isDefined() { | ||
return !!fastElementRegistry.getByType(this.type); | ||
return this.platformDefined; | ||
} | ||
@@ -79,14 +73,4 @@ /** | ||
const type = this.type; | ||
if (fastElementRegistry.register(this)) { | ||
const attributes = this.attributes; | ||
const proto = type.prototype; | ||
for (let i = 0, ii = attributes.length; i < ii; ++i) { | ||
Observable.defineProperty(proto, attributes[i]); | ||
} | ||
Reflect.defineProperty(type, "observedAttributes", { | ||
value: this.observedAttributes, | ||
enumerable: true, | ||
}); | ||
} | ||
if (!registry.get(this.name)) { | ||
this.platformDefined = true; | ||
registry.define(this.name, type, this.elementOptions); | ||
@@ -96,2 +80,16 @@ } | ||
} | ||
/** | ||
* Creates an instance of FASTElementDefinition. | ||
* @param type - The type this definition is being created for. | ||
* @param nameOrDef - The name of the element to define or a config object | ||
* that describes the element to define. | ||
*/ | ||
static compose(type, nameOrDef) { | ||
const found = fastElementRegistry.getByType(type); | ||
if (found) { | ||
return new FASTElementDefinition(class extends type { | ||
}, nameOrDef); | ||
} | ||
return new FASTElementDefinition(type, nameOrDef); | ||
} | ||
} | ||
@@ -98,0 +96,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { isFunction } from "../interfaces.js"; | ||
import { Controller } from "./controller.js"; | ||
@@ -25,2 +26,14 @@ import { FASTElementDefinition, } from "./fast-definitions.js"; | ||
} | ||
function compose(type, nameOrDef) { | ||
if (isFunction(type)) { | ||
return FASTElementDefinition.compose(type, nameOrDef); | ||
} | ||
return FASTElementDefinition.compose(this, type); | ||
} | ||
function define(type, nameOrDef) { | ||
if (isFunction(type)) { | ||
return FASTElementDefinition.compose(type, nameOrDef).define().type; | ||
} | ||
return FASTElementDefinition.compose(this, type).define().type; | ||
} | ||
/** | ||
@@ -46,13 +59,8 @@ * A minimal base class for FASTElements that also provides | ||
*/ | ||
define(type, nameOrDef) { | ||
return this.metadata(type, nameOrDef).define().type; | ||
}, | ||
define, | ||
/** | ||
* Defines metadata for a FASTElement which can be used to later define the element. | ||
* IMPORTANT: This API will be renamed to "compose" in a future beta. | ||
* @public | ||
*/ | ||
metadata(type, nameOrDef) { | ||
return new FASTElementDefinition(type, nameOrDef); | ||
}, | ||
compose, | ||
}); | ||
@@ -68,4 +76,4 @@ /** | ||
return function (type) { | ||
FASTElement.define(type, nameOrDef); | ||
define(type, nameOrDef); | ||
}; | ||
} |
@@ -0,2 +1,4 @@ | ||
import "./interfaces.js"; | ||
import { Metadata } from "./metadata.js"; | ||
import { FAST } from "./platform.js"; | ||
const contextEventType = "context-request"; | ||
@@ -22,3 +24,5 @@ let requestStrategy; | ||
if (target == null || new.target !== undefined) { | ||
throw new Error(`No registration for context: '${Interface.name}'`); | ||
throw FAST.error(1501 /* Message.noRegistrationForContext */, { | ||
name: Interface.name, | ||
}); | ||
} | ||
@@ -25,0 +29,0 @@ if (property) { |
@@ -15,4 +15,32 @@ if (globalThis.FAST === void 0) { | ||
[1203 /* twoWayBindingRequiresObservables */]: "View=>Model update skipped. To use twoWay binding, the target property must be observable.", | ||
[1204 /* hostBindingWithoutHost */]: "No host element is present. Cannot bind host with ${name}.", | ||
[1205 /* unsupportedBindingBehavior */]: "The requested binding behavior is not supported by the binding engine.", | ||
[1401 /* missingElementDefinition */]: "Missing FASTElement definition.", | ||
[1501 /* noRegistrationForContext */]: "No registration for Context/Interface '${name}'.", | ||
[1502 /* noFactoryForResolver */]: "Dependency injection resolver for '${key}' returned a null factory.", | ||
[1503 /* invalidResolverStrategy */]: "Invalid dependency injection resolver strategy specified '${strategy}'.", | ||
[1504 /* cannotAutoregisterDependency */]: "Unable to autoregister dependency.", | ||
[1505 /* cannotResolveKey */]: "Unable to resolve dependency injection key '${key}'.", | ||
[1506 /* cannotConstructNativeFunction */]: "'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.", | ||
[1507 /* cannotJITRegisterNonConstructor */]: "Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?", | ||
[1508 /* cannotJITRegisterIntrinsic */]: "Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?", | ||
[1509 /* cannotJITRegisterInterface */]: "Attempted to jitRegister an interface '${value}'.", | ||
[1510 /* invalidResolver */]: "A valid resolver was not returned from the register method.", | ||
[1511 /* invalidKey */]: "Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?", | ||
[1512 /* noDefaultResolver */]: "'${key}' not registered. Did you forget to add @singleton()?", | ||
[1513 /* cyclicDependency */]: "Cyclic dependency found '${name}'.", | ||
}; | ||
const allPlaceholders = /(\$\{\w+?})/g; | ||
const placeholder = /\$\{(\w+?)}/g; | ||
const noValues = Object.freeze({}); | ||
function formatMessage(message, values) { | ||
return message | ||
.split(allPlaceholders) | ||
.map(v => { | ||
var _a; | ||
const replaced = v.replace(placeholder, "$1"); | ||
return String((_a = values[replaced]) !== null && _a !== void 0 ? _a : v); | ||
}) | ||
.join(""); | ||
} | ||
Object.assign(FAST, { | ||
@@ -22,11 +50,13 @@ addMessages(messages) { | ||
}, | ||
warn(code, ...args) { | ||
warn(code, values = noValues) { | ||
var _a; | ||
console.warn((_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Warning"); | ||
const message = (_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Warning"; | ||
console.warn(formatMessage(message, values)); | ||
}, | ||
error(code, ...args) { | ||
error(code, values = noValues) { | ||
var _a; | ||
return new Error((_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Error"); | ||
const message = (_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Error"; | ||
return new Error(formatMessage(message, values)); | ||
}, | ||
}); | ||
export {}; |
@@ -66,3 +66,3 @@ import { isFunction, isString, } from "../interfaces.js"; | ||
} | ||
class BindingObserverImplementation extends SubscriberSet { | ||
class ExpressionNotifierImplementation extends SubscriberSet { | ||
constructor(binding, initialSubscriber, isVolatileBinding = false) { | ||
@@ -222,4 +222,4 @@ super(binding, initialSubscriber); | ||
/** | ||
* Creates a {@link BindingObserver} that can watch the | ||
* provided {@link Binding} for changes. | ||
* Creates a {@link ExpressionNotifier} that can watch the | ||
* provided {@link Expression} for changes. | ||
* @param binding - The binding to observe. | ||
@@ -230,3 +230,3 @@ * @param initialSubscriber - An initial subscriber to changes in the binding value. | ||
binding(binding, initialSubscriber, isVolatileBinding = this.isVolatileBinding(binding)) { | ||
return new BindingObserverImplementation(binding, initialSubscriber, isVolatileBinding); | ||
return new ExpressionNotifierImplementation(binding, initialSubscriber, isVolatileBinding); | ||
}, | ||
@@ -233,0 +233,0 @@ /** |
@@ -29,3 +29,3 @@ // ensure FAST global - duplicated in polyfills.ts and debug.ts | ||
error(code) { | ||
return new Error(`Code ${code}`); | ||
return new Error(`Error ${code}`); | ||
}, | ||
@@ -32,0 +32,0 @@ addMessages() { }, |
@@ -74,2 +74,16 @@ import { FAST } from "../platform.js"; | ||
} | ||
/** | ||
* Normalizes a set of composable style options. | ||
* @param styles - The style options to normalize. | ||
* @returns A singular ElementStyles instance or undefined. | ||
*/ | ||
static normalize(styles) { | ||
return styles === void 0 | ||
? void 0 | ||
: Array.isArray(styles) | ||
? new ElementStyles(styles) | ||
: styles instanceof ElementStyles | ||
? styles | ||
: new ElementStyles([styles]); | ||
} | ||
} | ||
@@ -76,0 +90,0 @@ /** |
import { isString } from "../interfaces.js"; | ||
import { BindingMode, UpdateBinding } from "./binding.js"; | ||
const signals = Object.create(null); | ||
/** | ||
* A binding behavior for signal bindings. | ||
* @public | ||
*/ | ||
export class SignalBinding extends UpdateBinding { | ||
constructor() { | ||
super(...arguments); | ||
this.handlerProperty = `${this.directive.id}-h`; | ||
} | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source, context, targets) { | ||
const directive = this.directive; | ||
const target = targets[directive.nodeId]; | ||
const signal = this.getSignal(source, context); | ||
const handler = (target[this.handlerProperty] = () => { | ||
this.updateTarget(target, directive.targetAspect, directive.binding(source, context), source, context); | ||
}); | ||
handler(); | ||
const found = signals[signal]; | ||
import { Binding } from "./html-directive.js"; | ||
const subscribers = Object.create(null); | ||
export const Signal = Object.freeze({ | ||
subscribe(signal, subscriber) { | ||
const found = subscribers[signal]; | ||
if (found) { | ||
Array.isArray(found) | ||
? found.push(handler) | ||
: (signals[signal] = [found, handler]); | ||
found instanceof Set | ||
? found.add(subscriber) | ||
: (subscribers[signal] = new Set([found, subscriber])); | ||
} | ||
else { | ||
signals[signal] = handler; | ||
subscribers[signal] = subscriber; | ||
} | ||
} | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source, context, targets) { | ||
const signal = this.getSignal(source, context); | ||
const found = signals[signal]; | ||
if (found && Array.isArray(found)) { | ||
const directive = this.directive; | ||
const target = targets[directive.nodeId]; | ||
const handler = target[this.handlerProperty]; | ||
const index = found.indexOf(handler); | ||
if (index !== -1) { | ||
found.splice(index, 1); | ||
} | ||
}, | ||
unsubscribe(signal, subscriber) { | ||
const found = subscribers[signal]; | ||
if (found && found instanceof Set) { | ||
found.delete(subscriber); | ||
} | ||
else { | ||
signals[signal] = void 0; | ||
subscribers[signal] = void 0; | ||
} | ||
} | ||
getSignal(source, context) { | ||
const options = this.directive.options; | ||
return isString(options) ? options : options(source, context); | ||
} | ||
}, | ||
/** | ||
@@ -68,12 +30,45 @@ * Sends the specified signal to signaled bindings. | ||
*/ | ||
static send(signal) { | ||
const found = signals[signal]; | ||
send(signal) { | ||
const found = subscribers[signal]; | ||
if (found) { | ||
Array.isArray(found) ? found.forEach(x => x()) : found(); | ||
found instanceof Set | ||
? found.forEach(x => x.handleChange(this, signal)) | ||
: found.handleChange(this, signal); | ||
} | ||
}, | ||
}); | ||
class SignalObserver { | ||
constructor(dataBinding, subscriber) { | ||
this.dataBinding = dataBinding; | ||
this.subscriber = subscriber; | ||
} | ||
observe(source, context) { | ||
const signal = (this.signal = this.getSignal(source, context)); | ||
Signal.subscribe(signal, this); | ||
return this.dataBinding.evaluate(source, context); | ||
} | ||
dispose() { | ||
Signal.unsubscribe(this.signal, this); | ||
} | ||
handleChange() { | ||
this.subscriber.handleChange(this.dataBinding.evaluate, this); | ||
} | ||
getSignal(source, context) { | ||
const options = this.dataBinding.options; | ||
return isString(options) ? options : options(source, context); | ||
} | ||
} | ||
const signalMode = BindingMode.define(SignalBinding); | ||
class SignalBinding extends Binding { | ||
constructor(evaluate, options) { | ||
super(); | ||
this.evaluate = evaluate; | ||
this.options = options; | ||
} | ||
createObserver(directive, subscriber) { | ||
return new SignalObserver(this, subscriber); | ||
} | ||
} | ||
/** | ||
* Creates a signal binding configuration with the supplied options. | ||
* @param binding - The binding to refresh when signaled. | ||
* @param options - The signal name or a binding to use to retrieve the signal name. | ||
@@ -83,4 +78,4 @@ * @returns A binding configuration. | ||
*/ | ||
export const signal = (options) => { | ||
return { mode: signalMode, options }; | ||
}; | ||
export function signal(binding, options) { | ||
return new SignalBinding(binding, options); | ||
} |
@@ -1,4 +0,8 @@ | ||
import "../interfaces.js"; | ||
import { isString } from "../interfaces.js"; | ||
import { Observable, } from "../observation/observable.js"; | ||
import { FAST } from "../platform.js"; | ||
import { BindingConfig, BindingMode, ChangeBinding, } from "./binding.js"; | ||
import { Binding } from "./html-directive.js"; | ||
const defaultOptions = { | ||
fromView: v => v, | ||
}; | ||
let twoWaySettings = { | ||
@@ -9,40 +13,32 @@ determineChangeEvent() { | ||
}; | ||
/** | ||
* A binding behavior for bindings that update in two directions. | ||
* @public | ||
*/ | ||
export class TwoWayBinding extends ChangeBinding { | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source, context, targets) { | ||
class TwoWayObserver { | ||
constructor(directive, subscriber, dataBinding) { | ||
this.directive = directive; | ||
this.subscriber = subscriber; | ||
this.dataBinding = dataBinding; | ||
this.notifier = Observable.binding(dataBinding.evaluate, this, dataBinding.isVolatile); | ||
} | ||
observe(source, context) { | ||
var _a; | ||
super.bind(source, context, targets); | ||
const directive = this.directive; | ||
const target = targets[directive.nodeId]; | ||
if (!this.changeEvent) { | ||
this.changeEvent = | ||
(_a = directive.options.changeEvent) !== null && _a !== void 0 ? _a : twoWaySettings.determineChangeEvent(directive, target); | ||
(_a = this.dataBinding.options.changeEvent) !== null && _a !== void 0 ? _a : twoWaySettings.determineChangeEvent(this.directive, this.target); | ||
} | ||
target.addEventListener(this.changeEvent, this); | ||
this.target.addEventListener(this.changeEvent, this); | ||
return this.notifier.observe(source, context); | ||
} | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source, context, targets) { | ||
super.unbind(source, context, targets); | ||
targets[this.directive.nodeId].removeEventListener(this.changeEvent, this); | ||
dispose() { | ||
this.notifier.dispose(); | ||
this.target.removeEventListener(this.changeEvent, this); | ||
} | ||
/** @internal */ | ||
handleChange(subject, args) { | ||
this.subscriber.handleChange(this.dataBinding.evaluate, this); | ||
} | ||
/** @internal */ | ||
handleEvent(event) { | ||
const directive = this.directive; | ||
const target = event.currentTarget; | ||
const observer = this.getObserver(target); | ||
const last = observer.last; // using internal API!!! | ||
const notifier = this.notifier; | ||
const last = notifier.last; // using internal API!!! | ||
if (!last) { | ||
@@ -67,4 +63,18 @@ FAST.warn(1203 /* Message.twoWayBindingRequiresObservables */); | ||
} | ||
last.propertySource[last.propertyName] = directive.options.fromView(value); | ||
last.propertySource[last.propertyName] = this.dataBinding.options.fromView(value); | ||
} | ||
} | ||
class TwoWayBinding extends Binding { | ||
constructor(evaluate, isVolatile, options = defaultOptions) { | ||
super(); | ||
this.evaluate = evaluate; | ||
this.isVolatile = isVolatile; | ||
this.options = options; | ||
if (!options.fromView) { | ||
options.fromView = defaultOptions.fromView; | ||
} | ||
} | ||
createObserver(directive, subscriber) { | ||
return new TwoWayObserver(directive, subscriber, this); | ||
} | ||
/** | ||
@@ -79,7 +89,13 @@ * Configures two-way binding. | ||
/** | ||
* The default twoWay binding configuration. | ||
* Creates a default binding. | ||
* @param binding - The binding to refresh when changed. | ||
* @param isBindingVolatile - Indicates whether the binding is volatile or not. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export const twoWay = BindingConfig.define(BindingMode.define(TwoWayBinding), { | ||
fromView: v => v, | ||
}); | ||
export function twoWay(binding, optionsOrChangeEvent, isBindingVolatile = Observable.isVolatileBinding(binding)) { | ||
if (isString(optionsOrChangeEvent)) { | ||
optionsOrChangeEvent = { changeEvent: optionsOrChangeEvent }; | ||
} | ||
return new TwoWayBinding(binding, isBindingVolatile, optionsOrChangeEvent); | ||
} |
@@ -1,7 +0,7 @@ | ||
import "../interfaces.js"; | ||
import { isFunction } from "../interfaces.js"; | ||
import { ExecutionContext, Observable, } from "../observation/observable.js"; | ||
import { FAST } from "../platform.js"; | ||
import { DOM } from "./dom.js"; | ||
import { Aspect, HTMLDirective, } from "./html-directive.js"; | ||
import { Markup } from "./markup.js"; | ||
import { Aspect, Binding, HTMLDirective, } from "./html-directive.js"; | ||
import { Markup, nextId } from "./markup.js"; | ||
const createInnerHTMLBinding = globalThis.TrustedHTML | ||
@@ -16,96 +16,25 @@ ? (binding) => (s, c) => { | ||
: (binding) => binding; | ||
/** | ||
* Describes how aspects of an HTML element will be affected by bindings. | ||
* @public | ||
*/ | ||
export const BindingMode = Object.freeze({ | ||
/** | ||
* Creates a binding mode based on the supplied behavior types. | ||
* @param UpdateType - The base behavior type used to update aspects. | ||
* @param EventType - The base behavior type used to respond to events. | ||
* @returns A new binding mode. | ||
*/ | ||
define(UpdateType, EventType = EventBinding) { | ||
return Object.freeze({ | ||
[1]: d => new UpdateType(d, DOM.setAttribute), | ||
[2]: d => new UpdateType(d, DOM.setBooleanAttribute), | ||
[3]: d => new UpdateType(d, (t, a, v) => (t[a] = v)), | ||
[4]: d => new (createContentBinding(UpdateType))(d, updateContentTarget), | ||
[5]: d => new UpdateType(d, updateTokenListTarget), | ||
[6]: d => new EventType(d), | ||
}); | ||
}, | ||
}); | ||
/** | ||
* Describes the configuration for a binding expression. | ||
* @public | ||
*/ | ||
export const BindingConfig = Object.freeze({ | ||
/** | ||
* Creates a binding configuration based on the provided mode and options. | ||
* @param mode - The mode to use for the configuration. | ||
* @param defaultOptions - The default options to use for the configuration. | ||
* @returns A new binding configuration. | ||
*/ | ||
define(mode, defaultOptions) { | ||
const config = (options) => { | ||
return { | ||
mode: config.mode, | ||
options: Object.assign({}, defaultOptions, options), | ||
}; | ||
}; | ||
config.options = defaultOptions; | ||
config.mode = mode; | ||
return config; | ||
}, | ||
}); | ||
/** | ||
* A base binding behavior for DOM updates. | ||
* @public | ||
*/ | ||
export class UpdateBinding { | ||
/** | ||
* Creates an instance of UpdateBinding. | ||
* @param directive - The directive that has the configuration for this behavior. | ||
* @param updateTarget - The function used to update the target with the latest value. | ||
*/ | ||
constructor(directive, updateTarget) { | ||
this.directive = directive; | ||
this.updateTarget = updateTarget; | ||
class OnChangeBinding extends Binding { | ||
constructor(evaluate, isVolatile) { | ||
super(); | ||
this.evaluate = evaluate; | ||
this.isVolatile = isVolatile; | ||
} | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source, context, targets) { } | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source, context, targets) { } | ||
/** | ||
* Creates a behavior. | ||
* @param targets - The targets available for behaviors to be attached to. | ||
*/ | ||
createBehavior(targets) { | ||
createObserver(_, subscriber) { | ||
return Observable.binding(this.evaluate, subscriber, this.isVolatile); | ||
} | ||
} | ||
class OneTimeBinding extends Binding { | ||
constructor(evaluate) { | ||
super(); | ||
this.evaluate = evaluate; | ||
} | ||
createObserver() { | ||
return this; | ||
} | ||
observe(source, context) { | ||
return this.evaluate(source, context); | ||
} | ||
dispose() { } | ||
} | ||
function createContentBinding(Type) { | ||
return class extends Type { | ||
unbind(source, context, targets) { | ||
super.unbind(source, context, targets); | ||
const target = targets[this.directive.nodeId]; | ||
const view = target.$fastView; | ||
if (view !== void 0 && view.isComposed) { | ||
view.unbind(); | ||
view.needsBindOnly = true; | ||
} | ||
} | ||
}; | ||
} | ||
function updateContentTarget(target, aspect, value, source, context) { | ||
@@ -117,3 +46,3 @@ // If there's no actual value, then this equates to the | ||
} | ||
// If the value has a "create" method, then it's a template-like. | ||
// If the value has a "create" method, then it's a ContentTemplate. | ||
if (value.create) { | ||
@@ -205,22 +134,6 @@ target.textContent = ""; | ||
/** | ||
* A binding behavior for one-time bindings. | ||
* @public | ||
*/ | ||
export class OneTimeBinding extends UpdateBinding { | ||
/** | ||
* Bind this behavior to the source. | ||
* @param source - The source to bind to. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
bind(source, context, targets) { | ||
const directive = this.directive; | ||
this.updateTarget(targets[directive.nodeId], directive.targetAspect, directive.binding(source, context), source, context); | ||
} | ||
} | ||
/** | ||
* A binding behavior for bindings that change. | ||
* @public | ||
*/ | ||
export class ChangeBinding extends UpdateBinding { | ||
export class BindingBehavior { | ||
/** | ||
@@ -232,16 +145,7 @@ * Creates an instance of ChangeBinding. | ||
constructor(directive, updateTarget) { | ||
super(directive, updateTarget); | ||
this.isBindingVolatile = Observable.isVolatileBinding(directive.binding); | ||
this.directive = directive; | ||
this.updateTarget = updateTarget; | ||
this.observerProperty = `${directive.id}-o`; | ||
} | ||
/** | ||
* Returns the binding observer used to update the node. | ||
* @param target - The target node. | ||
* @returns A BindingObserver. | ||
*/ | ||
getObserver(target) { | ||
var _a; | ||
return ((_a = target[this.observerProperty]) !== null && _a !== void 0 ? _a : (target[this.observerProperty] = Observable.binding(this.directive.binding, this, this.isBindingVolatile))); | ||
} | ||
/** | ||
* Bind this behavior to the source. | ||
@@ -282,8 +186,45 @@ * @param source - The source to bind to. | ||
} | ||
/** | ||
* Returns the binding observer used to update the node. | ||
* @param target - The target node. | ||
* @returns A BindingObserver. | ||
*/ | ||
getObserver(target) { | ||
var _a; | ||
return ((_a = target[this.observerProperty]) !== null && _a !== void 0 ? _a : (target[this.observerProperty] = this.directive.dataBinding.createObserver(this.directive, this))); | ||
} | ||
/** | ||
* Creates a behavior. | ||
* @param targets - The targets available for behaviors to be attached to. | ||
*/ | ||
createBehavior(targets) { | ||
return this; | ||
} | ||
} | ||
/** | ||
* A special binding behavior that can bind node content. | ||
* @public | ||
*/ | ||
export class ContentBehavior extends BindingBehavior { | ||
/** | ||
* Unbinds this behavior from the source. | ||
* @param source - The source to unbind from. | ||
* @param context - The execution context that the binding is operating within. | ||
* @param targets - The targets that behaviors in a view can attach to. | ||
*/ | ||
unbind(source, context, targets) { | ||
super.unbind(source, context, targets); | ||
const target = targets[this.directive.nodeId]; | ||
const view = target.$fastView; | ||
if (view !== void 0 && view.isComposed) { | ||
view.unbind(); | ||
view.needsBindOnly = true; | ||
} | ||
} | ||
} | ||
/** | ||
* A binding behavior for handling events. | ||
* @public | ||
*/ | ||
export class EventBinding { | ||
export class EventBehavior { | ||
/** | ||
@@ -309,3 +250,3 @@ * Creates an instance of EventBinding. | ||
target[this.contextProperty] = context; | ||
target.addEventListener(directive.targetAspect, this, directive.options); | ||
target.addEventListener(directive.targetAspect, this, directive.dataBinding.options); | ||
} | ||
@@ -322,3 +263,3 @@ /** | ||
target[this.sourceProperty] = target[this.contextProperty] = null; | ||
target.removeEventListener(directive.targetAspect, this, directive.options); | ||
target.removeEventListener(directive.targetAspect, this, directive.dataBinding.options); | ||
} | ||
@@ -338,3 +279,3 @@ /** | ||
ExecutionContext.setEvent(event); | ||
const result = this.directive.binding(target[this.sourceProperty], target[this.contextProperty]); | ||
const result = this.directive.dataBinding.evaluate(target[this.sourceProperty], target[this.contextProperty]); | ||
ExecutionContext.setEvent(null); | ||
@@ -347,14 +288,2 @@ if (result !== true) { | ||
/** | ||
* The default onChange binding configuration. | ||
* @public | ||
*/ | ||
export const onChange = BindingConfig.define(BindingMode.define(ChangeBinding), {}); | ||
/** | ||
* The default onTime binding configuration. | ||
* @public | ||
*/ | ||
export const oneTime = BindingConfig.define(BindingMode.define(OneTimeBinding), { | ||
once: true, | ||
}); | ||
/** | ||
* A directive that applies bindings. | ||
@@ -366,12 +295,12 @@ * @public | ||
* Creates an instance of HTMLBindingDirective. | ||
* @param binding - The binding to apply. | ||
* @param mode - The binding mode to use when applying the binding. | ||
* @param options - The options to configure the binding with. | ||
* @param dataBinding - The binding configuration to apply. | ||
*/ | ||
constructor(binding, mode, options) { | ||
this.binding = binding; | ||
this.mode = mode; | ||
this.options = options; | ||
constructor(dataBinding) { | ||
this.dataBinding = dataBinding; | ||
this.factory = null; | ||
/** | ||
* The unique id of the factory. | ||
*/ | ||
this.id = nextId(); | ||
/** | ||
* The type of aspect to target. | ||
@@ -395,5 +324,26 @@ */ | ||
if (this.targetAspect === "innerHTML") { | ||
this.binding = createInnerHTMLBinding(this.binding); | ||
this.dataBinding.evaluate = createInnerHTMLBinding(this.dataBinding.evaluate); | ||
} | ||
this.factory = this.mode[this.aspectType](this); | ||
switch (this.aspectType) { | ||
case 1: | ||
this.factory = new BindingBehavior(this, DOM.setAttribute); | ||
break; | ||
case 2: | ||
this.factory = new BindingBehavior(this, DOM.setBooleanAttribute); | ||
break; | ||
case 3: | ||
this.factory = new BindingBehavior(this, (t, a, v) => (t[a] = v)); | ||
break; | ||
case 4: | ||
this.factory = new ContentBehavior(this, updateContentTarget); | ||
break; | ||
case 5: | ||
this.factory = new BindingBehavior(this, updateTokenListTarget); | ||
break; | ||
case 6: | ||
this.factory = new EventBehavior(this); | ||
break; | ||
default: | ||
throw FAST.error(1205 /* Message.unsupportedBindingBehavior */); | ||
} | ||
} | ||
@@ -405,13 +355,44 @@ return this.factory.createBehavior(targets); | ||
/** | ||
* Creates a binding directive with the specified configuration. | ||
* @param binding - The binding expression. | ||
* @param config - The binding configuration. | ||
* @returns A binding directive. | ||
* Creates an standard binding. | ||
* @param binding - The binding to refresh when changed. | ||
* @param isVolatile - Indicates whether the binding is volatile or not. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export function bind(binding, config = onChange) { | ||
if (!("mode" in config)) { | ||
config = onChange(config); | ||
} | ||
return new HTMLBindingDirective(binding, config.mode, config.options); | ||
export function bind(binding, isVolatile = Observable.isVolatileBinding(binding)) { | ||
return new OnChangeBinding(binding, isVolatile); | ||
} | ||
/** | ||
* Creates a one time binding | ||
* @param binding - The binding to refresh when signaled. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export function oneTime(binding) { | ||
return new OneTimeBinding(binding); | ||
} | ||
/** | ||
* Creates an event listener binding. | ||
* @param binding - The binding to invoke when the event is raised. | ||
* @param options - Event listener options. | ||
* @returns A binding configuration. | ||
* @public | ||
*/ | ||
export function listener(binding, options) { | ||
const config = new OnChangeBinding(binding, false); | ||
config.options = options; | ||
return config; | ||
} | ||
/** | ||
* Normalizes the input value into a binding. | ||
* @param value - The value to create the default binding for. | ||
* @returns A binding configuration for the provided value. | ||
* @public | ||
*/ | ||
export function normalizeBinding(value) { | ||
return isFunction(value) | ||
? bind(value) | ||
: value instanceof Binding | ||
? value | ||
: oneTime(() => value); | ||
} |
@@ -1,5 +0,5 @@ | ||
import { isString } from "../interfaces.js"; | ||
import { isFunction, isString } from "../interfaces.js"; | ||
import { FAST } from "../platform.js"; | ||
import { Parser } from "./markup.js"; | ||
import { bind, oneTime } from "./binding.js"; | ||
import { HTMLBindingDirective, oneTime } from "./binding.js"; | ||
import { Aspect } from "./html-directive.js"; | ||
@@ -14,2 +14,18 @@ import { HTMLView } from "./view.js"; | ||
}; | ||
function tryWarn(name) { | ||
if (!name.startsWith("fast-")) { | ||
FAST.warn(1204 /* Message.hostBindingWithoutHost */, { name }); | ||
} | ||
} | ||
const warningHost = new Proxy(document.createElement("div"), { | ||
get(target, property) { | ||
tryWarn(property); | ||
const value = Reflect.get(target, property); | ||
return isFunction(value) ? value.bind(target) : value; | ||
}, | ||
set(target, property, value) { | ||
tryWarn(property); | ||
return Reflect.set(target, property, value); | ||
}, | ||
}); | ||
class CompilationContext { | ||
@@ -65,3 +81,3 @@ constructor(fragment, directives) { | ||
targets.r = fragment; | ||
targets.h = hostBindingTarget !== null && hostBindingTarget !== void 0 ? hostBindingTarget : fragment; | ||
targets.h = hostBindingTarget !== null && hostBindingTarget !== void 0 ? hostBindingTarget : warningHost; | ||
for (const id of this.nodeIds) { | ||
@@ -83,3 +99,3 @@ targets[id]; // trigger locator | ||
if (includeBasicValues) { | ||
result = bind(() => attrValue, oneTime); | ||
result = new HTMLBindingDirective(oneTime(() => attrValue)); | ||
Aspect.assign(result, attr.name); | ||
@@ -254,2 +270,4 @@ } | ||
let sourceAspect; | ||
let binding; | ||
let isVolatile = false; | ||
const partCount = parts.length; | ||
@@ -261,5 +279,7 @@ const finalParts = parts.map((x) => { | ||
sourceAspect = x.sourceAspect || sourceAspect; | ||
return x.binding; | ||
binding = x.dataBinding || binding; | ||
isVolatile = isVolatile || x.dataBinding.isVolatile; | ||
return x.dataBinding.evaluate; | ||
}); | ||
const binding = (scope, context) => { | ||
const expression = (scope, context) => { | ||
let output = ""; | ||
@@ -271,3 +291,5 @@ for (let i = 0; i < partCount; ++i) { | ||
}; | ||
const directive = bind(binding); | ||
binding.evaluate = expression; | ||
binding.isVolatile = isVolatile; | ||
const directive = new HTMLBindingDirective(binding); | ||
Aspect.assign(directive, sourceAspect); | ||
@@ -274,0 +296,0 @@ return directive; |
import { createTypeRegistry } from "../platform.js"; | ||
import { Markup } from "./markup.js"; | ||
import { Markup, nextId } from "./markup.js"; | ||
const registry = createTypeRegistry(); | ||
@@ -43,2 +43,9 @@ /** | ||
/** | ||
* Captures a binding expression along with related information and capabilities. | ||
* | ||
* @public | ||
*/ | ||
export class Binding { | ||
} | ||
/** | ||
* The type of HTML aspect to target. | ||
@@ -136,2 +143,6 @@ * @public | ||
this.options = options; | ||
/** | ||
* The unique id of the factory. | ||
*/ | ||
this.id = nextId(); | ||
} | ||
@@ -138,0 +149,0 @@ /** |
@@ -1,8 +0,8 @@ | ||
import { isFunction } from "../interfaces.js"; | ||
import { Observable, } from "../observation/observable.js"; | ||
import { emptyArray } from "../platform.js"; | ||
import { ArrayObserver } from "../observation/arrays.js"; | ||
import { Markup } from "./markup.js"; | ||
import { Markup, nextId } from "./markup.js"; | ||
import { HTMLDirective, } from "./html-directive.js"; | ||
import { HTMLView } from "./view.js"; | ||
import { normalizeBinding } from "./binding.js"; | ||
const defaultRepeatOptions = Object.freeze({ | ||
@@ -26,3 +26,3 @@ positioning: false, | ||
* @param location - The location in the DOM to render the repeat. | ||
* @param itemsBinding - The array to render. | ||
* @param dataBinding - The array to render. | ||
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies. | ||
@@ -33,7 +33,5 @@ * @param templateBinding - The template to render for each item. | ||
*/ | ||
constructor(location, itemsBinding, isItemsBindingVolatile, templateBinding, isTemplateBindingVolatile, options) { | ||
constructor(directive, location) { | ||
this.directive = directive; | ||
this.location = location; | ||
this.itemsBinding = itemsBinding; | ||
this.templateBinding = templateBinding; | ||
this.options = options; | ||
this.source = null; | ||
@@ -46,5 +44,5 @@ this.views = []; | ||
this.bindView = bindWithoutPositioning; | ||
this.itemsBindingObserver = Observable.binding(itemsBinding, this, isItemsBindingVolatile); | ||
this.templateBindingObserver = Observable.binding(templateBinding, this, isTemplateBindingVolatile); | ||
if (options.positioning) { | ||
this.itemsBindingObserver = directive.dataBinding.createObserver(directive, this); | ||
this.templateBindingObserver = directive.templateBinding.createObserver(directive, this); | ||
if (directive.options.positioning) { | ||
this.bindView = bindWithPositioning; | ||
@@ -87,3 +85,3 @@ } | ||
handleChange(source, args) { | ||
if (source === this.itemsBinding) { | ||
if (args === this.itemsBindingObserver) { | ||
this.items = this.itemsBindingObserver.observe(this.source, this.context); | ||
@@ -93,3 +91,3 @@ this.observeItems(); | ||
} | ||
else if (source === this.templateBinding) { | ||
else if (args === this.templateBindingObserver) { | ||
this.template = this.templateBindingObserver.observe(this.source, this.context); | ||
@@ -123,23 +121,35 @@ this.refreshAllViews(true); | ||
const childContext = this.childContext; | ||
const totalRemoved = []; | ||
const bindView = this.bindView; | ||
let removeDelta = 0; | ||
for (let i = 0, ii = splices.length; i < ii; ++i) { | ||
const splice = splices[i]; | ||
const removed = splice.removed; | ||
totalRemoved.push(...views.splice(splice.index + removeDelta, removed.length)); | ||
removeDelta -= splice.addedCount; | ||
} | ||
const items = this.items; | ||
const template = this.template; | ||
const recycle = this.directive.options.recycle; | ||
const leftoverViews = []; | ||
let leftoverIndex = 0; | ||
let availableViews = 0; | ||
for (let i = 0, ii = splices.length; i < ii; ++i) { | ||
const splice = splices[i]; | ||
const removed = splice.removed; | ||
let removeIndex = 0; | ||
let addIndex = splice.index; | ||
const end = addIndex + splice.addedCount; | ||
const removedViews = views.splice(splice.index, removed.length); | ||
availableViews = leftoverViews.length + removedViews.length; | ||
for (; addIndex < end; ++addIndex) { | ||
const neighbor = views[addIndex]; | ||
const location = neighbor ? neighbor.firstChild : this.location; | ||
const view = this.options.recycle && totalRemoved.length > 0 | ||
? totalRemoved.shift() | ||
: template.create(); | ||
let view; | ||
if (recycle && availableViews > 0) { | ||
if (removeIndex <= availableViews && removedViews.length > 0) { | ||
view = removedViews[removeIndex]; | ||
removeIndex++; | ||
} | ||
else { | ||
view = leftoverViews[leftoverIndex]; | ||
leftoverIndex++; | ||
} | ||
availableViews--; | ||
} | ||
else { | ||
view = template.create(); | ||
} | ||
views.splice(addIndex, 0, view); | ||
@@ -149,7 +159,10 @@ bindView(view, items, addIndex, childContext); | ||
} | ||
if (removedViews[removeIndex]) { | ||
leftoverViews.push(...removedViews.slice(removeIndex)); | ||
} | ||
} | ||
for (let i = 0, ii = totalRemoved.length; i < ii; ++i) { | ||
totalRemoved[i].dispose(); | ||
for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) { | ||
leftoverViews[i].dispose(); | ||
} | ||
if (this.options.positioning) { | ||
if (this.directive.options.positioning) { | ||
for (let i = 0, ii = views.length; i < ii; ++i) { | ||
@@ -169,3 +182,3 @@ views[i].context.updatePosition(i, ii); | ||
let viewsLength = views.length; | ||
if (itemsLength === 0 || templateChanged || !this.options.recycle) { | ||
if (itemsLength === 0 || templateChanged || !this.directive.options.recycle) { | ||
// all views need to be removed | ||
@@ -220,13 +233,15 @@ HTMLView.disposeContiguousBatch(views); | ||
* Creates an instance of RepeatDirective. | ||
* @param itemsBinding - The binding that provides the array to render. | ||
* @param dataBinding - The binding that provides the array to render. | ||
* @param templateBinding - The template binding used to obtain a template to render for each item in the array. | ||
* @param options - Options used to turn on special repeat features. | ||
*/ | ||
constructor(itemsBinding, templateBinding, options) { | ||
this.itemsBinding = itemsBinding; | ||
constructor(dataBinding, templateBinding, options) { | ||
this.dataBinding = dataBinding; | ||
this.templateBinding = templateBinding; | ||
this.options = options; | ||
/** | ||
* The unique id of the factory. | ||
*/ | ||
this.id = nextId(); | ||
ArrayObserver.enable(); | ||
this.isItemsBindingVolatile = Observable.isVolatileBinding(itemsBinding); | ||
this.isTemplateBindingVolatile = Observable.isVolatileBinding(templateBinding); | ||
} | ||
@@ -245,3 +260,3 @@ /** | ||
createBehavior(targets) { | ||
return new RepeatBehavior(targets[this.nodeId], this.itemsBinding, this.isItemsBindingVolatile, this.templateBinding, this.isTemplateBindingVolatile, this.options); | ||
return new RepeatBehavior(this, targets[this.nodeId]); | ||
} | ||
@@ -252,4 +267,4 @@ } | ||
* A directive that enables list rendering. | ||
* @param itemsBinding - The array to render. | ||
* @param templateOrTemplateBinding - The template or a template binding used obtain a template | ||
* @param items - The array to render. | ||
* @param template - The template or a template binding used obtain a template | ||
* to render for each item in the array. | ||
@@ -259,7 +274,6 @@ * @param options - Options used to turn on special repeat features. | ||
*/ | ||
export function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeatOptions) { | ||
const templateBinding = isFunction(templateOrTemplateBinding) | ||
? templateOrTemplateBinding | ||
: () => templateOrTemplateBinding; | ||
return new RepeatDirective(itemsBinding, templateBinding, options); | ||
export function repeat(items, template, options = defaultRepeatOptions) { | ||
const dataBinding = normalizeBinding(items); | ||
const templateBinding = normalizeBinding(template); | ||
return new RepeatDirective(dataBinding, templateBinding, options); | ||
} |
import { isFunction, isString } from "../interfaces.js"; | ||
import { ExecutionContext } from "../observation/observable.js"; | ||
import { bind, oneTime } from "./binding.js"; | ||
import { bind, HTMLBindingDirective, oneTime } from "./binding.js"; | ||
import { Compiler } from "./compiler.js"; | ||
import { Aspect, HTMLDirective, } from "./html-directive.js"; | ||
import { Aspect, Binding, HTMLDirective, } from "./html-directive.js"; | ||
import { nextId } from "./markup.js"; | ||
@@ -81,3 +81,3 @@ /** | ||
if (isFunction(currentValue)) { | ||
html += createAspectedHTML(bind(currentValue), currentString, add); | ||
html += createAspectedHTML(new HTMLBindingDirective(bind(currentValue)), currentString, add); | ||
} | ||
@@ -87,3 +87,3 @@ else if (isString(currentValue)) { | ||
if (match !== null) { | ||
const directive = bind(() => currentValue, oneTime); | ||
const directive = new HTMLBindingDirective(oneTime(() => currentValue)); | ||
Aspect.assign(directive, match[2]); | ||
@@ -96,4 +96,7 @@ html += directive.createHTML(add); | ||
} | ||
else if (currentValue instanceof Binding) { | ||
html += createAspectedHTML(new HTMLBindingDirective(currentValue), currentString, add); | ||
} | ||
else if ((definition = HTMLDirective.getForInstance(currentValue)) === void 0) { | ||
html += createAspectedHTML(bind(() => currentValue, oneTime), currentString, add); | ||
html += createAspectedHTML(new HTMLBindingDirective(oneTime(() => currentValue)), currentString, add); | ||
} | ||
@@ -100,0 +103,0 @@ else { |
import { isFunction } from "../interfaces.js"; | ||
/** | ||
* A directive that enables basic conditional rendering in a template. | ||
* @param binding - The condition to test for rendering. | ||
* @param condition - The condition to test for rendering. | ||
* @param templateOrTemplateBinding - The template or a binding that gets | ||
@@ -9,7 +9,8 @@ * the template to render when the condition is true. | ||
*/ | ||
export function when(binding, templateOrTemplateBinding) { | ||
const getTemplate = isFunction(templateOrTemplateBinding) | ||
export function when(condition, templateOrTemplateBinding) { | ||
const dataBinding = isFunction(condition) ? condition : () => condition; | ||
const templateBinding = isFunction(templateOrTemplateBinding) | ||
? templateOrTemplateBinding | ||
: () => templateOrTemplateBinding; | ||
return (source, context) => binding(source, context) ? getTemplate(source, context) : null; | ||
return (source, context) => dataBinding(source, context) ? templateBinding(source, context) : null; | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1401:"Missing FASTElement definition."};Object.assign(o,{addMessages(t){Object.assign(l,t)},warn(t,...e){var s;console.warn(null!==(s=l[t])&&void 0!==s?s:"Unknown Warning")},error(t,...e){var s;return new Error(null!==(s=l[t])&&void 0!==s?s:"Unknown Error")}});const h={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},h));const a=globalThis.FAST;if(void 0===a.getById){const t=Object.create(null);Reflect.defineProperty(a,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},h))}void 0===a.error&&Object.assign(a,{warn(){},error:t=>new Error(`Code ${t}`),addMessages(){}});const c=Object.freeze([]);function d(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const u=t=>"function"==typeof t,f=t=>"string"==typeof t,p=a.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class b{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class g{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new b(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new b(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const v=a.getById(2,(()=>{const t=p.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw a.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new g(t))),i}function l(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class h{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];u(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class c extends b{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:C.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){f(e)&&(e=new h(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,s=this.isVolatileBinding(t)){return new c(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function y(t,e){v.defineProperty(t,e)}function m(t,e,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=a.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class C{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return w.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new C(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}static setEvent(t){w.set(t)}static create(){return new C}}C.default=new C,v.defineProperty(C.prototype,"index"),v.defineProperty(C.prototype,"length");class T{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const S=Object.freeze({reset:1,splice:2,optimized:3}),x=new T(0,c,0);x.reset=!0;const O=[x];let A=Object.freeze({support:S.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:c:O,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new T(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new T(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new T(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new T(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new T(0,[],i.length).adjustTo(t)),n}});const B=Object.freeze({reset:O,setDefaultStrategy(t){A=t}});function j(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class I extends b{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,j(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,v.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:A).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,p.enqueue(this))}}let $=!1;const V=Object.freeze({enable(){if($)return;$=!0,v.setArrayObserverFactory((t=>new I(t)));const t=Array.prototype;t.$fastPatch||(j(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:A)[e.name](this,i,e,t)}})))}});function k(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&(V.enable(),e=v.getNotifier(t)),v.track(e.lengthObserver,"length"),t.length}const P=new Map;let N;function F(t){return t.map((t=>t instanceof M?F(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class M{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof M?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(N),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(F(this.styles)),this}static setDefaultStrategy(t){N=t}}M.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=P.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),P.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}M.setDefaultStrategy(a.getById(5,(()=>_)));const E=d(),L=Object.freeze({getForInstance:E.getForInstance,getByType:E.getByType,define:t=>(E.register({type:t}),t)});function z(){return function(t){L.define(t)}}function R(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==L.getForInstance(o)&&(o=o.createCSS(r)),o instanceof M||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const H=(t,...e)=>{const{styles:s,behaviors:i}=R(t,e),n=new M(s);return i.length?n.withBehaviors(...i):n};class q{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(f(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new M(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}L.define(q);const D=H.partial=(t,...e)=>{const{styles:s,behaviors:i}=R(t,e);return new q(s,i)},Q=Object.freeze({queueUpdate:p.enqueue,nextUpdate:p.next,processUpdates:p.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),W=`fast-${Math.random().toString(36).substring(2,8)}`,U=`${W}{`,G=`}${W}`,J=G.length;let K=0;const X=()=>`${W}-${++K}`,Y=Object.freeze({interpolation:t=>`${U}${t}${G}`,attribute:t=>`${X()}="${U}${t}${G}"`,comment:t=>`\x3c!--${U}${t}${G}--\x3e`}),Z=Object.freeze({parse(t,e){const s=t.split(U);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(G);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+J)}""!==o&&i.push(o)}return i}}),tt=d(),et=Object.freeze({getForInstance:tt.getForInstance,getByType:tt.getByType,define:(t,e)=>((e=e||{}).type=t,tt.register(e),t)});function st(t){return function(e){et.define(e,t)}}const it=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(e)switch(t.sourceAspect=e,e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=it.property;break;case"classList":t.aspectType=it.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=it.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=it.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=it.property):(t.targetAspect=e,t.aspectType=it.attribute)}else t.aspectType=it.content}});class nt{constructor(t){this.options=t}createBehavior(t){return this}createHTML(t){return Y.attribute(t(this))}}const rt=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw a.error(1202)}:t=>t,ot=Object.freeze({define:(t,e=ft)=>Object.freeze({1:e=>new t(e,Q.setAttribute),2:e=>new t(e,Q.setBooleanAttribute),3:e=>new t(e,((t,e,s)=>t[e]=s)),4:e=>{return new(s=t,class extends s{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}})(e,at);var s},5:e=>new t(e,ct),6:t=>new e(t)})}),lt=Object.freeze({define(t,e){const s=t=>({mode:s.mode,options:Object.assign({},e,t)});return s.options=e,s.mode=t,s}});class ht{constructor(t,e){this.directive=t,this.updateTarget=e}bind(t,e,s){}unbind(t,e,s){}createBehavior(t){return this}}function at(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ct(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class dt extends ht{bind(t,e,s){const i=this.directive;this.updateTarget(s[i.nodeId],i.targetAspect,i.binding(t,e),t,e)}}class ut extends ht{constructor(t,e){super(t,e),this.isBindingVolatile=v.isVolatileBinding(t.binding),this.observerProperty=`${t.id}-o`}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=v.binding(this.directive.binding,this,this.isBindingVolatile)}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}}class ft{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;C.setEvent(t);const s=this.directive.binding(e[this.sourceProperty],e[this.contextProperty]);C.setEvent(null),!0!==s&&t.preventDefault()}}const pt=lt.define(ot.define(ut),{}),bt=lt.define(ot.define(dt),{once:!0});class gt{constructor(t,e,s){this.binding=t,this.mode=e,this.options=s,this.factory=null,this.aspectType=it.content}createHTML(t){return Y.interpolation(t(this))}createBehavior(t){return null==this.factory&&("innerHTML"===this.targetAspect&&(this.binding=rt(this.binding)),this.factory=this.mode[this.aspectType](this)),this.factory.createBehavior(t)}}function vt(t,e=pt){return"mode"in e||(e=pt(e)),new gt(t,e.mode,e.options)}function yt(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}et.define(gt,{aspected:!0});class mt{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){yt(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){yt(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const wt=(t,e)=>`${t}.${e}`,Ct={},Tt={index:0,node:null};class St{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=Ct[e];if(!n){const i=`_${e}`;Ct[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:e;for(const t of this.nodeIds)s[t];return new mt(e,this.factories,s)}}function xt(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,a=o.length;h<a;++h){const c=o[h],d=c.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=vt((()=>d),bt),it.assign(f,c.name)):f=$t.aggregate(u),null!==f&&(s.removeAttributeNode(c),h--,a--,t.addFactory(f,e,i,n))}}function Ot(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=At(t,s,n,i);n=e.node,i=e.index}}function At(t,e,s,i){const n=wt(e,i);switch(s.nodeType){case 1:xt(t,e,s,n,i),Ot(t,s,n);break;case 3:return function(t,e,s,i,n){const r=Z.parse(e.textContent,t.directives);if(null===r)return Tt.node=e.nextSibling,Tt.index=n+1,Tt;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=wt(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),f(h)?o.textContent=h:(o.textContent=" ",it.assign(h),t.addFactory(h,s,i,n)),l=o}return Tt.index=n+1,Tt.node=l.nextSibling,Tt}(t,s,e,n,i);case 8:const r=Z.parse(s.data,t.directives);null!==r&&t.addFactory($t.aggregate(r),e,n,i)}return Tt.index=i+1,Tt.node=s.nextSibling,Tt}const Bt={createHTML:t=>t};let jt=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Bt):Bt;const It=jt,$t={setHTMLPolicy(t){if(jt!==It)throw a.error(1201);jt=t},compile(t,e){let s;if(f(t)){s=document.createElement("TEMPLATE"),s.innerHTML=jt.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new St(i,e);return xt(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==Z.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Ot(n,i,"r"),Tt.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map((t=>f(t)?()=>t:(e=t.sourceAspect||e,t.binding))),n=vt(((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n}));return it.assign(n,e),n}};class Vt{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=$t.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:C.default),n.appendTo(e),n}}const kt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Pt(t,e,s){const i=kt.exec(e);return null!==i&&it.assign(t,i[2]),t.createHTML(s)}function Nt(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=X();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,u(o))s+=Pt(vt(o),r,n);else if(f(o)){const t=kt.exec(r);if(null!==t){const e=vt((()=>o),bt);it.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else void 0===(l=et.getForInstance(o))?s+=Pt(vt((()=>o),bt),r,n):l.aspected?s+=Pt(o,r,n):s+=o.createHTML(n)}return new Vt(s+t[t.length-1],i)}class Ft extends nt{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}et.define(Ft);const Mt=t=>new Ft(t);function _t(t,e){const s=u(e)?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Et=Object.freeze({positioning:!1,recycle:!0});function Lt(t,e,s,i){t.bind(e[s],i)}function zt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Rt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Lt,this.itemsBindingObserver=v.binding(e,this,s),this.templateBindingObserver=v.binding(i,this,n),r.positioning&&(this.bindView=zt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=c);const e=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=[],n=this.bindView;let r=0;for(let s=0,n=t.length;s<n;++s){const n=t[s],o=n.removed;i.push(...e.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,h=t.length;r<h;++r){const h=t[r];let a=h.index;const c=a+h.addedCount;for(;a<c;++a){const t=e[a],r=t?t.firstChild:this.location,h=this.options.recycle&&i.length>0?i.shift():l.create();e.splice(a,0,h),n(h,o,a,s),h.insertBefore(r)}}for(let t=0,e=i.length;t<e;++t)i[t].dispose();if(this.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(mt.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const a=l.splice(t,h-t);for(t=0,o=a.length;t<o;++t)a[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Ht{constructor(t,e,s){this.itemsBinding=t,this.templateBinding=e,this.options=s,V.enable(),this.isItemsBindingVolatile=v.isVolatileBinding(t),this.isTemplateBindingVolatile=v.isVolatileBinding(e)}createHTML(t){return Y.comment(t(this))}createBehavior(t){return new Rt(t[this.nodeId],this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function qt(t,e,s=Et){const i=u(e)?e:()=>e;return new Ht(t,i,s)}et.define(Ht);const Dt=t=>1===t.nodeType,Qt=t=>t?e=>1===e.nodeType&&e.matches(t):Dt;class Wt extends nt{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,c),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class Ut extends Wt{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function Gt(t){return f(t)&&(t={property:t}),new Ut(t)}et.define(Ut);class Jt extends Wt{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function Kt(t){return f(t)&&(t={property:t}),new Jt(t)}et.define(Jt);const Xt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function Yt(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const Zt={toView(t){const e=Yt(t);return e?e.toString():e},fromView:Yt};class te{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=Xt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return v.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||p.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;Q.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":Q.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];f(i)?s.push(new te(t,i)):s.push(new te(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function ee(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const se={mode:"open"},ie={},ne=a.getById(4,(()=>d()));class re{constructor(t,e=t.definition){f(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=te.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?se:null===e.shadowOptions?void 0:Object.assign(Object.assign({},se),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ie:Object.assign(Object.assign({},ie),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?new M(e.styles):e.styles instanceof M?e.styles:new M([e.styles])}get isDefined(){return!!ne.getByType(this.type)}define(t=customElements){const e=this.type;if(ne.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)v.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}re.getByType=ne.getByType,re.getForInstance=ne.getForInstance;const oe=new WeakMap,le={bubbles:!0,composed:!0,cancelable:!0};function he(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:oe.get(t))&&void 0!==s?s:null}class ae extends g{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&oe.set(t,e))}const i=v.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,v.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=he(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=he(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=C.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=C.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=C.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=C.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},le),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=he(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=re.getForInstance(t);if(void 0===s)throw a.error(1401);return t.$fastController=new ae(t,s)}}function ce(t){return class extends t{constructor(){super(),ae.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const de=Object.assign(ce(HTMLElement),{from:t=>ce(t),define(t,e){return this.metadata(t,e).define().type},metadata:(t,e)=>new re(t,e)});function ue(t){return function(e){de.define(e,t)}}export{_ as AdoptedStyleSheetsStrategy,V as ArrayObserver,it as Aspect,te as AttributeDefinition,lt as BindingConfig,ot as BindingMode,L as CSSDirective,ut as ChangeBinding,Jt as ChildrenDirective,$t as Compiler,ae as Controller,Q as DOM,M as ElementStyles,ft as EventBinding,C as ExecutionContext,a as FAST,de as FASTElement,re as FASTElementDefinition,gt as HTMLBindingDirective,et as HTMLDirective,mt as HTMLView,Y as Markup,Wt as NodeObservationDirective,v as Observable,dt as OneTimeBinding,Z as Parser,g as PropertyChangeNotifier,Ft as RefDirective,Rt as RepeatBehavior,Ht as RepeatDirective,Ut as SlottedDirective,T as Splice,B as SpliceStrategy,S as SpliceStrategySupport,nt as StatelessAttachedAttributeDirective,b as SubscriberSet,ht as UpdateBinding,p as Updates,Vt as ViewTemplate,ee as attr,vt as bind,Xt as booleanConverter,Kt as children,d as createTypeRegistry,H as css,z as cssDirective,D as cssPartial,ue as customElement,Qt as elements,c as emptyArray,Nt as html,st as htmlDirective,k as lengthOf,Zt as nullableNumberConverter,y as observable,pt as onChange,bt as oneTime,Mt as ref,qt as repeat,Gt as slotted,m as volatile,_t as when}; | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'."},a=/(\$\{\w+?})/g,h=/\$\{(\w+?)}/g,c=Object.freeze({});function d(e,t){return e.split(a).map((e=>{var s;const i=e.replace(h,"$1");return String(null!==(s=t[i])&&void 0!==s?s:e)})).join("")}Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Warning";console.warn(d(i,t))},error(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Error";return new Error(d(i,t))}});const u={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},u));const f=globalThis.FAST;if(void 0===f.getById){const e=Object.create(null);Reflect.defineProperty(f,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},u))}void 0===f.error&&Object.assign(f,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const p=Object.freeze([]);function b(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}const g=e=>"function"==typeof e,v=e=>"string"==typeof e,y=f.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class m{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class w{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new m(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new m(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const C=f.getById(2,(()=>{const e=y.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=e=>{throw f.error(1101)};function o(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=r(e):s.set(e,i=new w(e))),i}function l(e){let t=i.get(e);if(void 0===t){let s=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==s;)t=i.get(s),s=Reflect.getPrototypeOf(s);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==n&&n.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];g(n)&&n.call(e,i,t),o(e).notify(this.name)}}}class h extends m{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(e,null!=t?t:O.default);return n=s,i}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=o(e),r=null===s?this.first:{};if(r.propertySource=e,r.propertyName=t,r.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;n=void 0,t=s.propertySource[s.propertyName],n=this,e===t&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){r=e},getNotifier:o,track(e,t){n&&n.watch(e,t)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(e,t){o(e).notify(t)},defineProperty(e,t){v(t)&&(t=new a(t)),l(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:l,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function T(e,t){C.defineProperty(e,t)}function x(e,t,s){return Object.assign({},s,{get(){return C.trackVolatile(),s.get.apply(this)}})}const S=f.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class O{constructor(e=null,t=null){this.index=0,this.length=0,this.parent=e,this.parentContext=t}get event(){return S.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(e,t){this.index=e,this.length=t}createChildContext(e){return new O(e,this)}createItemContext(e,t){const s=Object.create(this);return s.index=e,s.length=t,s}static setEvent(e){S.set(e)}static create(){return new O}}O.default=new O,C.defineProperty(O.prototype,"index"),C.defineProperty(O.prototype,"length");class A{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const B=Object.freeze({reset:1,splice:2,optimized:3}),j=new A(0,p,0);j.reset=!0;const $=[j];let k=Object.freeze({support:B.splice,normalize:(e,t,s)=>void 0===e?null!=s?s:p:$,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(0,[],i.length).adjustTo(e)),n}});const I=Object.freeze({reset:$,setDefaultStrategy(e){k=e}});function P(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class V extends m{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,P(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,C.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,y.enqueue(this))}}let N=!1;const E=Object.freeze({enable(){if(N)return;N=!0,C.setArrayObserverFactory((e=>new V(e)));const e=Array.prototype;e.$fastPatch||(P(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function F(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=C.getNotifier(e)),C.track(t.lengthObserver,"length"),e.length}const M=new Map;let _;function L(e){return e.map((e=>e instanceof R?L(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class R{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof R?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(_),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(L(this.styles)),this}static setDefaultStrategy(e){_=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new R(e):e instanceof R?e:new R([e])}}R.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class z{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=M.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),M.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}R.setDefaultStrategy(f.getById(5,(()=>z)));const D=b(),H=Object.freeze({getForInstance:D.getForInstance,getByType:D.getByType,define:e=>(D.register({type:e}),e)});function q(){return function(e){H.define(e)}}function Q(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==H.getForInstance(o)&&(o=o.createCSS(r)),o instanceof R||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const U=(e,...t)=>{const{styles:s,behaviors:i}=Q(e,t),n=new R(s);return i.length?n.withBehaviors(...i):n};class W{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(v(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new R(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}bind(e){e.$fastController.addStyles(this.styles)}unbind(e){e.$fastController.removeStyles(this.styles)}}H.define(W);const K=U.partial=(e,...t)=>{const{styles:s,behaviors:i}=Q(e,t);return new W(s,i)},G=Object.freeze({queueUpdate:y.enqueue,nextUpdate:y.next,processUpdates:y.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),J=`fast-${Math.random().toString(36).substring(2,8)}`,X=`${J}{`,Y=`}${J}`,Z=Y.length;let ee=0;const te=()=>`${J}-${++ee}`,se=Object.freeze({interpolation:e=>`${X}${e}${Y}`,attribute:e=>`${te()}="${X}${e}${Y}"`,comment:e=>`\x3c!--${X}${e}${Y}--\x3e`}),ie=Object.freeze({parse(e,t){const s=e.split(X);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(Y);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+Z)}""!==o&&i.push(o)}return i}}),ne=b(),re=Object.freeze({getForInstance:ne.getForInstance,getByType:ne.getByType,define:(e,t)=>((t=t||{}).type=e,ne.register(t),e)});function oe(e){return function(t){re.define(t,e)}}class le{}const ae=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=ae.property;break;case"classList":e.aspectType=ae.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=ae.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=ae.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=ae.property):(e.targetAspect=t,e.aspectType=ae.attribute)}else e.aspectType=ae.content}});class he{constructor(e){this.options=e,this.id=te()}createBehavior(e){return this}createHTML(e){return se.attribute(e(this))}}const ce=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw f.error(1202)}:e=>e;class de extends le{constructor(e,t){super(),this.evaluate=e,this.isVolatile=t}createObserver(e,t){return C.binding(this.evaluate,t,this.isVolatile)}}class ue extends le{constructor(e){super(),this.evaluate=e}createObserver(){return this}observe(e,t){return this.evaluate(e,t)}dispose(){}}function fe(e,t,s,i,n){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i,n)):(t.isComposed=!0,t.bind(i,n),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function pe(e,t,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}class be{constructor(e,t){this.directive=e,this.updateTarget=t,this.observerProperty=`${e.id}-o`}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=e,r.context=t,this.updateTarget(n,i.targetAspect,r.observe(e,t),e,t)}unbind(e,t,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(e,t){const s=t.target,i=t.source,n=t.context;this.updateTarget(s,this.directive.targetAspect,t.observe(i,n),i,n)}getObserver(e){var t;return null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(e){return this}}class ge extends be{unbind(e,t,s){super.unbind(e,t,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class ve{constructor(e){this.directive=e,this.sourceProperty=`${e.id}-s`,this.contextProperty=`${e.id}-c`}bind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=e,n[this.contextProperty]=t,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(e){return this}handleEvent(e){const t=e.currentTarget;O.setEvent(e);const s=this.directive.dataBinding.evaluate(t[this.sourceProperty],t[this.contextProperty]);O.setEvent(null),!0!==s&&e.preventDefault()}}class ye{constructor(e){this.dataBinding=e,this.factory=null,this.id=te(),this.aspectType=ae.content}createHTML(e){return se.interpolation(e(this))}createBehavior(e){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=ce(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new be(this,G.setAttribute);break;case 2:this.factory=new be(this,G.setBooleanAttribute);break;case 3:this.factory=new be(this,((e,t,s)=>e[t]=s));break;case 4:this.factory=new ge(this,fe);break;case 5:this.factory=new be(this,pe);break;case 6:this.factory=new ve(this);break;default:throw f.error(1205)}return this.factory.createBehavior(e)}}function me(e,t=C.isVolatileBinding(e)){return new de(e,t)}function we(e){return new ue(e)}function Ce(e,t){const s=new de(e,!1);return s.options=t,s}function Te(e){return g(e)?me(e):e instanceof le?e:we((()=>e))}function xe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}re.define(ye,{aspected:!0});class Se{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=e.firstChild,this.lastChild=e.lastChild}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=e.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,t.insertBefore(n,e),n=i;t.insertBefore(s,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){xe(this.firstChild,this.lastChild),this.unbind()}bind(e,t){let s=this.behaviors;const i=this.source;if(i===e)return;this.source=e,this.context=t;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,t,n),o.bind(e,t,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(e,t,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(e,t,n)}unbind(){const e=this.source;if(null===e)return;const t=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(e,s,t);this.source=null,this.context=null}static disposeContiguousBatch(e){if(0!==e.length){xe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}const Oe=(e,t)=>`${e}.${t}`,Ae={},Be={index:0,node:null};function je(e){e.startsWith("fast-")||f.warn(1204,{name:e})}const $e=new Proxy(document.createElement("div"),{get(e,t){je(t);const s=Reflect.get(e,t);return g(s)?s.bind(e):s},set:(e,t,s)=>(je(t),Reflect.set(e,t,s))});class ke{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=Ae[t];if(!n){const i=`_${t}`;Ae[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:$e;for(const e of this.nodeIds)s[e];return new Se(t,this.factories,s)}}function Ie(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=ie.parse(d,l);let f=null;null===u?r&&(f=new ye(we((()=>d))),ae.assign(f,c.name)):f=Me.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Pe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Ve(e,s,n,i);n=t.node,i=t.index}}function Ve(e,t,s,i){const n=Oe(t,i);switch(s.nodeType){case 1:Ie(e,t,s,n,i),Pe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=ie.parse(t.textContent,e.directives);if(null===r)return Be.node=t.nextSibling,Be.index=n+1,Be;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Oe(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),v(a)?o.textContent=a:(o.textContent=" ",ae.assign(a),e.addFactory(a,s,i,n)),l=o}return Be.index=n+1,Be.node=l.nextSibling,Be}(e,s,t,n,i);case 8:const r=ie.parse(s.data,e.directives);null!==r&&e.addFactory(Me.aggregate(r),t,n,i)}return Be.index=i+1,Be.node=s.nextSibling,Be}const Ne={createHTML:e=>e};let Ee=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ne):Ne;const Fe=Ee,Me={setHTMLPolicy(e){if(Ee!==Fe)throw f.error(1201);Ee=e},compile(e,t){let s;if(v(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ee.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new ke(i,t);return Ie(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==ie.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Pe(n,i,"r"),Be.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>v(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new ye(s);return ae.assign(o,t),o}};class _e{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Me.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s,i){const n=this.create(null!=s?s:t);return n.bind(e,null!=i?i:O.default),n.appendTo(t),n}}const Le=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Re(e,t,s){const i=Le.exec(t);return null!==i&&ae.assign(e,i[2]),e.createHTML(s)}function ze(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=te();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,g(o))s+=Re(new ye(me(o)),r,n);else if(v(o)){const e=Le.exec(r);if(null!==e){const t=new ye(we((()=>o)));ae.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof le?s+=Re(new ye(o),r,n):void 0===(l=re.getForInstance(o))?s+=Re(new ye(we((()=>o))),r,n):l.aspected?s+=Re(o,r,n):s+=o.createHTML(n)}return new _e(s+e[e.length-1],i)}class De extends he{bind(e,t,s){e[this.options]=s[this.nodeId]}unbind(){}}re.define(De);const He=e=>new De(e);function qe(e,t){const s=g(e)?e:()=>e,i=g(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Qe=Object.freeze({positioning:!1,recycle:!0});function Ue(e,t,s,i){e.bind(t[s],i)}function We(e,t,s,i){e.bind(t[s],i.createItemContext(s,t.length))}class Ke{constructor(e,t){this.directive=e,this.location=t,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ue,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=We)}bind(e,t){this.source=e,this.context=t,this.childContext=t.createChildContext(e),this.items=this.itemsBindingObserver.observe(e,this.context),this.template=this.templateBindingObserver.observe(e,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(e,t){t===this.itemsBindingObserver?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBindingObserver?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):t[0].reset?this.refreshAllViews():this.updateViews(t)}observeItems(e=!1){if(!this.items)return void(this.items=p);const t=this.itemsObserver,s=this.itemsObserver=C.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=t.splice(d.index,u.length);for(h=l.length+g.length;p<b;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=h&&g.length>0?(d=g[f],f++):(d=l[a],a++),h--):d=r.create(),t.splice(p,0,d),i(d,n,p,s),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e)t[e].context.updatePosition(e,s)}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(Se.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Ge{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=te(),E.enable()}createHTML(e){return se.comment(e(this))}createBehavior(e){return new Ke(this,e[this.nodeId])}}function Je(e,t,s=Qe){const i=Te(e),n=Te(t);return new Ge(i,n,s)}re.define(Ge);const Xe=e=>1===e.nodeType,Ye=e=>e?t=>1===t.nodeType&&t.matches(e):Xe;class Ze extends he{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e,t,s){const i=s[this.nodeId];i[this.sourceProperty]=e,this.updateTarget(e,this.computeNodes(i)),this.observe(i)}unbind(e,t,s){const i=s[this.nodeId];this.updateTarget(e,p),this.disconnect(i),i[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class et extends Ze{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function tt(e){return v(e)&&(e={property:e}),new et(e)}re.define(et);class st extends Ze{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function it(e){return v(e)&&(e={property:e}),new st(e)}re.define(st);const nt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function rt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const ot={toView(e){const t=rt(e);return t?t.toString():t},fromView:rt};class lt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=nt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return C.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||y.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;G.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":G.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(e.attributes);for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];v(i)?s.push(new lt(e,i)):s.push(new lt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function at(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t);const i=e.constructor.attributes||(e.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ht={mode:"open"},ct={},dt=f.getById(4,(()=>b()));class ut{constructor(e,t=e.definition){this.platformDefined=!1,v(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const s=e.prototype,i=lt.collect(e,t.attributes),n=new Array(i.length),r={},o={};for(let e=0,t=i.length;e<t;++e){const t=i[e];n[e]=t.attribute,r[t.name]=t,o[t.attribute]=t,C.defineProperty(s,t)}Reflect.defineProperty(e,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===t.shadowOptions?ht:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ht),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ct:Object.assign(Object.assign({},ct),t.elementOptions),this.styles=R.normalize(t.styles),dt.register(this)}get isDefined(){return this.platformDefined}define(e=customElements){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=dt.getByType(e);return new ut(s?class extends e{}:e,t)}}ut.getByType=dt.getByType,ut.getForInstance=dt.getForInstance;const ft=new WeakMap,pt={bubbles:!0,composed:!0,cancelable:!0};function bt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ft.get(e))&&void 0!==s?s:null}class gt extends w{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ft.set(e,t))}const i=C.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return C.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,C.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get styles(){var e;if(null===this._styles){const t=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():t.styles&&(this._styles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||this.addStyles(e))}addStyles(e){if(!e)return;const t=bt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.append(e);else if(!e.isAttachedTo(t)){const s=e.behaviors;e.addStylesTo(t),null!==s&&this.addBehaviors(s)}}removeStyles(e){if(!e)return;const t=bt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.removeChild(e);else if(e.isAttachedTo(t)){const s=e.behaviors;e.removeStylesFrom(t),null!==s&&this.removeBehaviors(s)}}addBehaviors(e){var t;const s=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,i=e.length,n=[];for(let t=0;t<i;++t){const i=e[t];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].bind(e,t)}}removeBehaviors(e,t=!1){const s=this.behaviors;if(null===s)return;const i=e.length,n=[];for(let r=0;r<i;++r){const i=e[r];if(s.has(i)){const e=s.get(i)-1;0===e||t?s.delete(i)&&n.push(i):s.set(i,e)}}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].unbind(e,t)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element,t=O.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,t);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(e,t);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const e=this.view;null!==e&&e.unbind();const t=this.behaviors;if(null!==t){const e=this.element,s=O.default;for(const i of t.keys())i.unbind(e,s)}}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(e,t,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},pt),s)))}finishInitialization(){const e=this.element,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.element,i=null!==(t=bt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ut.getForInstance(e);if(void 0===s)throw f.error(1401);return e.$fastController=new gt(e,s)}}function vt(e){return class extends e{constructor(){super(),gt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function yt(e,t){return g(e)?ut.compose(e,t).define().type:ut.compose(this,e).define().type}const mt=Object.assign(vt(HTMLElement),{from:e=>vt(e),define:yt,compose:function(e,t){return g(e)?ut.compose(e,t):ut.compose(this,e)}});function wt(e){return function(t){yt(t,e)}}export{z as AdoptedStyleSheetsStrategy,E as ArrayObserver,ae as Aspect,lt as AttributeDefinition,le as Binding,be as BindingBehavior,H as CSSDirective,st as ChildrenDirective,Me as Compiler,ge as ContentBehavior,gt as Controller,G as DOM,R as ElementStyles,ve as EventBehavior,O as ExecutionContext,f as FAST,mt as FASTElement,ut as FASTElementDefinition,ye as HTMLBindingDirective,re as HTMLDirective,Se as HTMLView,se as Markup,Ze as NodeObservationDirective,C as Observable,ie as Parser,w as PropertyChangeNotifier,De as RefDirective,Ke as RepeatBehavior,Ge as RepeatDirective,et as SlottedDirective,A as Splice,I as SpliceStrategy,B as SpliceStrategySupport,he as StatelessAttachedAttributeDirective,m as SubscriberSet,y as Updates,_e as ViewTemplate,at as attr,me as bind,nt as booleanConverter,it as children,b as createTypeRegistry,U as css,q as cssDirective,K as cssPartial,wt as customElement,Ye as elements,p as emptyArray,ze as html,oe as htmlDirective,F as lengthOf,Ce as listener,Te as normalizeBinding,ot as nullableNumberConverter,T as observable,we as oneTime,He as ref,Je as repeat,tt as slotted,x as volatile,qe as when}; |
@@ -1,1 +0,1 @@ | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const t=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:t=>new Error(`Code ${t}`),addMessages(){}});const h=Object.freeze([]);function c(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const a=t=>"function"==typeof t,d=t=>"string"==typeof t,u=l.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class f{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class p{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const b=l.getById(2,(()=>{const t=u.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw l.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new p(t))),i}function h(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class c{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];a(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class b extends f{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:m.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){d(e)&&(e=new c(e)),h(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:h,binding(t,e,s=this.isVolatileBinding(t)){return new b(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function g(t,e){b.defineProperty(t,e)}function v(t,e,s){return Object.assign({},s,{get(){return b.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class m{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return y.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new m(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}static setEvent(t){y.set(t)}static create(){return new m}}m.default=new m,b.defineProperty(m.prototype,"index"),b.defineProperty(m.prototype,"length");class w{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const C=Object.freeze({reset:1,splice:2,optimized:3}),T=new w(0,h,0);T.reset=!0;const x=[T];let S=Object.freeze({support:C.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:h:x,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(0,[],i.length).adjustTo(t)),n}});const O=Object.freeze({reset:x,setDefaultStrategy(t){S=t}});function A(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class B extends f{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,A(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,b.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:S).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let j=!1;const I=Object.freeze({enable(){if(j)return;j=!0,b.setArrayObserverFactory((t=>new B(t)));const t=Array.prototype;t.$fastPatch||(A(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:S)[e.name](this,i,e,t)}})))}});function $(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&(I.enable(),e=b.getNotifier(t)),b.track(e.lengthObserver,"length"),t.length}const V=new Map;let k;function P(t){return t.map((t=>t instanceof N?P(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class N{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof N?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(k),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(P(this.styles)),this}static setDefaultStrategy(t){k=t}}N.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=V.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),V.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}N.setDefaultStrategy(l.getById(5,(()=>_)));const E=c(),F=Object.freeze({getForInstance:E.getForInstance,getByType:E.getByType,define:t=>(E.register({type:t}),t)});function L(){return function(t){F.define(t)}}function M(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==F.getForInstance(o)&&(o=o.createCSS(r)),o instanceof N||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e),n=new N(s);return i.length?n.withBehaviors(...i):n};class R{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(d(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new N(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}F.define(R);const H=z.partial=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e);return new R(s,i)},q=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),D=`fast-${Math.random().toString(36).substring(2,8)}`,Q=`${D}{`,W=`}${D}`,U=W.length;let G=0;const J=()=>`${D}-${++G}`,K=Object.freeze({interpolation:t=>`${Q}${t}${W}`,attribute:t=>`${J()}="${Q}${t}${W}"`,comment:t=>`\x3c!--${Q}${t}${W}--\x3e`}),X=Object.freeze({parse(t,e){const s=t.split(Q);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(W);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+U)}""!==o&&i.push(o)}return i}}),Y=c(),Z=Object.freeze({getForInstance:Y.getForInstance,getByType:Y.getByType,define:(t,e)=>((e=e||{}).type=t,Y.register(e),t)});function tt(t){return function(e){Z.define(e,t)}}const et=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(e)switch(t.sourceAspect=e,e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=et.property;break;case"classList":t.aspectType=et.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=et.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=et.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=et.property):(t.targetAspect=e,t.aspectType=et.attribute)}else t.aspectType=et.content}});class st{constructor(t){this.options=t}createBehavior(t){return this}createHTML(t){return K.attribute(t(this))}}const it=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:t=>t,nt=Object.freeze({define:(t,e=dt)=>Object.freeze({1:e=>new t(e,q.setAttribute),2:e=>new t(e,q.setBooleanAttribute),3:e=>new t(e,((t,e,s)=>t[e]=s)),4:e=>{return new(s=t,class extends s{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}})(e,lt);var s},5:e=>new t(e,ht),6:t=>new e(t)})}),rt=Object.freeze({define(t,e){const s=t=>({mode:s.mode,options:Object.assign({},e,t)});return s.options=e,s.mode=t,s}});class ot{constructor(t,e){this.directive=t,this.updateTarget=e}bind(t,e,s){}unbind(t,e,s){}createBehavior(t){return this}}function lt(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ht(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class ct extends ot{bind(t,e,s){const i=this.directive;this.updateTarget(s[i.nodeId],i.targetAspect,i.binding(t,e),t,e)}}class at extends ot{constructor(t,e){super(t,e),this.isBindingVolatile=b.isVolatileBinding(t.binding),this.observerProperty=`${t.id}-o`}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=b.binding(this.directive.binding,this,this.isBindingVolatile)}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}}class dt{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;m.setEvent(t);const s=this.directive.binding(e[this.sourceProperty],e[this.contextProperty]);m.setEvent(null),!0!==s&&t.preventDefault()}}const ut=rt.define(nt.define(at),{}),ft=rt.define(nt.define(ct),{once:!0});class pt{constructor(t,e,s){this.binding=t,this.mode=e,this.options=s,this.factory=null,this.aspectType=et.content}createHTML(t){return K.interpolation(t(this))}createBehavior(t){return null==this.factory&&("innerHTML"===this.targetAspect&&(this.binding=it(this.binding)),this.factory=this.mode[this.aspectType](this)),this.factory.createBehavior(t)}}function bt(t,e=ut){return"mode"in e||(e=ut(e)),new pt(t,e.mode,e.options)}function gt(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}Z.define(pt,{aspected:!0});class vt{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){gt(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){gt(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const yt=(t,e)=>`${t}.${e}`,mt={},wt={index:0,node:null};class Ct{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=mt[e];if(!n){const i=`_${e}`;mt[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:e;for(const t of this.nodeIds)s[t];return new vt(e,this.factories,s)}}function Tt(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,c=o.length;h<c;++h){const a=o[h],d=a.value,u=X.parse(d,l);let f=null;null===u?r&&(f=bt((()=>d),ft),et.assign(f,a.name)):f=jt.aggregate(u),null!==f&&(s.removeAttributeNode(a),h--,c--,t.addFactory(f,e,i,n))}}function xt(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=St(t,s,n,i);n=e.node,i=e.index}}function St(t,e,s,i){const n=yt(e,i);switch(s.nodeType){case 1:Tt(t,e,s,n,i),xt(t,s,n);break;case 3:return function(t,e,s,i,n){const r=X.parse(e.textContent,t.directives);if(null===r)return wt.node=e.nextSibling,wt.index=n+1,wt;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=yt(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",et.assign(h),t.addFactory(h,s,i,n)),l=o}return wt.index=n+1,wt.node=l.nextSibling,wt}(t,s,e,n,i);case 8:const r=X.parse(s.data,t.directives);null!==r&&t.addFactory(jt.aggregate(r),e,n,i)}return wt.index=i+1,wt.node=s.nextSibling,wt}const Ot={createHTML:t=>t};let At=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ot):Ot;const Bt=At,jt={setHTMLPolicy(t){if(At!==Bt)throw l.error(1201);At=t},compile(t,e){let s;if(d(t)){s=document.createElement("TEMPLATE"),s.innerHTML=At.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new Ct(i,e);return Tt(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==X.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xt(n,i,"r"),wt.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map((t=>d(t)?()=>t:(e=t.sourceAspect||e,t.binding))),n=bt(((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n}));return et.assign(n,e),n}};class It{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=jt.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:m.default),n.appendTo(e),n}}const $t=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Vt(t,e,s){const i=$t.exec(e);return null!==i&&et.assign(t,i[2]),t.createHTML(s)}function kt(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=J();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,a(o))s+=Vt(bt(o),r,n);else if(d(o)){const t=$t.exec(r);if(null!==t){const e=bt((()=>o),ft);et.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else void 0===(l=Z.getForInstance(o))?s+=Vt(bt((()=>o),ft),r,n):l.aspected?s+=Vt(o,r,n):s+=o.createHTML(n)}return new It(s+t[t.length-1],i)}class Pt extends st{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}Z.define(Pt);const Nt=t=>new Pt(t);function _t(t,e){const s=a(e)?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Et=Object.freeze({positioning:!1,recycle:!0});function Ft(t,e,s,i){t.bind(e[s],i)}function Lt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Mt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ft,this.itemsBindingObserver=b.binding(e,this,s),this.templateBindingObserver=b.binding(i,this,n),r.positioning&&(this.bindView=Lt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=h);const e=this.itemsObserver,s=this.itemsObserver=b.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=[],n=this.bindView;let r=0;for(let s=0,n=t.length;s<n;++s){const n=t[s],o=n.removed;i.push(...e.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,h=t.length;r<h;++r){const h=t[r];let c=h.index;const a=c+h.addedCount;for(;c<a;++c){const t=e[c],r=t?t.firstChild:this.location,h=this.options.recycle&&i.length>0?i.shift():l.create();e.splice(c,0,h),n(h,o,c,s),h.insertBefore(r)}}for(let t=0,e=i.length;t<e;++t)i[t].dispose();if(this.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(vt.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const c=l.splice(t,h-t);for(t=0,o=c.length;t<o;++t)c[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class zt{constructor(t,e,s){this.itemsBinding=t,this.templateBinding=e,this.options=s,I.enable(),this.isItemsBindingVolatile=b.isVolatileBinding(t),this.isTemplateBindingVolatile=b.isVolatileBinding(e)}createHTML(t){return K.comment(t(this))}createBehavior(t){return new Mt(t[this.nodeId],this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Rt(t,e,s=Et){const i=a(e)?e:()=>e;return new zt(t,i,s)}Z.define(zt);const Ht=t=>1===t.nodeType,qt=t=>t?e=>1===e.nodeType&&e.matches(t):Ht;class Dt extends st{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,h),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class Qt extends Dt{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function Wt(t){return d(t)&&(t={property:t}),new Qt(t)}Z.define(Qt);class Ut extends Dt{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function Gt(t){return d(t)&&(t={property:t}),new Ut(t)}Z.define(Ut);const Jt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function Kt(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const Xt={toView(t){const e=Kt(t);return e?e.toString():e},fromView:Kt};class Yt{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=Jt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||u.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;q.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":q.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];d(i)?s.push(new Yt(t,i)):s.push(new Yt(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function Zt(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const te={mode:"open"},ee={},se=l.getById(4,(()=>c()));class ie{constructor(t,e=t.definition){d(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=Yt.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?te:null===e.shadowOptions?void 0:Object.assign(Object.assign({},te),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ee:Object.assign(Object.assign({},ee),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?new N(e.styles):e.styles instanceof N?e.styles:new N([e.styles])}get isDefined(){return!!se.getByType(this.type)}define(t=customElements){const e=this.type;if(se.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)b.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ie.getByType=se.getByType,ie.getForInstance=se.getForInstance;const ne=new WeakMap,re={bubbles:!0,composed:!0,cancelable:!0};function oe(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:ne.get(t))&&void 0!==s?s:null}class le extends p{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&ne.set(t,e))}const i=b.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=oe(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=oe(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=m.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=m.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},re),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=oe(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ie.getForInstance(t);if(void 0===s)throw l.error(1401);return t.$fastController=new le(t,s)}}function he(t){return class extends t{constructor(){super(),le.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const ce=Object.assign(he(HTMLElement),{from:t=>he(t),define(t,e){return this.metadata(t,e).define().type},metadata:(t,e)=>new ie(t,e)});function ae(t){return function(e){ce.define(e,t)}}export{_ as AdoptedStyleSheetsStrategy,I as ArrayObserver,et as Aspect,Yt as AttributeDefinition,rt as BindingConfig,nt as BindingMode,F as CSSDirective,at as ChangeBinding,Ut as ChildrenDirective,jt as Compiler,le as Controller,q as DOM,N as ElementStyles,dt as EventBinding,m as ExecutionContext,l as FAST,ce as FASTElement,ie as FASTElementDefinition,pt as HTMLBindingDirective,Z as HTMLDirective,vt as HTMLView,K as Markup,Dt as NodeObservationDirective,b as Observable,ct as OneTimeBinding,X as Parser,p as PropertyChangeNotifier,Pt as RefDirective,Mt as RepeatBehavior,zt as RepeatDirective,Qt as SlottedDirective,w as Splice,O as SpliceStrategy,C as SpliceStrategySupport,st as StatelessAttachedAttributeDirective,f as SubscriberSet,ot as UpdateBinding,u as Updates,It as ViewTemplate,Zt as attr,bt as bind,Jt as booleanConverter,Gt as children,c as createTypeRegistry,z as css,L as cssDirective,H as cssPartial,ae as customElement,qt as elements,h as emptyArray,kt as html,tt as htmlDirective,$ as lengthOf,Xt as nullableNumberConverter,g as observable,ut as onChange,ft as oneTime,Nt as ref,Rt as repeat,Wt as slotted,v as volatile,_t as when}; | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const t=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:t=>new Error(`Error ${t}`),addMessages(){}});const h=Object.freeze([]);function a(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const c=t=>"function"==typeof t,d=t=>"string"==typeof t,u=l.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class f{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class p{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const b=l.getById(2,(()=>{const t=u.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw l.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new p(t))),i}function h(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class a{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];c(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class b extends f{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:m.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){d(e)&&(e=new a(e)),h(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:h,binding(t,e,s=this.isVolatileBinding(t)){return new b(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function g(t,e){b.defineProperty(t,e)}function v(t,e,s){return Object.assign({},s,{get(){return b.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class m{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return y.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new m(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}static setEvent(t){y.set(t)}static create(){return new m}}m.default=new m,b.defineProperty(m.prototype,"index"),b.defineProperty(m.prototype,"length");class w{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const C=Object.freeze({reset:1,splice:2,optimized:3}),x=new w(0,h,0);x.reset=!0;const T=[x];let S=Object.freeze({support:C.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:h:T,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(0,[],i.length).adjustTo(t)),n}});const O=Object.freeze({reset:T,setDefaultStrategy(t){S=t}});function B(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class A extends f{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,B(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,b.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:S).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let j=!1;const $=Object.freeze({enable(){if(j)return;j=!0,b.setArrayObserverFactory((t=>new A(t)));const t=Array.prototype;t.$fastPatch||(B(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:S)[e.name](this,i,e,t)}})))}});function I(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&($.enable(),e=b.getNotifier(t)),b.track(e.lengthObserver,"length"),t.length}const k=new Map;let P;function V(t){return t.map((t=>t instanceof N?V(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class N{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof N?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(P),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(V(this.styles)),this}static setDefaultStrategy(t){P=t}static normalize(t){return void 0===t?void 0:Array.isArray(t)?new N(t):t instanceof N?t:new N([t])}}N.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=k.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),k.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}N.setDefaultStrategy(l.getById(5,(()=>_)));const E=a(),F=Object.freeze({getForInstance:E.getForInstance,getByType:E.getByType,define:t=>(E.register({type:t}),t)});function L(){return function(t){F.define(t)}}function M(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==F.getForInstance(o)&&(o=o.createCSS(r)),o instanceof N||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e),n=new N(s);return i.length?n.withBehaviors(...i):n};class R{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(d(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new N(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}F.define(R);const H=z.partial=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e);return new R(s,i)},D=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),q=`fast-${Math.random().toString(36).substring(2,8)}`,Q=`${q}{`,W=`}${q}`,U=W.length;let G=0;const J=()=>`${q}-${++G}`,K=Object.freeze({interpolation:t=>`${Q}${t}${W}`,attribute:t=>`${J()}="${Q}${t}${W}"`,comment:t=>`\x3c!--${Q}${t}${W}--\x3e`}),X=Object.freeze({parse(t,e){const s=t.split(Q);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(W);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+U)}""!==o&&i.push(o)}return i}}),Y=a(),Z=Object.freeze({getForInstance:Y.getForInstance,getByType:Y.getByType,define:(t,e)=>((e=e||{}).type=t,Y.register(e),t)});function tt(t){return function(e){Z.define(e,t)}}class et{}const st=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(e)switch(t.sourceAspect=e,e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=st.property;break;case"classList":t.aspectType=st.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=st.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=st.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=st.property):(t.targetAspect=e,t.aspectType=st.attribute)}else t.aspectType=st.content}});class it{constructor(t){this.options=t,this.id=J()}createBehavior(t){return this}createHTML(t){return K.attribute(t(this))}}const nt=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:t=>t;class rt extends et{constructor(t,e){super(),this.evaluate=t,this.isVolatile=e}createObserver(t,e){return b.binding(this.evaluate,e,this.isVolatile)}}class ot extends et{constructor(t){super(),this.evaluate=t}createObserver(){return this}observe(t,e){return this.evaluate(t,e)}dispose(){}}function lt(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ht(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class at{constructor(t,e){this.directive=t,this.updateTarget=e,this.observerProperty=`${t.id}-o`}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(t){return this}}class ct extends at{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class dt{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;m.setEvent(t);const s=this.directive.dataBinding.evaluate(e[this.sourceProperty],e[this.contextProperty]);m.setEvent(null),!0!==s&&t.preventDefault()}}class ut{constructor(t){this.dataBinding=t,this.factory=null,this.id=J(),this.aspectType=st.content}createHTML(t){return K.interpolation(t(this))}createBehavior(t){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=nt(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new at(this,D.setAttribute);break;case 2:this.factory=new at(this,D.setBooleanAttribute);break;case 3:this.factory=new at(this,((t,e,s)=>t[e]=s));break;case 4:this.factory=new ct(this,lt);break;case 5:this.factory=new at(this,ht);break;case 6:this.factory=new dt(this);break;default:throw l.error(1205)}return this.factory.createBehavior(t)}}function ft(t,e=b.isVolatileBinding(t)){return new rt(t,e)}function pt(t){return new ot(t)}function bt(t,e){const s=new rt(t,!1);return s.options=e,s}function gt(t){return c(t)?ft(t):t instanceof et?t:pt((()=>t))}function vt(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}Z.define(ut,{aspected:!0});class yt{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){vt(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){vt(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const mt=(t,e)=>`${t}.${e}`,wt={},Ct={index:0,node:null};function xt(t){t.startsWith("fast-")||l.warn(1204,{name:t})}const Tt=new Proxy(document.createElement("div"),{get(t,e){xt(e);const s=Reflect.get(t,e);return c(s)?s.bind(t):s},set:(t,e,s)=>(xt(e),Reflect.set(t,e,s))});class St{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=wt[e];if(!n){const i=`_${e}`;wt[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:Tt;for(const t of this.nodeIds)s[t];return new yt(e,this.factories,s)}}function Ot(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,a=o.length;h<a;++h){const c=o[h],d=c.value,u=X.parse(d,l);let f=null;null===u?r&&(f=new ut(pt((()=>d))),st.assign(f,c.name)):f=kt.aggregate(u),null!==f&&(s.removeAttributeNode(c),h--,a--,t.addFactory(f,e,i,n))}}function Bt(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=At(t,s,n,i);n=e.node,i=e.index}}function At(t,e,s,i){const n=mt(e,i);switch(s.nodeType){case 1:Ot(t,e,s,n,i),Bt(t,s,n);break;case 3:return function(t,e,s,i,n){const r=X.parse(e.textContent,t.directives);if(null===r)return Ct.node=e.nextSibling,Ct.index=n+1,Ct;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=mt(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",st.assign(h),t.addFactory(h,s,i,n)),l=o}return Ct.index=n+1,Ct.node=l.nextSibling,Ct}(t,s,e,n,i);case 8:const r=X.parse(s.data,t.directives);null!==r&&t.addFactory(kt.aggregate(r),e,n,i)}return Ct.index=i+1,Ct.node=s.nextSibling,Ct}const jt={createHTML:t=>t};let $t=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",jt):jt;const It=$t,kt={setHTMLPolicy(t){if($t!==It)throw l.error(1201);$t=t},compile(t,e){let s;if(d(t)){s=document.createElement("TEMPLATE"),s.innerHTML=$t.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new St(i,e);return Ot(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==X.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Bt(n,i,"r"),Ct.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e,s,i=!1;const n=t.length,r=t.map((t=>d(t)?()=>t:(e=t.sourceAspect||e,s=t.dataBinding||s,i=i||t.dataBinding.isVolatile,t.dataBinding.evaluate)));s.evaluate=(t,e)=>{let s="";for(let i=0;i<n;++i)s+=r[i](t,e);return s},s.isVolatile=i;const o=new ut(s);return st.assign(o,e),o}};class Pt{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=kt.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:m.default),n.appendTo(e),n}}const Vt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Nt(t,e,s){const i=Vt.exec(e);return null!==i&&st.assign(t,i[2]),t.createHTML(s)}function _t(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=J();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,c(o))s+=Nt(new ut(ft(o)),r,n);else if(d(o)){const t=Vt.exec(r);if(null!==t){const e=new ut(pt((()=>o)));st.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else o instanceof et?s+=Nt(new ut(o),r,n):void 0===(l=Z.getForInstance(o))?s+=Nt(new ut(pt((()=>o))),r,n):l.aspected?s+=Nt(o,r,n):s+=o.createHTML(n)}return new Pt(s+t[t.length-1],i)}class Et extends it{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}Z.define(Et);const Ft=t=>new Et(t);function Lt(t,e){const s=c(t)?t:()=>t,i=c(e)?e:()=>e;return(t,e)=>s(t,e)?i(t,e):null}const Mt=Object.freeze({positioning:!1,recycle:!0});function zt(t,e,s,i){t.bind(e[s],i)}function Rt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Ht{constructor(t,e){this.directive=t,this.location=e,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=zt,this.itemsBindingObserver=t.dataBinding.createObserver(t,this),this.templateBindingObserver=t.templateBinding.createObserver(t,this),t.options.positioning&&(this.bindView=Rt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){e===this.itemsBindingObserver?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):e===this.templateBindingObserver?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=h);const e=this.itemsObserver,s=this.itemsObserver=b.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let h=0,a=0;for(let c=0,d=t.length;c<d;++c){const d=t[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=e.splice(d.index,u.length);for(a=l.length+g.length;p<b;++p){const t=e[p],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=a&&g.length>0?(d=g[f],f++):(d=l[h],h++),a--):d=r.create(),e.splice(p,0,d),i(d,n,p,s),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.directive.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.directive.options.recycle||(yt.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const a=l.splice(t,h-t);for(t=0,o=a.length;t<o;++t)a[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Dt{constructor(t,e,s){this.dataBinding=t,this.templateBinding=e,this.options=s,this.id=J(),$.enable()}createHTML(t){return K.comment(t(this))}createBehavior(t){return new Ht(this,t[this.nodeId])}}function qt(t,e,s=Mt){const i=gt(t),n=gt(e);return new Dt(i,n,s)}Z.define(Dt);const Qt=t=>1===t.nodeType,Wt=t=>t?e=>1===e.nodeType&&e.matches(t):Qt;class Ut extends it{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,h),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class Gt extends Ut{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function Jt(t){return d(t)&&(t={property:t}),new Gt(t)}Z.define(Gt);class Kt extends Ut{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function Xt(t){return d(t)&&(t={property:t}),new Kt(t)}Z.define(Kt);const Yt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function Zt(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const te={toView(t){const e=Zt(t);return e?e.toString():e},fromView:Zt};class ee{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=Yt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||u.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;D.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":D.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];d(i)?s.push(new ee(t,i)):s.push(new ee(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function se(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const ie={mode:"open"},ne={},re=l.getById(4,(()=>a()));class oe{constructor(t,e=t.definition){this.platformDefined=!1,d(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=t.prototype,i=ee.collect(t,e.attributes),n=new Array(i.length),r={},o={};for(let t=0,e=i.length;t<e;++t){const e=i[t];n[t]=e.attribute,r[e.name]=e,o[e.attribute]=e,b.defineProperty(s,e)}Reflect.defineProperty(t,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===e.shadowOptions?ie:null===e.shadowOptions?void 0:Object.assign(Object.assign({},ie),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ne:Object.assign(Object.assign({},ne),e.elementOptions),this.styles=N.normalize(e.styles),re.register(this)}get isDefined(){return this.platformDefined}define(t=customElements){const e=this.type;return t.get(this.name)||(this.platformDefined=!0,t.define(this.name,e,this.elementOptions)),this}static compose(t,e){const s=re.getByType(t);return new oe(s?class extends t{}:t,e)}}oe.getByType=re.getByType,oe.getForInstance=re.getForInstance;const le=new WeakMap,he={bubbles:!0,composed:!0,cancelable:!0};function ae(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:le.get(t))&&void 0!==s?s:null}class ce extends p{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&le.set(t,e))}const i=b.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=ae(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=ae(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=m.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=m.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},he),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=ae(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=oe.getForInstance(t);if(void 0===s)throw l.error(1401);return t.$fastController=new ce(t,s)}}function de(t){return class extends t{constructor(){super(),ce.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}function ue(t,e){return c(t)?oe.compose(t,e).define().type:oe.compose(this,t).define().type}const fe=Object.assign(de(HTMLElement),{from:t=>de(t),define:ue,compose:function(t,e){return c(t)?oe.compose(t,e):oe.compose(this,t)}});function pe(t){return function(e){ue(e,t)}}export{_ as AdoptedStyleSheetsStrategy,$ as ArrayObserver,st as Aspect,ee as AttributeDefinition,et as Binding,at as BindingBehavior,F as CSSDirective,Kt as ChildrenDirective,kt as Compiler,ct as ContentBehavior,ce as Controller,D as DOM,N as ElementStyles,dt as EventBehavior,m as ExecutionContext,l as FAST,fe as FASTElement,oe as FASTElementDefinition,ut as HTMLBindingDirective,Z as HTMLDirective,yt as HTMLView,K as Markup,Ut as NodeObservationDirective,b as Observable,X as Parser,p as PropertyChangeNotifier,Et as RefDirective,Ht as RepeatBehavior,Dt as RepeatDirective,Gt as SlottedDirective,w as Splice,O as SpliceStrategy,C as SpliceStrategySupport,it as StatelessAttachedAttributeDirective,f as SubscriberSet,u as Updates,Pt as ViewTemplate,se as attr,ft as bind,Yt as booleanConverter,Xt as children,a as createTypeRegistry,z as css,L as cssDirective,H as cssPartial,pe as customElement,Wt as elements,h as emptyArray,_t as html,tt as htmlDirective,I as lengthOf,bt as listener,gt as normalizeBinding,te as nullableNumberConverter,g as observable,pt as oneTime,Ft as ref,qt as repeat,Jt as slotted,v as volatile,Lt as when}; |
@@ -65,3 +65,3 @@ ## API Report File for "@microsoft/fast-element" | ||
aspectType: Aspect; | ||
binding?: Binding; | ||
dataBinding?: Binding; | ||
sourceAspect: string; | ||
@@ -114,34 +114,25 @@ targetAspect: string; | ||
// @public | ||
export function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>; | ||
export function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>; | ||
// @public | ||
export type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn; | ||
// @public | ||
export interface BindingConfig<T = any> { | ||
mode: BindingMode; | ||
options: T; | ||
export abstract class Binding<TSource = any, TReturn = any, TParent = any> { | ||
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>; | ||
evaluate: Expression<TSource, TReturn, TParent>; | ||
isVolatile?: boolean; | ||
options?: any; | ||
} | ||
// @public | ||
export const BindingConfig: Readonly<{ | ||
define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>; | ||
}>; | ||
// @public | ||
export type BindingConfigResolver<T> = (options: T) => BindingConfig<T>; | ||
// @public | ||
export type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>; | ||
// @public | ||
export const BindingMode: Readonly<{ | ||
define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode; | ||
}>; | ||
// @public | ||
export interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable { | ||
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn; | ||
records(): IterableIterator<ObservationRecord>; | ||
setMode(isAsync: boolean): void; | ||
export class BindingBehavior implements ViewBehavior { | ||
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget); | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
createBehavior(targets: ViewBehaviorTargets): ViewBehavior; | ||
// (undocumented) | ||
readonly directive: HTMLBindingDirective; | ||
protected getObserver(target: Node): ExpressionObserver; | ||
// @internal (undocumented) | ||
handleChange(binding: Expression, observer: ExpressionObserver): void; | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
// (undocumented) | ||
protected updateTarget: UpdateTarget; | ||
} | ||
@@ -162,12 +153,2 @@ | ||
// @public | ||
export class ChangeBinding extends UpdateBinding { | ||
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget); | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
protected getObserver(target: Node): BindingObserver; | ||
// @internal (undocumented) | ||
handleChange(binding: Binding, observer: BindingObserver): void; | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
} | ||
// @public | ||
export interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> { | ||
@@ -217,2 +198,20 @@ } | ||
// @public | ||
export class ContentBehavior extends BindingBehavior { | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
} | ||
// @public | ||
export interface ContentTemplate { | ||
create(): ContentView; | ||
} | ||
// @public | ||
export interface ContentView { | ||
bind(source: any, context: ExecutionContext): void; | ||
insertBefore(node: Node): void; | ||
remove(): void; | ||
unbind(): void; | ||
} | ||
// @public | ||
export class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier { | ||
@@ -283,5 +282,2 @@ // @internal | ||
// @public | ||
export type DefaultBindingOptions = AddEventListenerOptions; | ||
// @public | ||
export interface Disposable { | ||
@@ -314,2 +310,3 @@ dispose(): void; | ||
isAttachedTo(target: StyleTarget): boolean; | ||
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined; | ||
// @internal (undocumented) | ||
@@ -341,3 +338,3 @@ removeStylesFrom(target: StyleTarget): void; | ||
// @public | ||
export class EventBinding { | ||
export class EventBehavior { | ||
constructor(directive: HTMLBindingDirective); | ||
@@ -376,2 +373,16 @@ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
// @public | ||
export type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn; | ||
// @public | ||
export interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> { | ||
records(): IterableIterator<ObservationRecord>; | ||
setMode(isAsync: boolean): void; | ||
} | ||
// @public | ||
export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable { | ||
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn; | ||
} | ||
// Warning: (ae-internal-missing-underscore) The name "FAST" should be prefixed with an underscore because the declaration is marked as @internal | ||
@@ -397,4 +408,4 @@ // | ||
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement; | ||
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType; | ||
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>; | ||
define: typeof define; | ||
compose: typeof compose; | ||
}; | ||
@@ -404,5 +415,5 @@ | ||
export class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> { | ||
constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string); | ||
readonly attributeLookup: Record<string, AttributeDefinition>; | ||
readonly attributes: ReadonlyArray<AttributeDefinition>; | ||
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>; | ||
define(registry?: CustomElementRegistry): this; | ||
@@ -426,3 +437,3 @@ readonly elementOptions?: ElementDefinitionOptions; | ||
addMessages(messages: Record<number, string>): void; | ||
error(code: number, ...args: any[]): Error; | ||
error(code: number, values?: Record<string, any>): Error; | ||
getById<T>(id: string | number): T | null; | ||
@@ -432,3 +443,3 @@ // (undocumented) | ||
readonly versions: string[]; | ||
warn(code: number, ...args: any[]): void; | ||
warn(code: number, values?: Record<string, any>): void; | ||
} | ||
@@ -441,14 +452,10 @@ | ||
export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected { | ||
constructor(binding: Binding, mode: BindingMode, options: any); | ||
constructor(dataBinding: Binding); | ||
aspectType: Aspect; | ||
// (undocumented) | ||
binding: Binding; | ||
createBehavior(targets: ViewBehaviorTargets): ViewBehavior; | ||
createHTML(add: AddViewBehaviorFactory): string; | ||
// (undocumented) | ||
dataBinding: Binding; | ||
id: string; | ||
// (undocumented) | ||
mode: BindingMode; | ||
nodeId: string; | ||
// (undocumented) | ||
options: any; | ||
sourceAspect: string; | ||
@@ -508,2 +515,5 @@ targetAspect: string; | ||
// @public | ||
export function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>; | ||
// @public | ||
export const Markup: Readonly<{ | ||
@@ -541,2 +551,5 @@ interpolation: (id: string) => string; | ||
// @public | ||
export function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>; | ||
// @public | ||
export interface Notifier { | ||
@@ -561,4 +574,4 @@ notify(args: any): void; | ||
getAccessors: (target: {}) => Accessor[]; | ||
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>; | ||
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean; | ||
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>; | ||
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean; | ||
}>; | ||
@@ -576,13 +589,5 @@ | ||
// @public | ||
export const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>; | ||
export function oneTime<T = any>(binding: Expression<T>): Binding<T>; | ||
// @public | ||
export const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>; | ||
// @public | ||
export class OneTimeBinding extends UpdateBinding { | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
} | ||
// @public | ||
export const Parser: Readonly<{ | ||
@@ -626,9 +631,9 @@ parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null; | ||
// @public | ||
export function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>; | ||
export function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>; | ||
// @public | ||
export class RepeatBehavior<TSource = any> implements Behavior, Subscriber { | ||
constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions); | ||
constructor(directive: RepeatDirective, location: Node); | ||
bind(source: TSource, context: ExecutionContext): void; | ||
handleChange(source: any, args: Splice[]): void; | ||
handleChange(source: any, args: Splice[] | ExpressionObserver): void; | ||
unbind(): void; | ||
@@ -639,8 +644,8 @@ } | ||
export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory { | ||
constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions); | ||
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions); | ||
createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>; | ||
createHTML(add: AddViewBehaviorFactory): string; | ||
// (undocumented) | ||
readonly dataBinding: Binding<TSource>; | ||
id: string; | ||
// (undocumented) | ||
readonly itemsBinding: Binding; | ||
nodeId: string; | ||
@@ -779,3 +784,3 @@ // (undocumented) | ||
// @public | ||
export type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>; | ||
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>; | ||
@@ -813,14 +818,2 @@ // @public | ||
// @public | ||
export class UpdateBinding implements ViewBehavior { | ||
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget); | ||
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
createBehavior(targets: ViewBehaviorTargets): ViewBehavior; | ||
// (undocumented) | ||
readonly directive: HTMLBindingDirective; | ||
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void; | ||
// (undocumented) | ||
protected updateTarget: UpdateTarget; | ||
} | ||
// @public | ||
export interface UpdateQueue { | ||
@@ -889,6 +882,11 @@ enqueue(callable: Callable): void; | ||
// @public | ||
export function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>; | ||
export function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>; | ||
// Warnings were encountered during analysis: | ||
// | ||
// dist/dts/components/fast-element.d.ts:73:5 - (ae-forgotten-export) The symbol "define" needs to be exported by the entry point index.d.ts | ||
// dist/dts/components/fast-element.d.ts:78:5 - (ae-forgotten-export) The symbol "compose" needs to be exported by the entry point index.d.ts | ||
// (No @packageDocumentation comment for this package) | ||
``` |
{ | ||
"name": "@microsoft/fast-element", | ||
"description": "A library for constructing Web Components", | ||
"version": "2.0.0-beta.3", | ||
"version": "2.0.0-beta.4", | ||
"author": { | ||
@@ -49,2 +49,6 @@ "name": "Microsoft", | ||
}, | ||
"./render": { | ||
"types": "./dist/dts/templating/render.d.ts", | ||
"default": "./dist/esm/templating/render.js" | ||
}, | ||
"./utilities": { | ||
@@ -65,2 +69,10 @@ "types": "./dist/dts/utilities.d.ts", | ||
"default": "./dist/esm/metadata.js" | ||
}, | ||
"./testing": { | ||
"types": "./dist/dts/testing/exports.d.ts", | ||
"default": "./dist/esm/testing/exports.js" | ||
}, | ||
"./di": { | ||
"types": "./dist/dts/di/di.d.ts", | ||
"default": "./dist/esm/di/di.js" | ||
} | ||
@@ -67,0 +79,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1743307
114
42738