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

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 (95) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +321 -1
  3. package/CHANGELOG.md +52 -2
  4. package/README.md +2 -2
  5. package/dist/dts/components/attributes.d.ts +4 -1
  6. package/dist/dts/components/controller.d.ts +12 -11
  7. package/dist/dts/components/fast-definitions.d.ts +8 -2
  8. package/dist/dts/components/fast-element.d.ts +5 -4
  9. package/dist/dts/debug.d.ts +1 -0
  10. package/dist/dts/hooks.d.ts +20 -0
  11. package/dist/dts/index.d.ts +16 -15
  12. package/dist/dts/index.debug.d.ts +2 -0
  13. package/dist/dts/index.rollup.d.ts +2 -0
  14. package/dist/dts/index.rollup.debug.d.ts +3 -0
  15. package/dist/dts/interfaces.d.ts +144 -0
  16. package/dist/dts/observation/arrays.d.ts +207 -0
  17. package/dist/dts/observation/behavior.d.ts +5 -5
  18. package/dist/dts/observation/notifier.d.ts +18 -18
  19. package/dist/dts/observation/observable.d.ts +86 -29
  20. package/dist/dts/observation/splice-strategies.d.ts +13 -0
  21. package/dist/dts/observation/update-queue.d.ts +40 -0
  22. package/dist/dts/platform.d.ts +18 -67
  23. package/dist/dts/polyfills.d.ts +8 -0
  24. package/dist/dts/styles/css-directive.d.ts +43 -5
  25. package/dist/dts/styles/css.d.ts +19 -3
  26. package/dist/dts/styles/element-styles.d.ts +42 -62
  27. package/dist/dts/templating/binding.d.ts +320 -64
  28. package/dist/dts/templating/children.d.ts +18 -15
  29. package/dist/dts/templating/compiler.d.ts +47 -28
  30. package/dist/dts/templating/dom.d.ts +41 -0
  31. package/dist/dts/templating/html-directive.d.ts +179 -43
  32. package/dist/dts/templating/markup.d.ts +48 -0
  33. package/dist/dts/templating/node-observation.d.ts +45 -29
  34. package/dist/dts/templating/ref.d.ts +6 -12
  35. package/dist/dts/templating/repeat.d.ts +72 -14
  36. package/dist/dts/templating/slotted.d.ts +13 -14
  37. package/dist/dts/templating/template.d.ts +78 -23
  38. package/dist/dts/templating/view.d.ts +16 -23
  39. package/dist/dts/utilities.d.ts +40 -0
  40. package/dist/esm/components/attributes.js +25 -24
  41. package/dist/esm/components/controller.js +77 -57
  42. package/dist/esm/components/fast-definitions.js +14 -22
  43. package/dist/esm/debug.js +29 -0
  44. package/dist/esm/hooks.js +32 -0
  45. package/dist/esm/index.debug.js +2 -0
  46. package/dist/esm/index.js +19 -14
  47. package/dist/esm/index.rollup.debug.js +3 -0
  48. package/dist/esm/index.rollup.js +2 -0
  49. package/dist/esm/interfaces.js +8 -1
  50. package/dist/esm/observation/arrays.js +269 -0
  51. package/dist/esm/observation/notifier.js +27 -35
  52. package/dist/esm/observation/observable.js +80 -107
  53. package/dist/esm/observation/{array-change-records.js → splice-strategies.js} +136 -62
  54. package/dist/esm/observation/update-queue.js +67 -0
  55. package/dist/esm/platform.js +36 -42
  56. package/dist/esm/polyfills.js +85 -0
  57. package/dist/esm/styles/css-directive.js +29 -13
  58. package/dist/esm/styles/css.js +27 -40
  59. package/dist/esm/styles/element-styles.js +65 -104
  60. package/dist/esm/templating/binding.js +465 -155
  61. package/dist/esm/templating/children.js +33 -23
  62. package/dist/esm/templating/compiler.js +235 -152
  63. package/dist/esm/templating/dom.js +49 -0
  64. package/dist/esm/templating/html-directive.js +125 -40
  65. package/dist/esm/templating/markup.js +75 -0
  66. package/dist/esm/templating/node-observation.js +50 -45
  67. package/dist/esm/templating/ref.js +7 -16
  68. package/dist/esm/templating/repeat.js +38 -43
  69. package/dist/esm/templating/slotted.js +23 -20
  70. package/dist/esm/templating/template.js +71 -95
  71. package/dist/esm/templating/view.js +44 -43
  72. package/dist/esm/templating/when.js +2 -1
  73. package/dist/esm/utilities.js +139 -0
  74. package/dist/fast-element.api.json +13633 -5266
  75. package/dist/fast-element.d.ts +1434 -578
  76. package/dist/fast-element.debug.js +3824 -0
  77. package/dist/fast-element.debug.min.js +1 -0
  78. package/dist/fast-element.js +3574 -4020
  79. package/dist/fast-element.min.js +1 -1
  80. package/dist/fast-element.untrimmed.d.ts +2908 -0
  81. package/dist/tsdoc-metadata.json +1 -1
  82. package/docs/api-report.md +590 -231
  83. package/docs/fast-element-2-changes.md +15 -0
  84. package/docs/guide/declaring-templates.md +4 -4
  85. package/docs/guide/defining-elements.md +2 -2
  86. package/docs/guide/next-steps.md +2 -2
  87. package/docs/guide/observables-and-state.md +1 -1
  88. package/docs/guide/using-directives.md +1 -1
  89. package/karma.conf.cjs +6 -17
  90. package/package.json +46 -14
  91. package/dist/dts/dom.d.ts +0 -112
  92. package/dist/dts/observation/array-change-records.d.ts +0 -48
  93. package/dist/dts/observation/array-observer.d.ts +0 -9
  94. package/dist/esm/dom.js +0 -207
  95. package/dist/esm/observation/array-observer.js +0 -177
@@ -0,0 +1 @@
1
+ !function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(e);const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=e.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r)),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const o=globalThis.FAST,l={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1401:"Missing FASTElement definition."};Object.assign(o,{addMessages(e){Object.assign(l,e)},warn(e,...t){var s;console.warn(null!==(s=l[e])&&void 0!==s?s:"Unknown Warning")},error(e,...t){var s;return new Error(null!==(s=l[e])&&void 0!==s?s:"Unknown Error")}});const h={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},h));const c=globalThis.FAST;if(void 0===c.getById){const e=Object.create(null);Reflect.defineProperty(c,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},h))}void 0===c.error&&Object.assign(c,{warn(){},error:e=>new Error(`Code ${e}`),addMessages(){}});const a=Object.freeze([]);function d(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance:t=>e.get(t.constructor)})}const u=e=>"function"==typeof e,f=e=>"string"==typeof e,p=c.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 b{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 g{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 b(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new b(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 v=c.getById(2,(()=>{const e=p.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=e=>{throw c.error(1101)};function o(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=r(e):s.set(e,i=new g(e))),i}function l(e){let t=i.get(e);if(void 0===t){let s=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==s;)t=i.get(s),s=Reflect.getPrototypeOf(s);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class h{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==n&&n.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];u(n)&&n.call(e,i,t),o(e).notify(this.name)}}}class a extends b{constructor(e,t,s=!1){super(e,t),this.binding=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(e,null!=t?t:T.default);return n=s,i}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=o(e),r=null===s?this.first:{};if(r.propertySource=e,r.propertyName=t,r.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;n=void 0,t=s.propertySource[s.propertyName],n=this,e===t&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){r=e},getNotifier:o,track(e,t){n&&n.watch(e,t)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(e,t){o(e).notify(t)},defineProperty(e,t){f(t)&&(t=new h(t)),l(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:l,binding(e,t,s=this.isVolatileBinding(e)){return new a(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=c.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class C{constructor(e=null,t=null){this.index=0,this.length=0,this.parent=e,this.parentContext=t}get event(){return w.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}updatePosition(e,t){this.index=e,this.length=t}createChildContext(e){return new C(e,this)}createItemContext(e,t){const s=Object.create(this);return s.index=e,s.length=t,s}}v.defineProperty(C.prototype,"index"),v.defineProperty(C.prototype,"length");const T=Object.freeze({default:new C,setEvent(e){w.set(e)},create:()=>new C});class S{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 x=Object.freeze({reset:1,splice:2,optimized:3}),O=new S(0,a,0);O.reset=!0;const A=[O];let B=Object.freeze({support:x.splice,normalize:(e,t,s)=>void 0===e?null!=s?s:a:A,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new S(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new S(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 S(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 S(+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 S(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:A,setDefaultStrategy(e){B=e}});function I(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class $ extends b{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,I(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:B).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,p.enqueue(this))}}let V=!1;const k=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new $(e)));const e=Array.prototype;e.$fastPatch||(I(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:B)[t.name](this,i,t,e)}})))}});function E(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(k.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}const P=new Map;let N;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(N),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){N=e}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=P.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),P.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}L.setDefaultStrategy(c.getById(5,(()=>_)));const M=d(),z=Object.freeze({getForInstance:M.getForInstance,getByType:M.getByType,define:e=>(M.register({type:e}),e)});function R(){return function(e){z.define(e)}}function H(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!==z.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const q=(e,...t)=>{const{styles:s,behaviors:i}=H(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class D{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(f(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}bind(e){e.$fastController.addStyles(this.styles)}unbind(e){e.$fastController.removeStyles(this.styles)}}z.define(D);const Q=q.partial=(e,...t)=>{const{styles:s,behaviors:i}=H(e,t);return new D(s,i)},U=Object.freeze({queueUpdate:p.enqueue,nextUpdate:p.next,processUpdates:p.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)}}),W=`fast-${Math.random().toString(36).substring(2,8)}`,G=`${W}{`,J=`}${W}`,K=J.length;let X=0;const Y=()=>`${W}-${++X}`,Z=Object.freeze({interpolation:e=>`${G}${e}${J}`,attribute:e=>`${Y()}="${G}${e}${J}"`,comment:e=>`\x3c!--${G}${e}${J}--\x3e`}),ee=Object.freeze({parse(e,t){const s=e.split(G);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(J);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+K)}""!==o&&i.push(o)}return i}}),te=d(),se=Object.freeze({getForInstance:te.getForInstance,getByType:te.getByType,define:(e,t)=>((t=t||{}).type=e,te.register(t),e)});function ie(e){return function(t){se.define(t,e)}}const ne=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(e.sourceAspect=t,t)switch(t[0]){case":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=ne.property;break;case"classList":e.aspectType=ne.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=ne.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=ne.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=ne.property):(e.targetAspect=t,e.aspectType=ne.attribute)}}});class re{constructor(e){this.options=e}createBehavior(e){return this}createHTML(e){return Z.attribute(e(this))}}const oe=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw c.error(1202)}:e=>e,le=Object.freeze({define:(e,t=ge)=>Object.freeze({1:t=>new e(t,U.setAttribute),2:t=>new e(t,U.setBooleanAttribute),3:t=>new e(t,((e,t,s)=>e[t]=s)),4:t=>{return new(s=e,class extends s{unbind(e,t,s){super.unbind(e,t,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}})(t,ae);var s},5:t=>new e(t,de),6:e=>new t(e)})}),he=Object.freeze({define(e,t){const s=e=>({mode:s.mode,options:Object.assign({},t,e)});return s.options=t,s.mode=e,s}});class ce{constructor(e,t){this.directive=e,this.updateTarget=t}bind(e,t,s){}unbind(e,t,s){}createBehavior(e){return this}}function ae(e,t,s,i,n){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i,n)):(t.isComposed=!0,t.bind(i,n),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function de(e,t,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const 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)}}class ue extends ce{bind(e,t,s){const i=this.directive;this.updateTarget(s[i.nodeId],i.targetAspect,i.binding(e,t),e,t)}}const fe=Object.create(null);class pe extends ce{constructor(){super(...arguments),this.handlerProperty=`${this.directive.id}-h`}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getSignal(e,t),o=n[this.handlerProperty]=()=>{this.updateTarget(n,i.targetAspect,i.binding(e,t),e,t)};o();const l=fe[r];l?Array.isArray(l)?l.push(o):fe[r]=[l,o]:fe[r]=o}unbind(e,t,s){const i=this.getSignal(e,t),n=fe[i];if(n&&Array.isArray(n)){const e=s[this.directive.nodeId][this.handlerProperty],t=n.indexOf(e);-1!==t&&n.splice(t,1)}else fe[i]=void 0}getSignal(e,t){const s=this.directive.options;return f(s)?s:s(e,t)}static send(e){const t=fe[e];t&&(Array.isArray(t)?t.forEach((e=>e())):t())}}class be extends ce{constructor(e,t){super(e,t),this.isBindingVolatile=v.isVolatileBinding(e.binding),this.observerProperty=`${e.id}-o`}getObserver(e){var t;return null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=v.binding(this.directive.binding,this,this.isBindingVolatile)}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=e,r.context=t,this.updateTarget(n,i.targetAspect,r.observe(e,t),e,t)}unbind(e,t,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(e,t){const s=t.target,i=t.source,n=t.context;this.updateTarget(s,this.directive.targetAspect,t.observe(i,n),i,n)}}class ge{constructor(e){this.directive=e,this.sourceProperty=`${e.id}-s`,this.contextProperty=`${e.id}-c`}bind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=e,n[this.contextProperty]=t,n.addEventListener(i.targetAspect,this,i.options)}unbind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.options)}createBehavior(e){return this}handleEvent(e){const t=e.currentTarget;T.setEvent(e);const s=this.directive.binding(t[this.sourceProperty],t[this.contextProperty]);T.setEvent(null),!0!==s&&e.preventDefault()}}let ve={determineChangeEvent:()=>"change"};class ye extends be{bind(e,t,s){var i;super.bind(e,t,s);const n=this.directive,r=s[n.nodeId];this.changeEvent||(this.changeEvent=null!==(i=n.options.changeEvent)&&void 0!==i?i:ve.determineChangeEvent(n,r)),r.addEventListener(this.changeEvent,this)}unbind(e,t,s){super.unbind(e,t,s),s[this.directive.nodeId].removeEventListener(this.changeEvent,this)}handleEvent(e){const t=this.directive,s=e.currentTarget;let i;switch(t.aspectType){case 1:i=s.getAttribute(t.targetAspect);break;case 2:i=s.hasAttribute(t.targetAspect);break;case 4:i=s.innerText;break;default:i=s[t.targetAspect]}const n=this.getObserver(s).last;n.propertySource[n.propertyName]=t.options.fromView(i)}static configure(e){ve=e}}const me=he.define(le.define(be),{}),we=he.define(le.define(ye),{fromView:e=>e}),Ce=he.define(le.define(ue),{once:!0}),Te=le.define(pe),Se=e=>({mode:Te,options:e});class xe{constructor(e,t,s){this.binding=e,this.mode=t,this.options=s,this.factory=null,this.aspectType=ne.content}createHTML(e){return Z.interpolation(e(this))}createBehavior(e){return null==this.factory&&("innerHTML"===this.targetAspect&&(this.binding=oe(this.binding)),this.factory=this.mode[this.aspectType](this)),this.factory.createBehavior(e)}}function Oe(e,t=me){return"mode"in t||(t=me(t)),new xe(e,t.mode,t.options)}function Ae(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}se.define(xe,{aspected:!0});class Be{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=e.firstChild,this.lastChild=e.lastChild}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=e.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,t.insertBefore(n,e),n=i;t.insertBefore(s,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){Ae(this.firstChild,this.lastChild),this.unbind()}bind(e,t){let s=this.behaviors;const i=this.source;if(i===e)return;this.source=e,this.context=t;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,t,n),o.bind(e,t,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(e,t,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(e,t,n)}unbind(){const e=this.source;if(null===e)return;const t=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(e,s,t);this.source=null,this.context=null}static disposeContiguousBatch(e){if(0!==e.length){Ae(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}const je=(e,t)=>`${e}.${t}`,Ie={},$e={index:0,node:null};class Ve{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=Ie[t];if(!n){const i=`_${t}`;Ie[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:t;for(const e of this.nodeIds)s[e];return new Be(t,this.factories,s)}}function ke(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let h=0,c=o.length;h<c;++h){const a=o[h],d=a.value,u=ee.parse(d,l);let f=null;null===u?r&&(f=Oe((()=>d),Ce),ne.assign(f,a.name)):f=_e.aggregate(u),null!==f&&(s.removeAttributeNode(a),h--,c--,e.addFactory(f,t,i,n))}}function Ee(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Pe(e,s,n,i);n=t.node,i=t.index}}function Pe(e,t,s,i){const n=je(t,i);switch(s.nodeType){case 1:ke(e,t,s,n,i),Ee(e,s,n);break;case 3:return function(e,t,s,i,n){const r=ee.parse(t.textContent,e.directives);if(null===r)return $e.node=t.nextSibling,$e.index=n+1,$e;let o,l=o=t;for(let t=0,h=r.length;t<h;++t){const h=r[t];0!==t&&(n++,i=je(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),f(h)?o.textContent=h:(o.textContent=" ",e.addFactory(h,s,i,n)),l=o}return $e.index=n+1,$e.node=l.nextSibling,$e}(e,s,t,n,i);case 8:const r=ee.parse(s.data,e.directives);null!==r&&e.addFactory(_e.aggregate(r),t,n,i)}return $e.index=i+1,$e.node=s.nextSibling,$e}const Ne={createHTML:e=>e};let Fe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ne):Ne;const Le=Fe,_e={setHTMLPolicy(e){if(Fe!==Le)throw c.error(1201);Fe=e},compile(e,t){let s;if(f(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Fe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ve(i,t);return ke(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==ee.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Ee(n,i,"r"),$e.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t;const s=e.length,i=e.map((e=>f(e)?()=>e:(t=e.sourceAspect||t,e.binding))),n=Oe(((e,t)=>{let n="";for(let r=0;r<s;++r)n+=i[r](e,t);return n}));return ne.assign(n,t),n}};class Me{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=_e.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s,i){const n=this.create(null!=s?s:t);return n.bind(e,null!=i?i:T.default),n.appendTo(t),n}}const ze=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Re(e,t,s){const i=ze.exec(t);return null!==i&&ne.assign(e,i[2]),e.createHTML(s)}function He(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=Y();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,u(o))s+=Re(Oe(o),r,n);else if(f(o)){const e=ze.exec(r);if(null!==e){const t=Oe((()=>o),Ce);ne.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else void 0===(l=se.getForInstance(o))?s+=Re(Oe((()=>o),Ce),r,n):l.aspected?s+=Re(o,r,n):s+=o.createHTML(n)}return new Me(s+e[e.length-1],i)}const qe=He,De=He;class Qe extends re{bind(e,t,s){e[this.options]=s[this.nodeId]}unbind(){}}se.define(Qe);const Ue=e=>new Qe(e);function We(e,t){const s=u(t)?t:()=>t;return(t,i)=>e(t,i)?s(t,i):null}const Ge=Object.freeze({positioning:!1,recycle:!0});function Je(e,t,s,i){e.bind(t[s],i)}function Ke(e,t,s,i){e.bind(t[s],i.createItemContext(s,t.length))}class Xe{constructor(e,t,s,i,n,r){this.location=e,this.itemsBinding=t,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=Je,this.itemsBindingObserver=v.binding(t,this,s),this.templateBindingObserver=v.binding(i,this,n),r.positioning&&(this.bindView=Ke)}bind(e,t){this.source=e,this.context=t,this.childContext=t.createChildContext(e),this.items=this.itemsBindingObserver.observe(e,this.context),this.template=this.templateBindingObserver.observe(e,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(e,t){e===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):e===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):t[0].reset?this.refreshAllViews():this.updateViews(t)}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.childContext,i=[],n=this.bindView;let r=0;for(let s=0,n=e.length;s<n;++s){const n=e[s],o=n.removed;i.push(...t.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,h=e.length;r<h;++r){const h=e[r];let c=h.index;const a=c+h.addedCount;for(;c<a;++c){const e=t[c],r=e?e.firstChild:this.location,h=this.options.recycle&&i.length>0?i.shift():l.create();t.splice(c,0,h),n(h,o,c,s),h.insertBefore(r)}}for(let e=0,t=i.length;e<t;++e)i[e].dispose();if(this.options.positioning)for(let e=0,s=t.length;e<s;++e)t[e].context.updatePosition(e,s)}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=t.length,l=this.views,h=l.length;if((0===o||e)&&(Be.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 c=l.splice(e,h-e);for(e=0,o=c.length;e<o;++e)c[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Ye{constructor(e,t,s){this.itemsBinding=e,this.templateBinding=t,this.options=s,k.enable(),this.isItemsBindingVolatile=v.isVolatileBinding(e),this.isTemplateBindingVolatile=v.isVolatileBinding(t)}createHTML(e){return Z.comment(e(this))}createBehavior(e){return new Xe(e[this.nodeId],this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Ze(e,t,s=Ge){const i=u(t)?t:()=>t;return new Ye(e,i,s)}se.define(Ye);const et=e=>1===e.nodeType,tt=e=>e?t=>1===t.nodeType&&t.matches(e):et;class st extends re{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e,t,s){const i=s[this.nodeId];i[this.sourceProperty]=e,this.updateTarget(e,this.computeNodes(i)),this.observe(i)}unbind(e,t,s){const i=s[this.nodeId];this.updateTarget(e,a),this.disconnect(i),i[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class it extends st{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 nt(e){return f(e)&&(e={property:e}),new it(e)}se.define(it);class rt extends st{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 ot(e){return f(e)&&(e={property:e}),new rt(e)}se.define(rt);const lt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function ht(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const ct={toView(e){const t=ht(e);return t?t.toString():t},fromView:ht};class at{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=lt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||p.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;U.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":U.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(e.attributes);for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];f(i)?s.push(new at(e,i)):s.push(new at(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function dt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t);const i=e.constructor.attributes||(e.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ut={mode:"open"},ft={},pt=c.getById(4,(()=>d()));class bt{constructor(e,t=e.definition){f(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const s=at.collect(e,t.attributes),i=new Array(s.length),n={},r={};for(let e=0,t=s.length;e<t;++e){const t=s[e];i[e]=t.attribute,n[t.name]=t,r[t.attribute]=t}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===t.shadowOptions?ut:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ut),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ft:Object.assign(Object.assign({},ft),t.elementOptions),this.styles=void 0===t.styles?void 0:Array.isArray(t.styles)?new L(t.styles):t.styles instanceof L?t.styles:new L([t.styles])}get isDefined(){return!!pt.getByType(this.type)}define(e=customElements){const t=this.type;if(pt.register(this)){const e=this.attributes,s=t.prototype;for(let t=0,i=e.length;t<i;++t)v.defineProperty(s,e[t]);Reflect.defineProperty(t,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return e.get(this.name)||e.define(this.name,t,this.elementOptions),this}}bt.getByType=pt.getByType,bt.getForInstance=pt.getForInstance;const gt=new WeakMap,vt={bubbles:!0,composed:!0,cancelable:!0};function yt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:gt.get(e))&&void 0!==s?s:null}class mt extends g{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&gt.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get styles(){var e;if(null===this._styles){const t=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():t.styles&&(this._styles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||this.addStyles(e))}addStyles(e){if(!e)return;const t=yt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.append(e);else if(!e.isAttachedTo(t)){const s=e.behaviors;e.addStylesTo(t),null!==s&&this.addBehaviors(s)}}removeStyles(e){if(!e)return;const t=yt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.removeChild(e);else if(e.isAttachedTo(t)){const s=e.behaviors;e.removeStylesFrom(t),null!==s&&this.removeBehaviors(s)}}addBehaviors(e){var t;const s=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,i=e.length,n=[];for(let t=0;t<i;++t){const i=e[t];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const e=this.element,t=T.default;for(let s=0;s<n.length;++s)n[s].bind(e,t)}}removeBehaviors(e,t=!1){const s=this.behaviors;if(null===s)return;const i=e.length,n=[];for(let r=0;r<i;++r){const i=e[r];if(s.has(i)){const e=s.get(i)-1;0===e||t?s.delete(i)&&n.push(i):s.set(i,e)}}if(this._isConnected){const e=this.element,t=T.default;for(let s=0;s<n.length;++s)n[s].unbind(e,t)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element,t=T.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,t);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(e,t);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const e=this.view;null!==e&&e.unbind();const t=this.behaviors;if(null!==t){const e=this.element,s=T.default;for(const i of t.keys())i.unbind(e,s)}}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(e,t,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},vt),s)))}finishInitialization(){const e=this.element,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.element,i=null!==(t=yt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=bt.getForInstance(e);if(void 0===s)throw c.error(1401);return e.$fastController=new mt(e,s)}}function wt(e){return class extends e{constructor(){super(),mt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}const Ct=Object.assign(wt(HTMLElement),{from:e=>wt(e),define:(e,t)=>new bt(e,t).define().type});function Tt(e){return function(t){new bt(t,e).define()}}export{_ as AdoptedStyleSheetsStrategy,k as ArrayObserver,ne as Aspect,at as AttributeDefinition,he as BindingConfig,le as BindingMode,z as CSSDirective,be as ChangeBinding,rt as ChildrenDirective,_e as Compiler,mt as Controller,U as DOM,L as ElementStyles,ge as EventBinding,T as ExecutionContext,c as FAST,Ct as FASTElement,bt as FASTElementDefinition,xe as HTMLBindingDirective,se as HTMLDirective,Be as HTMLView,Z as Markup,st as NodeObservationDirective,v as Observable,ue as OneTimeBinding,ee as Parser,g as PropertyChangeNotifier,Qe as RefDirective,Xe as RepeatBehavior,Ye as RepeatDirective,pe as SignalBinding,it as SlottedDirective,S as Splice,j as SpliceStrategy,x as SpliceStrategySupport,re as StatelessAttachedAttributeDirective,b as SubscriberSet,ye as TwoWayBinding,ce as UpdateBinding,p as Updates,Me as ViewTemplate,dt as attr,Oe as bind,lt as booleanConverter,qe as child,ot as children,d as createTypeRegistry,q as css,R as cssDirective,Q as cssPartial,Tt as customElement,tt as elements,a as emptyArray,He as html,ie as htmlDirective,De as item,E as length,ct as nullableNumberConverter,y as observable,me as onChange,Ce as oneTime,Ue as ref,Ze as repeat,Se as signal,nt as slotted,we as twoWay,m as volatile,We as when};