@microsoft/fast-element 1.10.4 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,16 +2,45 @@
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 26 Jul 2022 17:43:17 GMT",
6
- "tag": "@microsoft/fast-element_v1.10.4",
7
- "version": "1.10.4",
5
+ "date": "Tue, 25 Oct 2022 02:34:36 GMT",
6
+ "tag": "@microsoft/fast-element_v1.11.0",
7
+ "version": "1.11.0",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "wendywendy@microsoft.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "085bd287b815dcb43b7697d5e42cf8f29f3105cc",
14
+ "comment": "persist totaAvailableViews to compare removeIndex against"
15
+ },
16
+ {
17
+ "author": "wendywendy@microsoft.com",
18
+ "package": "@microsoft/fast-element",
19
+ "commit": "b0d0a0ccd68e932101dd4c35f89625684b485148",
20
+ "comment": "make insertBefore noop"
21
+ }
22
+ ],
23
+ "minor": [
24
+ {
25
+ "author": "roeisenb@microsoft.com",
26
+ "package": "@microsoft/fast-element",
27
+ "commit": "a8021a341f066d481ba0c6514c3caaa7e746be83",
28
+ "comment": "fix(fast-element): attributes properly located in inheritance hierarchy"
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ {
34
+ "date": "Wed, 17 Aug 2022 16:41:39 GMT",
35
+ "tag": "@microsoft/fast-element_v1.10.5",
36
+ "version": "1.10.5",
8
37
  "comments": {
9
38
  "patch": [
10
39
  {
11
40
  "author": "prudepixie@users.noreply.github.com",
12
41
  "package": "@microsoft/fast-element",
13
- "commit": "ae07e8fc912f2e05d43c19ee22d768e893316399",
14
- "comment": "only store views if it cant be reused right away"
42
+ "commit": "3d7f8e4e8a7f9e3c1d9d997d510eafd0dc220f97",
43
+ "comment": "default options in repeat should be set in various scenarios"
15
44
  }
16
45
  ]
17
46
  }
package/CHANGELOG.md CHANGED
@@ -1,16 +1,29 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Tue, 26 Jul 2022 17:43:17 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 25 Oct 2022 02:34:36 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 1.10.4
7
+ ## 1.11.0
8
8
 
9
- Tue, 26 Jul 2022 17:43:17 GMT
9
+ Tue, 25 Oct 2022 02:34:36 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - fix(fast-element): attributes properly located in inheritance hierarchy (roeisenb@microsoft.com)
14
+
15
+ ### Patches
16
+
17
+ - persist totaAvailableViews to compare removeIndex against (wendywendy@microsoft.com)
18
+ - make insertBefore noop (wendywendy@microsoft.com)
19
+
20
+ ## 1.10.5
21
+
22
+ Wed, 17 Aug 2022 16:41:39 GMT
10
23
 
11
24
  ### Patches
12
25
 
13
- - only store views if it cant be reused right away (prudepixie@users.noreply.github.com)
26
+ - default options in repeat should be set in various scenarios (prudepixie@users.noreply.github.com)
14
27
 
15
28
  ## 1.10.2
16
29
 
@@ -38,6 +38,16 @@ export declare type AttributeConfiguration = {
38
38
  mode?: AttributeMode;
39
39
  converter?: ValueConverter;
40
40
  };
41
+ /**
42
+ * Metadata used to configure a custom attribute's behavior.
43
+ * @public
44
+ */
45
+ export declare const AttributeConfiguration: Readonly<{
46
+ /**
47
+ * Locates all attribute configurations associated with a type.
48
+ */
49
+ locate: (target: {}) => AttributeConfiguration[];
50
+ }>;
41
51
  /**
42
52
  * Metadata used to configure a custom attribute's behavior through a decorator.
43
53
  * @public
@@ -82,3 +82,9 @@ export declare const enum KernelServiceId {
82
82
  * @internal
83
83
  */
84
84
  export declare const emptyArray: readonly never[];
85
+ /**
86
+ * Creates a function capable of locating metadata associated with a type.
87
+ * @returns A metadata locator function.
88
+ * @internal
89
+ */
90
+ export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
@@ -70,9 +70,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
70
70
  * @public
71
71
  */
72
72
  export declare class RepeatDirective<TSource = any> extends HTMLDirective {
73
- private itemsBinding;
74
- private templateBinding;
75
- private options;
73
+ readonly itemsBinding: Binding;
74
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
75
+ readonly options: RepeatOptions;
76
76
  private isItemsBindingVolatile;
77
77
  private isTemplateBindingVolatile;
78
78
  /**
@@ -1,5 +1,16 @@
1
1
  import { Observable } from "../observation/observable.js";
2
2
  import { DOM } from "../dom.js";
3
+ import { createMetadataLocator } from "../platform.js";
4
+ /**
5
+ * Metadata used to configure a custom attribute's behavior.
6
+ * @public
7
+ */
8
+ export const AttributeConfiguration = Object.freeze({
9
+ /**
10
+ * Locates all attribute configurations associated with a type.
11
+ */
12
+ locate: createMetadataLocator(),
13
+ });
3
14
  /**
4
15
  * A {@link ValueConverter} that converts to and from `boolean` values.
5
16
  * @remarks
@@ -140,7 +151,7 @@ export class AttributeDefinition {
140
151
  */
141
152
  static collect(Owner, ...attributeLists) {
142
153
  const attributes = [];
143
- attributeLists.push(Owner.attributes);
154
+ attributeLists.push(AttributeConfiguration.locate(Owner));
144
155
  for (let i = 0, ii = attributeLists.length; i < ii; ++i) {
145
156
  const list = attributeLists[i];
146
157
  if (list === void 0) {
@@ -170,9 +181,7 @@ export function attr(configOrTarget, prop) {
170
181
  // - @attr({...opts})
171
182
  config.property = $prop;
172
183
  }
173
- const attributes = $target.constructor.attributes ||
174
- ($target.constructor.attributes = []);
175
- attributes.push(config);
184
+ AttributeConfiguration.locate($target.constructor).push(config);
176
185
  }
177
186
  if (arguments.length > 1) {
178
187
  // Non invocation:
@@ -1,5 +1,5 @@
1
1
  import { DOM } from "../dom.js";
2
- import { FAST } from "../platform.js";
2
+ import { createMetadataLocator, FAST } from "../platform.js";
3
3
  import { PropertyChangeNotifier, SubscriberSet } from "./notifier.js";
4
4
  /**
5
5
  * Common Observable APIs.
@@ -8,7 +8,6 @@ import { PropertyChangeNotifier, SubscriberSet } from "./notifier.js";
8
8
  export const Observable = FAST.getById(2 /* observable */, () => {
9
9
  const volatileRegex = /(:|&&|\|\||if)/;
10
10
  const notifierLookup = new WeakMap();
11
- const accessorLookup = new WeakMap();
12
11
  const queueUpdate = DOM.queueUpdate;
13
12
  let watcher = void 0;
14
13
  let createArrayObserver = (array) => {
@@ -26,24 +25,7 @@ export const Observable = FAST.getById(2 /* observable */, () => {
26
25
  }
27
26
  return found;
28
27
  }
29
- function getAccessors(target) {
30
- let accessors = accessorLookup.get(target);
31
- if (accessors === void 0) {
32
- let currentTarget = Reflect.getPrototypeOf(target);
33
- while (accessors === void 0 && currentTarget !== null) {
34
- accessors = accessorLookup.get(currentTarget);
35
- currentTarget = Reflect.getPrototypeOf(currentTarget);
36
- }
37
- if (accessors === void 0) {
38
- accessors = [];
39
- }
40
- else {
41
- accessors = accessors.slice(0);
42
- }
43
- accessorLookup.set(target, accessors);
44
- }
45
- return accessors;
46
- }
28
+ const getAccessors = createMetadataLocator();
47
29
  class DefaultObservableAccessor {
48
30
  constructor(name) {
49
31
  this.name = name;
@@ -67,3 +67,24 @@ if (FAST.getById === void 0) {
67
67
  * @internal
68
68
  */
69
69
  export const emptyArray = Object.freeze([]);
70
+ /**
71
+ * Creates a function capable of locating metadata associated with a type.
72
+ * @returns A metadata locator function.
73
+ * @internal
74
+ */
75
+ export function createMetadataLocator() {
76
+ const metadataLookup = new WeakMap();
77
+ return function (target) {
78
+ let metadata = metadataLookup.get(target);
79
+ if (metadata === void 0) {
80
+ let currentTarget = Reflect.getPrototypeOf(target);
81
+ while (metadata === void 0 && currentTarget !== null) {
82
+ metadata = metadataLookup.get(currentTarget);
83
+ currentTarget = Reflect.getPrototypeOf(currentTarget);
84
+ }
85
+ metadata = metadata === void 0 ? [] : metadata.slice(0);
86
+ metadataLookup.set(target, metadata);
87
+ }
88
+ return metadata;
89
+ };
90
+ }
@@ -126,13 +126,14 @@ export class RepeatBehavior {
126
126
  let addIndex = splice.index;
127
127
  const end = addIndex + splice.addedCount;
128
128
  const removedViews = views.splice(splice.index, removed.length);
129
- availableViews = leftoverViews.length + removedViews.length;
129
+ const totalAvailableViews = (availableViews =
130
+ leftoverViews.length + removedViews.length);
130
131
  for (; addIndex < end; ++addIndex) {
131
132
  const neighbor = views[addIndex];
132
133
  const location = neighbor ? neighbor.firstChild : this.location;
133
134
  let view;
134
135
  if (recycle && availableViews > 0) {
135
- if (removeIndex <= availableViews && removedViews.length > 0) {
136
+ if (removeIndex <= totalAvailableViews && removedViews.length > 0) {
136
137
  view = removedViews[removeIndex];
137
138
  removeIndex++;
138
139
  }
@@ -261,5 +262,5 @@ export function repeat(itemsBinding, templateOrTemplateBinding, options = defaul
261
262
  const templateBinding = typeof templateOrTemplateBinding === "function"
262
263
  ? templateOrTemplateBinding
263
264
  : () => templateOrTemplateBinding;
264
- return new RepeatDirective(itemsBinding, templateBinding, options);
265
+ return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
265
266
  }
@@ -41,8 +41,10 @@ export class HTMLView {
41
41
  node.parentNode.insertBefore(this.fragment, node);
42
42
  }
43
43
  else {
44
- const parentNode = node.parentNode;
45
44
  const end = this.lastChild;
45
+ if (node.previousSibling === end)
46
+ return;
47
+ const parentNode = node.parentNode;
46
48
  let current = this.firstChild;
47
49
  let next;
48
50
  while (current !== end) {
@@ -751,6 +751,41 @@
751
751
  "endIndex": 6
752
752
  }
753
753
  },
754
+ {
755
+ "kind": "Variable",
756
+ "canonicalReference": "@microsoft/fast-element!AttributeConfiguration:var",
757
+ "docComment": "/**\n * Metadata used to configure a custom attribute's behavior.\n *\n * @public\n */\n",
758
+ "excerptTokens": [
759
+ {
760
+ "kind": "Content",
761
+ "text": "AttributeConfiguration: "
762
+ },
763
+ {
764
+ "kind": "Reference",
765
+ "text": "Readonly",
766
+ "canonicalReference": "!Readonly:type"
767
+ },
768
+ {
769
+ "kind": "Content",
770
+ "text": "<{\n locate: (target: {}) => "
771
+ },
772
+ {
773
+ "kind": "Reference",
774
+ "text": "AttributeConfiguration",
775
+ "canonicalReference": "@microsoft/fast-element!AttributeConfiguration:type"
776
+ },
777
+ {
778
+ "kind": "Content",
779
+ "text": "[];\n}>"
780
+ }
781
+ ],
782
+ "releaseTag": "Public",
783
+ "name": "AttributeConfiguration",
784
+ "variableTypeTokenRange": {
785
+ "startIndex": 1,
786
+ "endIndex": 5
787
+ }
788
+ },
754
789
  {
755
790
  "kind": "Class",
756
791
  "canonicalReference": "@microsoft/fast-element!AttributeDefinition:class",
@@ -8536,6 +8571,103 @@
8536
8571
  "endIndex": 2
8537
8572
  },
8538
8573
  "isStatic": false
8574
+ },
8575
+ {
8576
+ "kind": "Property",
8577
+ "canonicalReference": "@microsoft/fast-element!RepeatDirective#itemsBinding:member",
8578
+ "docComment": "",
8579
+ "excerptTokens": [
8580
+ {
8581
+ "kind": "Content",
8582
+ "text": "readonly itemsBinding: "
8583
+ },
8584
+ {
8585
+ "kind": "Reference",
8586
+ "text": "Binding",
8587
+ "canonicalReference": "@microsoft/fast-element!Binding:type"
8588
+ },
8589
+ {
8590
+ "kind": "Content",
8591
+ "text": ";"
8592
+ }
8593
+ ],
8594
+ "isOptional": false,
8595
+ "releaseTag": "Public",
8596
+ "name": "itemsBinding",
8597
+ "propertyTypeTokenRange": {
8598
+ "startIndex": 1,
8599
+ "endIndex": 2
8600
+ },
8601
+ "isStatic": false
8602
+ },
8603
+ {
8604
+ "kind": "Property",
8605
+ "canonicalReference": "@microsoft/fast-element!RepeatDirective#options:member",
8606
+ "docComment": "",
8607
+ "excerptTokens": [
8608
+ {
8609
+ "kind": "Content",
8610
+ "text": "readonly options: "
8611
+ },
8612
+ {
8613
+ "kind": "Reference",
8614
+ "text": "RepeatOptions",
8615
+ "canonicalReference": "@microsoft/fast-element!RepeatOptions:interface"
8616
+ },
8617
+ {
8618
+ "kind": "Content",
8619
+ "text": ";"
8620
+ }
8621
+ ],
8622
+ "isOptional": false,
8623
+ "releaseTag": "Public",
8624
+ "name": "options",
8625
+ "propertyTypeTokenRange": {
8626
+ "startIndex": 1,
8627
+ "endIndex": 2
8628
+ },
8629
+ "isStatic": false
8630
+ },
8631
+ {
8632
+ "kind": "Property",
8633
+ "canonicalReference": "@microsoft/fast-element!RepeatDirective#templateBinding:member",
8634
+ "docComment": "",
8635
+ "excerptTokens": [
8636
+ {
8637
+ "kind": "Content",
8638
+ "text": "readonly templateBinding: "
8639
+ },
8640
+ {
8641
+ "kind": "Reference",
8642
+ "text": "Binding",
8643
+ "canonicalReference": "@microsoft/fast-element!Binding:type"
8644
+ },
8645
+ {
8646
+ "kind": "Content",
8647
+ "text": "<TSource, "
8648
+ },
8649
+ {
8650
+ "kind": "Reference",
8651
+ "text": "SyntheticViewTemplate",
8652
+ "canonicalReference": "@microsoft/fast-element!SyntheticViewTemplate:interface"
8653
+ },
8654
+ {
8655
+ "kind": "Content",
8656
+ "text": ">"
8657
+ },
8658
+ {
8659
+ "kind": "Content",
8660
+ "text": ";"
8661
+ }
8662
+ ],
8663
+ "isOptional": false,
8664
+ "releaseTag": "Public",
8665
+ "name": "templateBinding",
8666
+ "propertyTypeTokenRange": {
8667
+ "startIndex": 1,
8668
+ "endIndex": 5
8669
+ },
8670
+ "isStatic": false
8539
8671
  }
8540
8672
  ],
8541
8673
  "extendsTokenRange": {
@@ -92,6 +92,17 @@ export declare type AttributeConfiguration = {
92
92
  converter?: ValueConverter;
93
93
  };
94
94
 
95
+ /**
96
+ * Metadata used to configure a custom attribute's behavior.
97
+ * @public
98
+ */
99
+ export declare const AttributeConfiguration: Readonly<{
100
+ /**
101
+ * Locates all attribute configurations associated with a type.
102
+ */
103
+ locate: (target: {}) => AttributeConfiguration[];
104
+ }>;
105
+
95
106
  /**
96
107
  * An implementation of {@link Accessor} that supports reactivity,
97
108
  * change callbacks, attribute reflection, and type conversion for
@@ -519,6 +530,13 @@ export declare class Controller extends PropertyChangeNotifier {
519
530
  static forCustomElement(element: HTMLElement): Controller;
520
531
  }
521
532
 
533
+ /**
534
+ * Creates a function capable of locating metadata associated with a type.
535
+ * @returns A metadata locator function.
536
+ * @internal
537
+ */
538
+ export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
539
+
522
540
  /**
523
541
  * Transforms a template literal string into styles.
524
542
  * @param strings - The string fragments that are interpolated with the values.
@@ -1540,9 +1558,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1540
1558
  * @public
1541
1559
  */
1542
1560
  export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1543
- private itemsBinding;
1544
- private templateBinding;
1545
- private options;
1561
+ readonly itemsBinding: Binding;
1562
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1563
+ readonly options: RepeatOptions;
1546
1564
  private isItemsBindingVolatile;
1547
1565
  private isTemplateBindingVolatile;
1548
1566
  /**
@@ -86,6 +86,32 @@ if (FAST.getById === void 0) {
86
86
 
87
87
 
88
88
  const emptyArray = Object.freeze([]);
89
+ /**
90
+ * Creates a function capable of locating metadata associated with a type.
91
+ * @returns A metadata locator function.
92
+ * @internal
93
+ */
94
+
95
+ function createMetadataLocator() {
96
+ const metadataLookup = new WeakMap();
97
+ return function (target) {
98
+ let metadata = metadataLookup.get(target);
99
+
100
+ if (metadata === void 0) {
101
+ let currentTarget = Reflect.getPrototypeOf(target);
102
+
103
+ while (metadata === void 0 && currentTarget !== null) {
104
+ metadata = metadataLookup.get(currentTarget);
105
+ currentTarget = Reflect.getPrototypeOf(currentTarget);
106
+ }
107
+
108
+ metadata = metadata === void 0 ? [] : metadata.slice(0);
109
+ metadataLookup.set(target, metadata);
110
+ }
111
+
112
+ return metadata;
113
+ };
114
+ }
89
115
 
90
116
  const updateQueue = $global.FAST.getById(1
91
117
  /* updateQueue */
@@ -530,7 +556,6 @@ const Observable = FAST.getById(2
530
556
  , () => {
531
557
  const volatileRegex = /(:|&&|\|\||if)/;
532
558
  const notifierLookup = new WeakMap();
533
- const accessorLookup = new WeakMap();
534
559
  const queueUpdate = DOM.queueUpdate;
535
560
  let watcher = void 0;
536
561
 
@@ -552,28 +577,7 @@ const Observable = FAST.getById(2
552
577
  return found;
553
578
  }
554
579
 
555
- function getAccessors(target) {
556
- let accessors = accessorLookup.get(target);
557
-
558
- if (accessors === void 0) {
559
- let currentTarget = Reflect.getPrototypeOf(target);
560
-
561
- while (accessors === void 0 && currentTarget !== null) {
562
- accessors = accessorLookup.get(currentTarget);
563
- currentTarget = Reflect.getPrototypeOf(currentTarget);
564
- }
565
-
566
- if (accessors === void 0) {
567
- accessors = [];
568
- } else {
569
- accessors = accessors.slice(0);
570
- }
571
-
572
- accessorLookup.set(target, accessors);
573
- }
574
-
575
- return accessors;
576
- }
580
+ const getAccessors = createMetadataLocator();
577
581
 
578
582
  class DefaultObservableAccessor {
579
583
  constructor(name) {
@@ -1609,8 +1613,9 @@ class HTMLView {
1609
1613
  if (this.fragment.hasChildNodes()) {
1610
1614
  node.parentNode.insertBefore(this.fragment, node);
1611
1615
  } else {
1612
- const parentNode = node.parentNode;
1613
1616
  const end = this.lastChild;
1617
+ if (node.previousSibling === end) return;
1618
+ const parentNode = node.parentNode;
1614
1619
  let current = this.firstChild;
1615
1620
  let next;
1616
1621
 
@@ -2096,6 +2101,17 @@ class StyleElementStyles extends ElementStyles {
2096
2101
 
2097
2102
  }
2098
2103
 
2104
+ /**
2105
+ * Metadata used to configure a custom attribute's behavior.
2106
+ * @public
2107
+ */
2108
+
2109
+ const AttributeConfiguration = Object.freeze({
2110
+ /**
2111
+ * Locates all attribute configurations associated with a type.
2112
+ */
2113
+ locate: createMetadataLocator()
2114
+ });
2099
2115
  /**
2100
2116
  * A {@link ValueConverter} that converts to and from `boolean` values.
2101
2117
  * @remarks
@@ -2262,7 +2278,7 @@ class AttributeDefinition {
2262
2278
 
2263
2279
  static collect(Owner, ...attributeLists) {
2264
2280
  const attributes = [];
2265
- attributeLists.push(Owner.attributes);
2281
+ attributeLists.push(AttributeConfiguration.locate(Owner));
2266
2282
 
2267
2283
  for (let i = 0, ii = attributeLists.length; i < ii; ++i) {
2268
2284
  const list = attributeLists[i];
@@ -2299,8 +2315,7 @@ function attr(configOrTarget, prop) {
2299
2315
  config.property = $prop;
2300
2316
  }
2301
2317
 
2302
- const attributes = $target.constructor.attributes || ($target.constructor.attributes = []);
2303
- attributes.push(config);
2318
+ AttributeConfiguration.locate($target.constructor).push(config);
2304
2319
  }
2305
2320
 
2306
2321
  if (arguments.length > 1) {
@@ -3889,7 +3904,7 @@ class RepeatBehavior {
3889
3904
  let addIndex = splice.index;
3890
3905
  const end = addIndex + splice.addedCount;
3891
3906
  const removedViews = views.splice(splice.index, removed.length);
3892
- availableViews = leftoverViews.length + removedViews.length;
3907
+ const totalAvailableViews = availableViews = leftoverViews.length + removedViews.length;
3893
3908
 
3894
3909
  for (; addIndex < end; ++addIndex) {
3895
3910
  const neighbor = views[addIndex];
@@ -3897,7 +3912,7 @@ class RepeatBehavior {
3897
3912
  let view;
3898
3913
 
3899
3914
  if (recycle && availableViews > 0) {
3900
- if (removeIndex <= availableViews && removedViews.length > 0) {
3915
+ if (removeIndex <= totalAvailableViews && removedViews.length > 0) {
3901
3916
  view = removedViews[removeIndex];
3902
3917
  removeIndex++;
3903
3918
  } else {
@@ -4041,7 +4056,7 @@ class RepeatDirective extends HTMLDirective {
4041
4056
 
4042
4057
  function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeatOptions) {
4043
4058
  const templateBinding = typeof templateOrTemplateBinding === "function" ? templateOrTemplateBinding : () => templateOrTemplateBinding;
4044
- return new RepeatDirective(itemsBinding, templateBinding, options);
4059
+ return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
4045
4060
  }
4046
4061
 
4047
4062
  /**
@@ -4255,4 +4270,4 @@ function children(propertyOrOptions) {
4255
4270
  return new AttachedBehaviorHTMLDirective("fast-children", ChildrenBehavior, propertyOrOptions);
4256
4271
  }
4257
4272
 
4258
- export { $global, AttachedBehaviorHTMLDirective, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, Controller, DOM, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Observable, PropertyChangeNotifier, RefBehavior, RepeatBehavior, RepeatDirective, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, ViewTemplate, attr, booleanConverter, children, compileTemplate, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, nullableNumberConverter, observable, ref, repeat, slotted, volatile, when };
4273
+ export { $global, AttachedBehaviorHTMLDirective, AttributeConfiguration, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, Controller, DOM, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Observable, PropertyChangeNotifier, RefBehavior, RepeatBehavior, RepeatDirective, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, ViewTemplate, attr, booleanConverter, children, compileTemplate, createMetadataLocator, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, nullableNumberConverter, observable, ref, repeat, slotted, volatile, when };
@@ -1 +1 @@
1
- const t=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===t.trustedTypes&&(t.trustedTypes={createPolicy:(t,e)=>e});const e={configurable:!1,enumerable:!1,writable:!1};void 0===t.FAST&&Reflect.defineProperty(t,"FAST",Object.assign({value:Object.create(null)},e));const s=t.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},e))}const i=Object.freeze([]),n=t.FAST.getById(1,()=>{const e=[],s=[];function i(){if(s.length)throw s.shift()}function n(t){try{t.call()}catch(t){s.push(t),setTimeout(i,0)}}function r(){let t=0;for(;t<e.length;)if(n(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}return Object.freeze({enqueue:function(s){e.length<1&&t.requestAnimationFrame(r),e.push(s)},process:r})}),r=t.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let o=r;const l="fast-"+Math.random().toString(36).substring(2,8),h=l+"{",a="}"+l,c=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(o!==r)throw new Error("The HTML policy can only be set once.");o=t},createHTML:t=>o.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(l),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(l+":","")),createInterpolationPlaceholder:t=>`${h}${t}${a}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${l}:${t}--\x3e`,queueUpdate:n.enqueue,processUpdates:n.process,nextUpdate:()=>new Promise(n.enqueue),setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});class d{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=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.source;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 u{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const s=this.subscribers[t];void 0!==s&&s.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var s;if(e){let s=this.subscribers[e];void 0===s&&(this.subscribers[e]=s=new d(this.source)),s.subscribe(t)}else this.sourceSubscribers=null!==(s=this.sourceSubscribers)&&void 0!==s?s:new d(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var s;if(e){const s=this.subscribers[e];void 0!==s&&s.unsubscribe(t)}else null===(s=this.sourceSubscribers)||void 0===s||s.unsubscribe(t)}}const f=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,s=new WeakMap,i=c.queueUpdate;let n=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let s=t.$fastController||e.get(t);return void 0===s&&(Array.isArray(t)?s=r(t):e.set(t,s=new u(t))),s}function l(t){let e=s.get(t);if(void 0===e){let i=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==i;)e=s.get(i),i=Reflect.getPrototypeOf(i);e=void 0===e?[]:e.slice(0),s.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];"function"==typeof n&&n.call(t,i,e),o(t).notify(this.name)}}}class a extends d{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,e);return n=s,i}disconnect(){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=!0}}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,i(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==n&&n.watch(t,e)},trackVolatile(){void 0!==n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new h(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,s=this.isVolatileBinding(t)){return new a(t,e,s)},isVolatileBinding:e=>t.test(e.toString())})});function p(t,e){f.defineProperty(t,e)}function g(t,e,s){return Object.assign({},s,{get:function(){return f.trackVolatile(),s.get.apply(this)}})}const b=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class v{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return b.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}static setEvent(t){b.set(t)}}f.defineProperty(v.prototype,"index"),f.defineProperty(v.prototype,"length");const m=Object.seal(new v);class y{constructor(){this.targetIndex=0}}class C extends y{constructor(){super(...arguments),this.createPlaceholder=c.createInterpolationPlaceholder}}class x extends y{constructor(t,e,s){super(),this.name=t,this.behavior=e,this.options=s}createPlaceholder(t){return c.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function w(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=f.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function S(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function B(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function T(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function O(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function A(t){c.setAttribute(this.target,this.targetName,t)}function N(t){c.setBooleanAttribute(this.target,this.targetName,t)}function k(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function V(t){this.target[this.targetName]=t}function F(t){const e=this.classVersions||Object.create(null),s=this.target;let i=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=i,s.classList.add(r))}}if(this.classVersions=e,this.version=i+1,0!==i){i-=1;for(const t in e)e[t]===i&&s.classList.remove(t)}}class I extends C{constructor(t){super(),this.binding=t,this.bind=w,this.unbind=B,this.updateTarget=A,this.isBindingVolatile=f.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=V,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,s)=>c.createHTML(t(e,s))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=N;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=S,this.unbind=O;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=F)}}targetAtContent(){this.updateTarget=k,this.unbind=T}createBehavior(t){return new $(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class ${constructor(t,e,s,i,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=s,this.bind=i,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){v.setEvent(t);const e=this.binding(this.source,this.context);v.setEvent(null),!0!==e&&t.preventDefault()}}let _=null;class M{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){_=this}static borrow(t){const e=_||new M;return e.directives=t,e.reset(),_=null,e}}function P(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new I((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n});return n.targetName=e,n}const E=a.length;function L(t,e){const s=e.split(h);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(a);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));i.push(t.directives[e]),o=n.substring(r+E)}""!==o&&i.push(o)}return i}function j(t,e,s=!1){const i=e.attributes;for(let n=0,r=i.length;n<r;++n){const o=i[n],l=o.value,h=L(t,l);let a=null;null===h?s&&(a=new I(()=>l),a.targetName=o.name):a=P(h),null!==a&&(e.removeAttributeNode(o),n--,r--,t.addFactory(a))}}function R(t,e,s){const i=L(t,e.textContent);if(null!==i){let n=e;for(let r=0,o=i.length;r<o;++r){const o=i[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&s.nextNode()}t.targetIndex--}}function z(t,e){const s=t.content;document.adoptNode(s);const i=M.borrow(e);j(i,t,!0);const n=i.behaviorFactories;i.reset();const r=c.createTemplateWalker(s);let o;for(;o=r.nextNode();)switch(i.targetIndex++,o.nodeType){case 1:j(i,o);break;case 3:R(i,o,r);break;case 8:c.isMarker(o)&&i.addFactory(e[c.extractDirectiveIndexFromMarker(o)])}let l=0;(c.isMarker(s.firstChild)||1===s.childNodes.length&&e.length)&&(s.insertBefore(document.createComment(""),s.firstChild),l=-1);const h=i.behaviorFactories;return i.release(),{fragment:s,viewBehaviorFactories:h,hostBehaviorFactories:n,targetOffset:l}}const H=document.createRange();class q{constructor(t,e){this.fragment=t,this.behaviors=e,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(){const t=this.firstChild.parentNode,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.removeChild(i),i=s;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const s=this.behaviors;if(this.source!==t)if(null!==this.source){const i=this.source;this.source=t,this.context=e;for(let n=0,r=s.length;n<r;++n){const r=s[n];r.unbind(i),r.bind(t,e)}}else{this.source=t,this.context=e;for(let i=0,n=s.length;i<n;++i)s[i].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let s=0,i=t.length;s<i;++s)t[s].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){H.setStartBefore(t[0].firstChild),H.setEndAfter(t[t.length-1].lastChild),H.deleteContents();for(let e=0,s=t.length;e<s;++e){const s=t[e],i=s.behaviors,n=s.source;for(let t=0,e=i.length;t<e;++t)i[t].unbind(n)}}}}class Q{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=c.createHTML(e);const s=t.content.firstElementChild;null!==s&&"TEMPLATE"===s.tagName&&(t=s)}else t=e;const s=z(t,this.directives);this.fragment=s.fragment,this.viewBehaviorFactories=s.viewBehaviorFactories,this.hostBehaviorFactories=s.hostBehaviorFactories,this.targetOffset=s.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),s=this.viewBehaviorFactories,i=new Array(this.behaviorCount),n=c.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=s.length;r<t;++r){const t=s[r],e=t.targetIndex;for(;null!==l;){if(o===e){i[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let s=0,n=e.length;s<n;++s,++r)i[r]=e[s].createBehavior(t)}return new q(e,i)}render(t,e,s){"string"==typeof e&&(e=document.getElementById(e)),void 0===s&&(s=e);const i=this.create(s);return i.bind(t,m),i.appendTo(e),i}}const U=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function W(t,...e){const s=[];let i="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(i+=r,o instanceof Q){const t=o;o=()=>t}if("function"==typeof o&&(o=new I(o)),o instanceof C){const t=U.exec(r);null!==t&&(o.targetName=t[2])}o instanceof y?(i+=o.createPlaceholder(s.length),s.push(o)):i+=o}return i+=t[t.length-1],new Q(i,s)}class D{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}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}}function G(t){return t.map(t=>t instanceof D?G(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function J(t){return t.map(t=>t instanceof D?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}D.create=(()=>{if(c.supportsAdoptedStyleSheets){const t=new Map;return e=>new K(e,t)}return t=>new Y(t)})();class K extends D{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=J(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=G(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let s=e.get(t);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(t),e.set(t,s)),s})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let X=0;class Y extends D{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=J(t),this.styleSheets=G(t),this.styleClass="fast-style-class-"+ ++X}addStylesTo(t){const e=this.styleSheets,s=this.styleClass;t=this.normalizeTarget(t);for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const Z={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},tt={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class et{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=Z)}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 f.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||c.queueUpdate(()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;c.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":c.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];"string"==typeof i?s.push(new et(t,i)):s.push(new et(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function st(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 it={mode:"open"},nt={},rt=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ot{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=et.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?it:null===e.shadowOptions?void 0:Object.assign(Object.assign({},it),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?nt:Object.assign(Object.assign({},nt),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?D.create(e.styles):e.styles instanceof D?e.styles:D.create([e.styles])}get isDefined(){return!!rt.getByType(this.type)}define(t=customElements){const e=this.type;if(rt.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)f.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}}ot.forType=rt.getByType;const lt=new WeakMap,ht={bubbles:!0,composed:!0,cancelable:!0};function at(t){return t.shadowRoot||lt.get(t)||null}class ct extends u{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,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){const e=t.attachShadow(s);"closed"===s.mode&&lt.set(t,e)}const i=f.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 f.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,f.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=at(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){const e=at(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),s=t.length,i=[];for(let n=0;n<s;++n){const s=t[n];e.has(s)?e.set(s,e.get(s)+1):(e.set(s,1),i.push(s))}if(this._isConnected){const t=this.element;for(let e=0;e<i.length;++e)i[e].bind(t,m)}}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;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,m);const e=this.behaviors;if(null!==e)for(const[s]of e)s.bind(t,m);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;for(const[s]of e)s.unbind(t)}}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},ht),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}const s=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():s.template&&(this._template=s.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():s.styles&&(this._styles=s.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,s=at(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||c.removeChildNodes(s),t&&(this.view=t.render(e,s,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ot.forType(t.constructor);if(void 0===s)throw new Error("Missing FASTElement definition.");return t.$fastController=new ct(t,s)}}function dt(t){return class extends t{constructor(){super(),ct.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 ut=Object.assign(dt(HTMLElement),{from:t=>dt(t),define:(t,e)=>new ot(t,e).define().type});function ft(t){return function(e){new ot(e,t).define()}}class pt{createCSS(){return""}createBehavior(){}}function gt(t,e){const s=[];let i="";const n=[];for(let r=0,o=t.length-1;r<o;++r){i+=t[r];let o=e[r];if(o instanceof pt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof D||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}}function bt(t,...e){const{styles:s,behaviors:i}=gt(t,e),n=D.create(s);return i.length&&n.withBehaviors(...i),n}class vt extends pt{constructor(t,e){super(),this.behaviors=e,this.css="";const s=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);s.length&&(this.styles=D.create(s))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function mt(t,...e){const{styles:s,behaviors:i}=gt(t,e);return new vt(s,i)}function yt(t,e,s){return{index:t,removed:e,addedCount:s}}function Ct(t,e,s,n,r,o){let l=0,h=0;const a=Math.min(s-e,o-r);if(0===e&&0===r&&(l=function(t,e,s){for(let i=0;i<s;++i)if(t[i]!==e[i])return i;return s}(t,n,a)),s===t.length&&o===n.length&&(h=function(t,e,s){let i=t.length,n=e.length,r=0;for(;r<s&&t[--i]===e[--n];)r++;return r}(t,n,a-l)),r+=l,o-=h,(s-=h)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=yt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[yt(e,[],s-e)];const c=function(t){let e=t.length-1,s=t[0].length-1,i=t[e][s];const n=[];for(;e>0||s>0;){if(0===e){n.push(2),s--;continue}if(0===s){n.push(3),e--;continue}const r=t[e-1][s-1],o=t[e-1][s],l=t[e][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),e--,s--):h===o?(n.push(3),e--,i=o):(n.push(2),s--,i=l)}return n.reverse(),n}(function(t,e,s,i,n,r){const o=r-n+1,l=s-e+1,h=new Array(o);let a,c;for(let t=0;t<o;++t)h[t]=new Array(l),h[t][0]=t;for(let t=0;t<l;++t)h[0][t]=t;for(let s=1;s<o;++s)for(let r=1;r<l;++r)t[e+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(t,e,s,n,r,o)),d=[];let u=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=yt(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=yt(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=yt(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}const xt=Array.prototype.push;function wt(t,e,s,i){const n=yt(e,s,i);let r=!1,o=0;for(let e=0;e<t.length;e++){const s=t[e];if(s.index+=o,r)continue;const i=(l=n.index,h=n.index+n.removed.length,a=s.index,c=s.index+s.addedCount,h<a||c<l?-1:h===a||c===l?0:l<a?h<c?h-a:c-a:c<h?c-l:h-l);if(i>=0){t.splice(e,1),e--,o-=s.addedCount-s.removed.length,n.addedCount+=s.addedCount-i;const l=n.removed.length+s.removed.length-i;if(n.addedCount||l){let t=s.removed;if(n.index<s.index){const e=n.removed.slice(0,s.index-n.index);xt.apply(e,t),t=e}if(n.index+n.removed.length>s.index+s.addedCount){const e=n.removed.slice(s.index+s.addedCount-n.index);xt.apply(t,e)}n.removed=t,s.index<n.index&&(n.index=s.index)}else r=!0}else if(n.index<s.index){r=!0,t.splice(e,0,n),e++;const i=n.addedCount-n.removed.length;s.index+=i,o+=i}}var l,h,a,c;r||t.push(n)}function St(t,e){let s=[];const i=function(t){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];wt(e,i.index,i.removed,i.addedCount)}return e}(e);for(let e=0,n=i.length;e<n;++e){const n=i[e];1!==n.addedCount||1!==n.removed.length?s=s.concat(Ct(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&s.push(n)}return s}let Bt=!1;function Tt(t,e){let s=t.index;const i=e.length;return s>i?s=i-t.addedCount:s<0&&(s=i+t.removed.length+s-t.addedCount),s<0&&(s=0),t.index=s,t}class Ot extends d{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,c.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,c.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const s=void 0===e?St(this.source,t):Ct(this.source,0,this.source.length,e,0,e.length);this.notify(s)}}function At(){if(Bt)return;Bt=!0,f.setArrayObserverFactory(t=>new Ot(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,s=t.push,i=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,s=e.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(yt(this.length,[s],0)),s},t.push=function(){const t=s.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Tt(yt(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=i.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(yt(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=r.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Tt(yt(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Tt(yt(0,[],arguments.length),this)),t}}class Nt{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function kt(t){return new x("fast-ref",Nt,t)}function Vt(t,e){const s="function"==typeof e?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Ft=Object.freeze({positioning:!1,recycle:!0});function It(t,e,s,i){t.bind(e[s],i)}function $t(t,e,s,i){const n=Object.create(i);n.index=s,n.length=e.length,t.bind(e[s],n)}class _t{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.originalContext=void 0,this.childContext=void 0,this.bindView=It,this.itemsBindingObserver=f.binding(e,this,s),this.templateBindingObserver=f.binding(i,this,n),r.positioning&&(this.bindView=$t)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=i);const e=this.itemsObserver,s=this.itemsObserver=f.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.subscribe(this)}updateViews(t){const e=this.childContext,s=this.views,i=this.bindView,n=this.items,r=this.template,o=this.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 g=p+d.addedCount,b=s.splice(d.index,u.length);for(a=l.length+b.length;p<g;++p){const t=s[p],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=a&&b.length>0?(d=b[f],f++):(d=l[h],h++),a--):d=r.create(),s.splice(p,0,d),i(d,n,p,e),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.options.positioning)for(let t=0,e=s.length;t<e;++t){const i=s[t].context;i.length=e,i.index=t}}refreshAllViews(t=!1){const e=this.items,s=this.childContext,i=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(q.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=i.create();r(o,e,t,s),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<h){r(l[t],e,t,s)}else{const o=i.create();r(o,e,t,s),l.push(o),o.insertBefore(n)}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 Mt extends y{constructor(t,e,s){super(),this.itemsBinding=t,this.templateBinding=e,this.options=s,this.createPlaceholder=c.createBlockPlaceholder,At(),this.isItemsBindingVolatile=f.isVolatileBinding(t),this.isTemplateBindingVolatile=f.isVolatileBinding(e)}createBehavior(t){return new _t(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Pt(t,e,s=Ft){return new Mt(t,"function"==typeof e?e:()=>e,s)}function Et(t){return t?function(e,s,i){return 1===e.nodeType&&e.matches(t)}:function(t,e,s){return 1===t.nodeType}}class Lt{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=f.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class jt extends Lt{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Rt(t){return"string"==typeof t&&(t={property:t}),new x("fast-slotted",jt,t)}class zt extends Lt{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Ht(t){return"string"==typeof t&&(t={property:t}),new x("fast-children",zt,t)}export{t as $global,x as AttachedBehaviorHTMLDirective,et as AttributeDefinition,$ as BindingBehavior,pt as CSSDirective,zt as ChildrenBehavior,ct as Controller,c as DOM,D as ElementStyles,v as ExecutionContext,s as FAST,ut as FASTElement,ot as FASTElementDefinition,I as HTMLBindingDirective,y as HTMLDirective,q as HTMLView,f as Observable,u as PropertyChangeNotifier,Nt as RefBehavior,_t as RepeatBehavior,Mt as RepeatDirective,jt as SlottedBehavior,d as SubscriberSet,C as TargetedHTMLDirective,Q as ViewTemplate,st as attr,Z as booleanConverter,Ht as children,z as compileTemplate,bt as css,mt as cssPartial,ft as customElement,m as defaultExecutionContext,Et as elements,i as emptyArray,At as enableArrayObservation,W as html,tt as nullableNumberConverter,p as observable,kt as ref,Pt as repeat,Rt as slotted,g as volatile,Vt as when};
1
+ const t=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===t.trustedTypes&&(t.trustedTypes={createPolicy:(t,e)=>e});const e={configurable:!1,enumerable:!1,writable:!1};void 0===t.FAST&&Reflect.defineProperty(t,"FAST",Object.assign({value:Object.create(null)},e));const s=t.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},e))}const i=Object.freeze([]);function n(){const t=new WeakMap;return function(e){let s=t.get(e);if(void 0===s){let i=Reflect.getPrototypeOf(e);for(;void 0===s&&null!==i;)s=t.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),t.set(e,s)}return s}}const r=t.FAST.getById(1,()=>{const e=[],s=[];function i(){if(s.length)throw s.shift()}function n(t){try{t.call()}catch(t){s.push(t),setTimeout(i,0)}}function r(){let t=0;for(;t<e.length;)if(n(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}return Object.freeze({enqueue:function(s){e.length<1&&t.requestAnimationFrame(r),e.push(s)},process:r})}),o=t.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const h="fast-"+Math.random().toString(36).substring(2,8),a=h+"{",c="}"+h,d=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(h),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(h+":","")),createInterpolationPlaceholder:t=>`${a}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${h}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});class u{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=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.source;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 f{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const s=this.subscribers[t];void 0!==s&&s.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var s;if(e){let s=this.subscribers[e];void 0===s&&(this.subscribers[e]=s=new u(this.source)),s.subscribe(t)}else this.sourceSubscribers=null!==(s=this.sourceSubscribers)&&void 0!==s?s:new u(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var s;if(e){const s=this.subscribers[e];void 0!==s&&s.unsubscribe(t)}else null===(s=this.sourceSubscribers)||void 0===s||s.unsubscribe(t)}}const g=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,s=d.queueUpdate;let i=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let s=t.$fastController||e.get(t);return void 0===s&&(Array.isArray(t)?s=r(t):e.set(t,s=new f(t))),s}const l=n();class h{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==i&&i.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];"function"==typeof n&&n.call(t,i,e),o(t).notify(this.name)}}}class a extends u{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const s=i;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const n=this.binding(t,e);return i=s,n}disconnect(){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=!0}}watch(t,e){const s=this.last,n=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=n,n.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;i=void 0,e=s.propertySource[s.propertyName],i=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==i&&i.watch(t,e)},trackVolatile(){void 0!==i&&(i.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new h(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,s=this.isVolatileBinding(t)){return new a(t,e,s)},isVolatileBinding:e=>t.test(e.toString())})});function p(t,e){g.defineProperty(t,e)}function b(t,e,s){return Object.assign({},s,{get:function(){return g.trackVolatile(),s.get.apply(this)}})}const v=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class m{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return v.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}static setEvent(t){v.set(t)}}g.defineProperty(m.prototype,"index"),g.defineProperty(m.prototype,"length");const y=Object.seal(new m);class C{constructor(){this.targetIndex=0}}class x extends C{constructor(){super(...arguments),this.createPlaceholder=d.createInterpolationPlaceholder}}class w extends C{constructor(t,e,s){super(),this.name=t,this.behavior=e,this.options=s}createPlaceholder(t){return d.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function S(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=g.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function B(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function T(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function O(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function A(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function N(t){d.setAttribute(this.target,this.targetName,t)}function k(t){d.setBooleanAttribute(this.target,this.targetName,t)}function V(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function F(t){this.target[this.targetName]=t}function I(t){const e=this.classVersions||Object.create(null),s=this.target;let i=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=i,s.classList.add(r))}}if(this.classVersions=e,this.version=i+1,0!==i){i-=1;for(const t in e)e[t]===i&&s.classList.remove(t)}}class $ extends x{constructor(t){super(),this.binding=t,this.bind=S,this.unbind=T,this.updateTarget=N,this.isBindingVolatile=g.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=F,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,s)=>d.createHTML(t(e,s))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=k;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=B,this.unbind=A;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=I)}}targetAtContent(){this.updateTarget=V,this.unbind=O}createBehavior(t){return new _(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class _{constructor(t,e,s,i,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=s,this.bind=i,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){m.setEvent(t);const e=this.binding(this.source,this.context);m.setEvent(null),!0!==e&&t.preventDefault()}}let M=null;class P{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){M=this}static borrow(t){const e=M||new P;return e.directives=t,e.reset(),M=null,e}}function E(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new $((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n});return n.targetName=e,n}const j=c.length;function L(t,e){const s=e.split(a);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(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));i.push(t.directives[e]),o=n.substring(r+j)}""!==o&&i.push(o)}return i}function R(t,e,s=!1){const i=e.attributes;for(let n=0,r=i.length;n<r;++n){const o=i[n],l=o.value,h=L(t,l);let a=null;null===h?s&&(a=new $(()=>l),a.targetName=o.name):a=E(h),null!==a&&(e.removeAttributeNode(o),n--,r--,t.addFactory(a))}}function z(t,e,s){const i=L(t,e.textContent);if(null!==i){let n=e;for(let r=0,o=i.length;r<o;++r){const o=i[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&s.nextNode()}t.targetIndex--}}function H(t,e){const s=t.content;document.adoptNode(s);const i=P.borrow(e);R(i,t,!0);const n=i.behaviorFactories;i.reset();const r=d.createTemplateWalker(s);let o;for(;o=r.nextNode();)switch(i.targetIndex++,o.nodeType){case 1:R(i,o);break;case 3:z(i,o,r);break;case 8:d.isMarker(o)&&i.addFactory(e[d.extractDirectiveIndexFromMarker(o)])}let l=0;(d.isMarker(s.firstChild)||1===s.childNodes.length&&e.length)&&(s.insertBefore(document.createComment(""),s.firstChild),l=-1);const h=i.behaviorFactories;return i.release(),{fragment:s,viewBehaviorFactories:h,hostBehaviorFactories:n,targetOffset:l}}const q=document.createRange();class Q{constructor(t,e){this.fragment=t,this.behaviors=e,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=this.lastChild;if(t.previousSibling===e)return;const s=t.parentNode;let i,n=this.firstChild;for(;n!==e;)i=n.nextSibling,s.insertBefore(n,t),n=i;s.insertBefore(e,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(){const t=this.firstChild.parentNode,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.removeChild(i),i=s;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const s=this.behaviors;if(this.source!==t)if(null!==this.source){const i=this.source;this.source=t,this.context=e;for(let n=0,r=s.length;n<r;++n){const r=s[n];r.unbind(i),r.bind(t,e)}}else{this.source=t,this.context=e;for(let i=0,n=s.length;i<n;++i)s[i].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let s=0,i=t.length;s<i;++s)t[s].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){q.setStartBefore(t[0].firstChild),q.setEndAfter(t[t.length-1].lastChild),q.deleteContents();for(let e=0,s=t.length;e<s;++e){const s=t[e],i=s.behaviors,n=s.source;for(let t=0,e=i.length;t<e;++t)i[t].unbind(n)}}}}class U{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=d.createHTML(e);const s=t.content.firstElementChild;null!==s&&"TEMPLATE"===s.tagName&&(t=s)}else t=e;const s=H(t,this.directives);this.fragment=s.fragment,this.viewBehaviorFactories=s.viewBehaviorFactories,this.hostBehaviorFactories=s.hostBehaviorFactories,this.targetOffset=s.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),s=this.viewBehaviorFactories,i=new Array(this.behaviorCount),n=d.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=s.length;r<t;++r){const t=s[r],e=t.targetIndex;for(;null!==l;){if(o===e){i[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let s=0,n=e.length;s<n;++s,++r)i[r]=e[s].createBehavior(t)}return new Q(e,i)}render(t,e,s){"string"==typeof e&&(e=document.getElementById(e)),void 0===s&&(s=e);const i=this.create(s);return i.bind(t,y),i.appendTo(e),i}}const W=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function D(t,...e){const s=[];let i="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(i+=r,o instanceof U){const t=o;o=()=>t}if("function"==typeof o&&(o=new $(o)),o instanceof x){const t=W.exec(r);null!==t&&(o.targetName=t[2])}o instanceof C?(i+=o.createPlaceholder(s.length),s.push(o)):i+=o}return i+=t[t.length-1],new U(i,s)}class G{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}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}}function J(t){return t.map(t=>t instanceof G?J(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function K(t){return t.map(t=>t instanceof G?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}G.create=(()=>{if(d.supportsAdoptedStyleSheets){const t=new Map;return e=>new X(e,t)}return t=>new Z(t)})();class X extends G{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=K(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=J(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let s=e.get(t);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(t),e.set(t,s)),s})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let Y=0;class Z extends G{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=K(t),this.styleSheets=J(t),this.styleClass="fast-style-class-"+ ++Y}addStylesTo(t){const e=this.styleSheets,s=this.styleClass;t=this.normalizeTarget(t);for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const tt=Object.freeze({locate:n()}),et={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},st={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class it{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=et)}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 g.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||d.queueUpdate(()=>{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(tt.locate(t));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];"string"==typeof i?s.push(new it(t,i)):s.push(new it(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function nt(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e),tt.locate(t.constructor).push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const rt={mode:"open"},ot={},lt=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ht{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=it.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?rt:null===e.shadowOptions?void 0:Object.assign(Object.assign({},rt),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ot:Object.assign(Object.assign({},ot),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?G.create(e.styles):e.styles instanceof G?e.styles:G.create([e.styles])}get isDefined(){return!!lt.getByType(this.type)}define(t=customElements){const e=this.type;if(lt.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)g.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}}ht.forType=lt.getByType;const at=new WeakMap,ct={bubbles:!0,composed:!0,cancelable:!0};function dt(t){return t.shadowRoot||at.get(t)||null}class ut extends f{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,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){const e=t.attachShadow(s);"closed"===s.mode&&at.set(t,e)}const i=g.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 g.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,g.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=dt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){const e=dt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),s=t.length,i=[];for(let n=0;n<s;++n){const s=t[n];e.has(s)?e.set(s,e.get(s)+1):(e.set(s,1),i.push(s))}if(this._isConnected){const t=this.element;for(let e=0;e<i.length;++e)i[e].bind(t,y)}}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;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,y);const e=this.behaviors;if(null!==e)for(const[s]of e)s.bind(t,y);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;for(const[s]of e)s.unbind(t)}}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},ct),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}const s=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():s.template&&(this._template=s.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():s.styles&&(this._styles=s.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,s=dt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||d.removeChildNodes(s),t&&(this.view=t.render(e,s,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ht.forType(t.constructor);if(void 0===s)throw new Error("Missing FASTElement definition.");return t.$fastController=new ut(t,s)}}function ft(t){return class extends t{constructor(){super(),ut.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 gt=Object.assign(ft(HTMLElement),{from:t=>ft(t),define:(t,e)=>new ht(t,e).define().type});function pt(t){return function(e){new ht(e,t).define()}}class bt{createCSS(){return""}createBehavior(){}}function vt(t,e){const s=[];let i="";const n=[];for(let r=0,o=t.length-1;r<o;++r){i+=t[r];let o=e[r];if(o instanceof bt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof G||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}}function mt(t,...e){const{styles:s,behaviors:i}=vt(t,e),n=G.create(s);return i.length&&n.withBehaviors(...i),n}class yt extends bt{constructor(t,e){super(),this.behaviors=e,this.css="";const s=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);s.length&&(this.styles=G.create(s))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function Ct(t,...e){const{styles:s,behaviors:i}=vt(t,e);return new yt(s,i)}function xt(t,e,s){return{index:t,removed:e,addedCount:s}}function wt(t,e,s,n,r,o){let l=0,h=0;const a=Math.min(s-e,o-r);if(0===e&&0===r&&(l=function(t,e,s){for(let i=0;i<s;++i)if(t[i]!==e[i])return i;return s}(t,n,a)),s===t.length&&o===n.length&&(h=function(t,e,s){let i=t.length,n=e.length,r=0;for(;r<s&&t[--i]===e[--n];)r++;return r}(t,n,a-l)),r+=l,o-=h,(s-=h)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=xt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[xt(e,[],s-e)];const c=function(t){let e=t.length-1,s=t[0].length-1,i=t[e][s];const n=[];for(;e>0||s>0;){if(0===e){n.push(2),s--;continue}if(0===s){n.push(3),e--;continue}const r=t[e-1][s-1],o=t[e-1][s],l=t[e][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),e--,s--):h===o?(n.push(3),e--,i=o):(n.push(2),s--,i=l)}return n.reverse(),n}(function(t,e,s,i,n,r){const o=r-n+1,l=s-e+1,h=new Array(o);let a,c;for(let t=0;t<o;++t)h[t]=new Array(l),h[t][0]=t;for(let t=0;t<l;++t)h[0][t]=t;for(let s=1;s<o;++s)for(let r=1;r<l;++r)t[e+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(t,e,s,n,r,o)),d=[];let u=void 0,f=e,g=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,g++;break;case 1:void 0===u&&(u=xt(f,[],0)),u.addedCount++,f++,u.removed.push(n[g]),g++;break;case 2:void 0===u&&(u=xt(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=xt(f,[],0)),u.removed.push(n[g]),g++}return void 0!==u&&d.push(u),d}const St=Array.prototype.push;function Bt(t,e,s,i){const n=xt(e,s,i);let r=!1,o=0;for(let e=0;e<t.length;e++){const s=t[e];if(s.index+=o,r)continue;const i=(l=n.index,h=n.index+n.removed.length,a=s.index,c=s.index+s.addedCount,h<a||c<l?-1:h===a||c===l?0:l<a?h<c?h-a:c-a:c<h?c-l:h-l);if(i>=0){t.splice(e,1),e--,o-=s.addedCount-s.removed.length,n.addedCount+=s.addedCount-i;const l=n.removed.length+s.removed.length-i;if(n.addedCount||l){let t=s.removed;if(n.index<s.index){const e=n.removed.slice(0,s.index-n.index);St.apply(e,t),t=e}if(n.index+n.removed.length>s.index+s.addedCount){const e=n.removed.slice(s.index+s.addedCount-n.index);St.apply(t,e)}n.removed=t,s.index<n.index&&(n.index=s.index)}else r=!0}else if(n.index<s.index){r=!0,t.splice(e,0,n),e++;const i=n.addedCount-n.removed.length;s.index+=i,o+=i}}var l,h,a,c;r||t.push(n)}function Tt(t,e){let s=[];const i=function(t){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];Bt(e,i.index,i.removed,i.addedCount)}return e}(e);for(let e=0,n=i.length;e<n;++e){const n=i[e];1!==n.addedCount||1!==n.removed.length?s=s.concat(wt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&s.push(n)}return s}let Ot=!1;function At(t,e){let s=t.index;const i=e.length;return s>i?s=i-t.addedCount:s<0&&(s=i+t.removed.length+s-t.addedCount),s<0&&(s=0),t.index=s,t}class Nt extends u{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const s=void 0===e?Tt(this.source,t):wt(this.source,0,this.source.length,e,0,e.length);this.notify(s)}}function kt(){if(Ot)return;Ot=!0,g.setArrayObserverFactory(t=>new Nt(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,s=t.push,i=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,s=e.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(xt(this.length,[s],0)),s},t.push=function(){const t=s.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(At(xt(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=i.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(xt(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=r.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(At(xt(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(At(xt(0,[],arguments.length),this)),t}}class Vt{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Ft(t){return new w("fast-ref",Vt,t)}function It(t,e){const s="function"==typeof e?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const $t=Object.freeze({positioning:!1,recycle:!0});function _t(t,e,s,i){t.bind(e[s],i)}function Mt(t,e,s,i){const n=Object.create(i);n.index=s,n.length=e.length,t.bind(e[s],n)}class Pt{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.originalContext=void 0,this.childContext=void 0,this.bindView=_t,this.itemsBindingObserver=g.binding(e,this,s),this.templateBindingObserver=g.binding(i,this,n),r.positioning&&(this.bindView=Mt)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=i);const e=this.itemsObserver,s=this.itemsObserver=g.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.subscribe(this)}updateViews(t){const e=this.childContext,s=this.views,i=this.bindView,n=this.items,r=this.template,o=this.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,g=d.index;const p=g+d.addedCount,b=s.splice(d.index,u.length),v=a=l.length+b.length;for(;g<p;++g){const t=s[g],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[h],h++),a--):d=r.create(),s.splice(g,0,d),i(d,n,g,e),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.options.positioning)for(let t=0,e=s.length;t<e;++t){const i=s[t].context;i.length=e,i.index=t}}refreshAllViews(t=!1){const e=this.items,s=this.childContext,i=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(Q.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=i.create();r(o,e,t,s),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<h){r(l[t],e,t,s)}else{const o=i.create();r(o,e,t,s),l.push(o),o.insertBefore(n)}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 Et extends C{constructor(t,e,s){super(),this.itemsBinding=t,this.templateBinding=e,this.options=s,this.createPlaceholder=d.createBlockPlaceholder,kt(),this.isItemsBindingVolatile=g.isVolatileBinding(t),this.isTemplateBindingVolatile=g.isVolatileBinding(e)}createBehavior(t){return new Pt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function jt(t,e,s=$t){return new Et(t,"function"==typeof e?e:()=>e,Object.assign(Object.assign({},$t),s))}function Lt(t){return t?function(e,s,i){return 1===e.nodeType&&e.matches(t)}:function(t,e,s){return 1===t.nodeType}}class Rt{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=g.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class zt extends Rt{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Ht(t){return"string"==typeof t&&(t={property:t}),new w("fast-slotted",zt,t)}class qt extends Rt{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Qt(t){return"string"==typeof t&&(t={property:t}),new w("fast-children",qt,t)}export{t as $global,w as AttachedBehaviorHTMLDirective,tt as AttributeConfiguration,it as AttributeDefinition,_ as BindingBehavior,bt as CSSDirective,qt as ChildrenBehavior,ut as Controller,d as DOM,G as ElementStyles,m as ExecutionContext,s as FAST,gt as FASTElement,ht as FASTElementDefinition,$ as HTMLBindingDirective,C as HTMLDirective,Q as HTMLView,g as Observable,f as PropertyChangeNotifier,Vt as RefBehavior,Pt as RepeatBehavior,Et as RepeatDirective,zt as SlottedBehavior,u as SubscriberSet,x as TargetedHTMLDirective,U as ViewTemplate,nt as attr,et as booleanConverter,Qt as children,H as compileTemplate,n as createMetadataLocator,mt as css,Ct as cssPartial,pt as customElement,y as defaultExecutionContext,Lt as elements,i as emptyArray,kt as enableArrayObservation,D as html,st as nullableNumberConverter,p as observable,Ft as ref,jt as repeat,Ht as slotted,b as volatile,It as when};
@@ -19,7 +19,7 @@ export class AttachedBehaviorHTMLDirective<T = any> extends HTMLDirective {
19
19
  constructor(name: string, behavior: AttachedBehaviorType<T>, options: T);
20
20
  createBehavior(target: Node): Behavior;
21
21
  createPlaceholder(index: number): string;
22
- }
22
+ }
23
23
 
24
24
  // @public
25
25
  export type AttachedBehaviorType<T = any> = new (target: any, options: T) => Behavior;
@@ -38,6 +38,11 @@ export type AttributeConfiguration = {
38
38
  converter?: ValueConverter;
39
39
  };
40
40
 
41
+ // @public
42
+ export const AttributeConfiguration: Readonly<{
43
+ locate: (target: {}) => AttributeConfiguration[];
44
+ }>;
45
+
41
46
  // @public
42
47
  export class AttributeDefinition implements Accessor {
43
48
  constructor(Owner: Function, name: string, attribute?: string, mode?: AttributeMode, converter?: ValueConverter);
@@ -52,7 +57,7 @@ export class AttributeDefinition implements Accessor {
52
57
  onAttributeChangedCallback(element: HTMLElement, value: any): void;
53
58
  readonly Owner: Function;
54
59
  setValue(source: HTMLElement, newValue: any): void;
55
- }
60
+ }
56
61
 
57
62
  // @public
58
63
  export type AttributeMode = "reflect" | "boolean" | "fromView";
@@ -135,7 +140,7 @@ export class ChildrenBehavior extends NodeObservationBehavior<ChildrenBehaviorOp
135
140
  disconnect(): void;
136
141
  protected getNodes(): ChildNode[];
137
142
  observe(): void;
138
- }
143
+ }
139
144
 
140
145
  // @public
141
146
  export type ChildrenBehaviorOptions<T = any> = ChildListBehaviorOptions<T> | SubtreeBehaviorOptions<T>;
@@ -184,6 +189,11 @@ export class Controller extends PropertyChangeNotifier {
184
189
  readonly view: ElementView | null;
185
190
  }
186
191
 
192
+ // Warning: (ae-internal-missing-underscore) The name "createMetadataLocator" should be prefixed with an underscore because the declaration is marked as @internal
193
+ //
194
+ // @internal
195
+ export function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
196
+
187
197
  // @public
188
198
  export function css(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): ElementStyles;
189
199
 
@@ -352,7 +362,7 @@ export class HTMLBindingDirective extends TargetedHTMLDirective {
352
362
  targetAtContent(): void;
353
363
  get targetName(): string | undefined;
354
364
  set targetName(value: string | undefined);
355
- }
365
+ }
356
366
 
357
367
  // @public
358
368
  export abstract class HTMLDirective implements NodeBehaviorFactory {
@@ -482,14 +492,20 @@ export class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
482
492
  // @internal (undocumented)
483
493
  handleChange(source: any, args: Splice[]): void;
484
494
  unbind(): void;
485
- }
495
+ }
486
496
 
487
497
  // @public
488
498
  export class RepeatDirective<TSource = any> extends HTMLDirective {
489
499
  constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
490
500
  createBehavior(target: Node): RepeatBehavior<TSource>;
491
501
  createPlaceholder: (index: number) => string;
492
- }
502
+ // (undocumented)
503
+ readonly itemsBinding: Binding;
504
+ // (undocumented)
505
+ readonly options: RepeatOptions;
506
+ // (undocumented)
507
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
508
+ }
493
509
 
494
510
  // @public
495
511
  export interface RepeatOptions {
@@ -605,7 +621,7 @@ export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTe
605
621
  readonly directives: ReadonlyArray<HTMLDirective>;
606
622
  readonly html: string | HTMLTemplateElement;
607
623
  render(source: TSource, host: Node | string, hostBindingTarget?: Element): HTMLView;
608
- }
624
+ }
609
625
 
610
626
  // @public
611
627
  export function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
@@ -613,7 +629,6 @@ export function volatile(target: {}, name: string | Accessor, descriptor: Proper
613
629
  // @public
614
630
  export function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
615
631
 
616
-
617
632
  // (No @packageDocumentation comment for this package)
618
633
 
619
634
  ```
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microsoft/fast-element",
3
3
  "description": "A library for constructing Web Components",
4
4
  "sideEffects": false,
5
- "version": "1.10.4",
5
+ "version": "1.11.0",
6
6
  "author": {
7
7
  "name": "Microsoft",
8
8
  "url": "https://discord.gg/FcSNfg4"