@microsoft/fast-element 2.0.0-beta.7 → 2.0.0-beta.9

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
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
+ {
5
+ "date": "Wed, 28 Sep 2022 20:45:51 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.9",
7
+ "version": "2.0.0-beta.9",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "roeisenb@microsoft.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "08fab33015853b7f820fdfdac2aecddfeb31843f",
14
+ "comment": "fix: ensure composed templates receive the existing execution context"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 27 Sep 2022 22:31:52 GMT",
21
+ "tag": "@microsoft/fast-element_v2.0.0-beta.8",
22
+ "version": "2.0.0-beta.8",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "roeisenb@microsoft.com",
27
+ "package": "@microsoft/fast-element",
28
+ "commit": "8834c6732c727d39f92f72b197388453a9c17f9b",
29
+ "comment": "fix: correct view state when processing unbindables during rebind"
30
+ },
31
+ {
32
+ "author": "roeisenb@microsoft.com",
33
+ "package": "@microsoft/fast-element",
34
+ "commit": "d949a8873621f409f9d9f3453cdb40b593d14b67",
35
+ "comment": "fix: do not crash when null/undefined is provided literally in templates"
36
+ }
37
+ ]
38
+ }
39
+ },
4
40
  {
5
41
  "date": "Fri, 23 Sep 2022 22:53:27 GMT",
6
42
  "tag": "@microsoft/fast-element_v2.0.0-beta.7",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,26 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Fri, 23 Sep 2022 22:53:27 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 28 Sep 2022 20:45:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.9
8
+
9
+ Wed, 28 Sep 2022 20:45:51 GMT
10
+
11
+ ### Changes
12
+
13
+ - fix: ensure composed templates receive the existing execution context (roeisenb@microsoft.com)
14
+
15
+ ## 2.0.0-beta.8
16
+
17
+ Tue, 27 Sep 2022 22:31:52 GMT
18
+
19
+ ### Changes
20
+
21
+ - fix: correct view state when processing unbindables during rebind (roeisenb@microsoft.com)
22
+ - fix: do not crash when null/undefined is provided literally in templates (roeisenb@microsoft.com)
23
+
7
24
  ## 2.0.0-beta.7
8
25
 
9
26
  Fri, 23 Sep 2022 22:53:27 GMT
@@ -11,7 +11,7 @@ export interface ContentView {
11
11
  * @param source - The binding source for the view's binding behaviors.
12
12
  * @param context - The execution context to run the view within.
13
13
  */
14
- bind(source: any): void;
14
+ bind(source: any, context?: ExecutionContext): void;
15
15
  /**
16
16
  * Unbinds a view's behaviors from its binding source and context.
17
17
  */
@@ -1,5 +1,5 @@
1
1
  import type { Disposable } from "../interfaces.js";
2
- import { ExecutionContext } from "../observation/observable.js";
2
+ import { ExecutionContext, SourceLifetime } from "../observation/observable.js";
3
3
  import type { ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
4
4
  /**
5
5
  * Represents a collection of DOM nodes which can be bound to a data source.
@@ -18,7 +18,7 @@ export interface View<TSource = any, TParent = any> extends Disposable {
18
18
  * Binds a view's behaviors to its binding source.
19
19
  * @param source - The binding source for the view's binding behaviors.
20
20
  */
21
- bind(source: TSource): void;
21
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
22
22
  /**
23
23
  * Unbinds a view's behaviors from its binding source and context.
24
24
  */
@@ -73,12 +73,18 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
73
73
  * The data that the view is bound to.
74
74
  */
75
75
  source: TSource | null;
76
+ /**
77
+ * Indicates whether the controller is bound.
78
+ */
76
79
  isBound: boolean;
77
- selfContained: boolean;
80
+ /**
81
+ * Indicates how the source's lifetime relates to the controller's lifetime.
82
+ */
83
+ readonly sourceLifetime: SourceLifetime;
78
84
  /**
79
85
  * The execution context the view is running within.
80
86
  */
81
- get context(): ExecutionContext<TParent>;
87
+ context: ExecutionContext<TParent>;
82
88
  /**
83
89
  * The index of the current item within a repeat context.
84
90
  */
@@ -174,7 +180,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
174
180
  * @param source - The binding source for the view's binding behaviors.
175
181
  * @param context - The execution context to run the behaviors within.
176
182
  */
177
- bind(source: TSource): void;
183
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
178
184
  /**
179
185
  * Unbinds a view's behaviors from its binding source.
180
186
  */
@@ -57,6 +57,9 @@ export function createTypeRegistry() {
57
57
  return typeToDefinition.get(key);
58
58
  },
59
59
  getForInstance(object) {
60
+ if (object === null || object === void 0) {
61
+ return void 0;
62
+ }
60
63
  return typeToDefinition.get(object.constructor);
61
64
  },
62
65
  });
@@ -58,14 +58,14 @@ function updateContent(target, aspect, value, controller) {
58
58
  // and that there's actually no need to compose it.
59
59
  if (!view.isComposed) {
60
60
  view.isComposed = true;
61
- view.bind(controller.source);
61
+ view.bind(controller.source, controller.context);
62
62
  view.insertBefore(target);
63
63
  target.$fastView = view;
64
64
  target.$fastTemplate = value;
65
65
  }
66
66
  else if (view.needsBindOnly) {
67
67
  view.needsBindOnly = false;
68
- view.bind(controller.source);
68
+ view.bind(controller.source, controller.context);
69
69
  }
70
70
  }
71
71
  else {
@@ -1,4 +1,4 @@
1
- import { ExecutionContext, Observable } from "../observation/observable.js";
1
+ import { ExecutionContext, Observable, SourceLifetime, } from "../observation/observable.js";
2
2
  function removeNodeSequence(firstNode, lastNode) {
3
3
  const parent = firstNode.parentNode;
4
4
  let current = firstNode;
@@ -30,8 +30,18 @@ export class HTMLView {
30
30
  * The data that the view is bound to.
31
31
  */
32
32
  this.source = null;
33
+ /**
34
+ * Indicates whether the controller is bound.
35
+ */
33
36
  this.isBound = false;
34
- this.selfContained = false;
37
+ /**
38
+ * Indicates how the source's lifetime relates to the controller's lifetime.
39
+ */
40
+ this.sourceLifetime = SourceLifetime.unknown;
41
+ /**
42
+ * The execution context the view is running within.
43
+ */
44
+ this.context = this;
35
45
  /**
36
46
  * The index of the current item within a repeat context.
37
47
  */
@@ -43,12 +53,6 @@ export class HTMLView {
43
53
  this.firstChild = fragment.firstChild;
44
54
  this.lastChild = fragment.lastChild;
45
55
  }
46
- /**
47
- * The execution context the view is running within.
48
- */
49
- get context() {
50
- return this;
51
- }
52
56
  /**
53
57
  * The current event within an event handler.
54
58
  */
@@ -164,14 +168,14 @@ export class HTMLView {
164
168
  * @param source - The binding source for the view's binding behaviors.
165
169
  * @param context - The execution context to run the behaviors within.
166
170
  */
167
- bind(source) {
168
- const oldSource = this.source;
169
- if (oldSource === source) {
171
+ bind(source, context = this) {
172
+ if (this.source === source) {
170
173
  return;
171
174
  }
172
175
  let behaviors = this.behaviors;
173
- this.source = source;
174
176
  if (behaviors === null) {
177
+ this.source = source;
178
+ this.context = context;
175
179
  this.behaviors = behaviors = new Array(this.factories.length);
176
180
  const factories = this.factories;
177
181
  for (let i = 0, ii = factories.length; i < ii; ++i) {
@@ -181,9 +185,12 @@ export class HTMLView {
181
185
  }
182
186
  }
183
187
  else {
184
- if (oldSource !== null) {
188
+ if (this.source !== null) {
185
189
  this.evaluateUnbindables();
186
190
  }
191
+ this.isBound = false;
192
+ this.source = source;
193
+ this.context = context;
187
194
  for (let i = 0, ii = behaviors.length; i < ii; ++i) {
188
195
  behaviors[i].bind(this);
189
196
  }
@@ -194,15 +201,12 @@ export class HTMLView {
194
201
  * Unbinds a view's behaviors from its binding source.
195
202
  */
196
203
  unbind() {
197
- if (!this.isBound) {
198
- return;
199
- }
200
- const oldSource = this.source;
201
- if (oldSource === null) {
204
+ if (!this.isBound || this.source === null) {
202
205
  return;
203
206
  }
204
207
  this.evaluateUnbindables();
205
208
  this.source = null;
209
+ this.context = this;
206
210
  this.isBound = false;
207
211
  }
208
212
  evaluateUnbindables() {
@@ -2704,6 +2704,15 @@
2704
2704
  "kind": "Content",
2705
2705
  "text": "any"
2706
2706
  },
2707
+ {
2708
+ "kind": "Content",
2709
+ "text": ", context?: "
2710
+ },
2711
+ {
2712
+ "kind": "Reference",
2713
+ "text": "ExecutionContext",
2714
+ "canonicalReference": "@microsoft/fast-element!ExecutionContext:interface"
2715
+ },
2707
2716
  {
2708
2717
  "kind": "Content",
2709
2718
  "text": "): "
@@ -2719,8 +2728,8 @@
2719
2728
  ],
2720
2729
  "isOptional": false,
2721
2730
  "returnTypeTokenRange": {
2722
- "startIndex": 3,
2723
- "endIndex": 4
2731
+ "startIndex": 5,
2732
+ "endIndex": 6
2724
2733
  },
2725
2734
  "releaseTag": "Public",
2726
2735
  "overloadIndex": 1,
@@ -2732,6 +2741,14 @@
2732
2741
  "endIndex": 2
2733
2742
  },
2734
2743
  "isOptional": false
2744
+ },
2745
+ {
2746
+ "parameterName": "context",
2747
+ "parameterTypeTokenRange": {
2748
+ "startIndex": 3,
2749
+ "endIndex": 4
2750
+ },
2751
+ "isOptional": true
2735
2752
  }
2736
2753
  ],
2737
2754
  "name": "bind"
@@ -9131,6 +9148,19 @@
9131
9148
  "kind": "Content",
9132
9149
  "text": "TSource"
9133
9150
  },
9151
+ {
9152
+ "kind": "Content",
9153
+ "text": ", context?: "
9154
+ },
9155
+ {
9156
+ "kind": "Reference",
9157
+ "text": "ExecutionContext",
9158
+ "canonicalReference": "@microsoft/fast-element!ExecutionContext:interface"
9159
+ },
9160
+ {
9161
+ "kind": "Content",
9162
+ "text": "<TParent>"
9163
+ },
9134
9164
  {
9135
9165
  "kind": "Content",
9136
9166
  "text": "): "
@@ -9147,8 +9177,8 @@
9147
9177
  "isOptional": false,
9148
9178
  "isStatic": false,
9149
9179
  "returnTypeTokenRange": {
9150
- "startIndex": 3,
9151
- "endIndex": 4
9180
+ "startIndex": 6,
9181
+ "endIndex": 7
9152
9182
  },
9153
9183
  "releaseTag": "Public",
9154
9184
  "overloadIndex": 1,
@@ -9160,6 +9190,14 @@
9160
9190
  "endIndex": 2
9161
9191
  },
9162
9192
  "isOptional": false
9193
+ },
9194
+ {
9195
+ "parameterName": "context",
9196
+ "parameterTypeTokenRange": {
9197
+ "startIndex": 3,
9198
+ "endIndex": 5
9199
+ },
9200
+ "isOptional": true
9163
9201
  }
9164
9202
  ],
9165
9203
  "name": "bind"
@@ -9171,7 +9209,7 @@
9171
9209
  "excerptTokens": [
9172
9210
  {
9173
9211
  "kind": "Content",
9174
- "text": "get context(): "
9212
+ "text": "context: "
9175
9213
  },
9176
9214
  {
9177
9215
  "kind": "Reference",
@@ -9502,7 +9540,7 @@
9502
9540
  {
9503
9541
  "kind": "Property",
9504
9542
  "canonicalReference": "@microsoft/fast-element!HTMLView#isBound:member",
9505
- "docComment": "",
9543
+ "docComment": "/**\n * Indicates whether the controller is bound.\n */\n",
9506
9544
  "excerptTokens": [
9507
9545
  {
9508
9546
  "kind": "Content",
@@ -9861,16 +9899,16 @@
9861
9899
  },
9862
9900
  {
9863
9901
  "kind": "Property",
9864
- "canonicalReference": "@microsoft/fast-element!HTMLView#selfContained:member",
9865
- "docComment": "",
9902
+ "canonicalReference": "@microsoft/fast-element!HTMLView#source:member",
9903
+ "docComment": "/**\n * The data that the view is bound to.\n */\n",
9866
9904
  "excerptTokens": [
9867
9905
  {
9868
9906
  "kind": "Content",
9869
- "text": "selfContained: "
9907
+ "text": "source: "
9870
9908
  },
9871
9909
  {
9872
9910
  "kind": "Content",
9873
- "text": "boolean"
9911
+ "text": "TSource | null"
9874
9912
  },
9875
9913
  {
9876
9914
  "kind": "Content",
@@ -9879,7 +9917,7 @@
9879
9917
  ],
9880
9918
  "isOptional": false,
9881
9919
  "releaseTag": "Public",
9882
- "name": "selfContained",
9920
+ "name": "source",
9883
9921
  "propertyTypeTokenRange": {
9884
9922
  "startIndex": 1,
9885
9923
  "endIndex": 2
@@ -9888,16 +9926,17 @@
9888
9926
  },
9889
9927
  {
9890
9928
  "kind": "Property",
9891
- "canonicalReference": "@microsoft/fast-element!HTMLView#source:member",
9892
- "docComment": "/**\n * The data that the view is bound to.\n */\n",
9929
+ "canonicalReference": "@microsoft/fast-element!HTMLView#sourceLifetime:member",
9930
+ "docComment": "/**\n * Indicates how the source's lifetime relates to the controller's lifetime.\n */\n",
9893
9931
  "excerptTokens": [
9894
9932
  {
9895
9933
  "kind": "Content",
9896
- "text": "source: "
9934
+ "text": "readonly sourceLifetime: "
9897
9935
  },
9898
9936
  {
9899
- "kind": "Content",
9900
- "text": "TSource | null"
9937
+ "kind": "Reference",
9938
+ "text": "SourceLifetime",
9939
+ "canonicalReference": "@microsoft/fast-element!SourceLifetime:type"
9901
9940
  },
9902
9941
  {
9903
9942
  "kind": "Content",
@@ -9906,7 +9945,7 @@
9906
9945
  ],
9907
9946
  "isOptional": false,
9908
9947
  "releaseTag": "Public",
9909
- "name": "source",
9948
+ "name": "sourceLifetime",
9910
9949
  "propertyTypeTokenRange": {
9911
9950
  "startIndex": 1,
9912
9951
  "endIndex": 2
@@ -16645,6 +16684,19 @@
16645
16684
  "kind": "Content",
16646
16685
  "text": "TSource"
16647
16686
  },
16687
+ {
16688
+ "kind": "Content",
16689
+ "text": ", context?: "
16690
+ },
16691
+ {
16692
+ "kind": "Reference",
16693
+ "text": "ExecutionContext",
16694
+ "canonicalReference": "@microsoft/fast-element!ExecutionContext:interface"
16695
+ },
16696
+ {
16697
+ "kind": "Content",
16698
+ "text": "<TParent>"
16699
+ },
16648
16700
  {
16649
16701
  "kind": "Content",
16650
16702
  "text": "): "
@@ -16660,8 +16712,8 @@
16660
16712
  ],
16661
16713
  "isOptional": false,
16662
16714
  "returnTypeTokenRange": {
16663
- "startIndex": 3,
16664
- "endIndex": 4
16715
+ "startIndex": 6,
16716
+ "endIndex": 7
16665
16717
  },
16666
16718
  "releaseTag": "Public",
16667
16719
  "overloadIndex": 1,
@@ -16673,6 +16725,14 @@
16673
16725
  "endIndex": 2
16674
16726
  },
16675
16727
  "isOptional": false
16728
+ },
16729
+ {
16730
+ "parameterName": "context",
16731
+ "parameterTypeTokenRange": {
16732
+ "startIndex": 3,
16733
+ "endIndex": 5
16734
+ },
16735
+ "isOptional": true
16676
16736
  }
16677
16737
  ],
16678
16738
  "name": "bind"
@@ -477,7 +477,7 @@ export declare interface ContentView {
477
477
  * @param source - The binding source for the view's binding behaviors.
478
478
  * @param context - The execution context to run the view within.
479
479
  */
480
- bind(source: any): void;
480
+ bind(source: any, context?: ExecutionContext): void;
481
481
  /**
482
482
  * Unbinds a view's behaviors from its binding source and context.
483
483
  */
@@ -1384,12 +1384,18 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1384
1384
  * The data that the view is bound to.
1385
1385
  */
1386
1386
  source: TSource | null;
1387
+ /**
1388
+ * Indicates whether the controller is bound.
1389
+ */
1387
1390
  isBound: boolean;
1388
- selfContained: boolean;
1391
+ /**
1392
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1393
+ */
1394
+ readonly sourceLifetime: SourceLifetime;
1389
1395
  /**
1390
1396
  * The execution context the view is running within.
1391
1397
  */
1392
- get context(): ExecutionContext<TParent>;
1398
+ context: ExecutionContext<TParent>;
1393
1399
  /**
1394
1400
  * The index of the current item within a repeat context.
1395
1401
  */
@@ -1485,7 +1491,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1485
1491
  * @param source - The binding source for the view's binding behaviors.
1486
1492
  * @param context - The execution context to run the behaviors within.
1487
1493
  */
1488
- bind(source: TSource): void;
1494
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
1489
1495
  /**
1490
1496
  * Unbinds a view's behaviors from its binding source.
1491
1497
  */
@@ -2538,7 +2544,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2538
2544
  * Binds a view's behaviors to its binding source.
2539
2545
  * @param source - The binding source for the view's binding behaviors.
2540
2546
  */
2541
- bind(source: TSource): void;
2547
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
2542
2548
  /**
2543
2549
  * Unbinds a view's behaviors from its binding source and context.
2544
2550
  */
@@ -204,6 +204,9 @@ function createTypeRegistry() {
204
204
  return typeToDefinition.get(key);
205
205
  },
206
206
  getForInstance(object) {
207
+ if (object === null || object === void 0) {
208
+ return void 0;
209
+ }
207
210
  return typeToDefinition.get(object.constructor);
208
211
  },
209
212
  });
@@ -2025,14 +2028,14 @@ function updateContent(target, aspect, value, controller) {
2025
2028
  // and that there's actually no need to compose it.
2026
2029
  if (!view.isComposed) {
2027
2030
  view.isComposed = true;
2028
- view.bind(controller.source);
2031
+ view.bind(controller.source, controller.context);
2029
2032
  view.insertBefore(target);
2030
2033
  target.$fastView = view;
2031
2034
  target.$fastTemplate = value;
2032
2035
  }
2033
2036
  else if (view.needsBindOnly) {
2034
2037
  view.needsBindOnly = false;
2035
- view.bind(controller.source);
2038
+ view.bind(controller.source, controller.context);
2036
2039
  }
2037
2040
  }
2038
2041
  else {
@@ -2279,8 +2282,18 @@ class HTMLView {
2279
2282
  * The data that the view is bound to.
2280
2283
  */
2281
2284
  this.source = null;
2285
+ /**
2286
+ * Indicates whether the controller is bound.
2287
+ */
2282
2288
  this.isBound = false;
2283
- this.selfContained = false;
2289
+ /**
2290
+ * Indicates how the source's lifetime relates to the controller's lifetime.
2291
+ */
2292
+ this.sourceLifetime = SourceLifetime.unknown;
2293
+ /**
2294
+ * The execution context the view is running within.
2295
+ */
2296
+ this.context = this;
2284
2297
  /**
2285
2298
  * The index of the current item within a repeat context.
2286
2299
  */
@@ -2292,12 +2305,6 @@ class HTMLView {
2292
2305
  this.firstChild = fragment.firstChild;
2293
2306
  this.lastChild = fragment.lastChild;
2294
2307
  }
2295
- /**
2296
- * The execution context the view is running within.
2297
- */
2298
- get context() {
2299
- return this;
2300
- }
2301
2308
  /**
2302
2309
  * The current event within an event handler.
2303
2310
  */
@@ -2413,14 +2420,14 @@ class HTMLView {
2413
2420
  * @param source - The binding source for the view's binding behaviors.
2414
2421
  * @param context - The execution context to run the behaviors within.
2415
2422
  */
2416
- bind(source) {
2417
- const oldSource = this.source;
2418
- if (oldSource === source) {
2423
+ bind(source, context = this) {
2424
+ if (this.source === source) {
2419
2425
  return;
2420
2426
  }
2421
2427
  let behaviors = this.behaviors;
2422
- this.source = source;
2423
2428
  if (behaviors === null) {
2429
+ this.source = source;
2430
+ this.context = context;
2424
2431
  this.behaviors = behaviors = new Array(this.factories.length);
2425
2432
  const factories = this.factories;
2426
2433
  for (let i = 0, ii = factories.length; i < ii; ++i) {
@@ -2430,9 +2437,12 @@ class HTMLView {
2430
2437
  }
2431
2438
  }
2432
2439
  else {
2433
- if (oldSource !== null) {
2440
+ if (this.source !== null) {
2434
2441
  this.evaluateUnbindables();
2435
2442
  }
2443
+ this.isBound = false;
2444
+ this.source = source;
2445
+ this.context = context;
2436
2446
  for (let i = 0, ii = behaviors.length; i < ii; ++i) {
2437
2447
  behaviors[i].bind(this);
2438
2448
  }
@@ -2443,15 +2453,12 @@ class HTMLView {
2443
2453
  * Unbinds a view's behaviors from its binding source.
2444
2454
  */
2445
2455
  unbind() {
2446
- if (!this.isBound) {
2447
- return;
2448
- }
2449
- const oldSource = this.source;
2450
- if (oldSource === null) {
2456
+ if (!this.isBound || this.source === null) {
2451
2457
  return;
2452
2458
  }
2453
2459
  this.evaluateUnbindables();
2454
2460
  this.source = null;
2461
+ this.context = this;
2455
2462
  this.isBound = false;
2456
2463
  }
2457
2464
  evaluateUnbindables() {
@@ -1 +1 @@
1
- !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},a=/(\$\{\w+?})/g,h=/\$\{(\w+?)}/g,c=Object.freeze({});function d(e,t){return e.split(a).map((e=>{var s;const i=e.replace(h,"$1");return String(null!==(s=t[i])&&void 0!==s?s:e)})).join("")}Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Warning";console.warn(d(i,t))},error(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Error";return new Error(d(i,t))}});const u={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},u));const f=globalThis.FAST;if(void 0===f.getById){const e=Object.create(null);Reflect.defineProperty(f,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},u))}void 0===f.error&&Object.assign(f,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const g=Object.freeze([]);function p(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}function b(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const v=e=>"function"==typeof e,y=e=>"string"==typeof e,m=f.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class w{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class C{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new w(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new w(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const T=Object.freeze({unknown:void 0,coupled:1}),S=f.getById(2,(()=>{const e=m.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw f.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new C(e))),i}const o=b();class l{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];v(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class a extends w{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==T.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.binding(e,t)}finally{i=s}return n}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){y(t)&&(t=new l(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new a(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function x(e,t){S.defineProperty(e,t)}function O(e,t,s){return Object.assign({},s,{get(){return S.trackVolatile(),s.get.apply(this)}})}const A=f.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),B=Object.freeze({default:{index:0,length:0,get event(){return B.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>A.get(),setEvent(e){A.set(e)}});class j{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const k=Object.freeze({reset:1,splice:2,optimized:3}),$=new j(0,g,0);$.reset=!0;const I=[$];function E(e,t,s,i,n,r){let o=0,l=0;const a=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,a)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,a-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return g;if(t===s){const e=new j(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new j(t,[],s-t)];const h=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),c=[];let d,u=t,f=n;for(let e=0;e<h.length;++e)switch(h[e]){case 0:void 0!==d&&(c.push(d),d=void 0),u++,f++;break;case 1:void 0===d&&(d=new j(u,[],0)),d.addedCount++,u++,d.removed.push(i[f]),f++;break;case 2:void 0===d&&(d=new j(u,[],0)),d.addedCount++,u++;break;case 3:void 0===d&&(d=new j(u,[],0)),d.removed.push(i[f]),f++}return void 0!==d&&c.push(d),c}function V(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let N=Object.freeze({support:k.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?g:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)V(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(E(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:I,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new j(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new j(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(0,[],i.length).adjustTo(e)),n}});const F=Object.freeze({reset:I,setDefaultStrategy(e){N=e}});function M(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class L extends w{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,M(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,S.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:N).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,m.enqueue(this))}}let z=!1;const _=Object.freeze({enable(){if(z)return;z=!0,S.setArrayObserverFactory((e=>new L(e)));const e=Array.prototype;e.$fastPatch||(M(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:N)[t.name](this,i,t,e)}})))}});function P(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(_.enable(),t=S.getNotifier(e)),S.track(t.lengthObserver,"length"),e.length}const R=new Map;let D;function H(e){return e.map((e=>e instanceof U?H(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class U{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof U?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(D),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(H(this.styles)),this}static setDefaultStrategy(e){D=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new U(e):e instanceof U?e:new U([e])}}U.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class q{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=R.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),R.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}U.setDefaultStrategy(f.getById(5,(()=>q)));const Q=p(),W=Object.freeze({getForInstance:Q.getForInstance,getByType:Q.getByType,define:e=>(Q.register({type:e}),e)});function K(){return function(e){W.define(e)}}function G(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==W.getForInstance(o)&&(o=o.createCSS(r)),o instanceof U||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const J=(e,...t)=>{const{styles:s,behaviors:i}=G(e,t),n=new U(s);return i.length?n.withBehaviors(...i):n};class X{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(y(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new U(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}W.define(X);const Y=J.partial=(e,...t)=>{const{styles:s,behaviors:i}=G(e,t);return new X(s,i)},Z=Object.freeze({queueUpdate:m.enqueue,nextUpdate:m.next,processUpdates:m.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),ee=`fast-${Math.random().toString(36).substring(2,8)}`,te=`${ee}{`,se=`}${ee}`,ie=se.length;let ne=0;const re=()=>`${ee}-${++ne}`,oe=Object.freeze({interpolation:e=>`${te}${e}${se}`,attribute:e=>`${re()}="${te}${e}${se}"`,comment:e=>`\x3c!--${te}${e}${se}--\x3e`}),le=Object.freeze({parse(e,t){const s=e.split(te);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(se);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+ie)}""!==o&&i.push(o)}return i}}),ae=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:B.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=re());e.id||(e.id=re()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),he=p(),ce=Object.freeze({getForInstance:he.getForInstance,getByType:he.getByType,define:(e,t)=>((t=t||{}).type=e,he.register(t),e)});function de(e){return function(t){ce.define(t,e)}}class ue{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const fe=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=fe.property;break;case"classList":e.aspectType=fe.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=fe.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=fe.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=fe.property):(e.targetAspect=t,e.aspectType=fe.attribute)}else e.aspectType=fe.content}});class ge{constructor(e){this.options=e,this.id=re()}createHTML(e){return oe.attribute(e(this))}createBehavior(){return this}}const pe=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw f.error(1202)}:e=>e;class be extends ue{createObserver(e,t){return S.binding(this.evaluate,t,this.isVolatile)}}class ve extends ue{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ye(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source)):(t.isComposed=!0,t.bind(i.source),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function me(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const we=(e,t,s)=>e[t]=s,Ce=()=>{};class Te{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=re(),this.aspectType=fe.content,this.bind=this.bindDefault,this.data=`${this.id}-d`}createHTML(e){return oe.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=pe(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=Z.setAttribute;break;case 2:this.updateTarget=Z.setBooleanAttribute;break;case 3:this.updateTarget=we;break;case 4:this.bind=this.bindContent,this.updateTarget=ye;break;case 5:this.updateTarget=me;break;case 6:this.bind=this.bindEvent,this.updateTarget=Ce;break;default:throw f.error(1205)}return this}bindDefault(e){var t;const s=e.targets[this.nodeId],i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e),this.updateTarget===ye&&e.onUnbind(this)}bindContent(e){this.bindDefault(e),e.onUnbind(this)}bindEvent(e){const t=e.targets[this.nodeId];t[this.data]=e,t.addEventListener(this.targetAspect,this,this.dataBinding.options)}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget;B.setEvent(e);const s=t[this.data],i=this.dataBinding.evaluate(s.source,s.context);B.setEvent(null),!0!==i&&e.preventDefault()}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function Se(e,t=S.isVolatileBinding(e)){return new be(e,t)}function xe(e){return new ve(e)}function Oe(e,t){const s=new be(e,!1);return s.options=t,s}function Ae(e){return v(e)?Se(e):e instanceof ue?e:xe((()=>e))}function Be(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}ce.define(Te,{aspected:!0});class je{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.selfContained=!1,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get context(){return this}get event(){return B.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Be(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e){const t=this.source;if(t===e)return;let s=this.behaviors;if(this.source=e,null===s){this.behaviors=s=new Array(this.factories.length);const e=this.factories;for(let t=0,i=e.length;t<i;++t){const i=e[t].createBehavior();i.bind(this),s[t]=i}}else{null!==t&&this.evaluateUnbindables();for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){if(!this.isBound)return;null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){Be(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}S.defineProperty(je.prototype,"index"),S.defineProperty(je.prototype,"length");const ke=(e,t)=>`${e}.${t}`,$e={},Ie={index:0,node:null};function Ee(e){e.startsWith("fast-")||f.warn(1204,{name:e})}const Ve=new Proxy(document.createElement("div"),{get(e,t){Ee(t);const s=Reflect.get(e,t);return v(s)?s.bind(e):s},set:(e,t,s)=>(Ee(t),Reflect.set(e,t,s))});class Ne{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=$e[t];if(!n){const i=`_${t}`;$e[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Ve;for(const e of this.nodeIds)s[e];return new je(t,this.factories,s)}}function Fe(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=le.parse(d,l);let f=null;null===u?r&&(f=new Te(xe((()=>d))),fe.assign(f,c.name)):f=Re.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Me(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Le(e,s,n,i);n=t.node,i=t.index}}function Le(e,t,s,i){const n=ke(t,i);switch(s.nodeType){case 1:Fe(e,t,s,n,i),Me(e,s,n);break;case 3:return function(e,t,s,i,n){const r=le.parse(t.textContent,e.directives);if(null===r)return Ie.node=t.nextSibling,Ie.index=n+1,Ie;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=ke(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),y(a)?o.textContent=a:(o.textContent=" ",fe.assign(a),e.addFactory(a,s,i,n)),l=o}return Ie.index=n+1,Ie.node=l.nextSibling,Ie}(e,s,t,n,i);case 8:const r=le.parse(s.data,e.directives);null!==r&&e.addFactory(Re.aggregate(r),t,n,i)}return Ie.index=i+1,Ie.node=s.nextSibling,Ie}const ze={createHTML:e=>e};let _e=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",ze):ze;const Pe=_e,Re={setHTMLPolicy(e){if(_e!==Pe)throw f.error(1201);_e=e},compile(e,t){let s;if(y(e)){s=document.createElement("TEMPLATE"),s.innerHTML=_e.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ne(i,t);return Fe(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==le.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Me(n,i,"r"),Ie.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>y(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new Te(s);return fe.assign(o,t),o}};class De{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Re.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const He=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Ue(e,t,s){const i=He.exec(t);return null!==i&&fe.assign(e,i[2]),e.createHTML(s)}function qe(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=re();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,v(o))s+=Ue(new Te(Se(o)),r,n);else if(y(o)){const e=He.exec(r);if(null!==e){const t=new Te(xe((()=>o)));fe.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ue?s+=Ue(new Te(o),r,n):void 0===(l=ce.getForInstance(o))?s+=Ue(new Te(xe((()=>o))),r,n):l.aspected?s+=Ue(o,r,n):s+=o.createHTML(n)}return new De(s+e[e.length-1],i)}class Qe extends ge{bind(e){e.source[this.options]=e.targets[this.nodeId]}}ce.define(Qe);const We=e=>new Qe(e);function Ke(e,t){const s=v(e)?e:()=>e,i=v(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Ge=Object.freeze({positioning:!1,recycle:!0});function Je(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function Xe(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ye{constructor(e){this.directive=e,this.views=[],this.items=null,this.itemsObserver=null,this.bindView=Je,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Xe)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=g);const t=this.itemsObserver,s=this.itemsObserver=S.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,g=d.index;const p=g+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;g<p;++g){const e=t[g],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(g,0,d),s(d,i,g,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=e,i.index=s}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(je.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Ze{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=re(),_.enable()}createHTML(e){return oe.comment(e(this))}createBehavior(){return new Ye(this)}}function et(e,t,s=Ge){const i=Ae(e),n=Ae(t);return new Ze(i,n,Object.assign(Object.assign({},Ge),s))}ce.define(Ze);const tt=e=>1===e.nodeType,st=e=>e?t=>1===t.nodeType&&t.matches(e):tt;class it extends ge{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,g),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class nt extends it{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function rt(e){return y(e)&&(e={property:e}),new nt(e)}ce.define(nt);class ot extends it{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function lt(e){return y(e)&&(e={property:e}),new ot(e)}ce.define(ot);const at=Object.freeze({locate:b()}),ht={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function ct(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const dt={toView(e){const t=ct(e);return t?t.toString():t},fromView:ct};class ut{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=ht)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return S.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||m.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;Z.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":Z.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(at.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];y(i)?s.push(new ut(e,i)):s.push(new ut(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function ft(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),at.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const gt={mode:"open"},pt={},bt=f.getById(4,(()=>p()));class vt{constructor(e,t=e.definition){var s;this.platformDefined=!1,y(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=ut.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,S.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?gt:null===t.shadowOptions?void 0:Object.assign(Object.assign({},gt),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?pt:Object.assign(Object.assign({},pt),t.elementOptions),this.styles=U.normalize(t.styles),bt.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=bt.getByType(e);return new vt(s?class extends e{}:e,t)}}vt.getByType=bt.getByType,vt.getForInstance=bt.getForInstance;const yt={bubbles:!0,composed:!0,cancelable:!0},mt=new WeakMap;function wt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:mt.get(e))&&void 0!==s?s:null}class Ct extends C{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&mt.set(e,t))}const i=S.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return S.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,S.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.append(e);else if(!e.isAttachedTo(i)){const t=e.behaviors;if(e.addStylesTo(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.removeChild(e);else if(e.isAttachedTo(i)){const t=e.behaviors;if(e.removeStylesFrom(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},yt),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=T.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=vt.getForInstance(e);if(void 0===s)throw f.error(1401);return e.$fastController=new Ct(e,s)}}function Tt(e){return class extends e{constructor(){super(),Ct.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function St(e,t){return v(e)?vt.compose(e,t).define().type:vt.compose(this,e).define().type}const xt=Object.assign(Tt(HTMLElement),{from:function(e){return Tt(e)},define:St,compose:function(e,t){return v(e)?vt.compose(e,t):vt.compose(this,e)}});function Ot(e){return function(t){St(t,e)}}export{q as AdoptedStyleSheetsStrategy,_ as ArrayObserver,fe as Aspect,at as AttributeConfiguration,ut as AttributeDefinition,ue as Binding,W as CSSDirective,ot as ChildrenDirective,Re as Compiler,Z as DOM,Ct as ElementController,U as ElementStyles,B as ExecutionContext,f as FAST,xt as FASTElement,vt as FASTElementDefinition,Te as HTMLBindingDirective,ce as HTMLDirective,je as HTMLView,oe as Markup,it as NodeObservationDirective,S as Observable,le as Parser,C as PropertyChangeNotifier,Qe as RefDirective,Ye as RepeatBehavior,Ze as RepeatDirective,nt as SlottedDirective,T as SourceLifetime,j as Splice,F as SpliceStrategy,k as SpliceStrategySupport,ge as StatelessAttachedAttributeDirective,w as SubscriberSet,m as Updates,ae as ViewBehaviorOrchestrator,De as ViewTemplate,ft as attr,Se as bind,ht as booleanConverter,lt as children,b as createMetadataLocator,p as createTypeRegistry,J as css,K as cssDirective,Y as cssPartial,Ot as customElement,st as elements,g as emptyArray,qe as html,de as htmlDirective,P as lengthOf,Oe as listener,Ae as normalizeBinding,dt as nullableNumberConverter,x as observable,xe as oneTime,We as ref,et as repeat,rt as slotted,O as volatile,Ke as when};
1
+ !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},a=/(\$\{\w+?})/g,h=/\$\{(\w+?)}/g,c=Object.freeze({});function d(e,t){return e.split(a).map((e=>{var s;const i=e.replace(h,"$1");return String(null!==(s=t[i])&&void 0!==s?s:e)})).join("")}Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Warning";console.warn(d(i,t))},error(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Error";return new Error(d(i,t))}});const u={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},u));const f=globalThis.FAST;if(void 0===f.getById){const e=Object.create(null);Reflect.defineProperty(f,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},u))}void 0===f.error&&Object.assign(f,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const g=Object.freeze([]);function p(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function b(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const v=e=>"function"==typeof e,y=e=>"string"==typeof e,m=f.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class w{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class C{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new w(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new w(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const T=Object.freeze({unknown:void 0,coupled:1}),x=f.getById(2,(()=>{const e=m.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw f.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new C(e))),i}const o=b();class l{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];v(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class a extends w{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==T.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.binding(e,t)}finally{i=s}return n}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){y(t)&&(t=new l(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new a(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function S(e,t){x.defineProperty(e,t)}function O(e,t,s){return Object.assign({},s,{get(){return x.trackVolatile(),s.get.apply(this)}})}const A=f.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),B=Object.freeze({default:{index:0,length:0,get event(){return B.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>A.get(),setEvent(e){A.set(e)}});class j{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const k=Object.freeze({reset:1,splice:2,optimized:3}),$=new j(0,g,0);$.reset=!0;const I=[$];function E(e,t,s,i,n,r){let o=0,l=0;const a=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,a)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,a-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return g;if(t===s){const e=new j(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new j(t,[],s-t)];const h=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),c=[];let d,u=t,f=n;for(let e=0;e<h.length;++e)switch(h[e]){case 0:void 0!==d&&(c.push(d),d=void 0),u++,f++;break;case 1:void 0===d&&(d=new j(u,[],0)),d.addedCount++,u++,d.removed.push(i[f]),f++;break;case 2:void 0===d&&(d=new j(u,[],0)),d.addedCount++,u++;break;case 3:void 0===d&&(d=new j(u,[],0)),d.removed.push(i[f]),f++}return void 0!==d&&c.push(d),c}function V(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let N=Object.freeze({support:k.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?g:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)V(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(E(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:I,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new j(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new j(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new j(0,[],i.length).adjustTo(e)),n}});const F=Object.freeze({reset:I,setDefaultStrategy(e){N=e}});function M(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class L extends w{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,M(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,x.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:N).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,m.enqueue(this))}}let z=!1;const _=Object.freeze({enable(){if(z)return;z=!0,x.setArrayObserverFactory((e=>new L(e)));const e=Array.prototype;e.$fastPatch||(M(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:N)[t.name](this,i,t,e)}})))}});function P(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(_.enable(),t=x.getNotifier(e)),x.track(t.lengthObserver,"length"),e.length}const R=new Map;let D;function H(e){return e.map((e=>e instanceof U?H(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class U{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof U?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(D),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(H(this.styles)),this}static setDefaultStrategy(e){D=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new U(e):e instanceof U?e:new U([e])}}U.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class q{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=R.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),R.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}U.setDefaultStrategy(f.getById(5,(()=>q)));const Q=p(),W=Object.freeze({getForInstance:Q.getForInstance,getByType:Q.getByType,define:e=>(Q.register({type:e}),e)});function K(){return function(e){W.define(e)}}function G(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==W.getForInstance(o)&&(o=o.createCSS(r)),o instanceof U||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const J=(e,...t)=>{const{styles:s,behaviors:i}=G(e,t),n=new U(s);return i.length?n.withBehaviors(...i):n};class X{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(y(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new U(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}W.define(X);const Y=J.partial=(e,...t)=>{const{styles:s,behaviors:i}=G(e,t);return new X(s,i)},Z=Object.freeze({queueUpdate:m.enqueue,nextUpdate:m.next,processUpdates:m.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),ee=`fast-${Math.random().toString(36).substring(2,8)}`,te=`${ee}{`,se=`}${ee}`,ie=se.length;let ne=0;const re=()=>`${ee}-${++ne}`,oe=Object.freeze({interpolation:e=>`${te}${e}${se}`,attribute:e=>`${re()}="${te}${e}${se}"`,comment:e=>`\x3c!--${te}${e}${se}--\x3e`}),le=Object.freeze({parse(e,t){const s=e.split(te);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(se);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+ie)}""!==o&&i.push(o)}return i}}),ae=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:B.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=re());e.id||(e.id=re()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),he=p(),ce=Object.freeze({getForInstance:he.getForInstance,getByType:he.getByType,define:(e,t)=>((t=t||{}).type=e,he.register(t),e)});function de(e){return function(t){ce.define(t,e)}}class ue{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const fe=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=fe.property;break;case"classList":e.aspectType=fe.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=fe.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=fe.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=fe.property):(e.targetAspect=t,e.aspectType=fe.attribute)}else e.aspectType=fe.content}});class ge{constructor(e){this.options=e,this.id=re()}createHTML(e){return oe.attribute(e(this))}createBehavior(){return this}}const pe=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw f.error(1202)}:e=>e;class be extends ue{createObserver(e,t){return x.binding(this.evaluate,t,this.isVolatile)}}class ve extends ue{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ye(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function me(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const we=(e,t,s)=>e[t]=s,Ce=()=>{};class Te{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=re(),this.aspectType=fe.content,this.bind=this.bindDefault,this.data=`${this.id}-d`}createHTML(e){return oe.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=pe(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=Z.setAttribute;break;case 2:this.updateTarget=Z.setBooleanAttribute;break;case 3:this.updateTarget=we;break;case 4:this.bind=this.bindContent,this.updateTarget=ye;break;case 5:this.updateTarget=me;break;case 6:this.bind=this.bindEvent,this.updateTarget=Ce;break;default:throw f.error(1205)}return this}bindDefault(e){var t;const s=e.targets[this.nodeId],i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e),this.updateTarget===ye&&e.onUnbind(this)}bindContent(e){this.bindDefault(e),e.onUnbind(this)}bindEvent(e){const t=e.targets[this.nodeId];t[this.data]=e,t.addEventListener(this.targetAspect,this,this.dataBinding.options)}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget;B.setEvent(e);const s=t[this.data],i=this.dataBinding.evaluate(s.source,s.context);B.setEvent(null),!0!==i&&e.preventDefault()}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function xe(e,t=x.isVolatileBinding(e)){return new be(e,t)}function Se(e){return new ve(e)}function Oe(e,t){const s=new be(e,!1);return s.options=t,s}function Ae(e){return v(e)?xe(e):e instanceof ue?e:Se((()=>e))}function Be(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}ce.define(Te,{aspected:!0});class je{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=T.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return B.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Be(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){Be(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}x.defineProperty(je.prototype,"index"),x.defineProperty(je.prototype,"length");const ke=(e,t)=>`${e}.${t}`,$e={},Ie={index:0,node:null};function Ee(e){e.startsWith("fast-")||f.warn(1204,{name:e})}const Ve=new Proxy(document.createElement("div"),{get(e,t){Ee(t);const s=Reflect.get(e,t);return v(s)?s.bind(e):s},set:(e,t,s)=>(Ee(t),Reflect.set(e,t,s))});class Ne{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=$e[t];if(!n){const i=`_${t}`;$e[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Ve;for(const e of this.nodeIds)s[e];return new je(t,this.factories,s)}}function Fe(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=le.parse(d,l);let f=null;null===u?r&&(f=new Te(Se((()=>d))),fe.assign(f,c.name)):f=Re.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Me(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Le(e,s,n,i);n=t.node,i=t.index}}function Le(e,t,s,i){const n=ke(t,i);switch(s.nodeType){case 1:Fe(e,t,s,n,i),Me(e,s,n);break;case 3:return function(e,t,s,i,n){const r=le.parse(t.textContent,e.directives);if(null===r)return Ie.node=t.nextSibling,Ie.index=n+1,Ie;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=ke(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),y(a)?o.textContent=a:(o.textContent=" ",fe.assign(a),e.addFactory(a,s,i,n)),l=o}return Ie.index=n+1,Ie.node=l.nextSibling,Ie}(e,s,t,n,i);case 8:const r=le.parse(s.data,e.directives);null!==r&&e.addFactory(Re.aggregate(r),t,n,i)}return Ie.index=i+1,Ie.node=s.nextSibling,Ie}const ze={createHTML:e=>e};let _e=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",ze):ze;const Pe=_e,Re={setHTMLPolicy(e){if(_e!==Pe)throw f.error(1201);_e=e},compile(e,t){let s;if(y(e)){s=document.createElement("TEMPLATE"),s.innerHTML=_e.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ne(i,t);return Fe(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==le.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Me(n,i,"r"),Ie.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>y(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new Te(s);return fe.assign(o,t),o}};class De{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Re.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const He=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Ue(e,t,s){const i=He.exec(t);return null!==i&&fe.assign(e,i[2]),e.createHTML(s)}function qe(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=re();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,v(o))s+=Ue(new Te(xe(o)),r,n);else if(y(o)){const e=He.exec(r);if(null!==e){const t=new Te(Se((()=>o)));fe.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ue?s+=Ue(new Te(o),r,n):void 0===(l=ce.getForInstance(o))?s+=Ue(new Te(Se((()=>o))),r,n):l.aspected?s+=Ue(o,r,n):s+=o.createHTML(n)}return new De(s+e[e.length-1],i)}class Qe extends ge{bind(e){e.source[this.options]=e.targets[this.nodeId]}}ce.define(Qe);const We=e=>new Qe(e);function Ke(e,t){const s=v(e)?e:()=>e,i=v(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Ge=Object.freeze({positioning:!1,recycle:!0});function Je(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function Xe(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ye{constructor(e){this.directive=e,this.views=[],this.items=null,this.itemsObserver=null,this.bindView=Je,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Xe)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=g);const t=this.itemsObserver,s=this.itemsObserver=x.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,g=d.index;const p=g+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;g<p;++g){const e=t[g],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(g,0,d),s(d,i,g,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=e,i.index=s}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(je.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Ze{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=re(),_.enable()}createHTML(e){return oe.comment(e(this))}createBehavior(){return new Ye(this)}}function et(e,t,s=Ge){const i=Ae(e),n=Ae(t);return new Ze(i,n,Object.assign(Object.assign({},Ge),s))}ce.define(Ze);const tt=e=>1===e.nodeType,st=e=>e?t=>1===t.nodeType&&t.matches(e):tt;class it extends ge{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,g),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class nt extends it{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function rt(e){return y(e)&&(e={property:e}),new nt(e)}ce.define(nt);class ot extends it{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function lt(e){return y(e)&&(e={property:e}),new ot(e)}ce.define(ot);const at=Object.freeze({locate:b()}),ht={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function ct(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const dt={toView(e){const t=ct(e);return t?t.toString():t},fromView:ct};class ut{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=ht)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return x.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||m.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;Z.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":Z.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(at.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];y(i)?s.push(new ut(e,i)):s.push(new ut(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function ft(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),at.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const gt={mode:"open"},pt={},bt=f.getById(4,(()=>p()));class vt{constructor(e,t=e.definition){var s;this.platformDefined=!1,y(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=ut.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,x.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?gt:null===t.shadowOptions?void 0:Object.assign(Object.assign({},gt),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?pt:Object.assign(Object.assign({},pt),t.elementOptions),this.styles=U.normalize(t.styles),bt.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=bt.getByType(e);return new vt(s?class extends e{}:e,t)}}vt.getByType=bt.getByType,vt.getForInstance=bt.getForInstance;const yt={bubbles:!0,composed:!0,cancelable:!0},mt=new WeakMap;function wt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:mt.get(e))&&void 0!==s?s:null}class Ct extends C{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&mt.set(e,t))}const i=x.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return x.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,x.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.append(e);else if(!e.isAttachedTo(i)){const t=e.behaviors;if(e.addStylesTo(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.removeChild(e);else if(e.isAttachedTo(i)){const t=e.behaviors;if(e.removeStylesFrom(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},yt),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=wt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=T.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=vt.getForInstance(e);if(void 0===s)throw f.error(1401);return e.$fastController=new Ct(e,s)}}function Tt(e){return class extends e{constructor(){super(),Ct.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function xt(e,t){return v(e)?vt.compose(e,t).define().type:vt.compose(this,e).define().type}const St=Object.assign(Tt(HTMLElement),{from:function(e){return Tt(e)},define:xt,compose:function(e,t){return v(e)?vt.compose(e,t):vt.compose(this,e)}});function Ot(e){return function(t){xt(t,e)}}export{q as AdoptedStyleSheetsStrategy,_ as ArrayObserver,fe as Aspect,at as AttributeConfiguration,ut as AttributeDefinition,ue as Binding,W as CSSDirective,ot as ChildrenDirective,Re as Compiler,Z as DOM,Ct as ElementController,U as ElementStyles,B as ExecutionContext,f as FAST,St as FASTElement,vt as FASTElementDefinition,Te as HTMLBindingDirective,ce as HTMLDirective,je as HTMLView,oe as Markup,it as NodeObservationDirective,x as Observable,le as Parser,C as PropertyChangeNotifier,Qe as RefDirective,Ye as RepeatBehavior,Ze as RepeatDirective,nt as SlottedDirective,T as SourceLifetime,j as Splice,F as SpliceStrategy,k as SpliceStrategySupport,ge as StatelessAttachedAttributeDirective,w as SubscriberSet,m as Updates,ae as ViewBehaviorOrchestrator,De as ViewTemplate,ft as attr,xe as bind,ht as booleanConverter,lt as children,b as createMetadataLocator,p as createTypeRegistry,J as css,K as cssDirective,Y as cssPartial,Ot as customElement,st as elements,g as emptyArray,qe as html,de as htmlDirective,P as lengthOf,Oe as listener,Ae as normalizeBinding,dt as nullableNumberConverter,S as observable,Se as oneTime,We as ref,et as repeat,rt as slotted,O as volatile,Ke as when};
@@ -143,6 +143,9 @@ function createTypeRegistry() {
143
143
  return typeToDefinition.get(key);
144
144
  },
145
145
  getForInstance(object) {
146
+ if (object === null || object === void 0) {
147
+ return void 0;
148
+ }
146
149
  return typeToDefinition.get(object.constructor);
147
150
  },
148
151
  });
@@ -1964,14 +1967,14 @@ function updateContent(target, aspect, value, controller) {
1964
1967
  // and that there's actually no need to compose it.
1965
1968
  if (!view.isComposed) {
1966
1969
  view.isComposed = true;
1967
- view.bind(controller.source);
1970
+ view.bind(controller.source, controller.context);
1968
1971
  view.insertBefore(target);
1969
1972
  target.$fastView = view;
1970
1973
  target.$fastTemplate = value;
1971
1974
  }
1972
1975
  else if (view.needsBindOnly) {
1973
1976
  view.needsBindOnly = false;
1974
- view.bind(controller.source);
1977
+ view.bind(controller.source, controller.context);
1975
1978
  }
1976
1979
  }
1977
1980
  else {
@@ -2218,8 +2221,18 @@ class HTMLView {
2218
2221
  * The data that the view is bound to.
2219
2222
  */
2220
2223
  this.source = null;
2224
+ /**
2225
+ * Indicates whether the controller is bound.
2226
+ */
2221
2227
  this.isBound = false;
2222
- this.selfContained = false;
2228
+ /**
2229
+ * Indicates how the source's lifetime relates to the controller's lifetime.
2230
+ */
2231
+ this.sourceLifetime = SourceLifetime.unknown;
2232
+ /**
2233
+ * The execution context the view is running within.
2234
+ */
2235
+ this.context = this;
2223
2236
  /**
2224
2237
  * The index of the current item within a repeat context.
2225
2238
  */
@@ -2231,12 +2244,6 @@ class HTMLView {
2231
2244
  this.firstChild = fragment.firstChild;
2232
2245
  this.lastChild = fragment.lastChild;
2233
2246
  }
2234
- /**
2235
- * The execution context the view is running within.
2236
- */
2237
- get context() {
2238
- return this;
2239
- }
2240
2247
  /**
2241
2248
  * The current event within an event handler.
2242
2249
  */
@@ -2352,14 +2359,14 @@ class HTMLView {
2352
2359
  * @param source - The binding source for the view's binding behaviors.
2353
2360
  * @param context - The execution context to run the behaviors within.
2354
2361
  */
2355
- bind(source) {
2356
- const oldSource = this.source;
2357
- if (oldSource === source) {
2362
+ bind(source, context = this) {
2363
+ if (this.source === source) {
2358
2364
  return;
2359
2365
  }
2360
2366
  let behaviors = this.behaviors;
2361
- this.source = source;
2362
2367
  if (behaviors === null) {
2368
+ this.source = source;
2369
+ this.context = context;
2363
2370
  this.behaviors = behaviors = new Array(this.factories.length);
2364
2371
  const factories = this.factories;
2365
2372
  for (let i = 0, ii = factories.length; i < ii; ++i) {
@@ -2369,9 +2376,12 @@ class HTMLView {
2369
2376
  }
2370
2377
  }
2371
2378
  else {
2372
- if (oldSource !== null) {
2379
+ if (this.source !== null) {
2373
2380
  this.evaluateUnbindables();
2374
2381
  }
2382
+ this.isBound = false;
2383
+ this.source = source;
2384
+ this.context = context;
2375
2385
  for (let i = 0, ii = behaviors.length; i < ii; ++i) {
2376
2386
  behaviors[i].bind(this);
2377
2387
  }
@@ -2382,15 +2392,12 @@ class HTMLView {
2382
2392
  * Unbinds a view's behaviors from its binding source.
2383
2393
  */
2384
2394
  unbind() {
2385
- if (!this.isBound) {
2386
- return;
2387
- }
2388
- const oldSource = this.source;
2389
- if (oldSource === null) {
2395
+ if (!this.isBound || this.source === null) {
2390
2396
  return;
2391
2397
  }
2392
2398
  this.evaluateUnbindables();
2393
2399
  this.source = null;
2400
+ this.context = this;
2394
2401
  this.isBound = false;
2395
2402
  }
2396
2403
  evaluateUnbindables() {
@@ -1 +1 @@
1
- !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class p{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class b{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new p(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new p(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const g=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new b(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends p{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==g.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.binding(e,t)}finally{i=s}return n}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function B(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function A(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)A(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(B(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function I(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class $ extends p{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,I(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new $(e)));const e=Array.prototype;e.$fastPatch||(I(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}const _=new Map;let z;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(z),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){z=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new L(e):e instanceof L?e:new L([e])}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class M{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=_.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),_.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}L.setDefaultStrategy(l.getById(5,(()=>M)));const P=h(),R=Object.freeze({getForInstance:P.getForInstance,getByType:P.getByType,define:e=>(P.register({type:e}),e)});function H(){return function(e){R.define(e)}}function D(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==R.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const U=(e,...t)=>{const{styles:s,behaviors:i}=D(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class q{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}R.define(q);const Q=U.partial=(e,...t)=>{const{styles:s,behaviors:i}=D(e,t);return new q(s,i)},W=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),G=`fast-${Math.random().toString(36).substring(2,8)}`,J=`${G}{`,K=`}${G}`,X=K.length;let Y=0;const Z=()=>`${G}-${++Y}`,ee=Object.freeze({interpolation:e=>`${J}${e}${K}`,attribute:e=>`${Z()}="${J}${e}${K}"`,comment:e=>`\x3c!--${J}${e}${K}--\x3e`}),te=Object.freeze({parse(e,t){const s=e.split(J);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(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+X)}""!==o&&i.push(o)}return i}}),se=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=Z());e.id||(e.id=Z()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),ie=h(),ne=Object.freeze({getForInstance:ie.getForInstance,getByType:ie.getByType,define:(e,t)=>((t=t||{}).type=e,ie.register(t),e)});function re(e){return function(t){ne.define(t,e)}}class oe{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const le=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=le.property;break;case"classList":e.aspectType=le.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=le.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=le.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=le.property):(e.targetAspect=t,e.aspectType=le.attribute)}else e.aspectType=le.content}});class ae{constructor(e){this.options=e,this.id=Z()}createHTML(e){return ee.attribute(e(this))}createBehavior(){return this}}const he=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ce extends oe{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class de extends oe{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ue(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source)):(t.isComposed=!0,t.bind(i.source),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function fe(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const pe=(e,t,s)=>e[t]=s,be=()=>{};class ge{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=Z(),this.aspectType=le.content,this.bind=this.bindDefault,this.data=`${this.id}-d`}createHTML(e){return ee.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=he(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=W.setAttribute;break;case 2:this.updateTarget=W.setBooleanAttribute;break;case 3:this.updateTarget=pe;break;case 4:this.bind=this.bindContent,this.updateTarget=ue;break;case 5:this.updateTarget=fe;break;case 6:this.bind=this.bindEvent,this.updateTarget=be;break;default:throw l.error(1205)}return this}bindDefault(e){var t;const s=e.targets[this.nodeId],i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e),this.updateTarget===ue&&e.onUnbind(this)}bindContent(e){this.bindDefault(e),e.onUnbind(this)}bindEvent(e){const t=e.targets[this.nodeId];t[this.data]=e,t.addEventListener(this.targetAspect,this,this.dataBinding.options)}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget;C.setEvent(e);const s=t[this.data],i=this.dataBinding.evaluate(s.source,s.context);C.setEvent(null),!0!==i&&e.preventDefault()}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ve(e,t=v.isVolatileBinding(e)){return new ce(e,t)}function ye(e){return new de(e)}function me(e,t){const s=new ce(e,!1);return s.options=t,s}function we(e){return d(e)?ve(e):e instanceof oe?e:ye((()=>e))}function Ce(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}ne.define(ge,{aspected:!0});class xe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.selfContained=!1,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get context(){return this}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Ce(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e){const t=this.source;if(t===e)return;let s=this.behaviors;if(this.source=e,null===s){this.behaviors=s=new Array(this.factories.length);const e=this.factories;for(let t=0,i=e.length;t<i;++t){const i=e[t].createBehavior();i.bind(this),s[t]=i}}else{null!==t&&this.evaluateUnbindables();for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){if(!this.isBound)return;null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){Ce(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(xe.prototype,"index"),v.defineProperty(xe.prototype,"length");const Te=(e,t)=>`${e}.${t}`,Se={},Oe={index:0,node:null};function Be(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Ae=new Proxy(document.createElement("div"),{get(e,t){Be(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Be(t),Reflect.set(e,t,s))});class ke{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=Se[t];if(!n){const i=`_${t}`;Se[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Ae;for(const e of this.nodeIds)s[e];return new xe(t,this.factories,s)}}function je(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=te.parse(d,l);let f=null;null===u?r&&(f=new ge(ye((()=>d))),le.assign(f,c.name)):f=_e.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Ie(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=$e(e,s,n,i);n=t.node,i=t.index}}function $e(e,t,s,i){const n=Te(t,i);switch(s.nodeType){case 1:je(e,t,s,n,i),Ie(e,s,n);break;case 3:return function(e,t,s,i,n){const r=te.parse(t.textContent,e.directives);if(null===r)return Oe.node=t.nextSibling,Oe.index=n+1,Oe;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Te(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",le.assign(a),e.addFactory(a,s,i,n)),l=o}return Oe.index=n+1,Oe.node=l.nextSibling,Oe}(e,s,t,n,i);case 8:const r=te.parse(s.data,e.directives);null!==r&&e.addFactory(_e.aggregate(r),t,n,i)}return Oe.index=i+1,Oe.node=s.nextSibling,Oe}const Ve={createHTML:e=>e};let Ee=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ve):Ve;const Ne=Ee,_e={setHTMLPolicy(e){if(Ee!==Ne)throw l.error(1201);Ee=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ee.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new ke(i,t);return je(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==te.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Ie(n,i,"r"),Oe.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new ge(s);return le.assign(o,t),o}};class ze{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=_e.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const Fe=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Le(e,t,s){const i=Fe.exec(t);return null!==i&&le.assign(e,i[2]),e.createHTML(s)}function Me(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=Z();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Le(new ge(ve(o)),r,n);else if(u(o)){const e=Fe.exec(r);if(null!==e){const t=new ge(ye((()=>o)));le.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof oe?s+=Le(new ge(o),r,n):void 0===(l=ne.getForInstance(o))?s+=Le(new ge(ye((()=>o))),r,n):l.aspected?s+=Le(o,r,n):s+=o.createHTML(n)}return new ze(s+e[e.length-1],i)}class Pe extends ae{bind(e){e.source[this.options]=e.targets[this.nodeId]}}ne.define(Pe);const Re=e=>new Pe(e);function He(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const De=Object.freeze({positioning:!1,recycle:!0});function Ue(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function qe(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Qe{constructor(e){this.directive=e,this.views=[],this.items=null,this.itemsObserver=null,this.bindView=Ue,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=qe)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=t.splice(d.index,u.length),v=h=l.length+g.length;for(;p<b;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&g.length>0?(d=g[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=e,i.index=s}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(xe.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class We{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=Z(),E.enable()}createHTML(e){return ee.comment(e(this))}createBehavior(){return new Qe(this)}}function Ge(e,t,s=De){const i=we(e),n=we(t);return new We(i,n,Object.assign(Object.assign({},De),s))}ne.define(We);const Je=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):Je;class Xe extends ae{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Ye extends Xe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}ne.define(Ye);class et extends Xe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function tt(e){return u(e)&&(e={property:e}),new et(e)}ne.define(et);const st=Object.freeze({locate:c()}),it={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function nt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const rt={toView(e){const t=nt(e);return t?t.toString():t},fromView:nt};class ot{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=it)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;W.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":W.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(st.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new ot(e,i)):s.push(new ot(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function lt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),st.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const at={mode:"open"},ht={},ct=l.getById(4,(()=>h()));class dt{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=ot.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?at:null===t.shadowOptions?void 0:Object.assign(Object.assign({},at),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ht:Object.assign(Object.assign({},ht),t.elementOptions),this.styles=L.normalize(t.styles),ct.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=ct.getByType(e);return new dt(s?class extends e{}:e,t)}}dt.getByType=ct.getByType,dt.getForInstance=ct.getForInstance;const ut={bubbles:!0,composed:!0,cancelable:!0},ft=new WeakMap;function pt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ft.get(e))&&void 0!==s?s:null}class bt extends b{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ft.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.append(e);else if(!e.isAttachedTo(i)){const t=e.behaviors;if(e.addStylesTo(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.removeChild(e);else if(e.isAttachedTo(i)){const t=e.behaviors;if(e.removeStylesFrom(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},ut),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=g.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=dt.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new bt(e,s)}}function gt(e){return class extends e{constructor(){super(),bt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function vt(e,t){return d(e)?dt.compose(e,t).define().type:dt.compose(this,e).define().type}const yt=Object.assign(gt(HTMLElement),{from:function(e){return gt(e)},define:vt,compose:function(e,t){return d(e)?dt.compose(e,t):dt.compose(this,e)}});function mt(e){return function(t){vt(t,e)}}export{M as AdoptedStyleSheetsStrategy,E as ArrayObserver,le as Aspect,st as AttributeConfiguration,ot as AttributeDefinition,oe as Binding,R as CSSDirective,et as ChildrenDirective,_e as Compiler,W as DOM,bt as ElementController,L as ElementStyles,C as ExecutionContext,l as FAST,yt as FASTElement,dt as FASTElementDefinition,ge as HTMLBindingDirective,ne as HTMLDirective,xe as HTMLView,ee as Markup,Xe as NodeObservationDirective,v as Observable,te as Parser,b as PropertyChangeNotifier,Pe as RefDirective,Qe as RepeatBehavior,We as RepeatDirective,Ye as SlottedDirective,g as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,ae as StatelessAttachedAttributeDirective,p as SubscriberSet,f as Updates,se as ViewBehaviorOrchestrator,ze as ViewTemplate,lt as attr,ve as bind,it as booleanConverter,tt as children,c as createMetadataLocator,h as createTypeRegistry,U as css,H as cssDirective,Q as cssPartial,mt as customElement,Ke as elements,a as emptyArray,Me as html,re as htmlDirective,N as lengthOf,me as listener,we as normalizeBinding,rt as nullableNumberConverter,y as observable,ye as oneTime,Re as ref,Ge as repeat,Ze as slotted,m as volatile,He as when};
1
+ !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class p{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class b{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new p(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new p(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const g=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new b(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends p{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==g.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.binding(e,t)}finally{i=s}return n}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function B(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function A(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)A(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(B(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function I(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class $ extends p{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,I(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new $(e)));const e=Array.prototype;e.$fastPatch||(I(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}const L=new Map;let _;function z(e){return e.map((e=>e instanceof F?z(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class F{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof F?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(_),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(z(this.styles)),this}static setDefaultStrategy(e){_=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new F(e):e instanceof F?e:new F([e])}}F.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class M{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=L.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),L.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}F.setDefaultStrategy(l.getById(5,(()=>M)));const P=h(),R=Object.freeze({getForInstance:P.getForInstance,getByType:P.getByType,define:e=>(P.register({type:e}),e)});function H(){return function(e){R.define(e)}}function D(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==R.getForInstance(o)&&(o=o.createCSS(r)),o instanceof F||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const U=(e,...t)=>{const{styles:s,behaviors:i}=D(e,t),n=new F(s);return i.length?n.withBehaviors(...i):n};class q{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new F(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}R.define(q);const Q=U.partial=(e,...t)=>{const{styles:s,behaviors:i}=D(e,t);return new q(s,i)},W=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),G=`fast-${Math.random().toString(36).substring(2,8)}`,J=`${G}{`,K=`}${G}`,X=K.length;let Y=0;const Z=()=>`${G}-${++Y}`,ee=Object.freeze({interpolation:e=>`${J}${e}${K}`,attribute:e=>`${Z()}="${J}${e}${K}"`,comment:e=>`\x3c!--${J}${e}${K}--\x3e`}),te=Object.freeze({parse(e,t){const s=e.split(J);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(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+X)}""!==o&&i.push(o)}return i}}),se=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=Z());e.id||(e.id=Z()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),ie=h(),ne=Object.freeze({getForInstance:ie.getForInstance,getByType:ie.getByType,define:(e,t)=>((t=t||{}).type=e,ie.register(t),e)});function re(e){return function(t){ne.define(t,e)}}class oe{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const le=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=le.property;break;case"classList":e.aspectType=le.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=le.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=le.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=le.property):(e.targetAspect=t,e.aspectType=le.attribute)}else e.aspectType=le.content}});class ae{constructor(e){this.options=e,this.id=Z()}createHTML(e){return ee.attribute(e(this))}createBehavior(){return this}}const he=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ce extends oe{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class de extends oe{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ue(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function fe(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const pe=(e,t,s)=>e[t]=s,be=()=>{};class ge{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=Z(),this.aspectType=le.content,this.bind=this.bindDefault,this.data=`${this.id}-d`}createHTML(e){return ee.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=he(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=W.setAttribute;break;case 2:this.updateTarget=W.setBooleanAttribute;break;case 3:this.updateTarget=pe;break;case 4:this.bind=this.bindContent,this.updateTarget=ue;break;case 5:this.updateTarget=fe;break;case 6:this.bind=this.bindEvent,this.updateTarget=be;break;default:throw l.error(1205)}return this}bindDefault(e){var t;const s=e.targets[this.nodeId],i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e),this.updateTarget===ue&&e.onUnbind(this)}bindContent(e){this.bindDefault(e),e.onUnbind(this)}bindEvent(e){const t=e.targets[this.nodeId];t[this.data]=e,t.addEventListener(this.targetAspect,this,this.dataBinding.options)}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget;C.setEvent(e);const s=t[this.data],i=this.dataBinding.evaluate(s.source,s.context);C.setEvent(null),!0!==i&&e.preventDefault()}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ve(e,t=v.isVolatileBinding(e)){return new ce(e,t)}function ye(e){return new de(e)}function me(e,t){const s=new ce(e,!1);return s.options=t,s}function we(e){return d(e)?ve(e):e instanceof oe?e:ye((()=>e))}function Ce(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}ne.define(ge,{aspected:!0});class xe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=g.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Ce(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){Ce(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(xe.prototype,"index"),v.defineProperty(xe.prototype,"length");const Te=(e,t)=>`${e}.${t}`,Se={},Oe={index:0,node:null};function Be(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Ae=new Proxy(document.createElement("div"),{get(e,t){Be(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Be(t),Reflect.set(e,t,s))});class ke{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=Se[t];if(!n){const i=`_${t}`;Se[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Ae;for(const e of this.nodeIds)s[e];return new xe(t,this.factories,s)}}function je(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=te.parse(d,l);let f=null;null===u?r&&(f=new ge(ye((()=>d))),le.assign(f,c.name)):f=Le.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Ie(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=$e(e,s,n,i);n=t.node,i=t.index}}function $e(e,t,s,i){const n=Te(t,i);switch(s.nodeType){case 1:je(e,t,s,n,i),Ie(e,s,n);break;case 3:return function(e,t,s,i,n){const r=te.parse(t.textContent,e.directives);if(null===r)return Oe.node=t.nextSibling,Oe.index=n+1,Oe;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Te(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",le.assign(a),e.addFactory(a,s,i,n)),l=o}return Oe.index=n+1,Oe.node=l.nextSibling,Oe}(e,s,t,n,i);case 8:const r=te.parse(s.data,e.directives);null!==r&&e.addFactory(Le.aggregate(r),t,n,i)}return Oe.index=i+1,Oe.node=s.nextSibling,Oe}const Ve={createHTML:e=>e};let Ee=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ve):Ve;const Ne=Ee,Le={setHTMLPolicy(e){if(Ee!==Ne)throw l.error(1201);Ee=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ee.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new ke(i,t);return je(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==te.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Ie(n,i,"r"),Oe.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new ge(s);return le.assign(o,t),o}};class _e{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Le.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const ze=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Fe(e,t,s){const i=ze.exec(t);return null!==i&&le.assign(e,i[2]),e.createHTML(s)}function Me(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=Z();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Fe(new ge(ve(o)),r,n);else if(u(o)){const e=ze.exec(r);if(null!==e){const t=new ge(ye((()=>o)));le.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof oe?s+=Fe(new ge(o),r,n):void 0===(l=ne.getForInstance(o))?s+=Fe(new ge(ye((()=>o))),r,n):l.aspected?s+=Fe(o,r,n):s+=o.createHTML(n)}return new _e(s+e[e.length-1],i)}class Pe extends ae{bind(e){e.source[this.options]=e.targets[this.nodeId]}}ne.define(Pe);const Re=e=>new Pe(e);function He(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const De=Object.freeze({positioning:!1,recycle:!0});function Ue(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function qe(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Qe{constructor(e){this.directive=e,this.views=[],this.items=null,this.itemsObserver=null,this.bindView=Ue,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=qe)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=t.splice(d.index,u.length),v=h=l.length+g.length;for(;p<b;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&g.length>0?(d=g[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=e,i.index=s}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(xe.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class We{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=Z(),E.enable()}createHTML(e){return ee.comment(e(this))}createBehavior(){return new Qe(this)}}function Ge(e,t,s=De){const i=we(e),n=we(t);return new We(i,n,Object.assign(Object.assign({},De),s))}ne.define(We);const Je=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):Je;class Xe extends ae{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Ye extends Xe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}ne.define(Ye);class et extends Xe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function tt(e){return u(e)&&(e={property:e}),new et(e)}ne.define(et);const st=Object.freeze({locate:c()}),it={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function nt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const rt={toView(e){const t=nt(e);return t?t.toString():t},fromView:nt};class ot{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=it)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;W.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":W.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(st.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new ot(e,i)):s.push(new ot(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function lt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),st.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const at={mode:"open"},ht={},ct=l.getById(4,(()=>h()));class dt{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=ot.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?at:null===t.shadowOptions?void 0:Object.assign(Object.assign({},at),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ht:Object.assign(Object.assign({},ht),t.elementOptions),this.styles=F.normalize(t.styles),ct.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=ct.getByType(e);return new dt(s?class extends e{}:e,t)}}dt.getByType=ct.getByType,dt.getForInstance=ct.getForInstance;const ut={bubbles:!0,composed:!0,cancelable:!0},ft=new WeakMap;function pt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ft.get(e))&&void 0!==s?s:null}class bt extends b{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ft.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.append(e);else if(!e.isAttachedTo(i)){const t=e.behaviors;if(e.addStylesTo(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s.getRootNode();if(e instanceof HTMLElement)i.removeChild(e);else if(e.isAttachedTo(i)){const t=e.behaviors;if(e.removeStylesFrom(i),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},ut),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=pt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=g.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=dt.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new bt(e,s)}}function gt(e){return class extends e{constructor(){super(),bt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function vt(e,t){return d(e)?dt.compose(e,t).define().type:dt.compose(this,e).define().type}const yt=Object.assign(gt(HTMLElement),{from:function(e){return gt(e)},define:vt,compose:function(e,t){return d(e)?dt.compose(e,t):dt.compose(this,e)}});function mt(e){return function(t){vt(t,e)}}export{M as AdoptedStyleSheetsStrategy,E as ArrayObserver,le as Aspect,st as AttributeConfiguration,ot as AttributeDefinition,oe as Binding,R as CSSDirective,et as ChildrenDirective,Le as Compiler,W as DOM,bt as ElementController,F as ElementStyles,C as ExecutionContext,l as FAST,yt as FASTElement,dt as FASTElementDefinition,ge as HTMLBindingDirective,ne as HTMLDirective,xe as HTMLView,ee as Markup,Xe as NodeObservationDirective,v as Observable,te as Parser,b as PropertyChangeNotifier,Pe as RefDirective,Qe as RepeatBehavior,We as RepeatDirective,Ye as SlottedDirective,g as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,ae as StatelessAttachedAttributeDirective,p as SubscriberSet,f as Updates,se as ViewBehaviorOrchestrator,_e as ViewTemplate,lt as attr,ve as bind,it as booleanConverter,tt as children,c as createMetadataLocator,h as createTypeRegistry,U as css,H as cssDirective,Q as cssPartial,mt as customElement,Ke as elements,a as emptyArray,Me as html,re as htmlDirective,N as lengthOf,me as listener,we as normalizeBinding,rt as nullableNumberConverter,y as observable,ye as oneTime,Re as ref,Ge as repeat,Ze as slotted,m as volatile,He as when};
@@ -496,7 +496,7 @@ export declare interface ContentView {
496
496
  * @param source - The binding source for the view's binding behaviors.
497
497
  * @param context - The execution context to run the view within.
498
498
  */
499
- bind(source: any): void;
499
+ bind(source: any, context?: ExecutionContext): void;
500
500
  /**
501
501
  * Unbinds a view's behaviors from its binding source and context.
502
502
  */
@@ -1469,12 +1469,18 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1469
1469
  * The data that the view is bound to.
1470
1470
  */
1471
1471
  source: TSource | null;
1472
+ /**
1473
+ * Indicates whether the controller is bound.
1474
+ */
1472
1475
  isBound: boolean;
1473
- selfContained: boolean;
1476
+ /**
1477
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1478
+ */
1479
+ readonly sourceLifetime: SourceLifetime;
1474
1480
  /**
1475
1481
  * The execution context the view is running within.
1476
1482
  */
1477
- get context(): ExecutionContext<TParent>;
1483
+ context: ExecutionContext<TParent>;
1478
1484
  /**
1479
1485
  * The index of the current item within a repeat context.
1480
1486
  */
@@ -1570,7 +1576,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1570
1576
  * @param source - The binding source for the view's binding behaviors.
1571
1577
  * @param context - The execution context to run the behaviors within.
1572
1578
  */
1573
- bind(source: TSource): void;
1579
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
1574
1580
  /**
1575
1581
  * Unbinds a view's behaviors from its binding source.
1576
1582
  */
@@ -2648,7 +2654,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2648
2654
  * Binds a view's behaviors to its binding source.
2649
2655
  * @param source - The binding source for the view's binding behaviors.
2650
2656
  */
2651
- bind(source: TSource): void;
2657
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
2652
2658
  /**
2653
2659
  * Unbinds a view's behaviors from its binding source and context.
2654
2660
  */
@@ -185,7 +185,7 @@ export interface ContentTemplate {
185
185
 
186
186
  // @public
187
187
  export interface ContentView {
188
- bind(source: any): void;
188
+ bind(source: any, context?: ExecutionContext): void;
189
189
  // (undocumented)
190
190
  readonly context: ExecutionContext;
191
191
  insertBefore(node: Node): void;
@@ -499,8 +499,8 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
499
499
  export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
500
500
  constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
501
501
  appendTo(node: Node): void;
502
- bind(source: TSource): void;
503
- get context(): ExecutionContext<TParent>;
502
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
503
+ context: ExecutionContext<TParent>;
504
504
  dispose(): void;
505
505
  static disposeContiguousBatch(views: SyntheticView[]): void;
506
506
  get event(): Event;
@@ -509,7 +509,6 @@ export class HTMLView<TSource = any, TParent = any> implements ElementView<TSour
509
509
  firstChild: Node;
510
510
  index: number;
511
511
  insertBefore(node: Node): void;
512
- // (undocumented)
513
512
  isBound: boolean;
514
513
  get isEven(): boolean;
515
514
  get isFirst(): boolean;
@@ -525,9 +524,8 @@ export class HTMLView<TSource = any, TParent = any> implements ElementView<TSour
525
524
  readonly parent: TParent;
526
525
  readonly parentContext: ExecutionContext<TParent>;
527
526
  remove(): void;
528
- // (undocumented)
529
- selfContained: boolean;
530
527
  source: TSource | null;
528
+ readonly sourceLifetime: SourceLifetime;
531
529
  // (undocumented)
532
530
  readonly targets: ViewBehaviorTargets;
533
531
  unbind(): void;
@@ -870,7 +868,7 @@ export interface ValueConverter {
870
868
 
871
869
  // @public
872
870
  export interface View<TSource = any, TParent = any> extends Disposable {
873
- bind(source: TSource): void;
871
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
874
872
  readonly context: ExecutionContext<TParent>;
875
873
  readonly source: TSource | null;
876
874
  unbind(): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "description": "A library for constructing Web Components",
4
- "version": "2.0.0-beta.7",
4
+ "version": "2.0.0-beta.9",
5
5
  "author": {
6
6
  "name": "Microsoft",
7
7
  "url": "https://discord.gg/FcSNfg4"