@microsoft/fast-element 2.0.0-beta.4 → 2.0.0-beta.5

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.
@@ -114,6 +114,7 @@ const debugMessages = {
114
114
  [1511 /* invalidKey */]: "Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",
115
115
  [1512 /* noDefaultResolver */]: "'${key}' not registered. Did you forget to add @singleton()?",
116
116
  [1513 /* cyclicDependency */]: "Cyclic dependency found '${name}'.",
117
+ [1514 /* connectUpdateRequiresController */]: "Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement.",
117
118
  };
118
119
  const allPlaceholders = /(\$\{\w+?})/g;
119
120
  const placeholder = /\$\{(\w+?)}/g;
@@ -534,8 +535,13 @@ const Observable = FAST.getById(2 /* KernelServiceId.observable */, () => {
534
535
  const previousWatcher = watcher;
535
536
  watcher = this.needsRefresh ? this : void 0;
536
537
  this.needsRefresh = this.isVolatileBinding;
537
- const result = this.binding(source, context !== null && context !== void 0 ? context : ExecutionContext.default);
538
- watcher = previousWatcher;
538
+ let result;
539
+ try {
540
+ result = this.binding(source, context !== null && context !== void 0 ? context : ExecutionContext.default);
541
+ }
542
+ finally {
543
+ watcher = previousWatcher;
544
+ }
539
545
  return result;
540
546
  }
541
547
  dispose() {
@@ -905,10 +911,311 @@ const SpliceStrategySupport = Object.freeze({
905
911
  const reset = new Splice(0, emptyArray, 0);
906
912
  reset.reset = true;
907
913
  const resetSplices = [reset];
914
+ // Note: This function is *based* on the computation of the Levenshtein
915
+ // "edit" distance. The one change is that "updates" are treated as two
916
+ // edits - not one. With Array splices, an update is really a delete
917
+ // followed by an add. By retaining this, we optimize for "keeping" the
918
+ // maximum array items in the original array. For example:
919
+ //
920
+ // 'xxxx123' to '123yyyy'
921
+ //
922
+ // With 1-edit updates, the shortest path would be just to update all seven
923
+ // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
924
+ // leaves the substring '123' intact.
925
+ function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
926
+ // "Deletion" columns
927
+ const rowCount = oldEnd - oldStart + 1;
928
+ const columnCount = currentEnd - currentStart + 1;
929
+ const distances = new Array(rowCount);
930
+ let north;
931
+ let west;
932
+ // "Addition" rows. Initialize null column.
933
+ for (let i = 0; i < rowCount; ++i) {
934
+ distances[i] = new Array(columnCount);
935
+ distances[i][0] = i;
936
+ }
937
+ // Initialize null row
938
+ for (let j = 0; j < columnCount; ++j) {
939
+ distances[0][j] = j;
940
+ }
941
+ for (let i = 1; i < rowCount; ++i) {
942
+ for (let j = 1; j < columnCount; ++j) {
943
+ if (current[currentStart + j - 1] === old[oldStart + i - 1]) {
944
+ distances[i][j] = distances[i - 1][j - 1];
945
+ }
946
+ else {
947
+ north = distances[i - 1][j] + 1;
948
+ west = distances[i][j - 1] + 1;
949
+ distances[i][j] = north < west ? north : west;
950
+ }
951
+ }
952
+ }
953
+ return distances;
954
+ }
955
+ // This starts at the final weight, and walks "backward" by finding
956
+ // the minimum previous weight recursively until the origin of the weight
957
+ // matrix.
958
+ function spliceOperationsFromEditDistances(distances) {
959
+ let i = distances.length - 1;
960
+ let j = distances[0].length - 1;
961
+ let current = distances[i][j];
962
+ const edits = [];
963
+ while (i > 0 || j > 0) {
964
+ if (i === 0) {
965
+ edits.push(2 /* Edit.add */);
966
+ j--;
967
+ continue;
968
+ }
969
+ if (j === 0) {
970
+ edits.push(3 /* Edit.delete */);
971
+ i--;
972
+ continue;
973
+ }
974
+ const northWest = distances[i - 1][j - 1];
975
+ const west = distances[i - 1][j];
976
+ const north = distances[i][j - 1];
977
+ let min;
978
+ if (west < north) {
979
+ min = west < northWest ? west : northWest;
980
+ }
981
+ else {
982
+ min = north < northWest ? north : northWest;
983
+ }
984
+ if (min === northWest) {
985
+ if (northWest === current) {
986
+ edits.push(0 /* Edit.leave */);
987
+ }
988
+ else {
989
+ edits.push(1 /* Edit.update */);
990
+ current = northWest;
991
+ }
992
+ i--;
993
+ j--;
994
+ }
995
+ else if (min === west) {
996
+ edits.push(3 /* Edit.delete */);
997
+ i--;
998
+ current = west;
999
+ }
1000
+ else {
1001
+ edits.push(2 /* Edit.add */);
1002
+ j--;
1003
+ current = north;
1004
+ }
1005
+ }
1006
+ return edits.reverse();
1007
+ }
1008
+ function sharedPrefix(current, old, searchLength) {
1009
+ for (let i = 0; i < searchLength; ++i) {
1010
+ if (current[i] !== old[i]) {
1011
+ return i;
1012
+ }
1013
+ }
1014
+ return searchLength;
1015
+ }
1016
+ function sharedSuffix(current, old, searchLength) {
1017
+ let index1 = current.length;
1018
+ let index2 = old.length;
1019
+ let count = 0;
1020
+ while (count < searchLength && current[--index1] === old[--index2]) {
1021
+ count++;
1022
+ }
1023
+ return count;
1024
+ }
1025
+ function intersect(start1, end1, start2, end2) {
1026
+ // Disjoint
1027
+ if (end1 < start2 || end2 < start1) {
1028
+ return -1;
1029
+ }
1030
+ // Adjacent
1031
+ if (end1 === start2 || end2 === start1) {
1032
+ return 0;
1033
+ }
1034
+ // Non-zero intersect, span1 first
1035
+ if (start1 < start2) {
1036
+ if (end1 < end2) {
1037
+ return end1 - start2; // Overlap
1038
+ }
1039
+ return end2 - start2; // Contained
1040
+ }
1041
+ // Non-zero intersect, span2 first
1042
+ if (end2 < end1) {
1043
+ return end2 - start1; // Overlap
1044
+ }
1045
+ return end1 - start1; // Contained
1046
+ }
1047
+ /**
1048
+ * @remarks
1049
+ * Lacking individual splice mutation information, the minimal set of
1050
+ * splices can be synthesized given the previous state and final state of an
1051
+ * array. The basic approach is to calculate the edit distance matrix and
1052
+ * choose the shortest path through it.
1053
+ *
1054
+ * Complexity: O(l * p)
1055
+ * l: The length of the current array
1056
+ * p: The length of the old array
1057
+ */
1058
+ function calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {
1059
+ let prefixCount = 0;
1060
+ let suffixCount = 0;
1061
+ const minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
1062
+ if (currentStart === 0 && oldStart === 0) {
1063
+ prefixCount = sharedPrefix(current, old, minLength);
1064
+ }
1065
+ if (currentEnd === current.length && oldEnd === old.length) {
1066
+ suffixCount = sharedSuffix(current, old, minLength - prefixCount);
1067
+ }
1068
+ currentStart += prefixCount;
1069
+ oldStart += prefixCount;
1070
+ currentEnd -= suffixCount;
1071
+ oldEnd -= suffixCount;
1072
+ if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {
1073
+ return emptyArray;
1074
+ }
1075
+ if (currentStart === currentEnd) {
1076
+ const splice = new Splice(currentStart, [], 0);
1077
+ while (oldStart < oldEnd) {
1078
+ splice.removed.push(old[oldStart++]);
1079
+ }
1080
+ return [splice];
1081
+ }
1082
+ else if (oldStart === oldEnd) {
1083
+ return [new Splice(currentStart, [], currentEnd - currentStart)];
1084
+ }
1085
+ const ops = spliceOperationsFromEditDistances(calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
1086
+ const splices = [];
1087
+ let splice = void 0;
1088
+ let index = currentStart;
1089
+ let oldIndex = oldStart;
1090
+ for (let i = 0; i < ops.length; ++i) {
1091
+ switch (ops[i]) {
1092
+ case 0 /* Edit.leave */:
1093
+ if (splice !== void 0) {
1094
+ splices.push(splice);
1095
+ splice = void 0;
1096
+ }
1097
+ index++;
1098
+ oldIndex++;
1099
+ break;
1100
+ case 1 /* Edit.update */:
1101
+ if (splice === void 0) {
1102
+ splice = new Splice(index, [], 0);
1103
+ }
1104
+ splice.addedCount++;
1105
+ index++;
1106
+ splice.removed.push(old[oldIndex]);
1107
+ oldIndex++;
1108
+ break;
1109
+ case 2 /* Edit.add */:
1110
+ if (splice === void 0) {
1111
+ splice = new Splice(index, [], 0);
1112
+ }
1113
+ splice.addedCount++;
1114
+ index++;
1115
+ break;
1116
+ case 3 /* Edit.delete */:
1117
+ if (splice === void 0) {
1118
+ splice = new Splice(index, [], 0);
1119
+ }
1120
+ splice.removed.push(old[oldIndex]);
1121
+ oldIndex++;
1122
+ break;
1123
+ // no default
1124
+ }
1125
+ }
1126
+ if (splice !== void 0) {
1127
+ splices.push(splice);
1128
+ }
1129
+ return splices;
1130
+ }
1131
+ function merge(splice, splices) {
1132
+ let inserted = false;
1133
+ let insertionOffset = 0;
1134
+ for (let i = 0; i < splices.length; i++) {
1135
+ const current = splices[i];
1136
+ current.index += insertionOffset;
1137
+ if (inserted) {
1138
+ continue;
1139
+ }
1140
+ const intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);
1141
+ if (intersectCount >= 0) {
1142
+ // Merge the two splices
1143
+ splices.splice(i, 1);
1144
+ i--;
1145
+ insertionOffset -= current.addedCount - current.removed.length;
1146
+ splice.addedCount += current.addedCount - intersectCount;
1147
+ const deleteCount = splice.removed.length + current.removed.length - intersectCount;
1148
+ if (!splice.addedCount && !deleteCount) {
1149
+ // merged splice is a noop. discard.
1150
+ inserted = true;
1151
+ }
1152
+ else {
1153
+ let currentRemoved = current.removed;
1154
+ if (splice.index < current.index) {
1155
+ // some prefix of splice.removed is prepended to current.removed.
1156
+ const prepend = splice.removed.slice(0, current.index - splice.index);
1157
+ prepend.push(...currentRemoved);
1158
+ currentRemoved = prepend;
1159
+ }
1160
+ if (splice.index + splice.removed.length >
1161
+ current.index + current.addedCount) {
1162
+ // some suffix of splice.removed is appended to current.removed.
1163
+ const append = splice.removed.slice(current.index + current.addedCount - splice.index);
1164
+ currentRemoved.push(...append);
1165
+ }
1166
+ splice.removed = currentRemoved;
1167
+ if (current.index < splice.index) {
1168
+ splice.index = current.index;
1169
+ }
1170
+ }
1171
+ }
1172
+ else if (splice.index < current.index) {
1173
+ // Insert splice here.
1174
+ inserted = true;
1175
+ splices.splice(i, 0, splice);
1176
+ i++;
1177
+ const offset = splice.addedCount - splice.removed.length;
1178
+ current.index += offset;
1179
+ insertionOffset += offset;
1180
+ }
1181
+ }
1182
+ if (!inserted) {
1183
+ splices.push(splice);
1184
+ }
1185
+ }
1186
+ function project(array, changes) {
1187
+ let splices = [];
1188
+ const initialSplices = [];
1189
+ for (let i = 0, ii = changes.length; i < ii; i++) {
1190
+ merge(changes[i], initialSplices);
1191
+ }
1192
+ for (let i = 0, ii = initialSplices.length; i < ii; ++i) {
1193
+ const splice = initialSplices[i];
1194
+ if (splice.addedCount === 1 && splice.removed.length === 1) {
1195
+ if (splice.removed[0] !== array[splice.index]) {
1196
+ splices.push(splice);
1197
+ }
1198
+ continue;
1199
+ }
1200
+ splices = splices.concat(calc(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));
1201
+ }
1202
+ return splices;
1203
+ }
1204
+ /**
1205
+ * A SpliceStrategy that attempts to merge all splices into the minimal set of
1206
+ * splices needed to represent the change from the old array to the new array.
1207
+ * @public
1208
+ */
908
1209
  let defaultSpliceStrategy = Object.freeze({
909
- support: SpliceStrategySupport.splice,
1210
+ support: SpliceStrategySupport.optimized,
910
1211
  normalize(previous, current, changes) {
911
- return previous === void 0 ? changes !== null && changes !== void 0 ? changes : emptyArray : resetSplices;
1212
+ if (previous === void 0) {
1213
+ if (changes === void 0) {
1214
+ return emptyArray;
1215
+ }
1216
+ return changes.length > 1 ? project(current, changes) : changes;
1217
+ }
1218
+ return resetSplices;
912
1219
  },
913
1220
  pop(array, observer, pop, args) {
914
1221
  const notEmpty = array.length > 0;
@@ -2074,8 +2381,10 @@ class HTMLView {
2074
2381
  node.parentNode.insertBefore(this.fragment, node);
2075
2382
  }
2076
2383
  else {
2077
- const parentNode = node.parentNode;
2078
2384
  const end = this.lastChild;
2385
+ if (node.previousSibling === end)
2386
+ return;
2387
+ const parentNode = node.parentNode;
2079
2388
  let current = this.firstChild;
2080
2389
  let next;
2081
2390
  while (current !== end) {
@@ -2697,6 +3006,9 @@ class RepeatBehavior {
2697
3006
  this.template = this.templateBindingObserver.observe(this.source, this.context);
2698
3007
  this.refreshAllViews(true);
2699
3008
  }
3009
+ else if (!args[0]) {
3010
+ return;
3011
+ }
2700
3012
  else if (args[0].reset) {
2701
3013
  this.refreshAllViews();
2702
3014
  }
@@ -2872,7 +3184,7 @@ HTMLDirective.define(RepeatDirective);
2872
3184
  function repeat(items, template, options = defaultRepeatOptions) {
2873
3185
  const dataBinding = normalizeBinding(items);
2874
3186
  const templateBinding = normalizeBinding(template);
2875
- return new RepeatDirective(dataBinding, templateBinding, options);
3187
+ return new RepeatDirective(dataBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
2876
3188
  }
2877
3189
 
2878
3190
  const selectElements = (value) => value.nodeType === 1;
@@ -3760,6 +4072,9 @@ function define(type, nameOrDef) {
3760
4072
  }
3761
4073
  return FASTElementDefinition.compose(this, type).define().type;
3762
4074
  }
4075
+ function from(BaseType) {
4076
+ return createFASTElement(BaseType);
4077
+ }
3763
4078
  /**
3764
4079
  * A minimal base class for FASTElements that also provides
3765
4080
  * static helpers for working with FASTElements.
@@ -3771,9 +4086,7 @@ const FASTElement = Object.assign(createFASTElement(HTMLElement), {
3771
4086
  * provided base type.
3772
4087
  * @param BaseType - The base element type to inherit from.
3773
4088
  */
3774
- from(BaseType) {
3775
- return createFASTElement(BaseType);
3776
- },
4089
+ from,
3777
4090
  /**
3778
4091
  * Defines a platform custom element based on the provided type and definition.
3779
4092
  * @param type - The custom element type to define.
@@ -1 +1 @@
1
- !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'."},a=/(\$\{\w+?})/g,h=/\$\{(\w+?)}/g,c=Object.freeze({});function d(e,t){return e.split(a).map((e=>{var s;const i=e.replace(h,"$1");return String(null!==(s=t[i])&&void 0!==s?s:e)})).join("")}Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Warning";console.warn(d(i,t))},error(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Error";return new Error(d(i,t))}});const u={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},u));const f=globalThis.FAST;if(void 0===f.getById){const e=Object.create(null);Reflect.defineProperty(f,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},u))}void 0===f.error&&Object.assign(f,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const p=Object.freeze([]);function b(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}const g=e=>"function"==typeof e,v=e=>"string"==typeof e,y=f.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class m{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class w{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new m(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new m(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const C=f.getById(2,(()=>{const e=y.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=e=>{throw f.error(1101)};function o(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=r(e):s.set(e,i=new w(e))),i}function l(e){let t=i.get(e);if(void 0===t){let s=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==s;)t=i.get(s),s=Reflect.getPrototypeOf(s);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==n&&n.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];g(n)&&n.call(e,i,t),o(e).notify(this.name)}}}class h extends m{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(e,null!=t?t:O.default);return n=s,i}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=o(e),r=null===s?this.first:{};if(r.propertySource=e,r.propertyName=t,r.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;n=void 0,t=s.propertySource[s.propertyName],n=this,e===t&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){r=e},getNotifier:o,track(e,t){n&&n.watch(e,t)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(e,t){o(e).notify(t)},defineProperty(e,t){v(t)&&(t=new a(t)),l(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:l,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function T(e,t){C.defineProperty(e,t)}function x(e,t,s){return Object.assign({},s,{get(){return C.trackVolatile(),s.get.apply(this)}})}const S=f.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class O{constructor(e=null,t=null){this.index=0,this.length=0,this.parent=e,this.parentContext=t}get event(){return S.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(e,t){this.index=e,this.length=t}createChildContext(e){return new O(e,this)}createItemContext(e,t){const s=Object.create(this);return s.index=e,s.length=t,s}static setEvent(e){S.set(e)}static create(){return new O}}O.default=new O,C.defineProperty(O.prototype,"index"),C.defineProperty(O.prototype,"length");class A{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const B=Object.freeze({reset:1,splice:2,optimized:3}),j=new A(0,p,0);j.reset=!0;const $=[j];let k=Object.freeze({support:B.splice,normalize:(e,t,s)=>void 0===e?null!=s?s:p:$,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(0,[],i.length).adjustTo(e)),n}});const I=Object.freeze({reset:$,setDefaultStrategy(e){k=e}});function P(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class V extends m{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,P(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,C.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,y.enqueue(this))}}let N=!1;const E=Object.freeze({enable(){if(N)return;N=!0,C.setArrayObserverFactory((e=>new V(e)));const e=Array.prototype;e.$fastPatch||(P(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function F(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=C.getNotifier(e)),C.track(t.lengthObserver,"length"),e.length}const M=new Map;let _;function L(e){return e.map((e=>e instanceof R?L(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class R{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof R?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(_),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(L(this.styles)),this}static setDefaultStrategy(e){_=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new R(e):e instanceof R?e:new R([e])}}R.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class z{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=M.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),M.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}R.setDefaultStrategy(f.getById(5,(()=>z)));const D=b(),H=Object.freeze({getForInstance:D.getForInstance,getByType:D.getByType,define:e=>(D.register({type:e}),e)});function q(){return function(e){H.define(e)}}function Q(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==H.getForInstance(o)&&(o=o.createCSS(r)),o instanceof R||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const U=(e,...t)=>{const{styles:s,behaviors:i}=Q(e,t),n=new R(s);return i.length?n.withBehaviors(...i):n};class W{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(v(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new R(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}bind(e){e.$fastController.addStyles(this.styles)}unbind(e){e.$fastController.removeStyles(this.styles)}}H.define(W);const K=U.partial=(e,...t)=>{const{styles:s,behaviors:i}=Q(e,t);return new W(s,i)},G=Object.freeze({queueUpdate:y.enqueue,nextUpdate:y.next,processUpdates:y.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),J=`fast-${Math.random().toString(36).substring(2,8)}`,X=`${J}{`,Y=`}${J}`,Z=Y.length;let ee=0;const te=()=>`${J}-${++ee}`,se=Object.freeze({interpolation:e=>`${X}${e}${Y}`,attribute:e=>`${te()}="${X}${e}${Y}"`,comment:e=>`\x3c!--${X}${e}${Y}--\x3e`}),ie=Object.freeze({parse(e,t){const s=e.split(X);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(Y);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+Z)}""!==o&&i.push(o)}return i}}),ne=b(),re=Object.freeze({getForInstance:ne.getForInstance,getByType:ne.getByType,define:(e,t)=>((t=t||{}).type=e,ne.register(t),e)});function oe(e){return function(t){re.define(t,e)}}class le{}const ae=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=ae.property;break;case"classList":e.aspectType=ae.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=ae.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=ae.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=ae.property):(e.targetAspect=t,e.aspectType=ae.attribute)}else e.aspectType=ae.content}});class he{constructor(e){this.options=e,this.id=te()}createBehavior(e){return this}createHTML(e){return se.attribute(e(this))}}const ce=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw f.error(1202)}:e=>e;class de extends le{constructor(e,t){super(),this.evaluate=e,this.isVolatile=t}createObserver(e,t){return C.binding(this.evaluate,t,this.isVolatile)}}class ue extends le{constructor(e){super(),this.evaluate=e}createObserver(){return this}observe(e,t){return this.evaluate(e,t)}dispose(){}}function fe(e,t,s,i,n){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i,n)):(t.isComposed=!0,t.bind(i,n),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function pe(e,t,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}class be{constructor(e,t){this.directive=e,this.updateTarget=t,this.observerProperty=`${e.id}-o`}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=e,r.context=t,this.updateTarget(n,i.targetAspect,r.observe(e,t),e,t)}unbind(e,t,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(e,t){const s=t.target,i=t.source,n=t.context;this.updateTarget(s,this.directive.targetAspect,t.observe(i,n),i,n)}getObserver(e){var t;return null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(e){return this}}class ge extends be{unbind(e,t,s){super.unbind(e,t,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class ve{constructor(e){this.directive=e,this.sourceProperty=`${e.id}-s`,this.contextProperty=`${e.id}-c`}bind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=e,n[this.contextProperty]=t,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(e){return this}handleEvent(e){const t=e.currentTarget;O.setEvent(e);const s=this.directive.dataBinding.evaluate(t[this.sourceProperty],t[this.contextProperty]);O.setEvent(null),!0!==s&&e.preventDefault()}}class ye{constructor(e){this.dataBinding=e,this.factory=null,this.id=te(),this.aspectType=ae.content}createHTML(e){return se.interpolation(e(this))}createBehavior(e){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=ce(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new be(this,G.setAttribute);break;case 2:this.factory=new be(this,G.setBooleanAttribute);break;case 3:this.factory=new be(this,((e,t,s)=>e[t]=s));break;case 4:this.factory=new ge(this,fe);break;case 5:this.factory=new be(this,pe);break;case 6:this.factory=new ve(this);break;default:throw f.error(1205)}return this.factory.createBehavior(e)}}function me(e,t=C.isVolatileBinding(e)){return new de(e,t)}function we(e){return new ue(e)}function Ce(e,t){const s=new de(e,!1);return s.options=t,s}function Te(e){return g(e)?me(e):e instanceof le?e:we((()=>e))}function xe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}re.define(ye,{aspected:!0});class Se{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=e.firstChild,this.lastChild=e.lastChild}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=e.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,t.insertBefore(n,e),n=i;t.insertBefore(s,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){xe(this.firstChild,this.lastChild),this.unbind()}bind(e,t){let s=this.behaviors;const i=this.source;if(i===e)return;this.source=e,this.context=t;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,t,n),o.bind(e,t,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(e,t,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(e,t,n)}unbind(){const e=this.source;if(null===e)return;const t=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(e,s,t);this.source=null,this.context=null}static disposeContiguousBatch(e){if(0!==e.length){xe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}const Oe=(e,t)=>`${e}.${t}`,Ae={},Be={index:0,node:null};function je(e){e.startsWith("fast-")||f.warn(1204,{name:e})}const $e=new Proxy(document.createElement("div"),{get(e,t){je(t);const s=Reflect.get(e,t);return g(s)?s.bind(e):s},set:(e,t,s)=>(je(t),Reflect.set(e,t,s))});class ke{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=Ae[t];if(!n){const i=`_${t}`;Ae[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:$e;for(const e of this.nodeIds)s[e];return new Se(t,this.factories,s)}}function Ie(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=ie.parse(d,l);let f=null;null===u?r&&(f=new ye(we((()=>d))),ae.assign(f,c.name)):f=Me.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Pe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Ve(e,s,n,i);n=t.node,i=t.index}}function Ve(e,t,s,i){const n=Oe(t,i);switch(s.nodeType){case 1:Ie(e,t,s,n,i),Pe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=ie.parse(t.textContent,e.directives);if(null===r)return Be.node=t.nextSibling,Be.index=n+1,Be;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Oe(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),v(a)?o.textContent=a:(o.textContent=" ",ae.assign(a),e.addFactory(a,s,i,n)),l=o}return Be.index=n+1,Be.node=l.nextSibling,Be}(e,s,t,n,i);case 8:const r=ie.parse(s.data,e.directives);null!==r&&e.addFactory(Me.aggregate(r),t,n,i)}return Be.index=i+1,Be.node=s.nextSibling,Be}const Ne={createHTML:e=>e};let Ee=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ne):Ne;const Fe=Ee,Me={setHTMLPolicy(e){if(Ee!==Fe)throw f.error(1201);Ee=e},compile(e,t){let s;if(v(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ee.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new ke(i,t);return Ie(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==ie.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Pe(n,i,"r"),Be.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>v(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new ye(s);return ae.assign(o,t),o}};class _e{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Me.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s,i){const n=this.create(null!=s?s:t);return n.bind(e,null!=i?i:O.default),n.appendTo(t),n}}const Le=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Re(e,t,s){const i=Le.exec(t);return null!==i&&ae.assign(e,i[2]),e.createHTML(s)}function ze(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=te();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,g(o))s+=Re(new ye(me(o)),r,n);else if(v(o)){const e=Le.exec(r);if(null!==e){const t=new ye(we((()=>o)));ae.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof le?s+=Re(new ye(o),r,n):void 0===(l=re.getForInstance(o))?s+=Re(new ye(we((()=>o))),r,n):l.aspected?s+=Re(o,r,n):s+=o.createHTML(n)}return new _e(s+e[e.length-1],i)}class De extends he{bind(e,t,s){e[this.options]=s[this.nodeId]}unbind(){}}re.define(De);const He=e=>new De(e);function qe(e,t){const s=g(e)?e:()=>e,i=g(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Qe=Object.freeze({positioning:!1,recycle:!0});function Ue(e,t,s,i){e.bind(t[s],i)}function We(e,t,s,i){e.bind(t[s],i.createItemContext(s,t.length))}class Ke{constructor(e,t){this.directive=e,this.location=t,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ue,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=We)}bind(e,t){this.source=e,this.context=t,this.childContext=t.createChildContext(e),this.items=this.itemsBindingObserver.observe(e,this.context),this.template=this.templateBindingObserver.observe(e,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(e,t){t===this.itemsBindingObserver?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBindingObserver?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):t[0].reset?this.refreshAllViews():this.updateViews(t)}observeItems(e=!1){if(!this.items)return void(this.items=p);const t=this.itemsObserver,s=this.itemsObserver=C.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=t.splice(d.index,u.length);for(h=l.length+g.length;p<b;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=h&&g.length>0?(d=g[f],f++):(d=l[a],a++),h--):d=r.create(),t.splice(p,0,d),i(d,n,p,s),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e)t[e].context.updatePosition(e,s)}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(Se.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Ge{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=te(),E.enable()}createHTML(e){return se.comment(e(this))}createBehavior(e){return new Ke(this,e[this.nodeId])}}function Je(e,t,s=Qe){const i=Te(e),n=Te(t);return new Ge(i,n,s)}re.define(Ge);const Xe=e=>1===e.nodeType,Ye=e=>e?t=>1===t.nodeType&&t.matches(e):Xe;class Ze extends he{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e,t,s){const i=s[this.nodeId];i[this.sourceProperty]=e,this.updateTarget(e,this.computeNodes(i)),this.observe(i)}unbind(e,t,s){const i=s[this.nodeId];this.updateTarget(e,p),this.disconnect(i),i[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class et extends Ze{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function tt(e){return v(e)&&(e={property:e}),new et(e)}re.define(et);class st extends Ze{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function it(e){return v(e)&&(e={property:e}),new st(e)}re.define(st);const nt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function rt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const ot={toView(e){const t=rt(e);return t?t.toString():t},fromView:rt};class lt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=nt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return C.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||y.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;G.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":G.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(e.attributes);for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];v(i)?s.push(new lt(e,i)):s.push(new lt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function at(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t);const i=e.constructor.attributes||(e.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ht={mode:"open"},ct={},dt=f.getById(4,(()=>b()));class ut{constructor(e,t=e.definition){this.platformDefined=!1,v(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const s=e.prototype,i=lt.collect(e,t.attributes),n=new Array(i.length),r={},o={};for(let e=0,t=i.length;e<t;++e){const t=i[e];n[e]=t.attribute,r[t.name]=t,o[t.attribute]=t,C.defineProperty(s,t)}Reflect.defineProperty(e,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===t.shadowOptions?ht:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ht),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ct:Object.assign(Object.assign({},ct),t.elementOptions),this.styles=R.normalize(t.styles),dt.register(this)}get isDefined(){return this.platformDefined}define(e=customElements){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=dt.getByType(e);return new ut(s?class extends e{}:e,t)}}ut.getByType=dt.getByType,ut.getForInstance=dt.getForInstance;const ft=new WeakMap,pt={bubbles:!0,composed:!0,cancelable:!0};function bt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ft.get(e))&&void 0!==s?s:null}class gt extends w{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ft.set(e,t))}const i=C.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return C.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,C.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get styles(){var e;if(null===this._styles){const t=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():t.styles&&(this._styles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||this.addStyles(e))}addStyles(e){if(!e)return;const t=bt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.append(e);else if(!e.isAttachedTo(t)){const s=e.behaviors;e.addStylesTo(t),null!==s&&this.addBehaviors(s)}}removeStyles(e){if(!e)return;const t=bt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.removeChild(e);else if(e.isAttachedTo(t)){const s=e.behaviors;e.removeStylesFrom(t),null!==s&&this.removeBehaviors(s)}}addBehaviors(e){var t;const s=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,i=e.length,n=[];for(let t=0;t<i;++t){const i=e[t];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].bind(e,t)}}removeBehaviors(e,t=!1){const s=this.behaviors;if(null===s)return;const i=e.length,n=[];for(let r=0;r<i;++r){const i=e[r];if(s.has(i)){const e=s.get(i)-1;0===e||t?s.delete(i)&&n.push(i):s.set(i,e)}}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].unbind(e,t)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element,t=O.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,t);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(e,t);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const e=this.view;null!==e&&e.unbind();const t=this.behaviors;if(null!==t){const e=this.element,s=O.default;for(const i of t.keys())i.unbind(e,s)}}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(e,t,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},pt),s)))}finishInitialization(){const e=this.element,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.element,i=null!==(t=bt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ut.getForInstance(e);if(void 0===s)throw f.error(1401);return e.$fastController=new gt(e,s)}}function vt(e){return class extends e{constructor(){super(),gt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function yt(e,t){return g(e)?ut.compose(e,t).define().type:ut.compose(this,e).define().type}const mt=Object.assign(vt(HTMLElement),{from:e=>vt(e),define:yt,compose:function(e,t){return g(e)?ut.compose(e,t):ut.compose(this,e)}});function wt(e){return function(t){yt(t,e)}}export{z as AdoptedStyleSheetsStrategy,E as ArrayObserver,ae as Aspect,lt as AttributeDefinition,le as Binding,be as BindingBehavior,H as CSSDirective,st as ChildrenDirective,Me as Compiler,ge as ContentBehavior,gt as Controller,G as DOM,R as ElementStyles,ve as EventBehavior,O as ExecutionContext,f as FAST,mt as FASTElement,ut as FASTElementDefinition,ye as HTMLBindingDirective,re as HTMLDirective,Se as HTMLView,se as Markup,Ze as NodeObservationDirective,C as Observable,ie as Parser,w as PropertyChangeNotifier,De as RefDirective,Ke as RepeatBehavior,Ge as RepeatDirective,et as SlottedDirective,A as Splice,I as SpliceStrategy,B as SpliceStrategySupport,he as StatelessAttachedAttributeDirective,m as SubscriberSet,y as Updates,_e as ViewTemplate,at as attr,me as bind,nt as booleanConverter,it as children,b as createTypeRegistry,U as css,q as cssDirective,K as cssPartial,wt as customElement,Ye as elements,p as emptyArray,ze as html,oe as htmlDirective,F as lengthOf,Ce as listener,Te as normalizeBinding,ot as nullableNumberConverter,T as observable,we as oneTime,He as ref,Je as repeat,tt as slotted,x as volatile,qe as when};
1
+ !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},a=/(\$\{\w+?})/g,h=/\$\{(\w+?)}/g,c=Object.freeze({});function d(e,t){return e.split(a).map((e=>{var s;const i=e.replace(h,"$1");return String(null!==(s=t[i])&&void 0!==s?s:e)})).join("")}Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Warning";console.warn(d(i,t))},error(e,t=c){var s;const i=null!==(s=l[e])&&void 0!==s?s:"Unknown Error";return new Error(d(i,t))}});const u={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},u));const f=globalThis.FAST;if(void 0===f.getById){const e=Object.create(null);Reflect.defineProperty(f,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},u))}void 0===f.error&&Object.assign(f,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const p=Object.freeze([]);function g(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}const b=e=>"function"==typeof e,v=e=>"string"==typeof e,y=f.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class m{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class w{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new m(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new m(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const C=f.getById(2,(()=>{const e=y.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=e=>{throw f.error(1101)};function o(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=r(e):s.set(e,i=new w(e))),i}function l(e){let t=i.get(e);if(void 0===t){let s=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==s;)t=i.get(s),s=Reflect.getPrototypeOf(s);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==n&&n.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];b(n)&&n.call(e,i,t),o(e).notify(this.name)}}}class h extends m{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;let i;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.binding(e,null!=t?t:O.default)}finally{n=s}return i}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=o(e),r=null===s?this.first:{};if(r.propertySource=e,r.propertyName=t,r.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;n=void 0,t=s.propertySource[s.propertyName],n=this,e===t&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){r=e},getNotifier:o,track(e,t){n&&n.watch(e,t)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(e,t){o(e).notify(t)},defineProperty(e,t){v(t)&&(t=new a(t)),l(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:l,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function x(e,t){C.defineProperty(e,t)}function T(e,t,s){return Object.assign({},s,{get(){return C.trackVolatile(),s.get.apply(this)}})}const S=f.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class O{constructor(e=null,t=null){this.index=0,this.length=0,this.parent=e,this.parentContext=t}get event(){return S.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(e,t){this.index=e,this.length=t}createChildContext(e){return new O(e,this)}createItemContext(e,t){const s=Object.create(this);return s.index=e,s.length=t,s}static setEvent(e){S.set(e)}static create(){return new O}}O.default=new O,C.defineProperty(O.prototype,"index"),C.defineProperty(O.prototype,"length");class A{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const B=Object.freeze({reset:1,splice:2,optimized:3}),j=new A(0,p,0);j.reset=!0;const $=[j];function k(e,t,s,i,n,r){let o=0,l=0;const a=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,a)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,a-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return p;if(t===s){const e=new A(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new A(t,[],s-t)];const h=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),c=[];let d,u=t,f=n;for(let e=0;e<h.length;++e)switch(h[e]){case 0:void 0!==d&&(c.push(d),d=void 0),u++,f++;break;case 1:void 0===d&&(d=new A(u,[],0)),d.addedCount++,u++,d.removed.push(i[f]),f++;break;case 2:void 0===d&&(d=new A(u,[],0)),d.addedCount++,u++;break;case 3:void 0===d&&(d=new A(u,[],0)),d.removed.push(i[f]),f++}return void 0!==d&&c.push(d),c}function I(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let P=Object.freeze({support:B.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?p:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)I(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(k(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:$,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new A(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new A(0,[],i.length).adjustTo(e)),n}});const V=Object.freeze({reset:$,setDefaultStrategy(e){P=e}});function N(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class E extends m{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,N(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,C.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:P).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,y.enqueue(this))}}let M=!1;const F=Object.freeze({enable(){if(M)return;M=!0,C.setArrayObserverFactory((e=>new E(e)));const e=Array.prototype;e.$fastPatch||(N(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:P)[t.name](this,i,t,e)}})))}});function _(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(F.enable(),t=C.getNotifier(e)),C.track(t.lengthObserver,"length"),e.length}const L=new Map;let R;function z(e){return e.map((e=>e instanceof D?z(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class D{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof D?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(R),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(z(this.styles)),this}static setDefaultStrategy(e){R=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new D(e):e instanceof D?e:new D([e])}}D.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class H{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=L.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),L.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}D.setDefaultStrategy(f.getById(5,(()=>H)));const q=g(),Q=Object.freeze({getForInstance:q.getForInstance,getByType:q.getByType,define:e=>(q.register({type:e}),e)});function U(){return function(e){Q.define(e)}}function W(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==Q.getForInstance(o)&&(o=o.createCSS(r)),o instanceof D||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const K=(e,...t)=>{const{styles:s,behaviors:i}=W(e,t),n=new D(s);return i.length?n.withBehaviors(...i):n};class G{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(v(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new D(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}bind(e){e.$fastController.addStyles(this.styles)}unbind(e){e.$fastController.removeStyles(this.styles)}}Q.define(G);const J=K.partial=(e,...t)=>{const{styles:s,behaviors:i}=W(e,t);return new G(s,i)},X=Object.freeze({queueUpdate:y.enqueue,nextUpdate:y.next,processUpdates:y.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),Y=`fast-${Math.random().toString(36).substring(2,8)}`,Z=`${Y}{`,ee=`}${Y}`,te=ee.length;let se=0;const ie=()=>`${Y}-${++se}`,ne=Object.freeze({interpolation:e=>`${Z}${e}${ee}`,attribute:e=>`${ie()}="${Z}${e}${ee}"`,comment:e=>`\x3c!--${Z}${e}${ee}--\x3e`}),re=Object.freeze({parse(e,t){const s=e.split(Z);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(ee);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+te)}""!==o&&i.push(o)}return i}}),oe=g(),le=Object.freeze({getForInstance:oe.getForInstance,getByType:oe.getByType,define:(e,t)=>((t=t||{}).type=e,oe.register(t),e)});function ae(e){return function(t){le.define(t,e)}}class he{}const ce=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=ce.property;break;case"classList":e.aspectType=ce.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=ce.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=ce.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=ce.property):(e.targetAspect=t,e.aspectType=ce.attribute)}else e.aspectType=ce.content}});class de{constructor(e){this.options=e,this.id=ie()}createBehavior(e){return this}createHTML(e){return ne.attribute(e(this))}}const ue=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw f.error(1202)}:e=>e;class fe extends he{constructor(e,t){super(),this.evaluate=e,this.isVolatile=t}createObserver(e,t){return C.binding(this.evaluate,t,this.isVolatile)}}class pe extends he{constructor(e){super(),this.evaluate=e}createObserver(){return this}observe(e,t){return this.evaluate(e,t)}dispose(){}}function ge(e,t,s,i,n){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i,n)):(t.isComposed=!0,t.bind(i,n),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function be(e,t,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}class ve{constructor(e,t){this.directive=e,this.updateTarget=t,this.observerProperty=`${e.id}-o`}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=e,r.context=t,this.updateTarget(n,i.targetAspect,r.observe(e,t),e,t)}unbind(e,t,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(e,t){const s=t.target,i=t.source,n=t.context;this.updateTarget(s,this.directive.targetAspect,t.observe(i,n),i,n)}getObserver(e){var t;return null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(e){return this}}class ye extends ve{unbind(e,t,s){super.unbind(e,t,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class me{constructor(e){this.directive=e,this.sourceProperty=`${e.id}-s`,this.contextProperty=`${e.id}-c`}bind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=e,n[this.contextProperty]=t,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(e){return this}handleEvent(e){const t=e.currentTarget;O.setEvent(e);const s=this.directive.dataBinding.evaluate(t[this.sourceProperty],t[this.contextProperty]);O.setEvent(null),!0!==s&&e.preventDefault()}}class we{constructor(e){this.dataBinding=e,this.factory=null,this.id=ie(),this.aspectType=ce.content}createHTML(e){return ne.interpolation(e(this))}createBehavior(e){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=ue(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new ve(this,X.setAttribute);break;case 2:this.factory=new ve(this,X.setBooleanAttribute);break;case 3:this.factory=new ve(this,((e,t,s)=>e[t]=s));break;case 4:this.factory=new ye(this,ge);break;case 5:this.factory=new ve(this,be);break;case 6:this.factory=new me(this);break;default:throw f.error(1205)}return this.factory.createBehavior(e)}}function Ce(e,t=C.isVolatileBinding(e)){return new fe(e,t)}function xe(e){return new pe(e)}function Te(e,t){const s=new fe(e,!1);return s.options=t,s}function Se(e){return b(e)?Ce(e):e instanceof he?e:xe((()=>e))}function Oe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}le.define(we,{aspected:!0});class Ae{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=e.firstChild,this.lastChild=e.lastChild}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Oe(this.firstChild,this.lastChild),this.unbind()}bind(e,t){let s=this.behaviors;const i=this.source;if(i===e)return;this.source=e,this.context=t;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,t,n),o.bind(e,t,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(e,t,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(e,t,n)}unbind(){const e=this.source;if(null===e)return;const t=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(e,s,t);this.source=null,this.context=null}static disposeContiguousBatch(e){if(0!==e.length){Oe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}const Be=(e,t)=>`${e}.${t}`,je={},$e={index:0,node:null};function ke(e){e.startsWith("fast-")||f.warn(1204,{name:e})}const Ie=new Proxy(document.createElement("div"),{get(e,t){ke(t);const s=Reflect.get(e,t);return b(s)?s.bind(e):s},set:(e,t,s)=>(ke(t),Reflect.set(e,t,s))});class Pe{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=je[t];if(!n){const i=`_${t}`;je[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Ie;for(const e of this.nodeIds)s[e];return new Ae(t,this.factories,s)}}function Ve(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=re.parse(d,l);let f=null;null===u?r&&(f=new we(xe((()=>d))),ce.assign(f,c.name)):f=Le.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function Ne(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Ee(e,s,n,i);n=t.node,i=t.index}}function Ee(e,t,s,i){const n=Be(t,i);switch(s.nodeType){case 1:Ve(e,t,s,n,i),Ne(e,s,n);break;case 3:return function(e,t,s,i,n){const r=re.parse(t.textContent,e.directives);if(null===r)return $e.node=t.nextSibling,$e.index=n+1,$e;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Be(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),v(a)?o.textContent=a:(o.textContent=" ",ce.assign(a),e.addFactory(a,s,i,n)),l=o}return $e.index=n+1,$e.node=l.nextSibling,$e}(e,s,t,n,i);case 8:const r=re.parse(s.data,e.directives);null!==r&&e.addFactory(Le.aggregate(r),t,n,i)}return $e.index=i+1,$e.node=s.nextSibling,$e}const Me={createHTML:e=>e};let Fe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Me):Me;const _e=Fe,Le={setHTMLPolicy(e){if(Fe!==_e)throw f.error(1201);Fe=e},compile(e,t){let s;if(v(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Fe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Pe(i,t);return Ve(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==re.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Ne(n,i,"r"),$e.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>v(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new we(s);return ce.assign(o,t),o}};class Re{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Le.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s,i){const n=this.create(null!=s?s:t);return n.bind(e,null!=i?i:O.default),n.appendTo(t),n}}const ze=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function De(e,t,s){const i=ze.exec(t);return null!==i&&ce.assign(e,i[2]),e.createHTML(s)}function He(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=ie();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,b(o))s+=De(new we(Ce(o)),r,n);else if(v(o)){const e=ze.exec(r);if(null!==e){const t=new we(xe((()=>o)));ce.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof he?s+=De(new we(o),r,n):void 0===(l=le.getForInstance(o))?s+=De(new we(xe((()=>o))),r,n):l.aspected?s+=De(o,r,n):s+=o.createHTML(n)}return new Re(s+e[e.length-1],i)}class qe extends de{bind(e,t,s){e[this.options]=s[this.nodeId]}unbind(){}}le.define(qe);const Qe=e=>new qe(e);function Ue(e,t){const s=b(e)?e:()=>e,i=b(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const We=Object.freeze({positioning:!1,recycle:!0});function Ke(e,t,s,i){e.bind(t[s],i)}function Ge(e,t,s,i){e.bind(t[s],i.createItemContext(s,t.length))}class Je{constructor(e,t){this.directive=e,this.location=t,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ke,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Ge)}bind(e,t){this.source=e,this.context=t,this.childContext=t.createChildContext(e),this.items=this.itemsBindingObserver.observe(e,this.context),this.template=this.templateBindingObserver.observe(e,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=p);const t=this.itemsObserver,s=this.itemsObserver=C.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length);for(h=l.length+b.length;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=h&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=r.create(),t.splice(p,0,d),i(d,n,p,s),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e)t[e].context.updatePosition(e,s)}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(Ae.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Xe{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=ie(),F.enable()}createHTML(e){return ne.comment(e(this))}createBehavior(e){return new Je(this,e[this.nodeId])}}function Ye(e,t,s=We){const i=Se(e),n=Se(t);return new Xe(i,n,Object.assign(Object.assign({},We),s))}le.define(Xe);const Ze=e=>1===e.nodeType,et=e=>e?t=>1===t.nodeType&&t.matches(e):Ze;class tt extends de{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e,t,s){const i=s[this.nodeId];i[this.sourceProperty]=e,this.updateTarget(e,this.computeNodes(i)),this.observe(i)}unbind(e,t,s){const i=s[this.nodeId];this.updateTarget(e,p),this.disconnect(i),i[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class st extends tt{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function it(e){return v(e)&&(e={property:e}),new st(e)}le.define(st);class nt extends tt{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function rt(e){return v(e)&&(e={property:e}),new nt(e)}le.define(nt);const ot={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function lt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const at={toView(e){const t=lt(e);return t?t.toString():t},fromView:lt};class ht{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=ot)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return C.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||y.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;X.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":X.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(e.attributes);for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];v(i)?s.push(new ht(e,i)):s.push(new ht(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function ct(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t);const i=e.constructor.attributes||(e.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const dt={mode:"open"},ut={},ft=f.getById(4,(()=>g()));class pt{constructor(e,t=e.definition){this.platformDefined=!1,v(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const s=e.prototype,i=ht.collect(e,t.attributes),n=new Array(i.length),r={},o={};for(let e=0,t=i.length;e<t;++e){const t=i[e];n[e]=t.attribute,r[t.name]=t,o[t.attribute]=t,C.defineProperty(s,t)}Reflect.defineProperty(e,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===t.shadowOptions?dt:null===t.shadowOptions?void 0:Object.assign(Object.assign({},dt),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ut:Object.assign(Object.assign({},ut),t.elementOptions),this.styles=D.normalize(t.styles),ft.register(this)}get isDefined(){return this.platformDefined}define(e=customElements){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=ft.getByType(e);return new pt(s?class extends e{}:e,t)}}pt.getByType=ft.getByType,pt.getForInstance=ft.getForInstance;const gt=new WeakMap,bt={bubbles:!0,composed:!0,cancelable:!0};function vt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:gt.get(e))&&void 0!==s?s:null}class yt extends w{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&gt.set(e,t))}const i=C.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return C.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,C.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get styles(){var e;if(null===this._styles){const t=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():t.styles&&(this._styles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||this.addStyles(e))}addStyles(e){if(!e)return;const t=vt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.append(e);else if(!e.isAttachedTo(t)){const s=e.behaviors;e.addStylesTo(t),null!==s&&this.addBehaviors(s)}}removeStyles(e){if(!e)return;const t=vt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.removeChild(e);else if(e.isAttachedTo(t)){const s=e.behaviors;e.removeStylesFrom(t),null!==s&&this.removeBehaviors(s)}}addBehaviors(e){var t;const s=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,i=e.length,n=[];for(let t=0;t<i;++t){const i=e[t];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].bind(e,t)}}removeBehaviors(e,t=!1){const s=this.behaviors;if(null===s)return;const i=e.length,n=[];for(let r=0;r<i;++r){const i=e[r];if(s.has(i)){const e=s.get(i)-1;0===e||t?s.delete(i)&&n.push(i):s.set(i,e)}}if(this._isConnected){const e=this.element,t=O.default;for(let s=0;s<n.length;++s)n[s].unbind(e,t)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element,t=O.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,t);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(e,t);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const e=this.view;null!==e&&e.unbind();const t=this.behaviors;if(null!==t){const e=this.element,s=O.default;for(const i of t.keys())i.unbind(e,s)}}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(e,t,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},bt),s)))}finishInitialization(){const e=this.element,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.element,i=null!==(t=vt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=pt.getForInstance(e);if(void 0===s)throw f.error(1401);return e.$fastController=new yt(e,s)}}function mt(e){return class extends e{constructor(){super(),yt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function wt(e,t){return b(e)?pt.compose(e,t).define().type:pt.compose(this,e).define().type}const Ct=Object.assign(mt(HTMLElement),{from:function(e){return mt(e)},define:wt,compose:function(e,t){return b(e)?pt.compose(e,t):pt.compose(this,e)}});function xt(e){return function(t){wt(t,e)}}export{H as AdoptedStyleSheetsStrategy,F as ArrayObserver,ce as Aspect,ht as AttributeDefinition,he as Binding,ve as BindingBehavior,Q as CSSDirective,nt as ChildrenDirective,Le as Compiler,ye as ContentBehavior,yt as Controller,X as DOM,D as ElementStyles,me as EventBehavior,O as ExecutionContext,f as FAST,Ct as FASTElement,pt as FASTElementDefinition,we as HTMLBindingDirective,le as HTMLDirective,Ae as HTMLView,ne as Markup,tt as NodeObservationDirective,C as Observable,re as Parser,w as PropertyChangeNotifier,qe as RefDirective,Je as RepeatBehavior,Xe as RepeatDirective,st as SlottedDirective,A as Splice,V as SpliceStrategy,B as SpliceStrategySupport,de as StatelessAttachedAttributeDirective,m as SubscriberSet,y as Updates,Re as ViewTemplate,ct as attr,Ce as bind,ot as booleanConverter,rt as children,g as createTypeRegistry,K as css,U as cssDirective,J as cssPartial,xt as customElement,et as elements,p as emptyArray,He as html,ae as htmlDirective,_ as lengthOf,Te as listener,Se as normalizeBinding,at as nullableNumberConverter,x as observable,xe as oneTime,Qe as ref,Ye as repeat,it as slotted,T as volatile,Ue as when};