@microsoft/fast-element 2.0.0-beta.1 → 2.0.0-beta.2

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.
Files changed (37) hide show
  1. package/CHANGELOG.json +51 -0
  2. package/CHANGELOG.md +15 -1
  3. package/dist/dts/components/fast-definitions.d.ts +2 -0
  4. package/dist/dts/components/fast-element.d.ts +7 -1
  5. package/dist/dts/context.d.ts +157 -0
  6. package/dist/dts/metadata.d.ts +25 -0
  7. package/dist/dts/observation/arrays.d.ts +1 -1
  8. package/dist/dts/observation/behavior.d.ts +4 -4
  9. package/dist/dts/observation/observable.d.ts +43 -62
  10. package/dist/dts/templating/binding-signal.d.ts +38 -0
  11. package/dist/dts/templating/binding-two-way.d.ts +56 -0
  12. package/dist/dts/templating/binding.d.ts +0 -88
  13. package/dist/dts/templating/compiler.d.ts +1 -2
  14. package/dist/dts/templating/repeat.d.ts +3 -49
  15. package/dist/dts/templating/template.d.ts +10 -59
  16. package/dist/dts/templating/view.d.ts +9 -9
  17. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
  18. package/dist/esm/components/fast-definitions.js +2 -0
  19. package/dist/esm/components/fast-element.js +10 -2
  20. package/dist/esm/context.js +159 -0
  21. package/dist/esm/metadata.js +60 -0
  22. package/dist/esm/observation/arrays.js +1 -1
  23. package/dist/esm/observation/observable.js +69 -17
  24. package/dist/esm/templating/binding-signal.js +84 -0
  25. package/dist/esm/templating/binding-two-way.js +76 -0
  26. package/dist/esm/templating/binding.js +1 -158
  27. package/dist/esm/templating/repeat.js +9 -1
  28. package/dist/esm/templating/template.js +1 -21
  29. package/dist/fast-element.api.json +5586 -7541
  30. package/dist/fast-element.d.ts +119 -329
  31. package/dist/fast-element.debug.js +92 -199
  32. package/dist/fast-element.debug.min.js +1 -1
  33. package/dist/fast-element.js +92 -199
  34. package/dist/fast-element.min.js +1 -1
  35. package/dist/fast-element.untrimmed.d.ts +120 -331
  36. package/docs/api-report.md +50 -156
  37. package/package.json +20 -4
@@ -658,75 +658,127 @@ const contextEvent = FAST.getById(3 /* KernelServiceId.contextEvent */, () => {
658
658
  },
659
659
  };
660
660
  });
661
- class DefaultExecutionContext {
661
+ /**
662
+ * Provides additional contextual information available to behaviors and expressions.
663
+ * @public
664
+ */
665
+ class ExecutionContext {
662
666
  constructor(parentSource = null, parentContext = null) {
667
+ /**
668
+ * The index of the current item within a repeat context.
669
+ */
663
670
  this.index = 0;
671
+ /**
672
+ * The length of the current collection within a repeat context.
673
+ */
664
674
  this.length = 0;
665
675
  this.parent = parentSource;
666
676
  this.parentContext = parentContext;
667
677
  }
678
+ /**
679
+ * The current event within an event handler.
680
+ */
668
681
  get event() {
669
682
  return contextEvent.get();
670
683
  }
684
+ /**
685
+ * Indicates whether the current item within a repeat context
686
+ * has an even index.
687
+ */
671
688
  get isEven() {
672
689
  return this.index % 2 === 0;
673
690
  }
691
+ /**
692
+ * Indicates whether the current item within a repeat context
693
+ * has an odd index.
694
+ */
674
695
  get isOdd() {
675
696
  return this.index % 2 !== 0;
676
697
  }
698
+ /**
699
+ * Indicates whether the current item within a repeat context
700
+ * is the first item in the collection.
701
+ */
677
702
  get isFirst() {
678
703
  return this.index === 0;
679
704
  }
705
+ /**
706
+ * Indicates whether the current item within a repeat context
707
+ * is somewhere in the middle of the collection.
708
+ */
680
709
  get isInMiddle() {
681
710
  return !this.isFirst && !this.isLast;
682
711
  }
712
+ /**
713
+ * Indicates whether the current item within a repeat context
714
+ * is the last item in the collection.
715
+ */
683
716
  get isLast() {
684
717
  return this.index === this.length - 1;
685
718
  }
719
+ /**
720
+ * Returns the typed event detail of a custom event.
721
+ */
686
722
  eventDetail() {
687
723
  return this.event.detail;
688
724
  }
725
+ /**
726
+ * Returns the typed event target of the event.
727
+ */
689
728
  eventTarget() {
690
729
  return this.event.target;
691
730
  }
731
+ /**
732
+ * Updates the position/size on a context associated with a list item.
733
+ * @param index - The new index of the item.
734
+ * @param length - The new length of the list.
735
+ */
692
736
  updatePosition(index, length) {
693
737
  this.index = index;
694
738
  this.length = length;
695
739
  }
740
+ /**
741
+ * Creates a new execution context descendent from the current context.
742
+ * @param source - The source for the context if different than the parent.
743
+ * @returns A child execution context.
744
+ */
696
745
  createChildContext(parentSource) {
697
- return new DefaultExecutionContext(parentSource, this);
746
+ return new ExecutionContext(parentSource, this);
698
747
  }
748
+ /**
749
+ * Creates a new execution context descent suitable for use in list rendering.
750
+ * @param item - The list item to serve as the source.
751
+ * @param index - The index of the item in the list.
752
+ * @param length - The length of the list.
753
+ */
699
754
  createItemContext(index, length) {
700
755
  const childContext = Object.create(this);
701
756
  childContext.index = index;
702
757
  childContext.length = length;
703
758
  return childContext;
704
759
  }
705
- }
706
- Observable.defineProperty(DefaultExecutionContext.prototype, "index");
707
- Observable.defineProperty(DefaultExecutionContext.prototype, "length");
708
- /**
709
- * The common execution context APIs.
710
- * @public
711
- */
712
- const ExecutionContext = Object.freeze({
713
- default: new DefaultExecutionContext(),
714
760
  /**
715
761
  * Sets the event for the current execution context.
716
762
  * @param event - The event to set.
717
763
  * @internal
718
764
  */
719
- setEvent(event) {
765
+ static setEvent(event) {
720
766
  contextEvent.set(event);
721
- },
767
+ }
722
768
  /**
723
769
  * Creates a new root execution context.
724
770
  * @returns A new execution context.
725
771
  */
726
- create() {
727
- return new DefaultExecutionContext();
728
- },
729
- });
772
+ static create() {
773
+ return new ExecutionContext();
774
+ }
775
+ }
776
+ /**
777
+ * The default execution context.
778
+ */
779
+ ExecutionContext.default = new ExecutionContext();
780
+ Observable.defineProperty(ExecutionContext.prototype, "index");
781
+ Observable.defineProperty(ExecutionContext.prototype, "length");
730
782
 
731
783
  /**
732
784
  * A splice map is a representation of how a previous array of items
@@ -981,7 +1033,7 @@ const ArrayObserver = Object.freeze({
981
1033
  * @returns The length of the array.
982
1034
  * @public
983
1035
  */
984
- function length(array) {
1036
+ function lengthOf(array) {
985
1037
  if (!array) {
986
1038
  return 0;
987
1039
  }
@@ -1711,78 +1763,6 @@ class OneTimeBinding extends UpdateBinding {
1711
1763
  this.updateTarget(targets[directive.nodeId], directive.targetAspect, directive.binding(source, context), source, context);
1712
1764
  }
1713
1765
  }
1714
- const signals = Object.create(null);
1715
- /**
1716
- * A binding behavior for signal bindings.
1717
- * @public
1718
- */
1719
- class SignalBinding extends UpdateBinding {
1720
- constructor() {
1721
- super(...arguments);
1722
- this.handlerProperty = `${this.directive.id}-h`;
1723
- }
1724
- /**
1725
- * Bind this behavior to the source.
1726
- * @param source - The source to bind to.
1727
- * @param context - The execution context that the binding is operating within.
1728
- * @param targets - The targets that behaviors in a view can attach to.
1729
- */
1730
- bind(source, context, targets) {
1731
- const directive = this.directive;
1732
- const target = targets[directive.nodeId];
1733
- const signal = this.getSignal(source, context);
1734
- const handler = (target[this.handlerProperty] = () => {
1735
- this.updateTarget(target, directive.targetAspect, directive.binding(source, context), source, context);
1736
- });
1737
- handler();
1738
- const found = signals[signal];
1739
- if (found) {
1740
- Array.isArray(found)
1741
- ? found.push(handler)
1742
- : (signals[signal] = [found, handler]);
1743
- }
1744
- else {
1745
- signals[signal] = handler;
1746
- }
1747
- }
1748
- /**
1749
- * Unbinds this behavior from the source.
1750
- * @param source - The source to unbind from.
1751
- * @param context - The execution context that the binding is operating within.
1752
- * @param targets - The targets that behaviors in a view can attach to.
1753
- */
1754
- unbind(source, context, targets) {
1755
- const signal = this.getSignal(source, context);
1756
- const found = signals[signal];
1757
- if (found && Array.isArray(found)) {
1758
- const directive = this.directive;
1759
- const target = targets[directive.nodeId];
1760
- const handler = target[this.handlerProperty];
1761
- const index = found.indexOf(handler);
1762
- if (index !== -1) {
1763
- found.splice(index, 1);
1764
- }
1765
- }
1766
- else {
1767
- signals[signal] = void 0;
1768
- }
1769
- }
1770
- getSignal(source, context) {
1771
- const options = this.directive.options;
1772
- return isString(options) ? options : options(source, context);
1773
- }
1774
- /**
1775
- * Sends the specified signal to signaled bindings.
1776
- * @param signal - The signal to send.
1777
- * @public
1778
- */
1779
- static send(signal) {
1780
- const found = signals[signal];
1781
- if (found) {
1782
- Array.isArray(found) ? found.forEach(x => x()) : found();
1783
- }
1784
- }
1785
- }
1786
1766
  /**
1787
1767
  * A binding behavior for bindings that change.
1788
1768
  * @public
@@ -1903,86 +1883,11 @@ class EventBinding {
1903
1883
  }
1904
1884
  }
1905
1885
  }
1906
- let twoWaySettings = {
1907
- determineChangeEvent() {
1908
- return "change";
1909
- },
1910
- };
1911
- /**
1912
- * A binding behavior for bindings that update in two directions.
1913
- * @public
1914
- */
1915
- class TwoWayBinding extends ChangeBinding {
1916
- /**
1917
- * Bind this behavior to the source.
1918
- * @param source - The source to bind to.
1919
- * @param context - The execution context that the binding is operating within.
1920
- * @param targets - The targets that behaviors in a view can attach to.
1921
- */
1922
- bind(source, context, targets) {
1923
- var _a;
1924
- super.bind(source, context, targets);
1925
- const directive = this.directive;
1926
- const target = targets[directive.nodeId];
1927
- if (!this.changeEvent) {
1928
- this.changeEvent =
1929
- (_a = directive.options.changeEvent) !== null && _a !== void 0 ? _a : twoWaySettings.determineChangeEvent(directive, target);
1930
- }
1931
- target.addEventListener(this.changeEvent, this);
1932
- }
1933
- /**
1934
- * Unbinds this behavior from the source.
1935
- * @param source - The source to unbind from.
1936
- * @param context - The execution context that the binding is operating within.
1937
- * @param targets - The targets that behaviors in a view can attach to.
1938
- */
1939
- unbind(source, context, targets) {
1940
- super.unbind(source, context, targets);
1941
- targets[this.directive.nodeId].removeEventListener(this.changeEvent, this);
1942
- }
1943
- /** @internal */
1944
- handleEvent(event) {
1945
- const directive = this.directive;
1946
- const target = event.currentTarget;
1947
- let value;
1948
- switch (directive.aspectType) {
1949
- case 1:
1950
- value = target.getAttribute(directive.targetAspect);
1951
- break;
1952
- case 2:
1953
- value = target.hasAttribute(directive.targetAspect);
1954
- break;
1955
- case 4:
1956
- value = target.innerText;
1957
- break;
1958
- default:
1959
- value = target[directive.targetAspect];
1960
- break;
1961
- }
1962
- const observer = this.getObserver(target);
1963
- const last = observer.last; // using internal API!!!
1964
- last.propertySource[last.propertyName] = directive.options.fromView(value);
1965
- }
1966
- /**
1967
- * Configures two-way binding.
1968
- * @param settings - The settings to use for the two-way binding system.
1969
- */
1970
- static configure(settings) {
1971
- twoWaySettings = settings;
1972
- }
1973
- }
1974
1886
  /**
1975
1887
  * The default onChange binding configuration.
1976
1888
  * @public
1977
1889
  */
1978
1890
  const onChange = BindingConfig.define(BindingMode.define(ChangeBinding), {});
1979
- /**
1980
- * The default twoWay binding configuration.
1981
- * @public
1982
- */
1983
- const twoWay = BindingConfig.define(BindingMode.define(TwoWayBinding), {
1984
- fromView: v => v,
1985
- });
1986
1891
  /**
1987
1892
  * The default onTime binding configuration.
1988
1893
  * @public
@@ -1990,16 +1895,6 @@ const twoWay = BindingConfig.define(BindingMode.define(TwoWayBinding), {
1990
1895
  const oneTime = BindingConfig.define(BindingMode.define(OneTimeBinding), {
1991
1896
  once: true,
1992
1897
  });
1993
- const signalMode = BindingMode.define(SignalBinding);
1994
- /**
1995
- * Creates a signal binding configuration with the supplied options.
1996
- * @param options - The signal name or a binding to use to retrieve the signal name.
1997
- * @returns A binding configuration.
1998
- * @public
1999
- */
2000
- const signal = (options) => {
2001
- return { mode: signalMode, options };
2002
- };
2003
1898
  /**
2004
1899
  * A directive that applies bindings.
2005
1900
  * @public
@@ -2579,26 +2474,6 @@ function html(strings, ...values) {
2579
2474
  }
2580
2475
  return new ViewTemplate(html + strings[strings.length - 1], factories);
2581
2476
  }
2582
- /**
2583
- * Transforms a template literal string into a ChildViewTemplate.
2584
- * @param strings - The string fragments that are interpolated with the values.
2585
- * @param values - The values that are interpolated with the string fragments.
2586
- * @remarks
2587
- * The html helper supports interpolation of strings, numbers, binding expressions,
2588
- * other template instances, and Directive instances.
2589
- * @public
2590
- */
2591
- const child = html;
2592
- /**
2593
- * Transforms a template literal string into an ItemViewTemplate.
2594
- * @param strings - The string fragments that are interpolated with the values.
2595
- * @param values - The values that are interpolated with the string fragments.
2596
- * @remarks
2597
- * The html helper supports interpolation of strings, numbers, binding expressions,
2598
- * other template instances, and Directive instances.
2599
- * @public
2600
- */
2601
- const item = html;
2602
2477
 
2603
2478
  /**
2604
2479
  * The runtime behavior for template references.
@@ -2797,7 +2672,7 @@ class RepeatBehavior {
2797
2672
  let itemsLength = items.length;
2798
2673
  let views = this.views;
2799
2674
  let viewsLength = views.length;
2800
- if (itemsLength === 0 || templateChanged) {
2675
+ if (itemsLength === 0 || templateChanged || !this.options.recycle) {
2801
2676
  // all views need to be removed
2802
2677
  HTMLView.disposeContiguousBatch(views);
2803
2678
  viewsLength = 0;
@@ -2875,6 +2750,14 @@ class RepeatDirective {
2875
2750
  }
2876
2751
  }
2877
2752
  HTMLDirective.define(RepeatDirective);
2753
+ /**
2754
+ * A directive that enables list rendering.
2755
+ * @param itemsBinding - The array to render.
2756
+ * @param templateOrTemplateBinding - The template or a template binding used obtain a template
2757
+ * to render for each item in the array.
2758
+ * @param options - Options used to turn on special repeat features.
2759
+ * @public
2760
+ */
2878
2761
  function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeatOptions) {
2879
2762
  const templateBinding = isFunction(templateOrTemplateBinding)
2880
2763
  ? templateOrTemplateBinding
@@ -3319,6 +3202,8 @@ class FASTElementDefinition {
3319
3202
  /**
3320
3203
  * Defines a custom element based on this definition.
3321
3204
  * @param registry - The element registry to define the element in.
3205
+ * @remarks
3206
+ * This operation is idempotent per registry.
3322
3207
  */
3323
3208
  define(registry = customElements) {
3324
3209
  const type = this.type;
@@ -3776,7 +3661,15 @@ const FASTElement = Object.assign(createFASTElement(HTMLElement), {
3776
3661
  * that describes the element to define.
3777
3662
  */
3778
3663
  define(type, nameOrDef) {
3779
- return new FASTElementDefinition(type, nameOrDef).define().type;
3664
+ return this.metadata(type, nameOrDef).define().type;
3665
+ },
3666
+ /**
3667
+ * Defines metadata for a FASTElement which can be used to later define the element.
3668
+ * IMPORTANT: This API will be renamed to "compose" in a future beta.
3669
+ * @public
3670
+ */
3671
+ metadata(type, nameOrDef) {
3672
+ return new FASTElementDefinition(type, nameOrDef);
3780
3673
  },
3781
3674
  });
3782
3675
  /**
@@ -3788,8 +3681,8 @@ const FASTElement = Object.assign(createFASTElement(HTMLElement), {
3788
3681
  function customElement(nameOrDef) {
3789
3682
  /* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */
3790
3683
  return function (type) {
3791
- new FASTElementDefinition(type, nameOrDef).define();
3684
+ FASTElement.define(type, nameOrDef);
3792
3685
  };
3793
3686
  }
3794
3687
 
3795
- export { AdoptedStyleSheetsStrategy, ArrayObserver, Aspect, AttributeDefinition, BindingConfig, BindingMode, CSSDirective, ChangeBinding, ChildrenDirective, Compiler, Controller, DOM, ElementStyles, EventBinding, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Markup, NodeObservationDirective, Observable, OneTimeBinding, Parser, PropertyChangeNotifier, RefDirective, RepeatBehavior, RepeatDirective, SignalBinding, SlottedDirective, Splice, SpliceStrategy, SpliceStrategySupport, StatelessAttachedAttributeDirective, SubscriberSet, TwoWayBinding, UpdateBinding, Updates, ViewTemplate, attr, bind, booleanConverter, child, children, createTypeRegistry, css, cssDirective, cssPartial, customElement, elements, emptyArray, html, htmlDirective, item, length, nullableNumberConverter, observable, onChange, oneTime, ref, repeat, signal, slotted, twoWay, volatile, when };
3688
+ export { AdoptedStyleSheetsStrategy, ArrayObserver, Aspect, AttributeDefinition, BindingConfig, BindingMode, CSSDirective, ChangeBinding, ChildrenDirective, Compiler, Controller, DOM, ElementStyles, EventBinding, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Markup, NodeObservationDirective, Observable, OneTimeBinding, Parser, PropertyChangeNotifier, RefDirective, RepeatBehavior, RepeatDirective, SlottedDirective, Splice, SpliceStrategy, SpliceStrategySupport, StatelessAttachedAttributeDirective, SubscriberSet, UpdateBinding, Updates, ViewTemplate, attr, bind, booleanConverter, children, createTypeRegistry, css, cssDirective, cssPartial, customElement, elements, emptyArray, html, htmlDirective, lengthOf, nullableNumberConverter, observable, onChange, oneTime, ref, repeat, slotted, volatile, when };
@@ -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 t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const t=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:t=>new Error(`Code ${t}`),addMessages(){}});const h=Object.freeze([]);function c(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const a=t=>"function"==typeof t,d=t=>"string"==typeof t,u=l.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class f{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class p{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const g=l.getById(2,(()=>{const t=u.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw l.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new p(t))),i}function h(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class c{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];a(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class g extends f{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:w.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){d(e)&&(e=new c(e)),h(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:h,binding(t,e,s=this.isVolatileBinding(t)){return new g(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function b(t,e){g.defineProperty(t,e)}function v(t,e,s){return Object.assign({},s,{get(){return g.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class m{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return y.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new m(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}}g.defineProperty(m.prototype,"index"),g.defineProperty(m.prototype,"length");const w=Object.freeze({default:new m,setEvent(t){y.set(t)},create:()=>new m});class C{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),x=new C(0,h,0);x.reset=!0;const S=[x];let O=Object.freeze({support:T.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:h:S,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new C(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new C(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new C(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new C(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new C(0,[],i.length).adjustTo(t)),n}});const A=Object.freeze({reset:S,setDefaultStrategy(t){O=t}});function B(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class j extends f{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,B(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,g.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:O).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let I=!1;const $=Object.freeze({enable(){if(I)return;I=!0,g.setArrayObserverFactory((t=>new j(t)));const t=Array.prototype;t.$fastPatch||(B(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:O)[e.name](this,i,e,t)}})))}});function V(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&($.enable(),e=g.getNotifier(t)),g.track(e.lengthObserver,"length"),t.length}const k=new Map;let P;function E(t){return t.map((t=>t instanceof N?E(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class N{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof N?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(P),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(E(this.styles)),this}static setDefaultStrategy(t){P=t}}N.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=k.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),k.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}N.setDefaultStrategy(l.getById(5,(()=>_)));const L=c(),F=Object.freeze({getForInstance:L.getForInstance,getByType:L.getByType,define:t=>(L.register({type:t}),t)});function z(){return function(t){F.define(t)}}function M(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==F.getForInstance(o)&&(o=o.createCSS(r)),o instanceof N||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const R=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e),n=new N(s);return i.length?n.withBehaviors(...i):n};class H{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(d(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new N(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}F.define(H);const q=R.partial=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e);return new H(s,i)},D=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),Q=`fast-${Math.random().toString(36).substring(2,8)}`,W=`${Q}{`,U=`}${Q}`,G=U.length;let J=0;const K=()=>`${Q}-${++J}`,X=Object.freeze({interpolation:t=>`${W}${t}${U}`,attribute:t=>`${K()}="${W}${t}${U}"`,comment:t=>`\x3c!--${W}${t}${U}--\x3e`}),Y=Object.freeze({parse(t,e){const s=t.split(W);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(U);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+G)}""!==o&&i.push(o)}return i}}),Z=c(),tt=Object.freeze({getForInstance:Z.getForInstance,getByType:Z.getByType,define:(t,e)=>((e=e||{}).type=t,Z.register(e),t)});function et(t){return function(e){tt.define(e,t)}}const st=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(t.sourceAspect=e,e)switch(e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=st.property;break;case"classList":t.aspectType=st.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=st.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=st.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=st.property):(t.targetAspect=e,t.aspectType=st.attribute)}}});class it{constructor(t){this.options=t}createBehavior(t){return this}createHTML(t){return X.attribute(t(this))}}const nt=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:t=>t,rt=Object.freeze({define:(t,e=pt)=>Object.freeze({1:e=>new t(e,D.setAttribute),2:e=>new t(e,D.setBooleanAttribute),3:e=>new t(e,((t,e,s)=>t[e]=s)),4:e=>{return new(s=t,class extends s{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}})(e,ht);var s},5:e=>new t(e,ct),6:t=>new e(t)})}),ot=Object.freeze({define(t,e){const s=t=>({mode:s.mode,options:Object.assign({},e,t)});return s.options=e,s.mode=t,s}});class lt{constructor(t,e){this.directive=t,this.updateTarget=e}bind(t,e,s){}unbind(t,e,s){}createBehavior(t){return this}}function ht(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ct(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class at extends lt{bind(t,e,s){const i=this.directive;this.updateTarget(s[i.nodeId],i.targetAspect,i.binding(t,e),t,e)}}const dt=Object.create(null);class ut extends lt{constructor(){super(...arguments),this.handlerProperty=`${this.directive.id}-h`}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getSignal(t,e),o=n[this.handlerProperty]=()=>{this.updateTarget(n,i.targetAspect,i.binding(t,e),t,e)};o();const l=dt[r];l?Array.isArray(l)?l.push(o):dt[r]=[l,o]:dt[r]=o}unbind(t,e,s){const i=this.getSignal(t,e),n=dt[i];if(n&&Array.isArray(n)){const t=s[this.directive.nodeId][this.handlerProperty],e=n.indexOf(t);-1!==e&&n.splice(e,1)}else dt[i]=void 0}getSignal(t,e){const s=this.directive.options;return d(s)?s:s(t,e)}static send(t){const e=dt[t];e&&(Array.isArray(e)?e.forEach((t=>t())):e())}}class ft extends lt{constructor(t,e){super(t,e),this.isBindingVolatile=g.isVolatileBinding(t.binding),this.observerProperty=`${t.id}-o`}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=g.binding(this.directive.binding,this,this.isBindingVolatile)}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}}class pt{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;w.setEvent(t);const s=this.directive.binding(e[this.sourceProperty],e[this.contextProperty]);w.setEvent(null),!0!==s&&t.preventDefault()}}let gt={determineChangeEvent:()=>"change"};class bt extends ft{bind(t,e,s){var i;super.bind(t,e,s);const n=this.directive,r=s[n.nodeId];this.changeEvent||(this.changeEvent=null!==(i=n.options.changeEvent)&&void 0!==i?i:gt.determineChangeEvent(n,r)),r.addEventListener(this.changeEvent,this)}unbind(t,e,s){super.unbind(t,e,s),s[this.directive.nodeId].removeEventListener(this.changeEvent,this)}handleEvent(t){const e=this.directive,s=t.currentTarget;let i;switch(e.aspectType){case 1:i=s.getAttribute(e.targetAspect);break;case 2:i=s.hasAttribute(e.targetAspect);break;case 4:i=s.innerText;break;default:i=s[e.targetAspect]}const n=this.getObserver(s).last;n.propertySource[n.propertyName]=e.options.fromView(i)}static configure(t){gt=t}}const vt=ot.define(rt.define(ft),{}),yt=ot.define(rt.define(bt),{fromView:t=>t}),mt=ot.define(rt.define(at),{once:!0}),wt=rt.define(ut),Ct=t=>({mode:wt,options:t});class Tt{constructor(t,e,s){this.binding=t,this.mode=e,this.options=s,this.factory=null,this.aspectType=st.content}createHTML(t){return X.interpolation(t(this))}createBehavior(t){return null==this.factory&&("innerHTML"===this.targetAspect&&(this.binding=nt(this.binding)),this.factory=this.mode[this.aspectType](this)),this.factory.createBehavior(t)}}function xt(t,e=vt){return"mode"in e||(e=vt(e)),new Tt(t,e.mode,e.options)}function St(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}tt.define(Tt,{aspected:!0});class Ot{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){St(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){St(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const At=(t,e)=>`${t}.${e}`,Bt={},jt={index:0,node:null};class It{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=Bt[e];if(!n){const i=`_${e}`;Bt[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:e;for(const t of this.nodeIds)s[t];return new Ot(e,this.factories,s)}}function $t(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,c=o.length;h<c;++h){const a=o[h],d=a.value,u=Y.parse(d,l);let f=null;null===u?r&&(f=xt((()=>d),mt),st.assign(f,a.name)):f=_t.aggregate(u),null!==f&&(s.removeAttributeNode(a),h--,c--,t.addFactory(f,e,i,n))}}function Vt(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=kt(t,s,n,i);n=e.node,i=e.index}}function kt(t,e,s,i){const n=At(e,i);switch(s.nodeType){case 1:$t(t,e,s,n,i),Vt(t,s,n);break;case 3:return function(t,e,s,i,n){const r=Y.parse(e.textContent,t.directives);if(null===r)return jt.node=e.nextSibling,jt.index=n+1,jt;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=At(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",t.addFactory(h,s,i,n)),l=o}return jt.index=n+1,jt.node=l.nextSibling,jt}(t,s,e,n,i);case 8:const r=Y.parse(s.data,t.directives);null!==r&&t.addFactory(_t.aggregate(r),e,n,i)}return jt.index=i+1,jt.node=s.nextSibling,jt}const Pt={createHTML:t=>t};let Et=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Pt):Pt;const Nt=Et,_t={setHTMLPolicy(t){if(Et!==Nt)throw l.error(1201);Et=t},compile(t,e){let s;if(d(t)){s=document.createElement("TEMPLATE"),s.innerHTML=Et.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new It(i,e);return $t(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==Y.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Vt(n,i,"r"),jt.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map((t=>d(t)?()=>t:(e=t.sourceAspect||e,t.binding))),n=xt(((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n}));return st.assign(n,e),n}};class Lt{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=_t.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:w.default),n.appendTo(e),n}}const Ft=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function zt(t,e,s){const i=Ft.exec(e);return null!==i&&st.assign(t,i[2]),t.createHTML(s)}function Mt(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=K();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,a(o))s+=zt(xt(o),r,n);else if(d(o)){const t=Ft.exec(r);if(null!==t){const e=xt((()=>o),mt);st.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else void 0===(l=tt.getForInstance(o))?s+=zt(xt((()=>o),mt),r,n):l.aspected?s+=zt(o,r,n):s+=o.createHTML(n)}return new Lt(s+t[t.length-1],i)}const Rt=Mt,Ht=Mt;class qt extends it{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}tt.define(qt);const Dt=t=>new qt(t);function Qt(t,e){const s=a(e)?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Wt=Object.freeze({positioning:!1,recycle:!0});function Ut(t,e,s,i){t.bind(e[s],i)}function Gt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Jt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ut,this.itemsBindingObserver=g.binding(e,this,s),this.templateBindingObserver=g.binding(i,this,n),r.positioning&&(this.bindView=Gt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=h);const e=this.itemsObserver,s=this.itemsObserver=g.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=[],n=this.bindView;let r=0;for(let s=0,n=t.length;s<n;++s){const n=t[s],o=n.removed;i.push(...e.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,h=t.length;r<h;++r){const h=t[r];let c=h.index;const a=c+h.addedCount;for(;c<a;++c){const t=e[c],r=t?t.firstChild:this.location,h=this.options.recycle&&i.length>0?i.shift():l.create();e.splice(c,0,h),n(h,o,c,s),h.insertBefore(r)}}for(let t=0,e=i.length;t<e;++t)i[t].dispose();if(this.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if((0===o||t)&&(Ot.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const c=l.splice(t,h-t);for(t=0,o=c.length;t<o;++t)c[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Kt{constructor(t,e,s){this.itemsBinding=t,this.templateBinding=e,this.options=s,$.enable(),this.isItemsBindingVolatile=g.isVolatileBinding(t),this.isTemplateBindingVolatile=g.isVolatileBinding(e)}createHTML(t){return X.comment(t(this))}createBehavior(t){return new Jt(t[this.nodeId],this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Xt(t,e,s=Wt){const i=a(e)?e:()=>e;return new Kt(t,i,s)}tt.define(Kt);const Yt=t=>1===t.nodeType,Zt=t=>t?e=>1===e.nodeType&&e.matches(t):Yt;class te extends it{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,h),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class ee extends te{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function se(t){return d(t)&&(t={property:t}),new ee(t)}tt.define(ee);class ie extends te{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function ne(t){return d(t)&&(t={property:t}),new ie(t)}tt.define(ie);const re={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function oe(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const le={toView(t){const e=oe(t);return e?e.toString():e},fromView:oe};class he{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=re)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return g.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||u.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;D.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":D.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];d(i)?s.push(new he(t,i)):s.push(new he(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function ce(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const ae={mode:"open"},de={},ue=l.getById(4,(()=>c()));class fe{constructor(t,e=t.definition){d(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=he.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?ae:null===e.shadowOptions?void 0:Object.assign(Object.assign({},ae),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?de:Object.assign(Object.assign({},de),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?new N(e.styles):e.styles instanceof N?e.styles:new N([e.styles])}get isDefined(){return!!ue.getByType(this.type)}define(t=customElements){const e=this.type;if(ue.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)g.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}fe.getByType=ue.getByType,fe.getForInstance=ue.getForInstance;const pe=new WeakMap,ge={bubbles:!0,composed:!0,cancelable:!0};function be(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:pe.get(t))&&void 0!==s?s:null}class ve extends p{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&pe.set(t,e))}const i=g.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return g.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,g.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=be(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=be(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=w.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=w.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=w.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=w.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},ge),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=be(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=fe.getForInstance(t);if(void 0===s)throw l.error(1401);return t.$fastController=new ve(t,s)}}function ye(t){return class extends t{constructor(){super(),ve.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const me=Object.assign(ye(HTMLElement),{from:t=>ye(t),define:(t,e)=>new fe(t,e).define().type});function we(t){return function(e){new fe(e,t).define()}}export{_ as AdoptedStyleSheetsStrategy,$ as ArrayObserver,st as Aspect,he as AttributeDefinition,ot as BindingConfig,rt as BindingMode,F as CSSDirective,ft as ChangeBinding,ie as ChildrenDirective,_t as Compiler,ve as Controller,D as DOM,N as ElementStyles,pt as EventBinding,w as ExecutionContext,l as FAST,me as FASTElement,fe as FASTElementDefinition,Tt as HTMLBindingDirective,tt as HTMLDirective,Ot as HTMLView,X as Markup,te as NodeObservationDirective,g as Observable,at as OneTimeBinding,Y as Parser,p as PropertyChangeNotifier,qt as RefDirective,Jt as RepeatBehavior,Kt as RepeatDirective,ut as SignalBinding,ee as SlottedDirective,C as Splice,A as SpliceStrategy,T as SpliceStrategySupport,it as StatelessAttachedAttributeDirective,f as SubscriberSet,bt as TwoWayBinding,lt as UpdateBinding,u as Updates,Lt as ViewTemplate,ce as attr,xt as bind,re as booleanConverter,Rt as child,ne as children,c as createTypeRegistry,R as css,z as cssDirective,q as cssPartial,we as customElement,Zt as elements,h as emptyArray,Mt as html,et as htmlDirective,Ht as item,V as length,le as nullableNumberConverter,b as observable,vt as onChange,mt as oneTime,Dt as ref,Xt as repeat,Ct as signal,se as slotted,yt as twoWay,v as volatile,Qt 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 t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r));const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const t=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:t=>new Error(`Code ${t}`),addMessages(){}});const h=Object.freeze([]);function c(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const a=t=>"function"==typeof t,d=t=>"string"==typeof t,u=l.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class f{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class p{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const b=l.getById(2,(()=>{const t=u.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw l.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new p(t))),i}function h(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class c{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];a(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class b extends f{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:m.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){d(e)&&(e=new c(e)),h(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:h,binding(t,e,s=this.isVolatileBinding(t)){return new b(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function g(t,e){b.defineProperty(t,e)}function v(t,e,s){return Object.assign({},s,{get(){return b.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class m{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return y.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new m(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}static setEvent(t){y.set(t)}static create(){return new m}}m.default=new m,b.defineProperty(m.prototype,"index"),b.defineProperty(m.prototype,"length");class w{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const C=Object.freeze({reset:1,splice:2,optimized:3}),T=new w(0,h,0);T.reset=!0;const x=[T];let S=Object.freeze({support:C.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:h:x,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(0,[],i.length).adjustTo(t)),n}});const O=Object.freeze({reset:x,setDefaultStrategy(t){S=t}});function A(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class B extends f{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,A(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,b.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:S).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let j=!1;const I=Object.freeze({enable(){if(j)return;j=!0,b.setArrayObserverFactory((t=>new B(t)));const t=Array.prototype;t.$fastPatch||(A(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:S)[e.name](this,i,e,t)}})))}});function $(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&(I.enable(),e=b.getNotifier(t)),b.track(e.lengthObserver,"length"),t.length}const V=new Map;let k;function P(t){return t.map((t=>t instanceof N?P(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class N{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof N?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(k),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(P(this.styles)),this}static setDefaultStrategy(t){k=t}}N.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=V.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),V.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}N.setDefaultStrategy(l.getById(5,(()=>_)));const E=c(),F=Object.freeze({getForInstance:E.getForInstance,getByType:E.getByType,define:t=>(E.register({type:t}),t)});function L(){return function(t){F.define(t)}}function M(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==F.getForInstance(o)&&(o=o.createCSS(r)),o instanceof N||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e),n=new N(s);return i.length?n.withBehaviors(...i):n};class R{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(d(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new N(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}F.define(R);const H=z.partial=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e);return new R(s,i)},q=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),D=`fast-${Math.random().toString(36).substring(2,8)}`,Q=`${D}{`,W=`}${D}`,U=W.length;let G=0;const J=()=>`${D}-${++G}`,K=Object.freeze({interpolation:t=>`${Q}${t}${W}`,attribute:t=>`${J()}="${Q}${t}${W}"`,comment:t=>`\x3c!--${Q}${t}${W}--\x3e`}),X=Object.freeze({parse(t,e){const s=t.split(Q);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(W);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+U)}""!==o&&i.push(o)}return i}}),Y=c(),Z=Object.freeze({getForInstance:Y.getForInstance,getByType:Y.getByType,define:(t,e)=>((e=e||{}).type=t,Y.register(e),t)});function tt(t){return function(e){Z.define(e,t)}}const et=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(t.sourceAspect=e,e)switch(e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=et.property;break;case"classList":t.aspectType=et.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=et.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=et.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=et.property):(t.targetAspect=e,t.aspectType=et.attribute)}}});class st{constructor(t){this.options=t}createBehavior(t){return this}createHTML(t){return K.attribute(t(this))}}const it=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:t=>t,nt=Object.freeze({define:(t,e=dt)=>Object.freeze({1:e=>new t(e,q.setAttribute),2:e=>new t(e,q.setBooleanAttribute),3:e=>new t(e,((t,e,s)=>t[e]=s)),4:e=>{return new(s=t,class extends s{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}})(e,lt);var s},5:e=>new t(e,ht),6:t=>new e(t)})}),rt=Object.freeze({define(t,e){const s=t=>({mode:s.mode,options:Object.assign({},e,t)});return s.options=e,s.mode=t,s}});class ot{constructor(t,e){this.directive=t,this.updateTarget=e}bind(t,e,s){}unbind(t,e,s){}createBehavior(t){return this}}function lt(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ht(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class ct extends ot{bind(t,e,s){const i=this.directive;this.updateTarget(s[i.nodeId],i.targetAspect,i.binding(t,e),t,e)}}class at extends ot{constructor(t,e){super(t,e),this.isBindingVolatile=b.isVolatileBinding(t.binding),this.observerProperty=`${t.id}-o`}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=b.binding(this.directive.binding,this,this.isBindingVolatile)}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}}class dt{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;m.setEvent(t);const s=this.directive.binding(e[this.sourceProperty],e[this.contextProperty]);m.setEvent(null),!0!==s&&t.preventDefault()}}const ut=rt.define(nt.define(at),{}),ft=rt.define(nt.define(ct),{once:!0});class pt{constructor(t,e,s){this.binding=t,this.mode=e,this.options=s,this.factory=null,this.aspectType=et.content}createHTML(t){return K.interpolation(t(this))}createBehavior(t){return null==this.factory&&("innerHTML"===this.targetAspect&&(this.binding=it(this.binding)),this.factory=this.mode[this.aspectType](this)),this.factory.createBehavior(t)}}function bt(t,e=ut){return"mode"in e||(e=ut(e)),new pt(t,e.mode,e.options)}function gt(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}Z.define(pt,{aspected:!0});class vt{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){gt(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){gt(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const yt=(t,e)=>`${t}.${e}`,mt={},wt={index:0,node:null};class Ct{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=mt[e];if(!n){const i=`_${e}`;mt[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:e;for(const t of this.nodeIds)s[t];return new vt(e,this.factories,s)}}function Tt(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,c=o.length;h<c;++h){const a=o[h],d=a.value,u=X.parse(d,l);let f=null;null===u?r&&(f=bt((()=>d),ft),et.assign(f,a.name)):f=jt.aggregate(u),null!==f&&(s.removeAttributeNode(a),h--,c--,t.addFactory(f,e,i,n))}}function xt(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=St(t,s,n,i);n=e.node,i=e.index}}function St(t,e,s,i){const n=yt(e,i);switch(s.nodeType){case 1:Tt(t,e,s,n,i),xt(t,s,n);break;case 3:return function(t,e,s,i,n){const r=X.parse(e.textContent,t.directives);if(null===r)return wt.node=e.nextSibling,wt.index=n+1,wt;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=yt(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",t.addFactory(h,s,i,n)),l=o}return wt.index=n+1,wt.node=l.nextSibling,wt}(t,s,e,n,i);case 8:const r=X.parse(s.data,t.directives);null!==r&&t.addFactory(jt.aggregate(r),e,n,i)}return wt.index=i+1,wt.node=s.nextSibling,wt}const Ot={createHTML:t=>t};let At=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ot):Ot;const Bt=At,jt={setHTMLPolicy(t){if(At!==Bt)throw l.error(1201);At=t},compile(t,e){let s;if(d(t)){s=document.createElement("TEMPLATE"),s.innerHTML=At.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new Ct(i,e);return Tt(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==X.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xt(n,i,"r"),wt.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map((t=>d(t)?()=>t:(e=t.sourceAspect||e,t.binding))),n=bt(((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n}));return et.assign(n,e),n}};class It{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=jt.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:m.default),n.appendTo(e),n}}const $t=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Vt(t,e,s){const i=$t.exec(e);return null!==i&&et.assign(t,i[2]),t.createHTML(s)}function kt(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=J();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,a(o))s+=Vt(bt(o),r,n);else if(d(o)){const t=$t.exec(r);if(null!==t){const e=bt((()=>o),ft);et.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else void 0===(l=Z.getForInstance(o))?s+=Vt(bt((()=>o),ft),r,n):l.aspected?s+=Vt(o,r,n):s+=o.createHTML(n)}return new It(s+t[t.length-1],i)}class Pt extends st{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}Z.define(Pt);const Nt=t=>new Pt(t);function _t(t,e){const s=a(e)?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Et=Object.freeze({positioning:!1,recycle:!0});function Ft(t,e,s,i){t.bind(e[s],i)}function Lt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Mt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=Ft,this.itemsBindingObserver=b.binding(e,this,s),this.templateBindingObserver=b.binding(i,this,n),r.positioning&&(this.bindView=Lt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=h);const e=this.itemsObserver,s=this.itemsObserver=b.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=[],n=this.bindView;let r=0;for(let s=0,n=t.length;s<n;++s){const n=t[s],o=n.removed;i.push(...e.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,h=t.length;r<h;++r){const h=t[r];let c=h.index;const a=c+h.addedCount;for(;c<a;++c){const t=e[c],r=t?t.firstChild:this.location,h=this.options.recycle&&i.length>0?i.shift():l.create();e.splice(c,0,h),n(h,o,c,s),h.insertBefore(r)}}for(let t=0,e=i.length;t<e;++t)i[t].dispose();if(this.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(vt.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const c=l.splice(t,h-t);for(t=0,o=c.length;t<o;++t)c[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class zt{constructor(t,e,s){this.itemsBinding=t,this.templateBinding=e,this.options=s,I.enable(),this.isItemsBindingVolatile=b.isVolatileBinding(t),this.isTemplateBindingVolatile=b.isVolatileBinding(e)}createHTML(t){return K.comment(t(this))}createBehavior(t){return new Mt(t[this.nodeId],this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Rt(t,e,s=Et){const i=a(e)?e:()=>e;return new zt(t,i,s)}Z.define(zt);const Ht=t=>1===t.nodeType,qt=t=>t?e=>1===e.nodeType&&e.matches(t):Ht;class Dt extends st{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,h),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class Qt extends Dt{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function Wt(t){return d(t)&&(t={property:t}),new Qt(t)}Z.define(Qt);class Ut extends Dt{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function Gt(t){return d(t)&&(t={property:t}),new Ut(t)}Z.define(Ut);const Jt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function Kt(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const Xt={toView(t){const e=Kt(t);return e?e.toString():e},fromView:Kt};class Yt{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=Jt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||u.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;q.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":q.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];d(i)?s.push(new Yt(t,i)):s.push(new Yt(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function Zt(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const te={mode:"open"},ee={},se=l.getById(4,(()=>c()));class ie{constructor(t,e=t.definition){d(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=Yt.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?te:null===e.shadowOptions?void 0:Object.assign(Object.assign({},te),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ee:Object.assign(Object.assign({},ee),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?new N(e.styles):e.styles instanceof N?e.styles:new N([e.styles])}get isDefined(){return!!se.getByType(this.type)}define(t=customElements){const e=this.type;if(se.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)b.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ie.getByType=se.getByType,ie.getForInstance=se.getForInstance;const ne=new WeakMap,re={bubbles:!0,composed:!0,cancelable:!0};function oe(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:ne.get(t))&&void 0!==s?s:null}class le extends p{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&ne.set(t,e))}const i=b.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=oe(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=oe(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=m.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=m.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},re),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=oe(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ie.getForInstance(t);if(void 0===s)throw l.error(1401);return t.$fastController=new le(t,s)}}function he(t){return class extends t{constructor(){super(),le.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const ce=Object.assign(he(HTMLElement),{from:t=>he(t),define(t,e){return this.metadata(t,e).define().type},metadata:(t,e)=>new ie(t,e)});function ae(t){return function(e){ce.define(e,t)}}export{_ as AdoptedStyleSheetsStrategy,I as ArrayObserver,et as Aspect,Yt as AttributeDefinition,rt as BindingConfig,nt as BindingMode,F as CSSDirective,at as ChangeBinding,Ut as ChildrenDirective,jt as Compiler,le as Controller,q as DOM,N as ElementStyles,dt as EventBinding,m as ExecutionContext,l as FAST,ce as FASTElement,ie as FASTElementDefinition,pt as HTMLBindingDirective,Z as HTMLDirective,vt as HTMLView,K as Markup,Dt as NodeObservationDirective,b as Observable,ct as OneTimeBinding,X as Parser,p as PropertyChangeNotifier,Pt as RefDirective,Mt as RepeatBehavior,zt as RepeatDirective,Qt as SlottedDirective,w as Splice,O as SpliceStrategy,C as SpliceStrategySupport,st as StatelessAttachedAttributeDirective,f as SubscriberSet,ot as UpdateBinding,u as Updates,It as ViewTemplate,Zt as attr,bt as bind,Jt as booleanConverter,Gt as children,c as createTypeRegistry,z as css,L as cssDirective,H as cssPartial,ae as customElement,qt as elements,h as emptyArray,kt as html,tt as htmlDirective,$ as lengthOf,Xt as nullableNumberConverter,g as observable,ut as onChange,ft as oneTime,Nt as ref,Rt as repeat,Wt as slotted,v as volatile,_t as when};