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

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 (98) hide show
  1. package/CHANGELOG.json +348 -0
  2. package/CHANGELOG.md +114 -1
  3. package/dist/dts/components/attributes.d.ts +10 -0
  4. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +49 -25
  5. package/dist/dts/components/fast-definitions.d.ts +43 -9
  6. package/dist/dts/components/fast-element.d.ts +15 -21
  7. package/dist/dts/context.d.ts +157 -0
  8. package/dist/dts/di/di.d.ts +899 -0
  9. package/dist/dts/index.d.ts +2 -2
  10. package/dist/dts/interfaces.d.ts +45 -14
  11. package/dist/dts/metadata.d.ts +25 -0
  12. package/dist/dts/observation/arrays.d.ts +1 -1
  13. package/dist/dts/observation/observable.d.ts +101 -75
  14. package/dist/dts/pending-task.d.ts +20 -0
  15. package/dist/dts/platform.d.ts +7 -0
  16. package/dist/dts/polyfills.d.ts +1 -8
  17. package/dist/dts/state/exports.d.ts +3 -0
  18. package/dist/dts/state/reactive.d.ts +8 -0
  19. package/dist/dts/state/state.d.ts +141 -0
  20. package/dist/dts/state/visitor.d.ts +6 -0
  21. package/dist/dts/state/watch.d.ts +10 -0
  22. package/dist/dts/styles/css-directive.d.ts +2 -2
  23. package/dist/dts/styles/element-styles.d.ts +10 -17
  24. package/dist/dts/styles/host.d.ts +68 -0
  25. package/dist/dts/templating/binding-signal.d.ts +21 -0
  26. package/dist/dts/templating/binding-two-way.d.ts +39 -0
  27. package/dist/dts/templating/binding.d.ts +69 -294
  28. package/dist/dts/templating/children.d.ts +1 -1
  29. package/dist/dts/templating/compiler.d.ts +1 -2
  30. package/dist/dts/templating/html-directive.d.ts +93 -35
  31. package/dist/dts/templating/node-observation.d.ts +4 -5
  32. package/dist/dts/templating/ref.d.ts +5 -13
  33. package/dist/dts/templating/render.d.ts +272 -0
  34. package/dist/dts/templating/repeat.d.ts +20 -75
  35. package/dist/dts/templating/slotted.d.ts +1 -1
  36. package/dist/dts/templating/template.d.ts +12 -61
  37. package/dist/dts/templating/view.d.ts +77 -12
  38. package/dist/dts/templating/when.d.ts +3 -3
  39. package/dist/dts/testing/exports.d.ts +3 -0
  40. package/dist/dts/testing/fakes.d.ts +4 -0
  41. package/dist/dts/testing/fixture.d.ts +84 -0
  42. package/dist/dts/testing/timeout.d.ts +7 -0
  43. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
  44. package/dist/dts/utilities.d.ts +0 -18
  45. package/dist/esm/components/attributes.js +13 -4
  46. package/dist/esm/components/{controller.js → element-controller.js} +188 -109
  47. package/dist/esm/components/fast-definitions.js +38 -28
  48. package/dist/esm/components/fast-element.js +31 -12
  49. package/dist/esm/context.js +163 -0
  50. package/dist/esm/debug.js +36 -4
  51. package/dist/esm/di/di.js +1435 -0
  52. package/dist/esm/index.js +2 -1
  53. package/dist/esm/interfaces.js +4 -0
  54. package/dist/esm/metadata.js +60 -0
  55. package/dist/esm/observation/arrays.js +304 -3
  56. package/dist/esm/observation/observable.js +81 -87
  57. package/dist/esm/pending-task.js +16 -0
  58. package/dist/esm/platform.js +26 -1
  59. package/dist/esm/polyfills.js +1 -55
  60. package/dist/esm/state/exports.js +3 -0
  61. package/dist/esm/state/reactive.js +34 -0
  62. package/dist/esm/state/state.js +148 -0
  63. package/dist/esm/state/visitor.js +28 -0
  64. package/dist/esm/state/watch.js +36 -0
  65. package/dist/esm/styles/css.js +4 -4
  66. package/dist/esm/styles/element-styles.js +14 -33
  67. package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
  68. package/dist/esm/templating/binding-signal.js +83 -0
  69. package/dist/esm/templating/binding-two-way.js +103 -0
  70. package/dist/esm/templating/binding.js +134 -414
  71. package/dist/esm/templating/compiler.js +30 -7
  72. package/dist/esm/templating/html-directive.js +100 -28
  73. package/dist/esm/templating/node-observation.js +9 -8
  74. package/dist/esm/templating/ref.js +4 -12
  75. package/dist/esm/templating/render.js +391 -0
  76. package/dist/esm/templating/repeat.js +96 -72
  77. package/dist/esm/templating/template.js +11 -29
  78. package/dist/esm/templating/view.js +107 -29
  79. package/dist/esm/templating/when.js +5 -4
  80. package/dist/esm/testing/exports.js +3 -0
  81. package/dist/esm/testing/fakes.js +76 -0
  82. package/dist/esm/testing/fixture.js +86 -0
  83. package/dist/esm/testing/timeout.js +24 -0
  84. package/dist/esm/utilities.js +0 -95
  85. package/dist/fast-element.api.json +9278 -10745
  86. package/dist/fast-element.d.ts +707 -813
  87. package/dist/fast-element.debug.js +1229 -944
  88. package/dist/fast-element.debug.min.js +1 -1
  89. package/dist/fast-element.js +1191 -938
  90. package/dist/fast-element.min.js +1 -1
  91. package/dist/fast-element.untrimmed.d.ts +716 -824
  92. package/docs/api-report.md +265 -319
  93. package/package.json +39 -14
  94. package/dist/dts/hooks.d.ts +0 -20
  95. package/dist/dts/observation/behavior.d.ts +0 -19
  96. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  97. package/dist/esm/hooks.js +0 -32
  98. package/dist/esm/observation/splice-strategies.js +0 -400
@@ -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 e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}void 0===t.error&&Object.assign(t,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const s=Object.freeze([]);function i(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function n(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const r=e=>"function"==typeof e,o=e=>"string"==typeof e,l=t.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class h{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class a{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new h(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new h(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const c=Object.freeze({unknown:void 0,coupled:1}),d=t.getById(2,(()=>{const e=l.enqueue,s=/(:|&&|\|\||if)/,i=new WeakMap;let d,u=e=>{throw t.error(1101)};function f(e){var t;let s=null!==(t=e.$fastController)&&void 0!==t?t:i.get(e);return void 0===s&&(Array.isArray(e)?s=u(e):i.set(e,s=new a(e))),s}const p=n();class b{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==d&&d.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];r(n)&&n.call(e,i,t),f(e).notify(this.name)}}}class g extends h{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==c.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=d;let i;d=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.expression(e,t)}finally{d=s}return i}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=f(e),n=null===s?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;d=void 0,t=s.propertySource[s.propertyName],d=this,e===t&&(this.needsRefresh=!0)}s.next=n}this.last=n}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){u=e},getNotifier:f,track(e,t){d&&d.watch(e,t)},trackVolatile(){d&&(d.needsRefresh=!0)},notify(e,t){f(e).notify(t)},defineProperty(e,t){o(t)&&(t=new b(t)),p(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:p,binding(e,t,s=this.isVolatileBinding(e)){return new g(e,t,s)},isVolatileBinding:e=>s.test(e.toString())})}));function u(e,t){d.defineProperty(e,t)}function f(e,t,s){return Object.assign({},s,{get(){return d.trackVolatile(),s.get.apply(this)}})}const p=t.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),b=Object.freeze({default:{index:0,length:0,get event(){return b.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>p.get(),setEvent(e){p.set(e)}});class g{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const v=Object.freeze({reset:1,splice:2,optimized:3}),y=new g(0,s,0);y.reset=!0;const m=[y];function w(e,t,i,n,r,o){let l=0,h=0;const a=Math.min(i-t,o-r);if(0===t&&0===r&&(l=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,n,a)),i===e.length&&o===n.length&&(h=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,n,a-l)),r+=l,o-=h,(i-=h)-(t+=l)==0&&o-r==0)return s;if(t===i){const e=new g(t,[],0);for(;r<o;)e.removed.push(n[r++]);return[e]}if(r===o)return[new g(t,[],i-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):h===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,h=new Array(o);let a,c;for(let e=0;e<o;++e)h[e]=new Array(l),h[e][0]=e;for(let e=0;e<l;++e)h[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(e,t,i,n,r,o)),d=[];let u,f=t,p=r;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new g(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=new g(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new g(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}function C(e,t){let s=!1,i=0;for(let h=0;h<t.length;h++){const a=t[h];if(a.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=a.index,l=a.index+a.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(h,1),h--,i-=a.addedCount-a.removed.length,e.addedCount+=a.addedCount-c;const n=e.removed.length+a.removed.length-c;if(e.addedCount||n){let t=a.removed;if(e.index<a.index){const s=e.removed.slice(0,a.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>a.index+a.addedCount){const s=e.removed.slice(a.index+a.addedCount-e.index);t.push(...s)}e.removed=t,a.index<e.index&&(e.index=a.index)}else s=!0}else if(e.index<a.index){s=!0,t.splice(h,0,e),h++;const n=e.addedCount-e.removed.length;a.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let x=Object.freeze({support:v.optimized,normalize:(e,t,i)=>void 0===e?void 0===i?s:i.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)C(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(w(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,i):i:m,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new g(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new g(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new g(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new g(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new g(0,[],i.length).adjustTo(e)),n}});const S=Object.freeze({reset:m,setDefaultStrategy(e){x=e}});function T(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class O extends h{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,T(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,d.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:x).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,l.enqueue(this))}}let B=!1;const A=Object.freeze({enable(){if(B)return;B=!0,d.setArrayObserverFactory((e=>new O(e)));const e=Array.prototype;e.$fastPatch||(T(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:x)[t.name](this,i,t,e)}})))}});function k(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(A.enable(),t=d.getNotifier(e)),d.track(t.lengthObserver,"length"),e.length}let j;function $(e){return e.map((e=>e instanceof I?$(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class I{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof I?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(j),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e($(this.styles)),this}static setDefaultStrategy(e){j=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new I(e):e instanceof I?e:new I([e])}}I.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const V=i(),E=Object.freeze({getForInstance:V.getForInstance,getByType:V.getByType,define:e=>(V.register({type:e}),e)});function N(){return function(e){E.define(e)}}function _(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==E.getForInstance(o)&&(o=o.createCSS(r)),o instanceof I||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t),n=new I(s);return i.length?n.withBehaviors(...i):n};class L{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(o(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new I(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}E.define(L);const F=z.partial=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t);return new L(s,i)},M=Object.freeze({queueUpdate:l.enqueue,nextUpdate:l.next,processUpdates:l.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),P=`fast-${Math.random().toString(36).substring(2,8)}`,R=`${P}{`,D=`}${P}`,H=D.length;let U=0;const q=()=>`${P}-${++U}`,Q=Object.freeze({interpolation:e=>`${R}${e}${D}`,attribute:e=>`${q()}="${R}${e}${D}"`,comment:e=>`\x3c!--${R}${e}${D}--\x3e`}),W=Object.freeze({parse(e,t){const s=e.split(R);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(D);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+H)}""!==o&&i.push(o)}return i}}),G=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:b.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=q());e.id||(e.id=q()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),J=i(),K=Object.freeze({getForInstance:J.getForInstance,getByType:J.getByType,define:(e,t)=>((t=t||{}).type=e,J.register(t),e)});function X(e){return function(t){K.define(t,e)}}class Y{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const Z=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?Z.tokenList:Z.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=Z.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=Z.event;break;default:e.targetAspect=t,e.aspectType=Z.attribute}else e.aspectType=Z.content}});class ee{constructor(e){this.options=e,this.id=q()}createHTML(e){return Q.attribute(e(this))}createBehavior(){return this}}const te=globalThis.TrustedHTML?e=>(s,i)=>{const n=e(s,i);if(n instanceof TrustedHTML)return n;throw t.error(1202)}:e=>e;class se extends Y{createObserver(e,t){return d.binding(this.evaluate,t,this.isVolatile)}}class ie extends Y{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ne(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function re(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&h.remove(e)}}const oe=(e,t,s)=>e[t]=s,le=()=>{};class he{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=q(),this.aspectType=Z.content,this.bind=this.bindDefault,this.data=`${this.id}-d`}createHTML(e){return Q.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=te(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=M.setAttribute;break;case 2:this.updateTarget=M.setBooleanAttribute;break;case 3:this.updateTarget=oe;break;case 4:this.bind=this.bindContent,this.updateTarget=ne;break;case 5:this.updateTarget=re;break;case 6:this.bind=this.bindEvent,this.updateTarget=le;break;default:throw t.error(1205)}return this}bindDefault(e){var t;const s=e.targets[this.nodeId],i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e),this.updateTarget===ne&&e.onUnbind(this)}bindContent(e){this.bindDefault(e),e.onUnbind(this)}bindEvent(e){const t=e.targets[this.nodeId];t[this.data]=e,t.addEventListener(this.targetAspect,this,this.dataBinding.options)}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget;b.setEvent(e);const s=t[this.data],i=this.dataBinding.evaluate(s.source,s.context);b.setEvent(null),!0!==i&&e.preventDefault()}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ae(e,t=d.isVolatileBinding(e)){return new se(e,t)}function ce(e){return new ie(e)}function de(e,t){const s=new se(e,!1);return s.options=t,s}function ue(e){return r(e)?ae(e):e instanceof Y?e:ce((()=>e))}function fe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}K.define(he,{aspected:!0});class pe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=c.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return b.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){fe(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){fe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}d.defineProperty(pe.prototype,"index"),d.defineProperty(pe.prototype,"length");const be=(e,t)=>`${e}.${t}`,ge={},ve={index:0,node:null};function ye(e){e.startsWith("fast-")||t.warn(1204,{name:e})}const me=new Proxy(document.createElement("div"),{get(e,t){ye(t);const s=Reflect.get(e,t);return r(s)?s.bind(e):s},set:(e,t,s)=>(ye(t),Reflect.set(e,t,s))});class we{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=ge[t];if(!n){const i=`_${t}`;ge[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:me;for(const e of this.nodeIds)s[e];return new pe(t,this.factories,s)}}function Ce(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let h=0,a=o.length;h<a;++h){const c=o[h],d=c.value,u=W.parse(d,l);let f=null;null===u?r&&(f=new he(ce((()=>d))),Z.assign(f,c.name)):f=Ae.aggregate(u),null!==f&&(s.removeAttributeNode(c),h--,a--,e.addFactory(f,t,i,n))}}function xe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Se(e,s,n,i);n=t.node,i=t.index}}function Se(e,t,s,i){const n=be(t,i);switch(s.nodeType){case 1:Ce(e,t,s,n,i),xe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=W.parse(t.textContent,e.directives);if(null===r)return ve.node=t.nextSibling,ve.index=n+1,ve;let l,h=l=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=be(s,n),l=h.parentNode.insertBefore(document.createTextNode(""),h.nextSibling)),o(a)?l.textContent=a:(l.textContent=" ",Z.assign(a),e.addFactory(a,s,i,n)),h=l}return ve.index=n+1,ve.node=h.nextSibling,ve}(e,s,t,n,i);case 8:const r=W.parse(s.data,e.directives);null!==r&&e.addFactory(Ae.aggregate(r),t,n,i)}return ve.index=i+1,ve.node=s.nextSibling,ve}const Te={createHTML:e=>e};let Oe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Te):Te;const Be=Oe,Ae={setHTMLPolicy(e){if(Oe!==Be)throw t.error(1201);Oe=e},compile(e,t){let s;if(o(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Oe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new we(i,t);return Ce(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==W.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xe(n,i,"r"),ve.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>o(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const l=new he(s);return Z.assign(l,t),l}};class ke{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ae.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const je=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function $e(e,t,s){const i=je.exec(t);return null!==i&&Z.assign(e,i[2]),e.createHTML(s)}function Ie(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=q();return i[s]=e,s};for(let i=0,l=e.length-1;i<l;++i){const l=e[i],h=t[i];let a;if(s+=l,r(h))s+=$e(new he(ae(h)),l,n);else if(o(h)){const e=je.exec(l);if(null!==e){const t=new he(ce((()=>h)));Z.assign(t,e[2]),s+=t.createHTML(n)}else s+=h}else h instanceof Y?s+=$e(new he(h),l,n):void 0===(a=K.getForInstance(h))?s+=$e(new he(ce((()=>h))),l,n):a.aspected?s+=$e(h,l,n):s+=h.createHTML(n)}return new ke(s+e[e.length-1],i)}class Ve extends ee{bind(e){e.source[this.options]=e.targets[this.nodeId]}}K.define(Ve);const Ee=e=>new Ve(e);function Ne(e,t){const s=r(e)?e:()=>e,i=r(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const _e=Object.freeze({positioning:!1,recycle:!0});function ze(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function Le(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Fe{constructor(e){this.directive=e,this.views=[],this.items=null,this.itemsObserver=null,this.bindView=ze,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Le)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=s);const t=this.itemsObserver,i=this.itemsObserver=d.getNotifier(this.items),n=t!==i;n&&null!==t&&t.unsubscribe(this),(n||e)&&i.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let h=0,a=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=t.splice(d.index,u.length),v=a=l.length+g.length;for(;p<b;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&a>0?(f<=v&&g.length>0?(d=g[f],f++):(d=l[h],h++),a--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let e=h,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=e,i.index=s}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,h=l.length;if(0!==o&&!e&&this.directive.options.recycle||(pe.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<h){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const a=l.splice(e,h-e);for(e=0,o=a.length;e<o;++e)a[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Me{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=q(),A.enable()}createHTML(e){return Q.comment(e(this))}createBehavior(){return new Fe(this)}}function Pe(e,t,s=_e){const i=ue(e),n=ue(t);return new Me(i,n,Object.assign(Object.assign({},_e),s))}K.define(Me);const Re=e=>1===e.nodeType,De=e=>e?t=>1===t.nodeType&&t.matches(e):Re;class He extends ee{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,s),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Ue extends He{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function qe(e){return o(e)&&(e={property:e}),new Ue(e)}K.define(Ue);class Qe extends He{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function We(e){return o(e)&&(e={property:e}),new Qe(e)}K.define(Qe);const Ge=Object.freeze({locate:n()}),Je={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function Ke(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const Xe={toView(e){const t=Ke(e);return t?t.toString():t},fromView:Ke};class Ye{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=Je)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return d.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||l.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;M.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":M.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(Ge.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];o(i)?s.push(new Ye(e,i)):s.push(new Ye(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function Ze(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),Ge.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const et={mode:"open"},tt={},st=new Set,it=t.getById(4,(()=>i()));class nt{constructor(e,t=e.definition){var s;this.platformDefined=!1,o(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=Ye.collect(e,t.attributes),r=new Array(n.length),l={},h={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,l[t.name]=t,h[t.attribute]=t,d.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=l,this.attributeLookup=h,this.shadowOptions=void 0===t.shadowOptions?et:null===t.shadowOptions?void 0:Object.assign(Object.assign({},et),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?tt:Object.assign(Object.assign({},tt),t.elementOptions),this.styles=I.normalize(t.styles),it.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return st.has(e)||it.getByType(e)?new nt(class extends e{},t):new nt(e,t)}static registerBaseType(e){st.add(e)}}nt.getByType=it.getByType,nt.getForInstance=it.getForInstance;const rt={bubbles:!0,composed:!0,cancelable:!0},ot=new WeakMap;function lt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ot.get(e))&&void 0!==s?s:null}class ht extends a{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ot.set(e,t))}const i=d.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return d.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,d.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},rt),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=lt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=c.coupled)}static forCustomElement(e){const s=e.$fastController;if(void 0!==s)return s;const i=nt.getForInstance(e);if(void 0===i)throw t.error(1401);return e.$fastController=new ht(e,i)}}function at(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=lt(e))&&void 0!==t?t:e.getRootNode()}class ct{constructor(e){const t=ct.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=at(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=at(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}ct.styleSheetCache=new Map;let dt=0;function ut(e){return e===document?document.body:e}function ft(e){const t=class extends e{constructor(){super(),ht.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return nt.registerBaseType(t),t}function pt(e,t){return r(e)?nt.compose(e,t).define().type:nt.compose(this,e).define().type}I.setDefaultStrategy(I.supportsAdoptedStyleSheets?ct:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++dt}addStylesTo(e){e=ut(at(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=ut(at(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const bt=Object.assign(ft(HTMLElement),{from:function(e){return ft(e)},define:pt,compose:function(e,t){return r(e)?nt.compose(e,t):nt.compose(this,e)}});function gt(e){return function(t){pt(t,e)}}export{A as ArrayObserver,Z as Aspect,Ge as AttributeConfiguration,Ye as AttributeDefinition,Y as Binding,E as CSSDirective,Qe as ChildrenDirective,Ae as Compiler,M as DOM,ht as ElementController,I as ElementStyles,b as ExecutionContext,t as FAST,bt as FASTElement,nt as FASTElementDefinition,he as HTMLBindingDirective,K as HTMLDirective,pe as HTMLView,Q as Markup,He as NodeObservationDirective,d as Observable,W as Parser,a as PropertyChangeNotifier,Ve as RefDirective,Fe as RepeatBehavior,Me as RepeatDirective,Ue as SlottedDirective,c as SourceLifetime,g as Splice,S as SpliceStrategy,v as SpliceStrategySupport,ee as StatelessAttachedAttributeDirective,h as SubscriberSet,l as Updates,G as ViewBehaviorOrchestrator,ke as ViewTemplate,Ze as attr,ae as bind,Je as booleanConverter,We as children,n as createMetadataLocator,i as createTypeRegistry,z as css,N as cssDirective,F as cssPartial,gt as customElement,De as elements,s as emptyArray,Ie as html,X as htmlDirective,k as lengthOf,de as listener,ue as normalizeBinding,Xe as nullableNumberConverter,u as observable,ce as oneTime,Ee as ref,Pe as repeat,qe as slotted,f as volatile,Ne as when};