@microsoft/fast-router 0.2.14 → 0.2.15
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 +16 -1
- package/CHANGELOG.md +10 -2
- package/dist/fast-router.js +420 -342
- package/dist/fast-router.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@microsoft/fast-router",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 08 Mar 2022 07:10:44 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-router_v0.2.15",
|
|
7
|
+
"version": "0.2.15",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Bump @microsoft/fast-element to v1.8.0",
|
|
12
|
+
"author": "roeisenb@microsoft.com",
|
|
13
|
+
"commit": "0e506c6c67a8a7d75e4ef9cfbd000f9da810dc14",
|
|
14
|
+
"package": "@microsoft/fast-router"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 25 Feb 2022 17:09:32 GMT",
|
|
6
21
|
"tag": "@microsoft/fast-router_v0.2.14",
|
|
7
22
|
"version": "0.2.14",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-router
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 08 Mar 2022 07:10:44 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.2.15
|
|
8
|
+
|
|
9
|
+
Tue, 08 Mar 2022 07:10:44 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @microsoft/fast-element to v1.8.0 (roeisenb@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.2.14
|
|
8
16
|
|
|
9
|
-
Fri, 25 Feb 2022 17:
|
|
17
|
+
Fri, 25 Feb 2022 17:09:32 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
package/dist/fast-router.js
CHANGED
|
@@ -94,6 +94,41 @@ if ($global.trustedTypes === void 0) {
|
|
|
94
94
|
createPolicy: (n, r) => r
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
const propConfig = {
|
|
99
|
+
configurable: false,
|
|
100
|
+
enumerable: false,
|
|
101
|
+
writable: false
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if ($global.FAST === void 0) {
|
|
105
|
+
Reflect.defineProperty($global, "FAST", Object.assign({
|
|
106
|
+
value: Object.create(null)
|
|
107
|
+
}, propConfig));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The FAST global.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const FAST = $global.FAST;
|
|
116
|
+
|
|
117
|
+
if (FAST.getById === void 0) {
|
|
118
|
+
const storage = Object.create(null);
|
|
119
|
+
Reflect.defineProperty(FAST, "getById", Object.assign({
|
|
120
|
+
value(id, initialize) {
|
|
121
|
+
let found = storage[id];
|
|
122
|
+
|
|
123
|
+
if (found === void 0) {
|
|
124
|
+
found = initialize ? storage[id] = initialize() : null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return found;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}, propConfig));
|
|
131
|
+
}
|
|
97
132
|
/**
|
|
98
133
|
* A readonly, empty array.
|
|
99
134
|
* @remarks
|
|
@@ -105,33 +140,75 @@ if ($global.trustedTypes === void 0) {
|
|
|
105
140
|
|
|
106
141
|
const emptyArray = Object.freeze([]);
|
|
107
142
|
|
|
108
|
-
const updateQueue =
|
|
109
|
-
/*
|
|
143
|
+
const updateQueue = $global.FAST.getById(1
|
|
144
|
+
/* updateQueue */
|
|
145
|
+
, () => {
|
|
146
|
+
const tasks = [];
|
|
147
|
+
const pendingErrors = [];
|
|
110
148
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
149
|
+
function throwFirstError() {
|
|
150
|
+
if (pendingErrors.length) {
|
|
151
|
+
throw pendingErrors.shift();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function tryRunTask(task) {
|
|
156
|
+
try {
|
|
157
|
+
task.call();
|
|
158
|
+
} catch (error) {
|
|
159
|
+
pendingErrors.push(error);
|
|
160
|
+
setTimeout(throwFirstError, 0);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
115
163
|
|
|
116
|
-
|
|
164
|
+
function process() {
|
|
165
|
+
const capacity = 1024;
|
|
166
|
+
let index = 0;
|
|
167
|
+
|
|
168
|
+
while (index < tasks.length) {
|
|
169
|
+
tryRunTask(tasks[index]);
|
|
170
|
+
index++; // Prevent leaking memory for long chains of recursive calls to `DOM.queueUpdate`.
|
|
171
|
+
// If we call `DOM.queueUpdate` within a task scheduled by `DOM.queueUpdate`, the queue will
|
|
172
|
+
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
|
173
|
+
// shift tasks off the queue after they have been executed.
|
|
174
|
+
// Instead, we periodically shift 1024 tasks off the queue.
|
|
117
175
|
|
|
118
|
-
|
|
176
|
+
if (index > capacity) {
|
|
177
|
+
// Manually shift all values starting at the index back to the
|
|
178
|
+
// beginning of the queue.
|
|
179
|
+
for (let scan = 0, newLength = tasks.length - index; scan < newLength; scan++) {
|
|
180
|
+
tasks[scan] = tasks[scan + index];
|
|
181
|
+
}
|
|
119
182
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
183
|
+
tasks.length -= index;
|
|
184
|
+
index = 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
tasks.length = 0;
|
|
123
189
|
}
|
|
124
|
-
}
|
|
125
190
|
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
191
|
+
function enqueue(callable) {
|
|
192
|
+
if (tasks.length < 1) {
|
|
193
|
+
$global.requestAnimationFrame(process);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
tasks.push(callable);
|
|
132
197
|
}
|
|
133
|
-
}
|
|
134
198
|
|
|
199
|
+
return Object.freeze({
|
|
200
|
+
enqueue,
|
|
201
|
+
process
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
/* eslint-disable */
|
|
205
|
+
|
|
206
|
+
const fastHTMLPolicy = $global.trustedTypes.createPolicy("fast-html", {
|
|
207
|
+
createHTML: html => html
|
|
208
|
+
});
|
|
209
|
+
/* eslint-enable */
|
|
210
|
+
|
|
211
|
+
let htmlPolicy = fastHTMLPolicy;
|
|
135
212
|
const marker = `fast-${Math.random().toString(36).substring(2, 8)}`;
|
|
136
213
|
/** @internal */
|
|
137
214
|
|
|
@@ -229,13 +306,7 @@ const DOM = Object.freeze({
|
|
|
229
306
|
* Schedules DOM update work in the next async batch.
|
|
230
307
|
* @param callable - The callable function or object to queue.
|
|
231
308
|
*/
|
|
232
|
-
queueUpdate
|
|
233
|
-
if (updateQueue.length < 1) {
|
|
234
|
-
window.requestAnimationFrame(DOM.processUpdates);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
updateQueue.push(callable);
|
|
238
|
-
},
|
|
309
|
+
queueUpdate: updateQueue.enqueue,
|
|
239
310
|
|
|
240
311
|
/**
|
|
241
312
|
* Immediately processes all work previously scheduled
|
|
@@ -244,40 +315,13 @@ const DOM = Object.freeze({
|
|
|
244
315
|
* This also forces nextUpdate promises
|
|
245
316
|
* to resolve.
|
|
246
317
|
*/
|
|
247
|
-
processUpdates
|
|
248
|
-
const capacity = 1024;
|
|
249
|
-
let index = 0;
|
|
250
|
-
|
|
251
|
-
while (index < updateQueue.length) {
|
|
252
|
-
tryRunTask(updateQueue[index]);
|
|
253
|
-
index++; // Prevent leaking memory for long chains of recursive calls to `DOM.queueUpdate`.
|
|
254
|
-
// If we call `DOM.queueUpdate` within a task scheduled by `DOM.queueUpdate`, the queue will
|
|
255
|
-
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
|
256
|
-
// shift tasks off the queue after they have been executed.
|
|
257
|
-
// Instead, we periodically shift 1024 tasks off the queue.
|
|
258
|
-
|
|
259
|
-
if (index > capacity) {
|
|
260
|
-
// Manually shift all values starting at the index back to the
|
|
261
|
-
// beginning of the queue.
|
|
262
|
-
for (let scan = 0, newLength = updateQueue.length - index; scan < newLength; scan++) {
|
|
263
|
-
updateQueue[scan] = updateQueue[scan + index];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
updateQueue.length -= index;
|
|
267
|
-
index = 0;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
updateQueue.length = 0;
|
|
272
|
-
},
|
|
318
|
+
processUpdates: updateQueue.process,
|
|
273
319
|
|
|
274
320
|
/**
|
|
275
321
|
* Resolves with the next DOM update.
|
|
276
322
|
*/
|
|
277
323
|
nextUpdate() {
|
|
278
|
-
return new Promise(
|
|
279
|
-
DOM.queueUpdate(resolve);
|
|
280
|
-
});
|
|
324
|
+
return new Promise(updateQueue.enqueue);
|
|
281
325
|
},
|
|
282
326
|
|
|
283
327
|
/**
|
|
@@ -537,69 +581,25 @@ class PropertyChangeNotifier {
|
|
|
537
581
|
|
|
538
582
|
}
|
|
539
583
|
|
|
540
|
-
const volatileRegex = /(:|&&|\|\||if)/;
|
|
541
|
-
const notifierLookup = new WeakMap();
|
|
542
|
-
const accessorLookup = new WeakMap();
|
|
543
|
-
let watcher = void 0;
|
|
544
|
-
|
|
545
|
-
let createArrayObserver = array => {
|
|
546
|
-
throw new Error("Must call enableArrayObservation before observing arrays.");
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
class DefaultObservableAccessor {
|
|
550
|
-
constructor(name) {
|
|
551
|
-
this.name = name;
|
|
552
|
-
this.field = `_${name}`;
|
|
553
|
-
this.callback = `${name}Changed`;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
getValue(source) {
|
|
557
|
-
if (watcher !== void 0) {
|
|
558
|
-
watcher.watch(source, this.name);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return source[this.field];
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
setValue(source, newValue) {
|
|
565
|
-
const field = this.field;
|
|
566
|
-
const oldValue = source[field];
|
|
567
|
-
|
|
568
|
-
if (oldValue !== newValue) {
|
|
569
|
-
source[field] = newValue;
|
|
570
|
-
const callback = source[this.callback];
|
|
571
|
-
|
|
572
|
-
if (typeof callback === "function") {
|
|
573
|
-
callback.call(source, oldValue, newValue);
|
|
574
|
-
}
|
|
575
|
-
/* eslint-disable-next-line @typescript-eslint/no-use-before-define */
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
getNotifier(source).notify(this.name);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
}
|
|
583
584
|
/**
|
|
584
585
|
* Common Observable APIs.
|
|
585
586
|
* @public
|
|
586
587
|
*/
|
|
587
588
|
|
|
589
|
+
const Observable = FAST.getById(2
|
|
590
|
+
/* observable */
|
|
591
|
+
, () => {
|
|
592
|
+
const volatileRegex = /(:|&&|\|\||if)/;
|
|
593
|
+
const notifierLookup = new WeakMap();
|
|
594
|
+
const accessorLookup = new WeakMap();
|
|
595
|
+
const queueUpdate = DOM.queueUpdate;
|
|
596
|
+
let watcher = void 0;
|
|
597
|
+
|
|
598
|
+
let createArrayObserver = array => {
|
|
599
|
+
throw new Error("Must call enableArrayObservation before observing arrays.");
|
|
600
|
+
};
|
|
588
601
|
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* @internal
|
|
592
|
-
* @param factory - The factory used to create array observers.
|
|
593
|
-
*/
|
|
594
|
-
setArrayObserverFactory(factory) {
|
|
595
|
-
createArrayObserver = factory;
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Gets a notifier for an object or Array.
|
|
600
|
-
* @param source - The object or Array to get the notifier for.
|
|
601
|
-
*/
|
|
602
|
-
getNotifier(source) {
|
|
602
|
+
function getNotifier(source) {
|
|
603
603
|
let found = source.$fastController || notifierLookup.get(source);
|
|
604
604
|
|
|
605
605
|
if (found === void 0) {
|
|
@@ -611,68 +611,9 @@ const Observable = Object.freeze({
|
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
return found;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Records a property change for a source object.
|
|
618
|
-
* @param source - The object to record the change against.
|
|
619
|
-
* @param propertyName - The property to track as changed.
|
|
620
|
-
*/
|
|
621
|
-
track(source, propertyName) {
|
|
622
|
-
if (watcher !== void 0) {
|
|
623
|
-
watcher.watch(source, propertyName);
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Notifies watchers that the currently executing property getter or function is volatile
|
|
629
|
-
* with respect to its observable dependencies.
|
|
630
|
-
*/
|
|
631
|
-
trackVolatile() {
|
|
632
|
-
if (watcher !== void 0) {
|
|
633
|
-
watcher.needsRefresh = true;
|
|
634
|
-
}
|
|
635
|
-
},
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Notifies subscribers of a source object of changes.
|
|
639
|
-
* @param source - the object to notify of changes.
|
|
640
|
-
* @param args - The change args to pass to subscribers.
|
|
641
|
-
*/
|
|
642
|
-
notify(source, args) {
|
|
643
|
-
/* eslint-disable-next-line @typescript-eslint/no-use-before-define */
|
|
644
|
-
getNotifier(source).notify(args);
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Defines an observable property on an object or prototype.
|
|
649
|
-
* @param target - The target object to define the observable on.
|
|
650
|
-
* @param nameOrAccessor - The name of the property to define as observable;
|
|
651
|
-
* or a custom accessor that specifies the property name and accessor implementation.
|
|
652
|
-
*/
|
|
653
|
-
defineProperty(target, nameOrAccessor) {
|
|
654
|
-
if (typeof nameOrAccessor === "string") {
|
|
655
|
-
nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
this.getAccessors(target).push(nameOrAccessor);
|
|
659
|
-
Reflect.defineProperty(target, nameOrAccessor.name, {
|
|
660
|
-
enumerable: true,
|
|
661
|
-
get: function () {
|
|
662
|
-
return nameOrAccessor.getValue(this);
|
|
663
|
-
},
|
|
664
|
-
set: function (newValue) {
|
|
665
|
-
nameOrAccessor.setValue(this, newValue);
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
},
|
|
614
|
+
}
|
|
669
615
|
|
|
670
|
-
|
|
671
|
-
* Finds all the observable accessors defined on the target,
|
|
672
|
-
* including its prototype chain.
|
|
673
|
-
* @param target - The target object to search for accessor on.
|
|
674
|
-
*/
|
|
675
|
-
getAccessors(target) {
|
|
616
|
+
function getAccessors(target) {
|
|
676
617
|
let accessors = accessorLookup.get(target);
|
|
677
618
|
|
|
678
619
|
if (accessors === void 0) {
|
|
@@ -693,33 +634,253 @@ const Observable = Object.freeze({
|
|
|
693
634
|
}
|
|
694
635
|
|
|
695
636
|
return accessors;
|
|
696
|
-
}
|
|
637
|
+
}
|
|
697
638
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
639
|
+
class DefaultObservableAccessor {
|
|
640
|
+
constructor(name) {
|
|
641
|
+
this.name = name;
|
|
642
|
+
this.field = `_${name}`;
|
|
643
|
+
this.callback = `${name}Changed`;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
getValue(source) {
|
|
647
|
+
if (watcher !== void 0) {
|
|
648
|
+
watcher.watch(source, this.name);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
return source[this.field];
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
setValue(source, newValue) {
|
|
655
|
+
const field = this.field;
|
|
656
|
+
const oldValue = source[field];
|
|
657
|
+
|
|
658
|
+
if (oldValue !== newValue) {
|
|
659
|
+
source[field] = newValue;
|
|
660
|
+
const callback = source[this.callback];
|
|
661
|
+
|
|
662
|
+
if (typeof callback === "function") {
|
|
663
|
+
callback.call(source, oldValue, newValue);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
getNotifier(source).notify(this.name);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
class BindingObserverImplementation extends SubscriberSet {
|
|
673
|
+
constructor(binding, initialSubscriber, isVolatileBinding = false) {
|
|
674
|
+
super(binding, initialSubscriber);
|
|
675
|
+
this.binding = binding;
|
|
676
|
+
this.isVolatileBinding = isVolatileBinding;
|
|
677
|
+
this.needsRefresh = true;
|
|
678
|
+
this.needsQueue = true;
|
|
679
|
+
this.first = this;
|
|
680
|
+
this.last = null;
|
|
681
|
+
this.propertySource = void 0;
|
|
682
|
+
this.propertyName = void 0;
|
|
683
|
+
this.notifier = void 0;
|
|
684
|
+
this.next = void 0;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
observe(source, context) {
|
|
688
|
+
if (this.needsRefresh && this.last !== null) {
|
|
689
|
+
this.disconnect();
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const previousWatcher = watcher;
|
|
693
|
+
watcher = this.needsRefresh ? this : void 0;
|
|
694
|
+
this.needsRefresh = this.isVolatileBinding;
|
|
695
|
+
const result = this.binding(source, context);
|
|
696
|
+
watcher = previousWatcher;
|
|
697
|
+
return result;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
disconnect() {
|
|
701
|
+
if (this.last !== null) {
|
|
702
|
+
let current = this.first;
|
|
703
|
+
|
|
704
|
+
while (current !== void 0) {
|
|
705
|
+
current.notifier.unsubscribe(this, current.propertyName);
|
|
706
|
+
current = current.next;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
this.last = null;
|
|
710
|
+
this.needsRefresh = this.needsQueue = true;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
watch(propertySource, propertyName) {
|
|
715
|
+
const prev = this.last;
|
|
716
|
+
const notifier = getNotifier(propertySource);
|
|
717
|
+
const current = prev === null ? this.first : {};
|
|
718
|
+
current.propertySource = propertySource;
|
|
719
|
+
current.propertyName = propertyName;
|
|
720
|
+
current.notifier = notifier;
|
|
721
|
+
notifier.subscribe(this, propertyName);
|
|
722
|
+
|
|
723
|
+
if (prev !== null) {
|
|
724
|
+
if (!this.needsRefresh) {
|
|
725
|
+
// Declaring the variable prior to assignment below circumvents
|
|
726
|
+
// a bug in Angular's optimization process causing infinite recursion
|
|
727
|
+
// of this watch() method. Details https://github.com/microsoft/fast/issues/4969
|
|
728
|
+
let prevValue;
|
|
729
|
+
watcher = void 0;
|
|
730
|
+
/* eslint-disable-next-line */
|
|
731
|
+
|
|
732
|
+
prevValue = prev.propertySource[prev.propertyName];
|
|
733
|
+
watcher = this;
|
|
734
|
+
|
|
735
|
+
if (propertySource === prevValue) {
|
|
736
|
+
this.needsRefresh = true;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
prev.next = current;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
this.last = current;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
handleChange() {
|
|
747
|
+
if (this.needsQueue) {
|
|
748
|
+
this.needsQueue = false;
|
|
749
|
+
queueUpdate(this);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
call() {
|
|
754
|
+
if (this.last !== null) {
|
|
755
|
+
this.needsQueue = true;
|
|
756
|
+
this.notify(this);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
records() {
|
|
761
|
+
let next = this.first;
|
|
762
|
+
return {
|
|
763
|
+
next: () => {
|
|
764
|
+
const current = next;
|
|
765
|
+
|
|
766
|
+
if (current === undefined) {
|
|
767
|
+
return {
|
|
768
|
+
value: void 0,
|
|
769
|
+
done: true
|
|
770
|
+
};
|
|
771
|
+
} else {
|
|
772
|
+
next = next.next;
|
|
773
|
+
return {
|
|
774
|
+
value: current,
|
|
775
|
+
done: false
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
[Symbol.iterator]: function () {
|
|
780
|
+
return this;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
}
|
|
709
784
|
|
|
710
|
-
/**
|
|
711
|
-
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
712
|
-
* on every evaluation of the value.
|
|
713
|
-
* @param binding - The binding to inspect.
|
|
714
|
-
*/
|
|
715
|
-
isVolatileBinding(binding) {
|
|
716
|
-
return volatileRegex.test(binding.toString());
|
|
717
785
|
}
|
|
718
786
|
|
|
787
|
+
return Object.freeze({
|
|
788
|
+
/**
|
|
789
|
+
* @internal
|
|
790
|
+
* @param factory - The factory used to create array observers.
|
|
791
|
+
*/
|
|
792
|
+
setArrayObserverFactory(factory) {
|
|
793
|
+
createArrayObserver = factory;
|
|
794
|
+
},
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Gets a notifier for an object or Array.
|
|
798
|
+
* @param source - The object or Array to get the notifier for.
|
|
799
|
+
*/
|
|
800
|
+
getNotifier,
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Records a property change for a source object.
|
|
804
|
+
* @param source - The object to record the change against.
|
|
805
|
+
* @param propertyName - The property to track as changed.
|
|
806
|
+
*/
|
|
807
|
+
track(source, propertyName) {
|
|
808
|
+
if (watcher !== void 0) {
|
|
809
|
+
watcher.watch(source, propertyName);
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Notifies watchers that the currently executing property getter or function is volatile
|
|
815
|
+
* with respect to its observable dependencies.
|
|
816
|
+
*/
|
|
817
|
+
trackVolatile() {
|
|
818
|
+
if (watcher !== void 0) {
|
|
819
|
+
watcher.needsRefresh = true;
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Notifies subscribers of a source object of changes.
|
|
825
|
+
* @param source - the object to notify of changes.
|
|
826
|
+
* @param args - The change args to pass to subscribers.
|
|
827
|
+
*/
|
|
828
|
+
notify(source, args) {
|
|
829
|
+
getNotifier(source).notify(args);
|
|
830
|
+
},
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Defines an observable property on an object or prototype.
|
|
834
|
+
* @param target - The target object to define the observable on.
|
|
835
|
+
* @param nameOrAccessor - The name of the property to define as observable;
|
|
836
|
+
* or a custom accessor that specifies the property name and accessor implementation.
|
|
837
|
+
*/
|
|
838
|
+
defineProperty(target, nameOrAccessor) {
|
|
839
|
+
if (typeof nameOrAccessor === "string") {
|
|
840
|
+
nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
getAccessors(target).push(nameOrAccessor);
|
|
844
|
+
Reflect.defineProperty(target, nameOrAccessor.name, {
|
|
845
|
+
enumerable: true,
|
|
846
|
+
get: function () {
|
|
847
|
+
return nameOrAccessor.getValue(this);
|
|
848
|
+
},
|
|
849
|
+
set: function (newValue) {
|
|
850
|
+
nameOrAccessor.setValue(this, newValue);
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Finds all the observable accessors defined on the target,
|
|
857
|
+
* including its prototype chain.
|
|
858
|
+
* @param target - The target object to search for accessor on.
|
|
859
|
+
*/
|
|
860
|
+
getAccessors,
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Creates a {@link BindingObserver} that can watch the
|
|
864
|
+
* provided {@link Binding} for changes.
|
|
865
|
+
* @param binding - The binding to observe.
|
|
866
|
+
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
867
|
+
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
868
|
+
*/
|
|
869
|
+
binding(binding, initialSubscriber, isVolatileBinding = this.isVolatileBinding(binding)) {
|
|
870
|
+
return new BindingObserverImplementation(binding, initialSubscriber, isVolatileBinding);
|
|
871
|
+
},
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
875
|
+
* on every evaluation of the value.
|
|
876
|
+
* @param binding - The binding to inspect.
|
|
877
|
+
*/
|
|
878
|
+
isVolatileBinding(binding) {
|
|
879
|
+
return volatileRegex.test(binding.toString());
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
});
|
|
719
883
|
});
|
|
720
|
-
const getNotifier = Observable.getNotifier;
|
|
721
|
-
const trackVolatile = Observable.trackVolatile;
|
|
722
|
-
const queueUpdate = DOM.queueUpdate;
|
|
723
884
|
/**
|
|
724
885
|
* Decorator: Defines an observable property on the target.
|
|
725
886
|
* @param target - The target to define the observable on.
|
|
@@ -741,20 +902,26 @@ function observable(target, nameOrAccessor) {
|
|
|
741
902
|
function volatile(target, name, descriptor) {
|
|
742
903
|
return Object.assign({}, descriptor, {
|
|
743
904
|
get: function () {
|
|
744
|
-
trackVolatile();
|
|
905
|
+
Observable.trackVolatile();
|
|
745
906
|
return descriptor.get.apply(this);
|
|
746
907
|
}
|
|
747
908
|
});
|
|
748
909
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
910
|
+
const contextEvent = FAST.getById(3
|
|
911
|
+
/* contextEvent */
|
|
912
|
+
, () => {
|
|
913
|
+
let current = null;
|
|
914
|
+
return {
|
|
915
|
+
get() {
|
|
916
|
+
return current;
|
|
917
|
+
},
|
|
754
918
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
919
|
+
set(event) {
|
|
920
|
+
current = event;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
};
|
|
924
|
+
});
|
|
758
925
|
/**
|
|
759
926
|
* Provides additional contextual information available to behaviors and expressions.
|
|
760
927
|
* @public
|
|
@@ -788,7 +955,7 @@ class ExecutionContext {
|
|
|
788
955
|
|
|
789
956
|
|
|
790
957
|
get event() {
|
|
791
|
-
return
|
|
958
|
+
return contextEvent.get();
|
|
792
959
|
}
|
|
793
960
|
/**
|
|
794
961
|
* Indicates whether the current item within a repeat context
|
|
@@ -835,6 +1002,16 @@ class ExecutionContext {
|
|
|
835
1002
|
get isLast() {
|
|
836
1003
|
return this.index === this.length - 1;
|
|
837
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Sets the event for the current execution context.
|
|
1007
|
+
* @param event - The event to set.
|
|
1008
|
+
* @internal
|
|
1009
|
+
*/
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
static setEvent(event) {
|
|
1013
|
+
contextEvent.set(event);
|
|
1014
|
+
}
|
|
838
1015
|
|
|
839
1016
|
}
|
|
840
1017
|
Observable.defineProperty(ExecutionContext.prototype, "index");
|
|
@@ -846,127 +1023,6 @@ Observable.defineProperty(ExecutionContext.prototype, "length");
|
|
|
846
1023
|
|
|
847
1024
|
const defaultExecutionContext = Object.seal(new ExecutionContext());
|
|
848
1025
|
|
|
849
|
-
class BindingObserverImplementation extends SubscriberSet {
|
|
850
|
-
constructor(binding, initialSubscriber, isVolatileBinding = false) {
|
|
851
|
-
super(binding, initialSubscriber);
|
|
852
|
-
this.binding = binding;
|
|
853
|
-
this.isVolatileBinding = isVolatileBinding;
|
|
854
|
-
this.needsRefresh = true;
|
|
855
|
-
this.needsQueue = true;
|
|
856
|
-
this.first = this;
|
|
857
|
-
this.last = null;
|
|
858
|
-
this.propertySource = void 0;
|
|
859
|
-
this.propertyName = void 0;
|
|
860
|
-
this.notifier = void 0;
|
|
861
|
-
this.next = void 0;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
observe(source, context) {
|
|
865
|
-
if (this.needsRefresh && this.last !== null) {
|
|
866
|
-
this.disconnect();
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
const previousWatcher = watcher;
|
|
870
|
-
watcher = this.needsRefresh ? this : void 0;
|
|
871
|
-
this.needsRefresh = this.isVolatileBinding;
|
|
872
|
-
const result = this.binding(source, context);
|
|
873
|
-
watcher = previousWatcher;
|
|
874
|
-
return result;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
disconnect() {
|
|
878
|
-
if (this.last !== null) {
|
|
879
|
-
let current = this.first;
|
|
880
|
-
|
|
881
|
-
while (current !== void 0) {
|
|
882
|
-
current.notifier.unsubscribe(this, current.propertyName);
|
|
883
|
-
current = current.next;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
this.last = null;
|
|
887
|
-
this.needsRefresh = this.needsQueue = true;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
/** @internal */
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
watch(propertySource, propertyName) {
|
|
894
|
-
const prev = this.last;
|
|
895
|
-
const notifier = getNotifier(propertySource);
|
|
896
|
-
const current = prev === null ? this.first : {};
|
|
897
|
-
current.propertySource = propertySource;
|
|
898
|
-
current.propertyName = propertyName;
|
|
899
|
-
current.notifier = notifier;
|
|
900
|
-
notifier.subscribe(this, propertyName);
|
|
901
|
-
|
|
902
|
-
if (prev !== null) {
|
|
903
|
-
if (!this.needsRefresh) {
|
|
904
|
-
// Declaring the variable prior to assignment below circumvents
|
|
905
|
-
// a bug in Angular's optimization process causing infinite recursion
|
|
906
|
-
// of this watch() method. Details https://github.com/microsoft/fast/issues/4969
|
|
907
|
-
let prevValue;
|
|
908
|
-
watcher = void 0;
|
|
909
|
-
/* eslint-disable-next-line */
|
|
910
|
-
|
|
911
|
-
prevValue = prev.propertySource[prev.propertyName];
|
|
912
|
-
watcher = this;
|
|
913
|
-
|
|
914
|
-
if (propertySource === prevValue) {
|
|
915
|
-
this.needsRefresh = true;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
prev.next = current;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
this.last = current;
|
|
923
|
-
}
|
|
924
|
-
/** @internal */
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
handleChange() {
|
|
928
|
-
if (this.needsQueue) {
|
|
929
|
-
this.needsQueue = false;
|
|
930
|
-
queueUpdate(this);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
/** @internal */
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
call() {
|
|
937
|
-
if (this.last !== null) {
|
|
938
|
-
this.needsQueue = true;
|
|
939
|
-
this.notify(this);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
records() {
|
|
944
|
-
let next = this.first;
|
|
945
|
-
return {
|
|
946
|
-
next: () => {
|
|
947
|
-
const current = next;
|
|
948
|
-
|
|
949
|
-
if (current === undefined) {
|
|
950
|
-
return {
|
|
951
|
-
value: void 0,
|
|
952
|
-
done: true
|
|
953
|
-
};
|
|
954
|
-
} else {
|
|
955
|
-
next = next.next;
|
|
956
|
-
return {
|
|
957
|
-
value: current,
|
|
958
|
-
done: false
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
[Symbol.iterator]: function () {
|
|
963
|
-
return this;
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
}
|
|
969
|
-
|
|
970
1026
|
/**
|
|
971
1027
|
* Instructs the template engine to apply behavior to a node.
|
|
972
1028
|
* @public
|
|
@@ -1329,9 +1385,9 @@ class BindingBehavior {
|
|
|
1329
1385
|
|
|
1330
1386
|
|
|
1331
1387
|
handleEvent(event) {
|
|
1332
|
-
|
|
1388
|
+
ExecutionContext.setEvent(event);
|
|
1333
1389
|
const result = this.binding(this.source, this.context);
|
|
1334
|
-
|
|
1390
|
+
ExecutionContext.setEvent(null);
|
|
1335
1391
|
|
|
1336
1392
|
if (result !== true) {
|
|
1337
1393
|
event.preventDefault();
|
|
@@ -2327,7 +2383,26 @@ const defaultShadowOptions = {
|
|
|
2327
2383
|
mode: "open"
|
|
2328
2384
|
};
|
|
2329
2385
|
const defaultElementOptions = {};
|
|
2330
|
-
const
|
|
2386
|
+
const fastRegistry = FAST.getById(4
|
|
2387
|
+
/* elementRegistry */
|
|
2388
|
+
, () => {
|
|
2389
|
+
const typeToDefinition = new Map();
|
|
2390
|
+
return Object.freeze({
|
|
2391
|
+
register(definition) {
|
|
2392
|
+
if (typeToDefinition.has(definition.type)) {
|
|
2393
|
+
return false;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
typeToDefinition.set(definition.type, definition);
|
|
2397
|
+
return true;
|
|
2398
|
+
},
|
|
2399
|
+
|
|
2400
|
+
getByType(key) {
|
|
2401
|
+
return typeToDefinition.get(key);
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
});
|
|
2405
|
+
});
|
|
2331
2406
|
/**
|
|
2332
2407
|
* Defines metadata for a FASTElement.
|
|
2333
2408
|
* @public
|
|
@@ -2370,6 +2445,14 @@ class FASTElementDefinition {
|
|
|
2370
2445
|
this.elementOptions = nameOrConfig.elementOptions === void 0 ? defaultElementOptions : Object.assign(Object.assign({}, defaultElementOptions), nameOrConfig.elementOptions);
|
|
2371
2446
|
this.styles = nameOrConfig.styles === void 0 ? void 0 : Array.isArray(nameOrConfig.styles) ? ElementStyles.create(nameOrConfig.styles) : nameOrConfig.styles instanceof ElementStyles ? nameOrConfig.styles : ElementStyles.create([nameOrConfig.styles]);
|
|
2372
2447
|
}
|
|
2448
|
+
/**
|
|
2449
|
+
* Indicates if this element has been defined in at least one registry.
|
|
2450
|
+
*/
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
get isDefined() {
|
|
2454
|
+
return !!fastRegistry.getByType(this.type);
|
|
2455
|
+
}
|
|
2373
2456
|
/**
|
|
2374
2457
|
* Defines a custom element based on this definition.
|
|
2375
2458
|
* @param registry - The element registry to define the element in.
|
|
@@ -2379,7 +2462,7 @@ class FASTElementDefinition {
|
|
|
2379
2462
|
define(registry = customElements) {
|
|
2380
2463
|
const type = this.type;
|
|
2381
2464
|
|
|
2382
|
-
if (
|
|
2465
|
+
if (fastRegistry.register(this)) {
|
|
2383
2466
|
const attributes = this.attributes;
|
|
2384
2467
|
const proto = type.prototype;
|
|
2385
2468
|
|
|
@@ -2391,8 +2474,6 @@ class FASTElementDefinition {
|
|
|
2391
2474
|
value: this.observedAttributes,
|
|
2392
2475
|
enumerable: true
|
|
2393
2476
|
});
|
|
2394
|
-
fastDefinitions.set(type, this);
|
|
2395
|
-
this.isDefined = true;
|
|
2396
2477
|
}
|
|
2397
2478
|
|
|
2398
2479
|
if (!registry.get(this.name)) {
|
|
@@ -2401,17 +2482,14 @@ class FASTElementDefinition {
|
|
|
2401
2482
|
|
|
2402
2483
|
return this;
|
|
2403
2484
|
}
|
|
2404
|
-
/**
|
|
2405
|
-
* Gets the element definition associated with the specified type.
|
|
2406
|
-
* @param type - The custom element type to retrieve the definition for.
|
|
2407
|
-
*/
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
static forType(type) {
|
|
2411
|
-
return fastDefinitions.get(type);
|
|
2412
|
-
}
|
|
2413
2485
|
|
|
2414
2486
|
}
|
|
2487
|
+
/**
|
|
2488
|
+
* Gets the element definition associated with the specified type.
|
|
2489
|
+
* @param type - The custom element type to retrieve the definition for.
|
|
2490
|
+
*/
|
|
2491
|
+
|
|
2492
|
+
FASTElementDefinition.forType = fastRegistry.getByType;
|
|
2415
2493
|
|
|
2416
2494
|
const shadowRoots = new WeakMap();
|
|
2417
2495
|
const defaultEventOptions = {
|
|
@@ -6698,4 +6776,4 @@ class RouterConfiguration {
|
|
|
6698
6776
|
let FASTRouter = class FASTRouter extends Router.from(FASTElement) {};
|
|
6699
6777
|
FASTRouter = __decorate([customElement("fast-router")], FASTRouter);
|
|
6700
6778
|
|
|
6701
|
-
export { $global, AttachedBehaviorHTMLDirective, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, ConfigurableRoute, Controller, DOM, DefaultLinkHandler, DefaultNavigationProcess, DefaultNavigationQueue, DefaultRouteRecognizer, DefaultRouter, ElementStyles, Endpoint, ExecutionContext, FASTElement, FASTElementDefinition, FASTElementLayout, FASTRouter, HTMLBindingDirective, HTMLDirective, HTMLView, Ignore, Layout, NavigationHandler, NavigationMessage, Observable, PropertyChangeNotifier, QueryString, RecognizedRoute, Redirect, RefBehavior, Render, RepeatBehavior, RepeatDirective, Route, RouteCollection, Router, RouterConfiguration, RouterExecutionContext, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, Transition, ViewTemplate, attr, booleanConverter, childRouteParameter, children, compileTemplate, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, isFASTElementHost, isNavigationPhaseContributor, navigationContributor, nullableNumberConverter, observable, ref, repeat,
|
|
6779
|
+
export { $global, AttachedBehaviorHTMLDirective, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, ConfigurableRoute, Controller, DOM, DefaultLinkHandler, DefaultNavigationProcess, DefaultNavigationQueue, DefaultRouteRecognizer, DefaultRouter, ElementStyles, Endpoint, ExecutionContext, FAST, FASTElement, FASTElementDefinition, FASTElementLayout, FASTRouter, HTMLBindingDirective, HTMLDirective, HTMLView, Ignore, Layout, NavigationHandler, NavigationMessage, Observable, PropertyChangeNotifier, QueryString, RecognizedRoute, Redirect, RefBehavior, Render, RepeatBehavior, RepeatDirective, Route, RouteCollection, Router, RouterConfiguration, RouterExecutionContext, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, Transition, ViewTemplate, attr, booleanConverter, childRouteParameter, children, compileTemplate, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, isFASTElementHost, isNavigationPhaseContributor, navigationContributor, nullableNumberConverter, observable, ref, repeat, slotted, volatile, when };
|
package/dist/fast-router.min.js
CHANGED
|
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
function t(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function l(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}a((s=s.apply(t,e||[])).next())}))}const e=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===e.trustedTypes&&(e.trustedTypes={createPolicy:(t,e)=>e});const i=Object.freeze([]),s=[],n=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let r=n;const o=[];function l(){if(o.length)throw o.shift()}function a(t){try{t.call()}catch(t){o.push(t),setTimeout(l,0)}}const h="fast-"+Math.random().toString(36).substring(2,8),c=h+"{",u="}"+h,d=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(r!==n)throw new Error("The HTML policy can only be set once.");r=t},createHTML:t=>r.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(h),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(h+":","")),createInterpolationPlaceholder:t=>`${c}${t}${u}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${h}:${t}--\x3e`,queueUpdate(t){s.length<1&&window.requestAnimationFrame(d.processUpdates),s.push(t)},processUpdates(){let t=0;for(;t<s.length;)if(a(s[t]),t++,t>1024){for(let e=0,i=s.length-t;e<i;e++)s[e]=s[e+t];s.length-=t,t=0}s.length=0},nextUpdate:()=>new Promise(t=>{d.queueUpdate(t)}),setAttribute(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)},setBooleanAttribute(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});function f(t){const e=this.spillover;-1===e.indexOf(t)&&e.push(t)}function p(t){const e=this.spillover,i=e.indexOf(t);-1!==i&&e.splice(i,1)}function g(t){const e=this.spillover,i=this.source;for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}function v(t){return-1!==this.spillover.indexOf(t)}class m{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return this.sub1===t||this.sub2===t}subscribe(t){this.has(t)||(void 0!==this.sub1?void 0!==this.sub2?(this.spillover=[this.sub1,this.sub2,t],this.subscribe=f,this.unsubscribe=p,this.notify=g,this.has=v,this.sub1=void 0,this.sub2=void 0):this.sub2=t:this.sub1=t)}unsubscribe(t){this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0)}notify(t){const e=this.sub1,i=this.sub2,s=this.source;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}}class b{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const i=this.subscribers[t];void 0!==i&&i.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var i;if(e){let i=this.subscribers[e];void 0===i&&(this.subscribers[e]=i=new m(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new m(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var i;if(e){const i=this.subscribers[e];void 0!==i&&i.unsubscribe(t)}else null===(i=this.sourceSubscribers)||void 0===i||i.unsubscribe(t)}}const y=/(:|&&|\|\||if)/,C=new WeakMap,w=new WeakMap;let S=void 0,x=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};class O{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==S&&S.watch(t,this.name),t[this.field]}setValue(t,e){const i=this.field,s=t[i];if(s!==e){t[i]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,s,e),k(t).notify(this.name)}}}const T=Object.freeze({setArrayObserverFactory(t){x=t},getNotifier(t){let e=t.$fastController||C.get(t);return void 0===e&&(Array.isArray(t)?e=x(t):C.set(t,e=new b(t))),e},track(t,e){void 0!==S&&S.watch(t,e)},trackVolatile(){void 0!==S&&(S.needsRefresh=!0)},notify(t,e){k(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new O(e)),this.getAccessors(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors(t){let e=w.get(t);if(void 0===e){let i=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==i;)e=w.get(i),i=Reflect.getPrototypeOf(i);e=void 0===e?[]:e.slice(0),w.set(t,e)}return e},binding(t,e,i=this.isVolatileBinding(t)){return new F(t,e,i)},isVolatileBinding:t=>y.test(t.toString())}),k=T.getNotifier,N=T.trackVolatile,B=d.queueUpdate;function A(t,e){T.defineProperty(t,e)}function $(t,e,i){return Object.assign({},i,{get:function(){return N(),i.get.apply(this)}})}let R=null;function P(t){R=t}class V{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return R}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}}T.defineProperty(V.prototype,"index"),T.defineProperty(V.prototype,"length");const E=Object.seal(new V);class F extends m{constructor(t,e,i=!1){super(t,e),this.binding=t,this.isVolatileBinding=i,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const i=S;S=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return S=i,s}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const i=this.last,s=k(t),n=null===i?this.first:{};if(n.propertySource=t,n.propertyName=e,n.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;S=void 0,e=i.propertySource[i.propertyName],S=this,t===e&&(this.needsRefresh=!0)}i.next=n}this.last=n}handleChange(){this.needsQueue&&(this.needsQueue=!1,B(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}class j{constructor(){this.targetIndex=0}}class z extends j{constructor(){super(...arguments),this.createPlaceholder=d.createInterpolationPlaceholder}}class M extends j{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return d.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function I(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=T.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function _(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function L(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function q(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function H(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function D(t){d.setAttribute(this.target,this.targetName,t)}function Q(t){d.setBooleanAttribute(this.target,this.targetName,t)}function U(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function W(t){this.target[this.targetName]=t}function K(t){const e=this.classVersions||Object.create(null),i=this.target;let s=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=s,i.classList.add(r))}}if(this.classVersions=e,this.version=s+1,0!==s){s-=1;for(const t in e)e[t]===s&&i.classList.remove(t)}}class J extends z{constructor(t){super(),this.binding=t,this.bind=I,this.unbind=L,this.updateTarget=D,this.isBindingVolatile=T.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=W,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>d.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=Q;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=_,this.unbind=H;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=K)}}targetAtContent(){this.updateTarget=U,this.unbind=q}createBehavior(t){return new G(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class G{constructor(t,e,i,s,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=i,this.bind=s,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){P(t);const e=this.binding(this.source,this.context);P(null),!0!==e&&t.preventDefault()}}let X=null;class Y{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){X=this}static borrow(t){const e=X||new Y;return e.directives=t,e.reset(),X=null,e}}function Z(t){if(1===t.length)return t[0];let e;const i=t.length,s=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new J((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const tt=u.length;function et(t,e){const i=e.split(c);if(1===i.length)return null;const s=[];for(let e=0,n=i.length;e<n;++e){const n=i[e],r=n.indexOf(u);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+tt)}""!==o&&s.push(o)}return s}function it(t,e,i=!1){const s=e.attributes;for(let n=0,r=s.length;n<r;++n){const o=s[n],l=o.value,a=et(t,l);let h=null;null===a?i&&(h=new J(()=>l),h.targetName=o.name):h=Z(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function st(t,e,i){const s=et(t,e.textContent);if(null!==s){let n=e;for(let r=0,o=s.length;r<o;++r){const o=s[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&i.nextNode()}t.targetIndex--}}function nt(t,e){const i=t.content;document.adoptNode(i);const s=Y.borrow(e);it(s,t,!0);const n=s.behaviorFactories;s.reset();const r=d.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:it(s,o);break;case 3:st(s,o,r);break;case 8:d.isMarker(o)&&s.addFactory(e[d.extractDirectiveIndexFromMarker(o)])}let l=0;(d.isMarker(i.firstChild)||1===i.childNodes.length&&e.length)&&(i.insertBefore(document.createComment(""),i.firstChild),l=-1);const a=s.behaviorFactories;return s.release(),{fragment:i,viewBehaviorFactories:a,hostBehaviorFactories:n,targetOffset:l}}const rt=document.createRange();class ot{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,i=this.lastChild;let s,n=this.firstChild;for(;n!==i;)s=n.nextSibling,e.insertBefore(n,t),n=s;e.insertBefore(i,t)}}remove(){const t=this.fragment,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.appendChild(s),s=i;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.removeChild(s),s=i;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const i=this.behaviors;if(this.source!==t)if(null!==this.source){const s=this.source;this.source=t,this.context=e;for(let n=0,r=i.length;n<r;++n){const r=i[n];r.unbind(s),r.bind(t,e)}}else{this.source=t,this.context=e;for(let s=0,n=i.length;s<n;++s)i[s].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let i=0,s=t.length;i<s;++i)t[i].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){rt.setStartBefore(t[0].firstChild),rt.setEndAfter(t[t.length-1].lastChild),rt.deleteContents();for(let e=0,i=t.length;e<i;++e){const i=t[e],s=i.behaviors,n=i.source;for(let t=0,e=s.length;t<e;++t)s[t].unbind(n)}}}}class lt{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=d.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=nt(t,this.directives);this.fragment=i.fragment,this.viewBehaviorFactories=i.viewBehaviorFactories,this.hostBehaviorFactories=i.hostBehaviorFactories,this.targetOffset=i.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),i=this.viewBehaviorFactories,s=new Array(this.behaviorCount),n=d.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=i.length;r<t;++r){const t=i[r],e=t.targetIndex;for(;null!==l;){if(o===e){s[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let i=0,n=e.length;i<n;++i,++r)s[r]=e[i].createBehavior(t)}return new ot(e,s)}render(t,e,i){"string"==typeof e&&(e=document.getElementById(e)),void 0===i&&(i=e);const s=this.create(i);return s.bind(t,E),s.appendTo(e),s}}const at=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function ht(t,...e){const i=[];let s="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(s+=r,o instanceof lt){const t=o;o=()=>t}if("function"==typeof o&&(o=new J(o)),o instanceof z){const t=at.exec(r);null!==t&&(o.targetName=t[2])}o instanceof j?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new lt(s,i)}class ct{constructor(){this.targets=new WeakSet,this.behaviors=null}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function ut(t){return t.map(t=>t instanceof ct?ut(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function dt(t){return t.map(t=>t instanceof ct?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}ct.create=(()=>{if(d.supportsAdoptedStyleSheets){const t=new Map;return e=>new ft(e,t)}return t=>new gt(t)})();class ft extends ct{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=dt(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=ut(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let i=e.get(t);return void 0===i&&(i=new CSSStyleSheet,i.replaceSync(t),e.set(t,i)),i})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let pt=0;class gt extends ct{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=dt(t),this.styleSheets=ut(t),this.styleClass="fast-style-class-"+ ++pt}addStylesTo(t){const e=this.styleSheets,i=this.styleClass;t=this.normalizeTarget(t);for(let s=0;s<e.length;s++){const n=document.createElement("style");n.innerHTML=e[s],n.className=i,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let i=0,s=e.length;i<s;++i)t.removeChild(e[i]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const vt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},mt={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class bt{constructor(t,e,i=e.toLowerCase(),s="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=i,this.mode=s,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===s&&void 0===n&&(this.converter=vt)}setValue(t,e){const i=t[this.fieldName],s=this.converter;void 0!==s&&(e=s.fromView(e)),i!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](i,e),t.$fastController.notify(this.name))}getValue(t){return T.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,i=this.guards;i.has(t)||"fromView"===e||d.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;d.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":d.setBooleanAttribute(t,this.attribute,s)}i.delete(t)})}static collect(t,...e){const i=[];e.push(t.attributes);for(let s=0,n=e.length;s<n;++s){const n=e[s];if(void 0!==n)for(let e=0,s=n.length;e<s;++e){const s=n[e];"string"==typeof s?i.push(new bt(t,s)):i.push(new bt(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function yt(t,e){let i;function s(t,e){arguments.length>1&&(i.property=e);const s=t.constructor.attributes||(t.constructor.attributes=[]);s.push(i)}return arguments.length>1?(i={},void s(t,e)):(i=void 0===t?{}:t,s)}const Ct={mode:"open"},wt={},St=new Map;class xt{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=bt.collect(t,e.attributes),s=new Array(i.length),n={},r={};for(let t=0,e=i.length;t<e;++t){const e=i[t];s[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=i,this.observedAttributes=s,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?Ct:null===e.shadowOptions?void 0:Object.assign(Object.assign({},Ct),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?wt:Object.assign(Object.assign({},wt),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?ct.create(e.styles):e.styles instanceof ct?e.styles:ct.create([e.styles])}define(t=customElements){const e=this.type;if(!this.isDefined){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)T.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0}),St.set(e,this),this.isDefined=!0}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}static forType(t){return St.get(t)}}const Ot=new WeakMap,Tt={bubbles:!0,composed:!0,cancelable:!0};function kt(t){return t.shadowRoot||Ot.get(t)||null}class Nt extends b{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const i=e.shadowOptions;if(void 0!==i){const e=t.attachShadow(i);"closed"===i.mode&&Ot.set(t,e)}const s=T.getAccessors(t);if(s.length>0){const e=this.boundObservables=Object.create(null);for(let i=0,n=s.length;i<n;++i){const n=s[i].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return T.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,T.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=kt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const i=t.behaviors;t.addStylesTo(e),null!==i&&this.addBehaviors(i)}}removeStyles(t){const e=kt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const i=t.behaviors;t.removeStylesFrom(e),null!==i&&this.removeBehaviors(i)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),i=t.length,s=[];for(let n=0;n<i;++n){const i=t[n];e.has(i)?e.set(i,e.get(i)+1):(e.set(i,1),s.push(i))}if(this._isConnected){const t=this.element;for(let e=0;e<s.length;++e)s[e].bind(t,E)}}removeBehaviors(t,e=!1){const i=this.behaviors;if(null===i)return;const s=t.length,n=[];for(let r=0;r<s;++r){const s=t[r];if(i.has(s)){const t=i.get(s)-1;0===t||e?i.delete(s)&&n.push(s):i.set(s,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,E);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,E);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[i]of e)i.unbind(t)}}onAttributeChangedCallback(t,e,i){const s=this.definition.attributeLookup[t];void 0!==s&&s.onAttributeChangedCallback(this.element,i)}emit(t,e,i){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},Tt),i)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const i=Object.keys(e);for(let s=0,n=i.length;s<n;++s){const n=i[s];t[n]=e[n]}this.boundObservables=null}const i=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():i.template&&(this._template=i.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():i.styles&&(this._styles=i.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,i=kt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||d.removeChildNodes(i),t&&(this.view=t.render(e,i,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const i=xt.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new Nt(t,i)}}function Bt(t){return class extends t{constructor(){super(),Nt.forCustomElement(this)}$emit(t,e,i){return this.$fastController.emit(t,e,i)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,i){this.$fastController.onAttributeChangedCallback(t,e,i)}}}const At=Object.assign(Bt(HTMLElement),{from:t=>Bt(t),define:(t,e)=>new xt(t,e).define().type});function $t(t){return function(e){new xt(e,t).define()}}class Rt{createCSS(){return""}createBehavior(){}}function Pt(t,e){const i=[];let s="";const n=[];for(let r=0,o=t.length-1;r<o;++r){s+=t[r];let o=e[r];if(o instanceof Rt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof ct||o instanceof CSSStyleSheet?(""!==s.trim()&&(i.push(s),s=""),i.push(o)):s+=o}return s+=t[t.length-1],""!==s.trim()&&i.push(s),{styles:i,behaviors:n}}function Vt(t,...e){const{styles:i,behaviors:s}=Pt(t,e),n=ct.create(i);return s.length&&n.withBehaviors(...s),n}class Et extends Rt{constructor(t,e){super(),this.behaviors=e,this.css="";const i=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);i.length&&(this.styles=ct.create(i))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function Ft(t,...e){const{styles:i,behaviors:s}=Pt(t,e);return new Et(i,s)}function jt(t,e,i){return{index:t,removed:e,addedCount:i}}function zt(t,e,s,n,r,o){let l=0,a=0;const h=Math.min(s-e,o-r);if(0===e&&0===r&&(l=function(t,e,i){for(let s=0;s<i;++s)if(t[s]!==e[s])return s;return i}(t,n,h)),s===t.length&&o===n.length&&(a=function(t,e,i){let s=t.length,n=e.length,r=0;for(;r<i&&t[--s]===e[--n];)r++;return r}(t,n,h-l)),r+=l,o-=a,(s-=a)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=jt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[jt(e,[],s-e)];const c=function(t){let e=t.length-1,i=t[0].length-1,s=t[e][i];const n=[];for(;e>0||i>0;){if(0===e){n.push(2),i--;continue}if(0===i){n.push(3),e--;continue}const r=t[e-1][i-1],o=t[e-1][i],l=t[e][i-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===s?n.push(0):(n.push(1),s=r),e--,i--):a===o?(n.push(3),e--,s=o):(n.push(2),i--,s=l)}return n.reverse(),n}(function(t,e,i,s,n,r){const o=r-n+1,l=i-e+1,a=new Array(o);let h,c;for(let t=0;t<o;++t)a[t]=new Array(l),a[t][0]=t;for(let t=0;t<l;++t)a[0][t]=t;for(let i=1;i<o;++i)for(let r=1;r<l;++r)t[e+r-1]===s[n+i-1]?a[i][r]=a[i-1][r-1]:(h=a[i-1][r]+1,c=a[i][r-1]+1,a[i][r]=h<c?h:c);return a}(t,e,s,n,r,o)),u=[];let d=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==d&&(u.push(d),d=void 0),f++,p++;break;case 1:void 0===d&&(d=jt(f,[],0)),d.addedCount++,f++,d.removed.push(n[p]),p++;break;case 2:void 0===d&&(d=jt(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=jt(f,[],0)),d.removed.push(n[p]),p++}return void 0!==d&&u.push(d),u}const Mt=Array.prototype.push;function It(t,e,i,s){const n=jt(e,i,s);let r=!1,o=0;for(let e=0;e<t.length;e++){const i=t[e];if(i.index+=o,r)continue;const s=(l=n.index,a=n.index+n.removed.length,h=i.index,c=i.index+i.addedCount,a<h||c<l?-1:a===h||c===l?0:l<h?a<c?a-h:c-h:c<a?c-l:a-l);if(s>=0){t.splice(e,1),e--,o-=i.addedCount-i.removed.length,n.addedCount+=i.addedCount-s;const l=n.removed.length+i.removed.length-s;if(n.addedCount||l){let t=i.removed;if(n.index<i.index){const e=n.removed.slice(0,i.index-n.index);Mt.apply(e,t),t=e}if(n.index+n.removed.length>i.index+i.addedCount){const e=n.removed.slice(i.index+i.addedCount-n.index);Mt.apply(t,e)}n.removed=t,i.index<n.index&&(n.index=i.index)}else r=!0}else if(n.index<i.index){r=!0,t.splice(e,0,n),e++;const s=n.addedCount-n.removed.length;i.index+=s,o+=s}}var l,a,h,c;r||t.push(n)}function _t(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];It(e,s.index,s.removed,s.addedCount)}return e}(e);for(let e=0,n=s.length;e<n;++e){const n=s[e];1!==n.addedCount||1!==n.removed.length?i=i.concat(zt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&i.push(n)}return i}let Lt=!1;function qt(t,e){let i=t.index;const s=e.length;return i>s?i=s-t.addedCount:i<0&&(i=s+t.removed.length+i-t.addedCount),i<0&&(i=0),t.index=i,t}class Ht extends m{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const i=void 0===e?_t(this.source,t):zt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Dt(){if(Lt)return;Lt=!0,T.setArrayObserverFactory(t=>new Ht(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,i=t.push,s=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,i=e.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(jt(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(qt(jt(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=s.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(jt(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=r.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(qt(jt(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(qt(jt(0,[],arguments.length),this)),t}}class Qt{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Ut(t){return new M("fast-ref",Qt,t)}function Wt(t,e){const i="function"==typeof e?e:()=>e;return(e,s)=>t(e,s)?i(e,s):null}const Kt=Object.freeze({positioning:!1,recycle:!0});function Jt(t,e,i,s){t.bind(e[i],s)}function Gt(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Xt{constructor(t,e,i,s,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=s,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=Jt,this.itemsBindingObserver=T.binding(e,this,i),this.templateBindingObserver=T.binding(s,this,n),r.positioning&&(this.bindView=Gt)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=i);const e=this.itemsObserver,s=this.itemsObserver=T.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.subscribe(this)}updateViews(t){const e=this.childContext,i=this.views,s=[],n=this.bindView;let r=0;for(let e=0,n=t.length;e<n;++e){const n=t[e],o=n.removed;s.push(...i.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,a=t.length;r<a;++r){const a=t[r];let h=a.index;const c=h+a.addedCount;for(;h<c;++h){const t=i[h],r=t?t.firstChild:this.location,a=this.options.recycle&&s.length>0?s.shift():l.create();i.splice(h,0,a),n(a,o,h,e),a.insertBefore(r)}}for(let t=0,e=s.length;t<e;++t)s[t].dispose();if(this.options.positioning)for(let t=0,e=i.length;t<e;++t){const s=i[t].context;s.length=e,s.index=t}}refreshAllViews(t=!1){const e=this.items,i=this.childContext,s=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,a=l.length;if((0===o||t)&&(ot.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();r(o,e,t,i),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<a){r(l[t],e,t,i)}else{const o=s.create();r(o,e,t,i),l.push(o),o.insertBefore(n)}const h=l.splice(t,a-t);for(t=0,o=h.length;t<o;++t)h[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,i=t.length;e<i;++e)t[e].unbind()}}class Yt extends j{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=d.createBlockPlaceholder,Dt(),this.isItemsBindingVolatile=T.isVolatileBinding(t),this.isTemplateBindingVolatile=T.isVolatileBinding(e)}createBehavior(t){return new Xt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Zt(t,e,i=Kt){return new Yt(t,"function"==typeof e?e:()=>e,i)}function te(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class ee{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=T.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class ie extends ee{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function se(t){return"string"==typeof t&&(t={property:t}),new M("fast-slotted",ie,t)}class ne extends ee{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function re(t){return"string"==typeof t&&(t={property:t}),new M("fast-children",ne,t)}class oe{constructor(t){this.path=t}}const le=new Set,ae=Object.freeze({register(t){le.add(t)},unregister(t){le.delete(t)}}),he=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ce=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Ie.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromPath(i,s);if(null!==e)return e;t=t.parent}return null}))},push(t,e=!0){t&&he.test(t)?location.href=t:(history.pushState({},document.title,t),e&&ce.path.trigger(t))},replace(t,e=!0){t&&he.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&ce.path.trigger(t))},trigger(t){const e=new oe(t);for(const t of le)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Ie.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromName(i,s);if(null!==e)return e;t=t.parent}return null}))},push(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield ce.name.generateRoute(e,i,s);null!==t&&ce.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield ce.name.generateRoute(e,i,s);null!==t&&ce.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield ce.name.generateRoute(e,i,s);null!==t&&ce.path.trigger(t)}))}})});class ue{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new oe(ce.path.current)),window.addEventListener("popstate",this),ae.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),ae.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(t=>this.resolve=t),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(t){this.queue.push(t),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const t=this.queue[this.queue.length-1],e=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,e(t)}handleEvent(t){this.enqueue(new oe(ce.path.current))}}const de=encodeURIComponent,fe=t=>de(t).replace("%24","$");function pe(t,e,i){let s=[];if(null==e)return s;if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)if(i)s.push(`${fe(t)}=${de(e[n])}`);else{const i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(pe(i,e[n]))}else if("object"!=typeof e||i)s.push(`${fe(t)}=${de(e)}`);else for(const i in e)s=s.concat(pe(t+"["+i+"]",e[i]));return s}function ge(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function ve(t,e,i){let s=t;const n=e.length-1;for(let t=0;t<=n;t++){const r=""===e[t]?s.length:e[t];if(t<n){const i=s[r]&&"object"!=typeof s[r]?[s[r]]:s[r];s=s[r]=i||(isNaN(e[t+1])?{}:[])}else s=s[r]=i}}const me=Object.freeze({get current(){return location.search},build(t,e){let i=[];const s=Object.keys(t||{}).sort();for(let n=0,r=s.length;n<r;n++){const r=s[n];i=i.concat(pe(r,t[r],e))}return 0===i.length?"":i.join("&")},separate(t){const e=t.indexOf("?");let i="";return-1!==e&&(i=t.substr(e+1,t.length),t=t.substr(0,e)),{path:t,queryString:i}},parse(t){const e={};if(!t||"string"!=typeof t)return e;let i=t;"?"===i.charAt(0)&&(i=i.substr(1));const s=i.replace(/\+/g," ").split("&");for(let t=0;t<s.length;t++){const i=s[t].split("="),n=decodeURIComponent(i[0]);if(!n)continue;let r=n.split("]["),o=r.length-1;if(/\[/.test(r[0])&&/\]$/.test(r[o])?(r[o]=r[o].replace(/\]$/,""),r=r.shift().split("[").concat(r),o=r.length-1):o=0,i.length>=2){const t=i[1]?decodeURIComponent(i[1]):"";o?ve(e,r,t):e[n]=ge(e[n],t)}else e[n]=!0}return e}}),be=t=>t;class ye{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class Ce{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class we{constructor(t,e,i,s){this.endpoint=t,this.params=e,this.typedParams=i,this.queryParams=s,this.allParams=Object.assign(Object.assign({},e),s),this.allTypedParams=Object.assign(Object.assign({},i),s)}get settings(){return this.endpoint.settings}}class Se{constructor(t,e,i,s){var n;this.chars=t,this.states=e,this.skippedStates=i,this.result=s,this.head=e[e.length-1],this.endpoint=null===(n=this.head)||void 0===n?void 0:n.endpoint}advance(t){const{chars:e,states:i,skippedStates:s,result:n}=this;let r=null,o=0;const l=i[i.length-1];function a(h,c){if(h.isMatch(t)&&(1==++o?r=h:n.add(new Se(e.concat(t),i.concat(h),null===c?s:s.concat(c),n))),null===l.segment&&h.isOptional&&null!==h.nextStates){if(h.nextStates.length>1)throw new Error(h.nextStates.length+" nextStates");const t=h.nextStates[0];if(!t.isSeparator)throw new Error("Not a separator");if(null!==t.nextStates)for(const e of t.nextStates)a(e,h)}}if(l.isDynamic&&a(l,null),null!==l.nextStates)for(const t of l.nextStates)a(t,null);null!==r&&(i.push(this.head=r),e.push(t),null!==r.endpoint&&(this.endpoint=r.endpoint)),0===o&&n.remove(this)}finalize(){!function t(e,i){const s=i.nextStates;if(null!==s)if(1===s.length&&null===s[0].segment)t(e,s[0]);else for(const i of s)if(i.isOptional&&null!==i.endpoint){if(e.push(i),null!==i.nextStates)for(const s of i.nextStates)t(e,s);break}}(this.skippedStates,this.head)}getParams(){const{states:t,chars:e,endpoint:i}=this,s={};for(const t of i.paramNames)s[t]=void 0;for(let i=0,n=t.length;i<n;++i){const n=t[i];if(n.isDynamic){const t=n.segment.name;void 0===s[t]?s[t]=e[i]:s[t]+=e[i]}}return s}compareTo(t){const e=this.states,i=t.states;for(let t=0,s=0,n=Math.max(e.length,i.length);t<n;++t){let n=e[t];if(void 0===n)return 1;let r=i[s];if(void 0===r)return-1;let o=n.segment,l=r.segment;if(null===o){if(null===l){++s;continue}if(void 0===(n=e[++t]))return 1;o=n.segment}else if(null===l){if(void 0===(r=i[++s]))return-1;l=r.segment}if(o.kind<l.kind)return 1;if(o.kind>l.kind)return-1;++s}const s=this.skippedStates,n=t.skippedStates,r=s.length,o=n.length;if(r<o)return 1;if(r>o)return-1;for(let t=0;t<r;++t){const e=s[t],i=n[t];if(e.length<i.length)return 1;if(e.length>i.length)return-1}return 0}}function xe(t){return null!==t.head.endpoint}function Oe(t,e){return t.compareTo(e)}class Te{constructor(t){this.candidates=[],this.candidates=[new Se([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(xe);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(Oe),t[0]}add(t){this.candidates.push(t)}remove(t){this.candidates.splice(this.candidates.indexOf(t),1)}advance(t){const e=this.candidates.slice();for(const i of e)i.advance(t)}}class ke{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new Ne(null,null,"")}add(t,e){if(t instanceof Array)for(const i of t)this.$add(i,e);else this.$add(t,e)}$add(t,e){const i=t.path,s=new ye(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(Be),r=[],o=[];let l=this.rootState;const a=[];for(const t of n)switch(l=l.append(null,"/"),t.charAt(0)){case"{":{const e=t.slice(1,-1).split(":").map(t=>t.trim());2===e.length?o.push(e[1]):o.push("string");const i=e[0].endsWith("?"),s=i?e[0].slice(0,-1):e[0];r.push(s);const n=new $e(s,i);a.push(n),l=n.appendTo(l);break}case"*":{const e=t.slice(1);r.push(e),o.push("string");const i=new Re(e);a.push(i),l=i.appendTo(l);break}default:{const e=new Ae(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new Ce(s,r,o,e||null);l.setEndpoint(h),this.paths.set(i,a),t.name&&this.names.set(t.name,a)}recognize(e,i={}){return t(this,void 0,void 0,(function*(){const t=me.separate(e),s=me.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new Te(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(n.advance(i),n.isEmpty)return null}const r=n.getSolution();if(null===r)return null;const{endpoint:o}=r,l=o.paramNames,a=o.paramTypes,h=r.getParams(),c={};for(let t=0,e=l.length;t<e;++t){const e=l[t],s=i[a[t]]||be,n=h[e],r=yield s(n);c[e]=r}return new we(o,h,c,s)}))}generateFromName(t,e){return this.generate(this.names.get(t),e)}generateFromPath(t,e){return this.generate(this.paths.get(t),e)}generate(t,e){if(!t)return null;const i=Object.assign({},e),s={};let n="";for(let e=0,r=t.length;e<r;e++){const r=t[e],o=r.generate(i,s);if(null==o){if(r instanceof $e&&!r.optional)throw new Error(`A value is required for route parameter '${r.name}'.`)}else n+="/",n+=o}"/"!==n.charAt(0)&&(n="/"+n);for(const t in s)delete i[t];const r=me.build(i);return n+=r?"?"+r:"",n}}class Ne{constructor(t,e,i){switch(this.prevState=t,this.segment=e,this.value=i,this.nextStates=null,this.endpoint=null,null==e?void 0:e.kind){case 2:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=e.optional;break;case 1:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===t?0:t.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(t,e){let i,s=this.nextStates;return null===s?(i=void 0,s=this.nextStates=[]):i=null===t?s.find(t=>t.value===e):s.find(e=>{var i;return null===(i=e.segment)||void 0===i?void 0:i.equals(t)}),void 0===i&&s.push(i=new Ne(this,t,e)),i}setEndpoint(t){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${t.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=t,this.isOptional&&(this.prevState.setEndpoint(t),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(t))}isMatch(t){const e=this.segment;switch(null==e?void 0:e.kind){case 2:return!this.value.includes(t);case 1:return!0;case 3:case void 0:return this.value.includes(t)}}}function Be(t){return t.length>0}class Ae{constructor(t,e){this.value=t,this.caseSensitive=e}get kind(){return 3}appendTo(t){const{value:e,value:{length:i}}=this;if(this.caseSensitive)for(let s=0;s<i;++s)t=t.append(this,e.charAt(s));else for(let s=0;s<i;++s){const i=e.charAt(s);t=t.append(this,i.toUpperCase()+i.toLowerCase())}return t}generate(){return this.value}equals(t){return 3===t.kind&&t.caseSensitive===this.caseSensitive&&t.value===this.value}}class $e{constructor(t,e){this.name=t,this.optional=e}get kind(){return 2}appendTo(t){return t=t.append(this,"/")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 2===t.kind&&t.optional===this.optional&&t.name===this.name}}class Re{constructor(t){this.name=t}get kind(){return 1}appendTo(t){return t=t.append(this,"")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 1===t.kind&&t.name===this.name}}const Pe="fast-child-route";function Ve(t,e){return"command"in e?e.command:"redirect"in e?new Ye(e.redirect):ii.fromDefinition(t,e)}const Ee=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},Fe={number:t=>void 0===t?NaN:parseFloat(t),float:t=>void 0===t?NaN:parseFloat(t),int:t=>void 0===t?NaN:parseInt(t),integer:t=>void 0===t?NaN:parseInt(t),Date:t=>void 0===t?new Date(Date.now()):new Date(t),boolean:Ee,bool:Ee};class je{constructor(t){this.owner=t,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(t){"string"==typeof t&&(t={path:t}),this.pathToCommand.set(t.path,new Xe),this.recognizer.add(t,t.settings)}map(...t){for(const e of t){if("children"in e){const t=this.owner.createTitleBuilder(),i=e.children.map(i=>{const s=Object.assign(Object.assign(Object.assign({},e),i),{path:`${e.path}/${i.path}`});if("title"in e||"title"in i){const n=e.title||"",r=i.title||"";s.title=t.joinTitles(n,r)}if("name"in i){const t=e.name?e.name+"/":"";s.name=t+i.name}return s.children===e.children&&delete s.children,s});this.map(...i);continue}let t;if(t="command"in e?e.command:"redirect"in e?new Ye(e.redirect):ii.fromDefinition(this.owner,e),this.pathToCommand.set(e.path,t),this.recognizer.add(e,e.settings),"childRouters"in e&&e.childRouters){const i=Object.assign(Object.assign({},e),{path:e.path+"/*fast-child-route"});this.pathToCommand.set(i.path,t),this.recognizer.add(i,i.settings)}}}fallback(e){const i=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(s,n){return t(this,void 0,void 0,(function*(){const t=yield e();return Ve(i,t).createContributor(s,n)}))}}:Ve(i,e)}converter(t,e){let i;i="convert"in e?e.convert.bind(e):e.prototype&&"convert"in e.prototype?t=>this.owner.construct(e).convert(t):e,this.converters[t]=i}recognize(e){return t(this,void 0,void 0,(function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=me.separate(e),i=me.parse(t.queryString);return{route:new we(new Ce(new ye("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null}))}generateFromName(t,e){return this.recognizer.generateFromName(t,e)}generateFromPath(t,e){return this.recognizer.generateFromPath(t,e)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},Fe),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function ze(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function Me(t){let e=t;for(;e=ze(e);)if("$router"in e)return e.$router;return null}const Ie=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new Le(t)},find:t=>t.$router||Me(t),from(t){class e extends t{constructor(){super(),Ie.getOrCreateFor(this)}get config(){return this.$router.config}set config(t){this.$router.config=t}}const i=e.prototype;if("connectedCallback"in i){const t=i.connectedCallback;i.connectedCallback=function(){t.call(this),this.$router.connect()}}else i.connectedCallback=function(){this.$router.connect()};if("disconnectedCallback"in i){const t=i.disconnectedCallback;i.disconnectedCallback=function(){t.call(this),this.$router.disconnect()}}else i.disconnectedCallback=function(){this.$router.disconnect()};return e}});function _e(t){return t instanceof At}class Le{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>t(this,void 0,void 0,(function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)})),e.$router=this}get config(){return this.routerConfig}set config(t){this.routerConfig=t,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=Me(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(t){var e;if(this.route&&this.route.endpoint.path===t.endpoint.path){const i=null==t?void 0:t.allParams,s=null===(e=this.route)||void 0===e?void 0:e.allParams;if(JSON.stringify(s)===JSON.stringify(i))return!1}return!0}beginRender(e,i){return t(this,void 0,void 0,(function*(){return this.newRoute=e,this.newView=yield i.createView(),this.newView.bind(e.allTypedParams,qe.create(this)),this.newView.appendTo(this.host),yield i.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,i.layout,i.transition),rollback:this.renderOperationRollback.bind(this,i.transition)}}))}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(t){this.contributors.add(t)}removeContributor(t){this.contributors.delete(t)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,i){return t(this,void 0,void 0,(function*(){yield e.beforeCommit(this.host),yield i.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null}))}renderOperationRollback(e){return t(this,void 0,void 0,(function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)}))}navigate(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}leave(e){return t(this,void 0,void 0,(function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}}))}construct(e){return t(this,void 0,void 0,(function*(){if(null!==this.parent){const t=e.route.allParams["fast-child-route"]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new oe(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)}))}enter(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}tunnel(e){return t(this,void 0,void 0,(function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const s=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of s)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return}))}}const qe=Object.freeze({create:t=>Object.create(E,{router:{value:t}})}),He=Object.freeze({default:Object.freeze({begin(e,i,s){return t(this,void 0,void 0,(function*(){}))},rollback(e,i,s){return t(this,void 0,void 0,(function*(){}))},commit(e,i,s){return t(this,void 0,void 0,(function*(){}))}})});class De{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?ct.create(e):e instanceof ct?e:ct.create([e])}beforeCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit&&this.apply(e)}))}afterCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit||this.apply(e)}))}apply(t){_e(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Qe=Object.freeze({default:new De(ht`<slot></slot>`)});function Ue(t,e){return e in t}const We={lifecycle:!0,parameters:!0};class Ke extends j{constructor(t){super(),this.options=t}createPlaceholder(t){return d.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new Je(t,this.options)}}class Je{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||Ie.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const e=this.contributor,i=t;for(const t in i)e[t]=i[t]}}unbind(t){null!==this.router&&this.router.removeContributor(this.contributor)}}function Ge(t){return new Ke(Object.assign({},We,t))}class Xe{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class Ye{constructor(t){this.redirect=t}createContributor(){return t(this,void 0,void 0,(function*(){const e=this.redirect;return{navigate(i){return t(this,void 0,void 0,(function*(){const s=i.router.config,n=(yield s.generateRouteFromName(e,i.route.allParams))||(yield s.generateRouteFromPath(e,i.route.allParams));if(null===n)throw new Error("Invalid redirect. Name or path not found: "+e);i.cancel(()=>t(this,void 0,void 0,(function*(){return ce.path.replace(n)})))}))}}}))}}function Ze(t){return ht`<${t} ${Ge()}></${t}>`}function ti(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new ot(e,[Ge().createBehavior(t)]);return{create:()=>i}}class ei{constructor(t,e,i){this.router=t,this.route=e,this.command=i}construct(e){return t(this,void 0,void 0,(function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)}))}}class ii{constructor(t,e){this.owner=t,this.createView=e,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(t){this._transition=t}get layout(){return this._layout||this.owner.defaultLayout}set layout(t){this._layout=t}createContributor(e,i){return t(this,void 0,void 0,(function*(){return new ei(e,i,this)}))}static fromDefinition(e,i){let s;s="template"in i?()=>t(this,void 0,void 0,(function*(){let t=i.template;return"function"==typeof t&&(t=yield t()),t.create()})):()=>t(this,void 0,void 0,(function*(){let t=i.element,e=null;if(i.factory)e=i.factory;else if("function"==typeof t){let i=xt.forType(t);if(i)e=Ze(i.name);else if(t=yield t(),"string"==typeof t)e=Ze(t);else if(t instanceof HTMLElement)e=ti(t);else{if(i=xt.forType(t),!i)throw new Error("Invalid value for element in route config.");e=Ze(i.name)}}else t instanceof HTMLElement?i.factory=e=ti(t):i.factory=e=Ze(t);return e.create()}));const n=new ii(e,s);return i.layout&&(i.layout instanceof lt?n.layout=new De(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class si{constructor(){this.handler=t=>{const{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),ce.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(t){const e={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(t);if(!i||!this.targetIsThisWindow(i))return e;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return e;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return e;const s=i.getAttribute("href");e.anchor=i,e.href=s;const n=1===t.which,r=s&&!("#"===s.charAt(0)||/^[a-z]+:/i.test(s));return e.shouldHandleEvent=n&&!!r,e}findClosestAnchor(t){const e=t.composedPath();for(let t=0,i=e.length;t<i;++t){const i=e[t];if("A"===i.tagName)return i}return t.target}targetIsThisWindow(t){const e=t.getAttribute("target");return!e||e===window.name||"_self"===e}}class ni{constructor(t,e,i,s,n){this.name=t,this.commitActions=s,this.cancelActions=n,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(e),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(t){this.canceled=!0,t&&this.cancelActions.push(t)}onCommit(t){this.commitActions.push(t)}onCancel(t){this.cancelActions.push(t)}setTitle(t){const e=this.router.level;for(;this.titles.length<e+1;)this.titles.push([]);this.titles[e].push(t)}evaluateContributor(e,i=this.route,s=this.router){return t(this,void 0,void 0,(function*(){Ue(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class ri{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,i){return t(this,void 0,void 0,(function*(){const t=e.config.createEventSink(),s=yield e.config.recognizeRoute(i.path);if(null===s)return void t.onUnhandledNavigationMessage(e,i);const n=s.route,r=s.command;t.onNavigationBegin(e,n,r);const o=[],l=[];let a=o;const h=[yield r.createContributor(e,n),e,this];for(const i of this.phases){const s=new ni(i,n,e,o,l);if(t.onPhaseBegin(s),s.canceled)a=l;else for(const t of h)if(yield s.evaluateContributor(t),s.canceled){a=l;break}if(t.onPhaseEnd(s),s.canceled)break}yield Promise.all(a.map(t=>t())).then(()=>t.onNavigationEnd(e,n,r))}))}commit(t){const e=t.router.config.createTitleBuilder();document.title=e.buildTitle(t.router.config.title,t.titles)}}class oi{constructor(t=" - ",e=":"){this.segmentSeparator=t,this.fragmentSeparator=e}joinTitles(t,e){return""===t?e:""===e?t:`${t}${this.segmentSeparator}${e}`}buildTitle(t,e){let i=t;for(const t of e){i&&(i+=this.segmentSeparator);let e="";for(const i of t)e&&(e+=this.fragmentSeparator),e+=i;i+=e}return i}}class li{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class ai{constructor(){this.isConfigured=!1,this.routes=new je(this),this.contributors=[],this.defaultLayout=Qe.default,this.defaultTransition=He.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(ue)}createLinkHandler(){return this.construct(si)}createNavigationProcess(){return new ri}createEventSink(){return this.construct(li)}createTitleBuilder(){return this.construct(oi)}createRouteRecognizer(){return this.construct(ke)}construct(t){return null!==this.parent?this.parent.construct(t):new t}recognizeRoute(e){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.recognize(e)}))}generateRouteFromName(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,i)}))}generateRouteFromPath(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,i)}))}findContributors(t){return this.contributors.filter(e=>Ue(e,t))}cached(e){let i=null;return()=>t(this,void 0,void 0,(function*(){return null===i&&(i=new e),i}))}ensureConfigured(){return t(this,void 0,void 0,(function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)}))}}let hi=class extends(Ie.from(At)){};hi=function(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}([$t("fast-router")],hi);export{e as $global,M as AttachedBehaviorHTMLDirective,bt as AttributeDefinition,G as BindingBehavior,Rt as CSSDirective,ne as ChildrenBehavior,ye as ConfigurableRoute,Nt as Controller,d as DOM,si as DefaultLinkHandler,ri as DefaultNavigationProcess,ue as DefaultNavigationQueue,ke as DefaultRouteRecognizer,Le as DefaultRouter,ct as ElementStyles,Ce as Endpoint,V as ExecutionContext,At as FASTElement,xt as FASTElementDefinition,De as FASTElementLayout,hi as FASTRouter,J as HTMLBindingDirective,j as HTMLDirective,ot as HTMLView,Xe as Ignore,Qe as Layout,ae as NavigationHandler,oe as NavigationMessage,T as Observable,b as PropertyChangeNotifier,me as QueryString,we as RecognizedRoute,Ye as Redirect,Qt as RefBehavior,ii as Render,Xt as RepeatBehavior,Yt as RepeatDirective,ce as Route,je as RouteCollection,Ie as Router,ai as RouterConfiguration,qe as RouterExecutionContext,ie as SlottedBehavior,m as SubscriberSet,z as TargetedHTMLDirective,He as Transition,lt as ViewTemplate,yt as attr,vt as booleanConverter,Pe as childRouteParameter,re as children,nt as compileTemplate,Vt as css,Ft as cssPartial,$t as customElement,E as defaultExecutionContext,te as elements,i as emptyArray,Dt as enableArrayObservation,ht as html,_e as isFASTElementHost,Ue as isNavigationPhaseContributor,Ge as navigationContributor,mt as nullableNumberConverter,A as observable,Ut as ref,Zt as repeat,P as setCurrentEvent,se as slotted,$ as volatile,Wt as when};
|
|
15
|
+
function t(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function l(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}a((s=s.apply(t,e||[])).next())}))}const e=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===e.trustedTypes&&(e.trustedTypes={createPolicy:(t,e)=>e});const i={configurable:!1,enumerable:!1,writable:!1};void 0===e.FAST&&Reflect.defineProperty(e,"FAST",Object.assign({value:Object.create(null)},i));const s=e.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,i){let s=t[e];return void 0===s&&(s=i?t[e]=i():null),s}},i))}const n=Object.freeze([]),r=e.FAST.getById(1,()=>{const t=[],i=[];function s(){if(i.length)throw i.shift()}function n(t){try{t.call()}catch(t){i.push(t),setTimeout(s,0)}}function r(){let e=0;for(;e<t.length;)if(n(t[e]),e++,e>1024){for(let i=0,s=t.length-e;i<s;i++)t[i]=t[i+e];t.length-=e,e=0}t.length=0}return Object.freeze({enqueue:function(i){t.length<1&&e.requestAnimationFrame(r),t.push(i)},process:r})}),o=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const a="fast-"+Math.random().toString(36).substring(2,8),h=a+"{",c="}"+a,u=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(a),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(a+":","")),createInterpolationPlaceholder:t=>`${h}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${a}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)},setBooleanAttribute(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});function d(t){const e=this.spillover;-1===e.indexOf(t)&&e.push(t)}function f(t){const e=this.spillover,i=e.indexOf(t);-1!==i&&e.splice(i,1)}function p(t){const e=this.spillover,i=this.source;for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}function g(t){return-1!==this.spillover.indexOf(t)}class v{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return this.sub1===t||this.sub2===t}subscribe(t){this.has(t)||(void 0!==this.sub1?void 0!==this.sub2?(this.spillover=[this.sub1,this.sub2,t],this.subscribe=d,this.unsubscribe=f,this.notify=p,this.has=g,this.sub1=void 0,this.sub2=void 0):this.sub2=t:this.sub1=t)}unsubscribe(t){this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0)}notify(t){const e=this.sub1,i=this.sub2,s=this.source;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}}class m{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const i=this.subscribers[t];void 0!==i&&i.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var i;if(e){let i=this.subscribers[e];void 0===i&&(this.subscribers[e]=i=new v(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new v(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var i;if(e){const i=this.subscribers[e];void 0!==i&&i.unsubscribe(t)}else null===(i=this.sourceSubscribers)||void 0===i||i.unsubscribe(t)}}const b=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,i=new WeakMap,s=u.queueUpdate;let n=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let i=t.$fastController||e.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):e.set(t,i=new m(t))),i}function l(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class a{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const i=this.field,s=t[i];if(s!==e){t[i]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,s,e),o(t).notify(this.name)}}}class h extends v{constructor(t,e,i=!1){super(t,e),this.binding=t,this.isVolatileBinding=i,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const i=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return n=i,s}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const i=this.last,s=o(t),r=null===i?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;n=void 0,e=i.propertySource[i.propertyName],n=this,t===e&&(this.needsRefresh=!0)}i.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==n&&n.watch(t,e)},trackVolatile(){void 0!==n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new a(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,i=this.isVolatileBinding(t)){return new h(t,e,i)},isVolatileBinding:e=>t.test(e.toString())})});function y(t,e){b.defineProperty(t,e)}function C(t,e,i){return Object.assign({},i,{get:function(){return b.trackVolatile(),i.get.apply(this)}})}const w=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class S{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return w.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}static setEvent(t){w.set(t)}}b.defineProperty(S.prototype,"index"),b.defineProperty(S.prototype,"length");const x=Object.seal(new S);class O{constructor(){this.targetIndex=0}}class T extends O{constructor(){super(...arguments),this.createPlaceholder=u.createInterpolationPlaceholder}}class k extends O{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return u.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function B(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=b.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function N(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function A(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function $(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function R(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function P(t){u.setAttribute(this.target,this.targetName,t)}function E(t){u.setBooleanAttribute(this.target,this.targetName,t)}function V(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function F(t){this.target[this.targetName]=t}function j(t){const e=this.classVersions||Object.create(null),i=this.target;let s=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=s,i.classList.add(r))}}if(this.classVersions=e,this.version=s+1,0!==s){s-=1;for(const t in e)e[t]===s&&i.classList.remove(t)}}class z extends T{constructor(t){super(),this.binding=t,this.bind=B,this.unbind=A,this.updateTarget=P,this.isBindingVolatile=b.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=F,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>u.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=E;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=N,this.unbind=R;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=j)}}targetAtContent(){this.updateTarget=V,this.unbind=$}createBehavior(t){return new I(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class I{constructor(t,e,i,s,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=i,this.bind=s,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){S.setEvent(t);const e=this.binding(this.source,this.context);S.setEvent(null),!0!==e&&t.preventDefault()}}let M=null;class _{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){M=this}static borrow(t){const e=M||new _;return e.directives=t,e.reset(),M=null,e}}function L(t){if(1===t.length)return t[0];let e;const i=t.length,s=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new z((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const q=c.length;function H(t,e){const i=e.split(h);if(1===i.length)return null;const s=[];for(let e=0,n=i.length;e<n;++e){const n=i[e],r=n.indexOf(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+q)}""!==o&&s.push(o)}return s}function D(t,e,i=!1){const s=e.attributes;for(let n=0,r=s.length;n<r;++n){const o=s[n],l=o.value,a=H(t,l);let h=null;null===a?i&&(h=new z(()=>l),h.targetName=o.name):h=L(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function Q(t,e,i){const s=H(t,e.textContent);if(null!==s){let n=e;for(let r=0,o=s.length;r<o;++r){const o=s[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&i.nextNode()}t.targetIndex--}}function U(t,e){const i=t.content;document.adoptNode(i);const s=_.borrow(e);D(s,t,!0);const n=s.behaviorFactories;s.reset();const r=u.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:D(s,o);break;case 3:Q(s,o,r);break;case 8:u.isMarker(o)&&s.addFactory(e[u.extractDirectiveIndexFromMarker(o)])}let l=0;(u.isMarker(i.firstChild)||1===i.childNodes.length&&e.length)&&(i.insertBefore(document.createComment(""),i.firstChild),l=-1);const a=s.behaviorFactories;return s.release(),{fragment:i,viewBehaviorFactories:a,hostBehaviorFactories:n,targetOffset:l}}const W=document.createRange();class K{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,i=this.lastChild;let s,n=this.firstChild;for(;n!==i;)s=n.nextSibling,e.insertBefore(n,t),n=s;e.insertBefore(i,t)}}remove(){const t=this.fragment,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.appendChild(s),s=i;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.removeChild(s),s=i;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const i=this.behaviors;if(this.source!==t)if(null!==this.source){const s=this.source;this.source=t,this.context=e;for(let n=0,r=i.length;n<r;++n){const r=i[n];r.unbind(s),r.bind(t,e)}}else{this.source=t,this.context=e;for(let s=0,n=i.length;s<n;++s)i[s].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let i=0,s=t.length;i<s;++i)t[i].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){W.setStartBefore(t[0].firstChild),W.setEndAfter(t[t.length-1].lastChild),W.deleteContents();for(let e=0,i=t.length;e<i;++e){const i=t[e],s=i.behaviors,n=i.source;for(let t=0,e=s.length;t<e;++t)s[t].unbind(n)}}}}class J{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=u.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=U(t,this.directives);this.fragment=i.fragment,this.viewBehaviorFactories=i.viewBehaviorFactories,this.hostBehaviorFactories=i.hostBehaviorFactories,this.targetOffset=i.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),i=this.viewBehaviorFactories,s=new Array(this.behaviorCount),n=u.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=i.length;r<t;++r){const t=i[r],e=t.targetIndex;for(;null!==l;){if(o===e){s[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let i=0,n=e.length;i<n;++i,++r)s[r]=e[i].createBehavior(t)}return new K(e,s)}render(t,e,i){"string"==typeof e&&(e=document.getElementById(e)),void 0===i&&(i=e);const s=this.create(i);return s.bind(t,x),s.appendTo(e),s}}const G=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function X(t,...e){const i=[];let s="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(s+=r,o instanceof J){const t=o;o=()=>t}if("function"==typeof o&&(o=new z(o)),o instanceof T){const t=G.exec(r);null!==t&&(o.targetName=t[2])}o instanceof O?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new J(s,i)}class Y{constructor(){this.targets=new WeakSet,this.behaviors=null}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function Z(t){return t.map(t=>t instanceof Y?Z(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function tt(t){return t.map(t=>t instanceof Y?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}Y.create=(()=>{if(u.supportsAdoptedStyleSheets){const t=new Map;return e=>new et(e,t)}return t=>new st(t)})();class et extends Y{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=tt(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=Z(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let i=e.get(t);return void 0===i&&(i=new CSSStyleSheet,i.replaceSync(t),e.set(t,i)),i})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let it=0;class st extends Y{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=tt(t),this.styleSheets=Z(t),this.styleClass="fast-style-class-"+ ++it}addStylesTo(t){const e=this.styleSheets,i=this.styleClass;t=this.normalizeTarget(t);for(let s=0;s<e.length;s++){const n=document.createElement("style");n.innerHTML=e[s],n.className=i,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let i=0,s=e.length;i<s;++i)t.removeChild(e[i]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const nt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},rt={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class ot{constructor(t,e,i=e.toLowerCase(),s="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=i,this.mode=s,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===s&&void 0===n&&(this.converter=nt)}setValue(t,e){const i=t[this.fieldName],s=this.converter;void 0!==s&&(e=s.fromView(e)),i!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](i,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,i=this.guards;i.has(t)||"fromView"===e||u.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;u.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":u.setBooleanAttribute(t,this.attribute,s)}i.delete(t)})}static collect(t,...e){const i=[];e.push(t.attributes);for(let s=0,n=e.length;s<n;++s){const n=e[s];if(void 0!==n)for(let e=0,s=n.length;e<s;++e){const s=n[e];"string"==typeof s?i.push(new ot(t,s)):i.push(new ot(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function lt(t,e){let i;function s(t,e){arguments.length>1&&(i.property=e);const s=t.constructor.attributes||(t.constructor.attributes=[]);s.push(i)}return arguments.length>1?(i={},void s(t,e)):(i=void 0===t?{}:t,s)}const at={mode:"open"},ht={},ct=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ut{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=ot.collect(t,e.attributes),s=new Array(i.length),n={},r={};for(let t=0,e=i.length;t<e;++t){const e=i[t];s[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=i,this.observedAttributes=s,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?at:null===e.shadowOptions?void 0:Object.assign(Object.assign({},at),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ht:Object.assign(Object.assign({},ht),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?Y.create(e.styles):e.styles instanceof Y?e.styles:Y.create([e.styles])}get isDefined(){return!!ct.getByType(this.type)}define(t=customElements){const e=this.type;if(ct.register(this)){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)b.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ut.forType=ct.getByType;const dt=new WeakMap,ft={bubbles:!0,composed:!0,cancelable:!0};function pt(t){return t.shadowRoot||dt.get(t)||null}class gt extends m{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const i=e.shadowOptions;if(void 0!==i){const e=t.attachShadow(i);"closed"===i.mode&&dt.set(t,e)}const s=b.getAccessors(t);if(s.length>0){const e=this.boundObservables=Object.create(null);for(let i=0,n=s.length;i<n;++i){const n=s[i].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=pt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const i=t.behaviors;t.addStylesTo(e),null!==i&&this.addBehaviors(i)}}removeStyles(t){const e=pt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const i=t.behaviors;t.removeStylesFrom(e),null!==i&&this.removeBehaviors(i)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),i=t.length,s=[];for(let n=0;n<i;++n){const i=t[n];e.has(i)?e.set(i,e.get(i)+1):(e.set(i,1),s.push(i))}if(this._isConnected){const t=this.element;for(let e=0;e<s.length;++e)s[e].bind(t,x)}}removeBehaviors(t,e=!1){const i=this.behaviors;if(null===i)return;const s=t.length,n=[];for(let r=0;r<s;++r){const s=t[r];if(i.has(s)){const t=i.get(s)-1;0===t||e?i.delete(s)&&n.push(s):i.set(s,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,x);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,x);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[i]of e)i.unbind(t)}}onAttributeChangedCallback(t,e,i){const s=this.definition.attributeLookup[t];void 0!==s&&s.onAttributeChangedCallback(this.element,i)}emit(t,e,i){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},ft),i)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const i=Object.keys(e);for(let s=0,n=i.length;s<n;++s){const n=i[s];t[n]=e[n]}this.boundObservables=null}const i=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():i.template&&(this._template=i.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():i.styles&&(this._styles=i.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,i=pt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||u.removeChildNodes(i),t&&(this.view=t.render(e,i,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const i=ut.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new gt(t,i)}}function vt(t){return class extends t{constructor(){super(),gt.forCustomElement(this)}$emit(t,e,i){return this.$fastController.emit(t,e,i)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,i){this.$fastController.onAttributeChangedCallback(t,e,i)}}}const mt=Object.assign(vt(HTMLElement),{from:t=>vt(t),define:(t,e)=>new ut(t,e).define().type});function bt(t){return function(e){new ut(e,t).define()}}class yt{createCSS(){return""}createBehavior(){}}function Ct(t,e){const i=[];let s="";const n=[];for(let r=0,o=t.length-1;r<o;++r){s+=t[r];let o=e[r];if(o instanceof yt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof Y||o instanceof CSSStyleSheet?(""!==s.trim()&&(i.push(s),s=""),i.push(o)):s+=o}return s+=t[t.length-1],""!==s.trim()&&i.push(s),{styles:i,behaviors:n}}function wt(t,...e){const{styles:i,behaviors:s}=Ct(t,e),n=Y.create(i);return s.length&&n.withBehaviors(...s),n}class St extends yt{constructor(t,e){super(),this.behaviors=e,this.css="";const i=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);i.length&&(this.styles=Y.create(i))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function xt(t,...e){const{styles:i,behaviors:s}=Ct(t,e);return new St(i,s)}function Ot(t,e,i){return{index:t,removed:e,addedCount:i}}function Tt(t,e,i,s,r,o){let l=0,a=0;const h=Math.min(i-e,o-r);if(0===e&&0===r&&(l=function(t,e,i){for(let s=0;s<i;++s)if(t[s]!==e[s])return s;return i}(t,s,h)),i===t.length&&o===s.length&&(a=function(t,e,i){let s=t.length,n=e.length,r=0;for(;r<i&&t[--s]===e[--n];)r++;return r}(t,s,h-l)),r+=l,o-=a,(i-=a)-(e+=l)==0&&o-r==0)return n;if(e===i){const t=Ot(e,[],0);for(;r<o;)t.removed.push(s[r++]);return[t]}if(r===o)return[Ot(e,[],i-e)];const c=function(t){let e=t.length-1,i=t[0].length-1,s=t[e][i];const n=[];for(;e>0||i>0;){if(0===e){n.push(2),i--;continue}if(0===i){n.push(3),e--;continue}const r=t[e-1][i-1],o=t[e-1][i],l=t[e][i-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===s?n.push(0):(n.push(1),s=r),e--,i--):a===o?(n.push(3),e--,s=o):(n.push(2),i--,s=l)}return n.reverse(),n}(function(t,e,i,s,n,r){const o=r-n+1,l=i-e+1,a=new Array(o);let h,c;for(let t=0;t<o;++t)a[t]=new Array(l),a[t][0]=t;for(let t=0;t<l;++t)a[0][t]=t;for(let i=1;i<o;++i)for(let r=1;r<l;++r)t[e+r-1]===s[n+i-1]?a[i][r]=a[i-1][r-1]:(h=a[i-1][r]+1,c=a[i][r-1]+1,a[i][r]=h<c?h:c);return a}(t,e,i,s,r,o)),u=[];let d=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==d&&(u.push(d),d=void 0),f++,p++;break;case 1:void 0===d&&(d=Ot(f,[],0)),d.addedCount++,f++,d.removed.push(s[p]),p++;break;case 2:void 0===d&&(d=Ot(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=Ot(f,[],0)),d.removed.push(s[p]),p++}return void 0!==d&&u.push(d),u}const kt=Array.prototype.push;function Bt(t,e,i,s){const n=Ot(e,i,s);let r=!1,o=0;for(let e=0;e<t.length;e++){const i=t[e];if(i.index+=o,r)continue;const s=(l=n.index,a=n.index+n.removed.length,h=i.index,c=i.index+i.addedCount,a<h||c<l?-1:a===h||c===l?0:l<h?a<c?a-h:c-h:c<a?c-l:a-l);if(s>=0){t.splice(e,1),e--,o-=i.addedCount-i.removed.length,n.addedCount+=i.addedCount-s;const l=n.removed.length+i.removed.length-s;if(n.addedCount||l){let t=i.removed;if(n.index<i.index){const e=n.removed.slice(0,i.index-n.index);kt.apply(e,t),t=e}if(n.index+n.removed.length>i.index+i.addedCount){const e=n.removed.slice(i.index+i.addedCount-n.index);kt.apply(t,e)}n.removed=t,i.index<n.index&&(n.index=i.index)}else r=!0}else if(n.index<i.index){r=!0,t.splice(e,0,n),e++;const s=n.addedCount-n.removed.length;i.index+=s,o+=s}}var l,a,h,c;r||t.push(n)}function Nt(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];Bt(e,s.index,s.removed,s.addedCount)}return e}(e);for(let e=0,n=s.length;e<n;++e){const n=s[e];1!==n.addedCount||1!==n.removed.length?i=i.concat(Tt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&i.push(n)}return i}let At=!1;function $t(t,e){let i=t.index;const s=e.length;return i>s?i=s-t.addedCount:i<0&&(i=s+t.removed.length+i-t.addedCount),i<0&&(i=0),t.index=i,t}class Rt extends v{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const i=void 0===e?Nt(this.source,t):Tt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Pt(){if(At)return;At=!0,b.setArrayObserverFactory(t=>new Rt(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,i=t.push,s=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,i=e.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(Ot(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=s.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(Ot(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=r.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(0,[],arguments.length),this)),t}}class Et{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Vt(t){return new k("fast-ref",Et,t)}function Ft(t,e){const i="function"==typeof e?e:()=>e;return(e,s)=>t(e,s)?i(e,s):null}const jt=Object.freeze({positioning:!1,recycle:!0});function zt(t,e,i,s){t.bind(e[i],s)}function It(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Mt{constructor(t,e,i,s,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=s,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=zt,this.itemsBindingObserver=b.binding(e,this,i),this.templateBindingObserver=b.binding(s,this,n),r.positioning&&(this.bindView=It)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=n);const e=this.itemsObserver,i=this.itemsObserver=b.getNotifier(this.items),s=e!==i;s&&null!==e&&e.unsubscribe(this),(s||t)&&i.subscribe(this)}updateViews(t){const e=this.childContext,i=this.views,s=[],n=this.bindView;let r=0;for(let e=0,n=t.length;e<n;++e){const n=t[e],o=n.removed;s.push(...i.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,a=t.length;r<a;++r){const a=t[r];let h=a.index;const c=h+a.addedCount;for(;h<c;++h){const t=i[h],r=t?t.firstChild:this.location,a=this.options.recycle&&s.length>0?s.shift():l.create();i.splice(h,0,a),n(a,o,h,e),a.insertBefore(r)}}for(let t=0,e=s.length;t<e;++t)s[t].dispose();if(this.options.positioning)for(let t=0,e=i.length;t<e;++t){const s=i[t].context;s.length=e,s.index=t}}refreshAllViews(t=!1){const e=this.items,i=this.childContext,s=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,a=l.length;if((0===o||t)&&(K.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();r(o,e,t,i),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<a){r(l[t],e,t,i)}else{const o=s.create();r(o,e,t,i),l.push(o),o.insertBefore(n)}const h=l.splice(t,a-t);for(t=0,o=h.length;t<o;++t)h[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,i=t.length;e<i;++e)t[e].unbind()}}class _t extends O{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=u.createBlockPlaceholder,Pt(),this.isItemsBindingVolatile=b.isVolatileBinding(t),this.isTemplateBindingVolatile=b.isVolatileBinding(e)}createBehavior(t){return new Mt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Lt(t,e,i=jt){return new _t(t,"function"==typeof e?e:()=>e,i)}function qt(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class Ht{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=b.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(n),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class Dt extends Ht{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Qt(t){return"string"==typeof t&&(t={property:t}),new k("fast-slotted",Dt,t)}class Ut extends Ht{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Wt(t){return"string"==typeof t&&(t={property:t}),new k("fast-children",Ut,t)}class Kt{constructor(t){this.path=t}}const Jt=new Set,Gt=Object.freeze({register(t){Jt.add(t)},unregister(t){Jt.delete(t)}}),Xt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Yt=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Be.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromPath(i,s);if(null!==e)return e;t=t.parent}return null}))},push(t,e=!0){t&&Xt.test(t)?location.href=t:(history.pushState({},document.title,t),e&&Yt.path.trigger(t))},replace(t,e=!0){t&&Xt.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&Yt.path.trigger(t))},trigger(t){const e=new Kt(t);for(const t of Jt)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Be.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromName(i,s);if(null!==e)return e;t=t.parent}return null}))},push(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.trigger(t)}))}})});class Zt{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new Kt(Yt.path.current)),window.addEventListener("popstate",this),Gt.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),Gt.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(t=>this.resolve=t),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(t){this.queue.push(t),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const t=this.queue[this.queue.length-1],e=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,e(t)}handleEvent(t){this.enqueue(new Kt(Yt.path.current))}}const te=encodeURIComponent,ee=t=>te(t).replace("%24","$");function ie(t,e,i){let s=[];if(null==e)return s;if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)if(i)s.push(`${ee(t)}=${te(e[n])}`);else{const i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(ie(i,e[n]))}else if("object"!=typeof e||i)s.push(`${ee(t)}=${te(e)}`);else for(const i in e)s=s.concat(ie(t+"["+i+"]",e[i]));return s}function se(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function ne(t,e,i){let s=t;const n=e.length-1;for(let t=0;t<=n;t++){const r=""===e[t]?s.length:e[t];if(t<n){const i=s[r]&&"object"!=typeof s[r]?[s[r]]:s[r];s=s[r]=i||(isNaN(e[t+1])?{}:[])}else s=s[r]=i}}const re=Object.freeze({get current(){return location.search},build(t,e){let i=[];const s=Object.keys(t||{}).sort();for(let n=0,r=s.length;n<r;n++){const r=s[n];i=i.concat(ie(r,t[r],e))}return 0===i.length?"":i.join("&")},separate(t){const e=t.indexOf("?");let i="";return-1!==e&&(i=t.substr(e+1,t.length),t=t.substr(0,e)),{path:t,queryString:i}},parse(t){const e={};if(!t||"string"!=typeof t)return e;let i=t;"?"===i.charAt(0)&&(i=i.substr(1));const s=i.replace(/\+/g," ").split("&");for(let t=0;t<s.length;t++){const i=s[t].split("="),n=decodeURIComponent(i[0]);if(!n)continue;let r=n.split("]["),o=r.length-1;if(/\[/.test(r[0])&&/\]$/.test(r[o])?(r[o]=r[o].replace(/\]$/,""),r=r.shift().split("[").concat(r),o=r.length-1):o=0,i.length>=2){const t=i[1]?decodeURIComponent(i[1]):"";o?ne(e,r,t):e[n]=se(e[n],t)}else e[n]=!0}return e}}),oe=t=>t;class le{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class ae{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class he{constructor(t,e,i,s){this.endpoint=t,this.params=e,this.typedParams=i,this.queryParams=s,this.allParams=Object.assign(Object.assign({},e),s),this.allTypedParams=Object.assign(Object.assign({},i),s)}get settings(){return this.endpoint.settings}}class ce{constructor(t,e,i,s){var n;this.chars=t,this.states=e,this.skippedStates=i,this.result=s,this.head=e[e.length-1],this.endpoint=null===(n=this.head)||void 0===n?void 0:n.endpoint}advance(t){const{chars:e,states:i,skippedStates:s,result:n}=this;let r=null,o=0;const l=i[i.length-1];function a(h,c){if(h.isMatch(t)&&(1==++o?r=h:n.add(new ce(e.concat(t),i.concat(h),null===c?s:s.concat(c),n))),null===l.segment&&h.isOptional&&null!==h.nextStates){if(h.nextStates.length>1)throw new Error(h.nextStates.length+" nextStates");const t=h.nextStates[0];if(!t.isSeparator)throw new Error("Not a separator");if(null!==t.nextStates)for(const e of t.nextStates)a(e,h)}}if(l.isDynamic&&a(l,null),null!==l.nextStates)for(const t of l.nextStates)a(t,null);null!==r&&(i.push(this.head=r),e.push(t),null!==r.endpoint&&(this.endpoint=r.endpoint)),0===o&&n.remove(this)}finalize(){!function t(e,i){const s=i.nextStates;if(null!==s)if(1===s.length&&null===s[0].segment)t(e,s[0]);else for(const i of s)if(i.isOptional&&null!==i.endpoint){if(e.push(i),null!==i.nextStates)for(const s of i.nextStates)t(e,s);break}}(this.skippedStates,this.head)}getParams(){const{states:t,chars:e,endpoint:i}=this,s={};for(const t of i.paramNames)s[t]=void 0;for(let i=0,n=t.length;i<n;++i){const n=t[i];if(n.isDynamic){const t=n.segment.name;void 0===s[t]?s[t]=e[i]:s[t]+=e[i]}}return s}compareTo(t){const e=this.states,i=t.states;for(let t=0,s=0,n=Math.max(e.length,i.length);t<n;++t){let n=e[t];if(void 0===n)return 1;let r=i[s];if(void 0===r)return-1;let o=n.segment,l=r.segment;if(null===o){if(null===l){++s;continue}if(void 0===(n=e[++t]))return 1;o=n.segment}else if(null===l){if(void 0===(r=i[++s]))return-1;l=r.segment}if(o.kind<l.kind)return 1;if(o.kind>l.kind)return-1;++s}const s=this.skippedStates,n=t.skippedStates,r=s.length,o=n.length;if(r<o)return 1;if(r>o)return-1;for(let t=0;t<r;++t){const e=s[t],i=n[t];if(e.length<i.length)return 1;if(e.length>i.length)return-1}return 0}}function ue(t){return null!==t.head.endpoint}function de(t,e){return t.compareTo(e)}class fe{constructor(t){this.candidates=[],this.candidates=[new ce([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(ue);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(de),t[0]}add(t){this.candidates.push(t)}remove(t){this.candidates.splice(this.candidates.indexOf(t),1)}advance(t){const e=this.candidates.slice();for(const i of e)i.advance(t)}}class pe{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new ge(null,null,"")}add(t,e){if(t instanceof Array)for(const i of t)this.$add(i,e);else this.$add(t,e)}$add(t,e){const i=t.path,s=new le(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(ve),r=[],o=[];let l=this.rootState;const a=[];for(const t of n)switch(l=l.append(null,"/"),t.charAt(0)){case"{":{const e=t.slice(1,-1).split(":").map(t=>t.trim());2===e.length?o.push(e[1]):o.push("string");const i=e[0].endsWith("?"),s=i?e[0].slice(0,-1):e[0];r.push(s);const n=new be(s,i);a.push(n),l=n.appendTo(l);break}case"*":{const e=t.slice(1);r.push(e),o.push("string");const i=new ye(e);a.push(i),l=i.appendTo(l);break}default:{const e=new me(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new ae(s,r,o,e||null);l.setEndpoint(h),this.paths.set(i,a),t.name&&this.names.set(t.name,a)}recognize(e,i={}){return t(this,void 0,void 0,(function*(){const t=re.separate(e),s=re.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new fe(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(n.advance(i),n.isEmpty)return null}const r=n.getSolution();if(null===r)return null;const{endpoint:o}=r,l=o.paramNames,a=o.paramTypes,h=r.getParams(),c={};for(let t=0,e=l.length;t<e;++t){const e=l[t],s=i[a[t]]||oe,n=h[e],r=yield s(n);c[e]=r}return new he(o,h,c,s)}))}generateFromName(t,e){return this.generate(this.names.get(t),e)}generateFromPath(t,e){return this.generate(this.paths.get(t),e)}generate(t,e){if(!t)return null;const i=Object.assign({},e),s={};let n="";for(let e=0,r=t.length;e<r;e++){const r=t[e],o=r.generate(i,s);if(null==o){if(r instanceof be&&!r.optional)throw new Error(`A value is required for route parameter '${r.name}'.`)}else n+="/",n+=o}"/"!==n.charAt(0)&&(n="/"+n);for(const t in s)delete i[t];const r=re.build(i);return n+=r?"?"+r:"",n}}class ge{constructor(t,e,i){switch(this.prevState=t,this.segment=e,this.value=i,this.nextStates=null,this.endpoint=null,null==e?void 0:e.kind){case 2:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=e.optional;break;case 1:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===t?0:t.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(t,e){let i,s=this.nextStates;return null===s?(i=void 0,s=this.nextStates=[]):i=null===t?s.find(t=>t.value===e):s.find(e=>{var i;return null===(i=e.segment)||void 0===i?void 0:i.equals(t)}),void 0===i&&s.push(i=new ge(this,t,e)),i}setEndpoint(t){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${t.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=t,this.isOptional&&(this.prevState.setEndpoint(t),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(t))}isMatch(t){const e=this.segment;switch(null==e?void 0:e.kind){case 2:return!this.value.includes(t);case 1:return!0;case 3:case void 0:return this.value.includes(t)}}}function ve(t){return t.length>0}class me{constructor(t,e){this.value=t,this.caseSensitive=e}get kind(){return 3}appendTo(t){const{value:e,value:{length:i}}=this;if(this.caseSensitive)for(let s=0;s<i;++s)t=t.append(this,e.charAt(s));else for(let s=0;s<i;++s){const i=e.charAt(s);t=t.append(this,i.toUpperCase()+i.toLowerCase())}return t}generate(){return this.value}equals(t){return 3===t.kind&&t.caseSensitive===this.caseSensitive&&t.value===this.value}}class be{constructor(t,e){this.name=t,this.optional=e}get kind(){return 2}appendTo(t){return t=t.append(this,"/")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 2===t.kind&&t.optional===this.optional&&t.name===this.name}}class ye{constructor(t){this.name=t}get kind(){return 1}appendTo(t){return t=t.append(this,"")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 1===t.kind&&t.name===this.name}}const Ce="fast-child-route";function we(t,e){return"command"in e?e.command:"redirect"in e?new _e(e.redirect):De.fromDefinition(t,e)}const Se=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},xe={number:t=>void 0===t?NaN:parseFloat(t),float:t=>void 0===t?NaN:parseFloat(t),int:t=>void 0===t?NaN:parseInt(t),integer:t=>void 0===t?NaN:parseInt(t),Date:t=>void 0===t?new Date(Date.now()):new Date(t),boolean:Se,bool:Se};class Oe{constructor(t){this.owner=t,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(t){"string"==typeof t&&(t={path:t}),this.pathToCommand.set(t.path,new Me),this.recognizer.add(t,t.settings)}map(...t){for(const e of t){if("children"in e){const t=this.owner.createTitleBuilder(),i=e.children.map(i=>{const s=Object.assign(Object.assign(Object.assign({},e),i),{path:`${e.path}/${i.path}`});if("title"in e||"title"in i){const n=e.title||"",r=i.title||"";s.title=t.joinTitles(n,r)}if("name"in i){const t=e.name?e.name+"/":"";s.name=t+i.name}return s.children===e.children&&delete s.children,s});this.map(...i);continue}let t;if(t="command"in e?e.command:"redirect"in e?new _e(e.redirect):De.fromDefinition(this.owner,e),this.pathToCommand.set(e.path,t),this.recognizer.add(e,e.settings),"childRouters"in e&&e.childRouters){const i=Object.assign(Object.assign({},e),{path:e.path+"/*fast-child-route"});this.pathToCommand.set(i.path,t),this.recognizer.add(i,i.settings)}}}fallback(e){const i=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(s,n){return t(this,void 0,void 0,(function*(){const t=yield e();return we(i,t).createContributor(s,n)}))}}:we(i,e)}converter(t,e){let i;i="convert"in e?e.convert.bind(e):e.prototype&&"convert"in e.prototype?t=>this.owner.construct(e).convert(t):e,this.converters[t]=i}recognize(e){return t(this,void 0,void 0,(function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=re.separate(e),i=re.parse(t.queryString);return{route:new he(new ae(new le("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null}))}generateFromName(t,e){return this.recognizer.generateFromName(t,e)}generateFromPath(t,e){return this.recognizer.generateFromPath(t,e)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},xe),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function Te(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function ke(t){let e=t;for(;e=Te(e);)if("$router"in e)return e.$router;return null}const Be=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new Ae(t)},find:t=>t.$router||ke(t),from(t){class e extends t{constructor(){super(),Be.getOrCreateFor(this)}get config(){return this.$router.config}set config(t){this.$router.config=t}}const i=e.prototype;if("connectedCallback"in i){const t=i.connectedCallback;i.connectedCallback=function(){t.call(this),this.$router.connect()}}else i.connectedCallback=function(){this.$router.connect()};if("disconnectedCallback"in i){const t=i.disconnectedCallback;i.disconnectedCallback=function(){t.call(this),this.$router.disconnect()}}else i.disconnectedCallback=function(){this.$router.disconnect()};return e}});function Ne(t){return t instanceof mt}class Ae{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>t(this,void 0,void 0,(function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)})),e.$router=this}get config(){return this.routerConfig}set config(t){this.routerConfig=t,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=ke(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(t){var e;if(this.route&&this.route.endpoint.path===t.endpoint.path){const i=null==t?void 0:t.allParams,s=null===(e=this.route)||void 0===e?void 0:e.allParams;if(JSON.stringify(s)===JSON.stringify(i))return!1}return!0}beginRender(e,i){return t(this,void 0,void 0,(function*(){return this.newRoute=e,this.newView=yield i.createView(),this.newView.bind(e.allTypedParams,$e.create(this)),this.newView.appendTo(this.host),yield i.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,i.layout,i.transition),rollback:this.renderOperationRollback.bind(this,i.transition)}}))}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(t){this.contributors.add(t)}removeContributor(t){this.contributors.delete(t)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,i){return t(this,void 0,void 0,(function*(){yield e.beforeCommit(this.host),yield i.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null}))}renderOperationRollback(e){return t(this,void 0,void 0,(function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)}))}navigate(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}leave(e){return t(this,void 0,void 0,(function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}}))}construct(e){return t(this,void 0,void 0,(function*(){if(null!==this.parent){const t=e.route.allParams["fast-child-route"]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new Kt(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)}))}enter(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}tunnel(e){return t(this,void 0,void 0,(function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const s=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of s)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return}))}}const $e=Object.freeze({create:t=>Object.create(x,{router:{value:t}})}),Re=Object.freeze({default:Object.freeze({begin(e,i,s){return t(this,void 0,void 0,(function*(){}))},rollback(e,i,s){return t(this,void 0,void 0,(function*(){}))},commit(e,i,s){return t(this,void 0,void 0,(function*(){}))}})});class Pe{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?Y.create(e):e instanceof Y?e:Y.create([e])}beforeCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit&&this.apply(e)}))}afterCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit||this.apply(e)}))}apply(t){Ne(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Ee=Object.freeze({default:new Pe(X`<slot></slot>`)});function Ve(t,e){return e in t}const Fe={lifecycle:!0,parameters:!0};class je extends O{constructor(t){super(),this.options=t}createPlaceholder(t){return u.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new ze(t,this.options)}}class ze{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||Be.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const e=this.contributor,i=t;for(const t in i)e[t]=i[t]}}unbind(t){null!==this.router&&this.router.removeContributor(this.contributor)}}function Ie(t){return new je(Object.assign({},Fe,t))}class Me{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class _e{constructor(t){this.redirect=t}createContributor(){return t(this,void 0,void 0,(function*(){const e=this.redirect;return{navigate(i){return t(this,void 0,void 0,(function*(){const s=i.router.config,n=(yield s.generateRouteFromName(e,i.route.allParams))||(yield s.generateRouteFromPath(e,i.route.allParams));if(null===n)throw new Error("Invalid redirect. Name or path not found: "+e);i.cancel(()=>t(this,void 0,void 0,(function*(){return Yt.path.replace(n)})))}))}}}))}}function Le(t){return X`<${t} ${Ie()}></${t}>`}function qe(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new K(e,[Ie().createBehavior(t)]);return{create:()=>i}}class He{constructor(t,e,i){this.router=t,this.route=e,this.command=i}construct(e){return t(this,void 0,void 0,(function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)}))}}class De{constructor(t,e){this.owner=t,this.createView=e,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(t){this._transition=t}get layout(){return this._layout||this.owner.defaultLayout}set layout(t){this._layout=t}createContributor(e,i){return t(this,void 0,void 0,(function*(){return new He(e,i,this)}))}static fromDefinition(e,i){let s;s="template"in i?()=>t(this,void 0,void 0,(function*(){let t=i.template;return"function"==typeof t&&(t=yield t()),t.create()})):()=>t(this,void 0,void 0,(function*(){let t=i.element,e=null;if(i.factory)e=i.factory;else if("function"==typeof t){let i=ut.forType(t);if(i)e=Le(i.name);else if(t=yield t(),"string"==typeof t)e=Le(t);else if(t instanceof HTMLElement)e=qe(t);else{if(i=ut.forType(t),!i)throw new Error("Invalid value for element in route config.");e=Le(i.name)}}else t instanceof HTMLElement?i.factory=e=qe(t):i.factory=e=Le(t);return e.create()}));const n=new De(e,s);return i.layout&&(i.layout instanceof J?n.layout=new Pe(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class Qe{constructor(){this.handler=t=>{const{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),Yt.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(t){const e={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(t);if(!i||!this.targetIsThisWindow(i))return e;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return e;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return e;const s=i.getAttribute("href");e.anchor=i,e.href=s;const n=1===t.which,r=s&&!("#"===s.charAt(0)||/^[a-z]+:/i.test(s));return e.shouldHandleEvent=n&&!!r,e}findClosestAnchor(t){const e=t.composedPath();for(let t=0,i=e.length;t<i;++t){const i=e[t];if("A"===i.tagName)return i}return t.target}targetIsThisWindow(t){const e=t.getAttribute("target");return!e||e===window.name||"_self"===e}}class Ue{constructor(t,e,i,s,n){this.name=t,this.commitActions=s,this.cancelActions=n,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(e),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(t){this.canceled=!0,t&&this.cancelActions.push(t)}onCommit(t){this.commitActions.push(t)}onCancel(t){this.cancelActions.push(t)}setTitle(t){const e=this.router.level;for(;this.titles.length<e+1;)this.titles.push([]);this.titles[e].push(t)}evaluateContributor(e,i=this.route,s=this.router){return t(this,void 0,void 0,(function*(){Ve(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class We{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,i){return t(this,void 0,void 0,(function*(){const t=e.config.createEventSink(),s=yield e.config.recognizeRoute(i.path);if(null===s)return void t.onUnhandledNavigationMessage(e,i);const n=s.route,r=s.command;t.onNavigationBegin(e,n,r);const o=[],l=[];let a=o;const h=[yield r.createContributor(e,n),e,this];for(const i of this.phases){const s=new Ue(i,n,e,o,l);if(t.onPhaseBegin(s),s.canceled)a=l;else for(const t of h)if(yield s.evaluateContributor(t),s.canceled){a=l;break}if(t.onPhaseEnd(s),s.canceled)break}yield Promise.all(a.map(t=>t())).then(()=>t.onNavigationEnd(e,n,r))}))}commit(t){const e=t.router.config.createTitleBuilder();document.title=e.buildTitle(t.router.config.title,t.titles)}}class Ke{constructor(t=" - ",e=":"){this.segmentSeparator=t,this.fragmentSeparator=e}joinTitles(t,e){return""===t?e:""===e?t:`${t}${this.segmentSeparator}${e}`}buildTitle(t,e){let i=t;for(const t of e){i&&(i+=this.segmentSeparator);let e="";for(const i of t)e&&(e+=this.fragmentSeparator),e+=i;i+=e}return i}}class Je{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class Ge{constructor(){this.isConfigured=!1,this.routes=new Oe(this),this.contributors=[],this.defaultLayout=Ee.default,this.defaultTransition=Re.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(Zt)}createLinkHandler(){return this.construct(Qe)}createNavigationProcess(){return new We}createEventSink(){return this.construct(Je)}createTitleBuilder(){return this.construct(Ke)}createRouteRecognizer(){return this.construct(pe)}construct(t){return null!==this.parent?this.parent.construct(t):new t}recognizeRoute(e){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.recognize(e)}))}generateRouteFromName(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,i)}))}generateRouteFromPath(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,i)}))}findContributors(t){return this.contributors.filter(e=>Ve(e,t))}cached(e){let i=null;return()=>t(this,void 0,void 0,(function*(){return null===i&&(i=new e),i}))}ensureConfigured(){return t(this,void 0,void 0,(function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)}))}}let Xe=class extends(Be.from(mt)){};Xe=function(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}([bt("fast-router")],Xe);export{e as $global,k as AttachedBehaviorHTMLDirective,ot as AttributeDefinition,I as BindingBehavior,yt as CSSDirective,Ut as ChildrenBehavior,le as ConfigurableRoute,gt as Controller,u as DOM,Qe as DefaultLinkHandler,We as DefaultNavigationProcess,Zt as DefaultNavigationQueue,pe as DefaultRouteRecognizer,Ae as DefaultRouter,Y as ElementStyles,ae as Endpoint,S as ExecutionContext,s as FAST,mt as FASTElement,ut as FASTElementDefinition,Pe as FASTElementLayout,Xe as FASTRouter,z as HTMLBindingDirective,O as HTMLDirective,K as HTMLView,Me as Ignore,Ee as Layout,Gt as NavigationHandler,Kt as NavigationMessage,b as Observable,m as PropertyChangeNotifier,re as QueryString,he as RecognizedRoute,_e as Redirect,Et as RefBehavior,De as Render,Mt as RepeatBehavior,_t as RepeatDirective,Yt as Route,Oe as RouteCollection,Be as Router,Ge as RouterConfiguration,$e as RouterExecutionContext,Dt as SlottedBehavior,v as SubscriberSet,T as TargetedHTMLDirective,Re as Transition,J as ViewTemplate,lt as attr,nt as booleanConverter,Ce as childRouteParameter,Wt as children,U as compileTemplate,wt as css,xt as cssPartial,bt as customElement,x as defaultExecutionContext,qt as elements,n as emptyArray,Pt as enableArrayObservation,X as html,Ne as isFASTElementHost,Ve as isNavigationPhaseContributor,Ie as navigationContributor,rt as nullableNumberConverter,y as observable,Vt as ref,Lt as repeat,Qt as slotted,C as volatile,Ft as when};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@microsoft/fast-router",
|
|
3
3
|
"description": "A web-components-based router.",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.15",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Microsoft",
|
|
8
8
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"webpack": "^4.44.0"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@microsoft/fast-element": "^1.
|
|
86
|
+
"@microsoft/fast-element": "^1.8.0"
|
|
87
87
|
}
|
|
88
88
|
}
|