@jupyter-notebook/web-components
Version:
A component library for building extensions in Jupyter frontends.
16 lines (14 loc) • 370 kB
JavaScript
const e=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(e){return{}}}();void 0===e.trustedTypes&&(e.trustedTypes={createPolicy:(e,t)=>t});const t={configurable:!1,enumerable:!1,writable:!1};void 0===e.FAST&&Reflect.defineProperty(e,"FAST",Object.assign({value:Object.create(null)},t));const i=e.FAST;if(void 0===i.getById){const e=Object.create(null);Reflect.defineProperty(i,"getById",Object.assign({value(t,i){let o=e[t];return void 0===o&&(o=i?e[t]=i():null),o}},t))}const o=Object.freeze([]),s=e.FAST.getById(1,(()=>{const t=[],i=[];function o(){if(i.length)throw i.shift()}function s(e){try{e.call()}catch(e){i.push(e),setTimeout(o,0)}}function n(){let e=0;for(;e<t.length;)if(s(t[e]),e++,e>1024){for(let i=0,o=t.length-e;i<o;i++)t[i]=t[i+e];t.length-=e,e=0}t.length=0}return Object.freeze({enqueue:function(i){t.length<1&&e.requestAnimationFrame(n),t.push(i)},process:n})})),n=e.trustedTypes.createPolicy("fast-html",{createHTML:e=>e});let r=n;const a=`fast-${Math.random().toString(36).substring(2,8)}`,l=`${a}{`,c=`}${a}`,h=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(e){if(r!==n)throw new Error("The HTML policy can only be set once.");r=e},createHTML:e=>r.createHTML(e),isMarker:e=>e&&8===e.nodeType&&e.data.startsWith(a),extractDirectiveIndexFromMarker:e=>parseInt(e.data.replace(`${a}:`,"")),createInterpolationPlaceholder:e=>`${l}${e}${c}`,createCustomAttributePlaceholder(e,t){return`${e}="${this.createInterpolationPlaceholder(t)}"`},createBlockPlaceholder:e=>`\x3c!--${a}:${e}--\x3e`,queueUpdate:s.enqueue,processUpdates:s.process,nextUpdate:()=>new Promise(s.enqueue),setAttribute(e,t,i){null==i?e.removeAttribute(t):e.setAttribute(t,i)},setBooleanAttribute(e,t,i){i?e.setAttribute(t,""):e.removeAttribute(t)},removeChildNodes(e){for(let t=e.firstChild;null!==t;t=e.firstChild)e.removeChild(t)},createTemplateWalker:e=>document.createTreeWalker(e,133,null,!1)});function d(e){const t=this.spillover;-1===t.indexOf(e)&&t.push(e)}function u(e){const t=this.spillover,i=t.indexOf(e);-1!==i&&t.splice(i,1)}function p(e){const t=this.spillover,i=this.source;for(let o=0,s=t.length;o<s;++o)t[o].handleChange(i,e)}function g(e){return-1!==this.spillover.indexOf(e)}class b{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=e,this.sub1=t}has(e){return this.sub1===e||this.sub2===e}subscribe(e){this.has(e)||(void 0!==this.sub1?void 0!==this.sub2?(this.spillover=[this.sub1,this.sub2,e],this.subscribe=d,this.unsubscribe=u,this.notify=p,this.has=g,this.sub1=void 0,this.sub2=void 0):this.sub2=e:this.sub1=e)}unsubscribe(e){this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0)}notify(e){const t=this.sub1,i=this.sub2,o=this.source;void 0!==t&&t.handleChange(o,e),void 0!==i&&i.handleChange(o,e)}}class f{constructor(e){this.subscribers={},this.sourceSubscribers=null,this.source=e}notify(e){var t;const i=this.subscribers[e];void 0!==i&&i.notify(e),null===(t=this.sourceSubscribers)||void 0===t||t.notify(e)}subscribe(e,t){var i;if(t){let i=this.subscribers[t];void 0===i&&(this.subscribers[t]=i=new b(this.source)),i.subscribe(e)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new b(this.source),this.sourceSubscribers.subscribe(e)}unsubscribe(e,t){var i;if(t){const i=this.subscribers[t];void 0!==i&&i.unsubscribe(e)}else null===(i=this.sourceSubscribers)||void 0===i||i.unsubscribe(e)}}const m=i.getById(2,(()=>{const e=/(:|&&|\|\||if)/,t=new WeakMap,i=new WeakMap,o=h.queueUpdate;let s,n=e=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function r(e){let i=e.$fastController||t.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):t.set(e,i=new f(e))),i}function a(e){let t=i.get(e);if(void 0===t){let o=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==o;)t=i.get(o),o=Reflect.getPrototypeOf(o);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class l{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==s&&s.watch(e,this.name),e[this.field]}setValue(e,t){const i=this.field,o=e[i];if(o!==t){e[i]=t;const s=e[this.callback];"function"==typeof s&&s.call(e,o,t),r(e).notify(this.name)}}}class c extends b{constructor(e,t,i=!1){super(e,t),this.binding=e,this.isVolatileBinding=i,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(e,t){this.needsRefresh&&null!==this.last&&this.disconnect();const i=s;s=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const o=this.binding(e,t);return s=i,o}disconnect(){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=!0}}watch(e,t){const i=this.last,o=r(e),n=null===i?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=o,o.subscribe(this,t),null!==i){if(!this.needsRefresh){let t;s=void 0,t=i.propertySource[i.propertyName],s=this,e===t&&(this.needsRefresh=!0)}i.next=n}this.last=n}handleChange(){this.needsQueue&&(this.needsQueue=!1,o(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let e=this.first;return{next:()=>{const t=e;return void 0===t?{value:void 0,done:!0}:(e=e.next,{value:t,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){void 0!==s&&s.watch(e,t)},trackVolatile(){void 0!==s&&(s.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){"string"==typeof t&&(t=new l(t)),a(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get:function(){return t.getValue(this)},set:function(e){t.setValue(this,e)}})},getAccessors:a,binding(e,t,i=this.isVolatileBinding(e)){return new c(e,t,i)},isVolatileBinding:t=>e.test(t.toString())})}));function v(e,t){m.defineProperty(e,t)}const y=i.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class x{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}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}static setEvent(e){y.set(e)}}m.defineProperty(x.prototype,"index"),m.defineProperty(x.prototype,"length");const $=Object.seal(new x);class w{constructor(){this.targetIndex=0}}class k extends w{constructor(){super(...arguments),this.createPlaceholder=h.createInterpolationPlaceholder}}class C extends w{constructor(e,t,i){super(),this.name=e,this.behavior=t,this.options=i}createPlaceholder(e){return h.createCustomAttributePlaceholder(this.name,e)}createBehavior(e){return new this.behavior(e,this.options)}}function I(e,t){this.source=e,this.context=t,null===this.bindingObserver&&(this.bindingObserver=m.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(e,t))}function T(e,t){this.source=e,this.context=t,this.target.addEventListener(this.targetName,this)}function D(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function O(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.unbind(),e.needsBindOnly=!0)}function F(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function E(e){h.setAttribute(this.target,this.targetName,e)}function R(e){h.setBooleanAttribute(this.target,this.targetName,e)}function S(e){if(null==e&&(e=""),e.create){this.target.textContent="";let t=this.target.$fastView;void 0===t?t=e.create():this.target.$fastTemplate!==e&&(t.isComposed&&(t.remove(),t.unbind()),t=e.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(this.source,this.context)):(t.isComposed=!0,t.bind(this.source,this.context),t.insertBefore(this.target),this.target.$fastView=t,this.target.$fastTemplate=e)}else{const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),this.target.textContent=e}}function V(e){this.target[this.targetName]=e}function A(e){const t=this.classVersions||Object.create(null),i=this.target;let o=this.version||0;if(null!=e&&e.length){const s=e.split(/\s+/);for(let e=0,n=s.length;e<n;++e){const n=s[e];""!==n&&(t[n]=o,i.classList.add(n))}}if(this.classVersions=t,this.version=o+1,0!==o){o-=1;for(const e in t)t[e]===o&&i.classList.remove(e)}}class L extends k{constructor(e){super(),this.binding=e,this.bind=I,this.unbind=D,this.updateTarget=E,this.isBindingVolatile=m.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(e){if(this.originalTargetName=e,void 0!==e)switch(e[0]){case":":if(this.cleanedTargetName=e.substr(1),this.updateTarget=V,"innerHTML"===this.cleanedTargetName){const e=this.binding;this.binding=(t,i)=>h.createHTML(e(t,i))}break;case"?":this.cleanedTargetName=e.substr(1),this.updateTarget=R;break;case"@":this.cleanedTargetName=e.substr(1),this.bind=T,this.unbind=F;break;default:this.cleanedTargetName=e,"class"===e&&(this.updateTarget=A)}}targetAtContent(){this.updateTarget=S,this.unbind=O}createBehavior(e){return new z(e,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class z{constructor(e,t,i,o,s,n,r){this.source=null,this.context=null,this.bindingObserver=null,this.target=e,this.binding=t,this.isBindingVolatile=i,this.bind=o,this.unbind=s,this.updateTarget=n,this.targetName=r}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(e){x.setEvent(e);const t=this.binding(this.source,this.context);x.setEvent(null),!0!==t&&e.preventDefault()}}let P=null;class H{addFactory(e){e.targetIndex=this.targetIndex,this.behaviorFactories.push(e)}captureContentBinding(e){e.targetAtContent(),this.addFactory(e)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){P=this}static borrow(e){const t=P||new H;return t.directives=e,t.reset(),P=null,t}}function N(e){if(1===e.length)return e[0];let t;const i=e.length,o=e.map((e=>"string"==typeof e?()=>e:(t=e.targetName||t,e.binding))),s=new L(((e,t)=>{let s="";for(let n=0;n<i;++n)s+=o[n](e,t);return s}));return s.targetName=t,s}const M=c.length;function B(e,t){const i=t.split(l);if(1===i.length)return null;const o=[];for(let t=0,s=i.length;t<s;++t){const s=i[t],n=s.indexOf(c);let r;if(-1===n)r=s;else{const t=parseInt(s.substring(0,n));o.push(e.directives[t]),r=s.substring(n+M)}""!==r&&o.push(r)}return o}function j(e,t,i=!1){const o=t.attributes;for(let s=0,n=o.length;s<n;++s){const r=o[s],a=r.value,l=B(e,a);let c=null;null===l?i&&(c=new L((()=>a)),c.targetName=r.name):c=N(l),null!==c&&(t.removeAttributeNode(r),s--,n--,e.addFactory(c))}}function U(e,t,i){const o=B(e,t.textContent);if(null!==o){let s=t;for(let n=0,r=o.length;n<r;++n){const r=o[n],a=0===n?t:s.parentNode.insertBefore(document.createTextNode(""),s.nextSibling);"string"==typeof r?a.textContent=r:(a.textContent=" ",e.captureContentBinding(r)),s=a,e.targetIndex++,a!==t&&i.nextNode()}e.targetIndex--}}const q=document.createRange();class _{constructor(e,t){this.fragment=e,this.behaviors=t,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,i=this.lastChild;let o,s=this.firstChild;for(;s!==i;)o=s.nextSibling,t.insertBefore(s,e),s=o;t.insertBefore(i,e)}}remove(){const e=this.fragment,t=this.lastChild;let i,o=this.firstChild;for(;o!==t;)i=o.nextSibling,e.appendChild(o),o=i;e.appendChild(t)}dispose(){const e=this.firstChild.parentNode,t=this.lastChild;let i,o=this.firstChild;for(;o!==t;)i=o.nextSibling,e.removeChild(o),o=i;e.removeChild(t);const s=this.behaviors,n=this.source;for(let e=0,t=s.length;e<t;++e)s[e].unbind(n)}bind(e,t){const i=this.behaviors;if(this.source!==e)if(null!==this.source){const o=this.source;this.source=e,this.context=t;for(let s=0,n=i.length;s<n;++s){const n=i[s];n.unbind(o),n.bind(e,t)}}else{this.source=e,this.context=t;for(let o=0,s=i.length;o<s;++o)i[o].bind(e,t)}}unbind(){if(null===this.source)return;const e=this.behaviors,t=this.source;for(let i=0,o=e.length;i<o;++i)e[i].unbind(t);this.source=null}static disposeContiguousBatch(e){if(0!==e.length){q.setStartBefore(e[0].firstChild),q.setEndAfter(e[e.length-1].lastChild),q.deleteContents();for(let t=0,i=e.length;t<i;++t){const i=e[t],o=i.behaviors,s=i.source;for(let e=0,t=o.length;e<t;++e)o[e].unbind(s)}}}}class G{constructor(e,t){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=e,this.directives=t}create(e){if(null===this.fragment){let e;const t=this.html;if("string"==typeof t){e=document.createElement("template"),e.innerHTML=h.createHTML(t);const i=e.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(e=i)}else e=t;const i=function(e,t){const i=e.content;document.adoptNode(i);const o=H.borrow(t);j(o,e,!0);const s=o.behaviorFactories;o.reset();const n=h.createTemplateWalker(i);let r;for(;r=n.nextNode();)switch(o.targetIndex++,r.nodeType){case 1:j(o,r);break;case 3:U(o,r,n);break;case 8:h.isMarker(r)&&o.addFactory(t[h.extractDirectiveIndexFromMarker(r)])}let a=0;(h.isMarker(i.firstChild)||1===i.childNodes.length&&t.length)&&(i.insertBefore(document.createComment(""),i.firstChild),a=-1);const l=o.behaviorFactories;return o.release(),{fragment:i,viewBehaviorFactories:l,hostBehaviorFactories:s,targetOffset:a}}(e,this.directives);this.fragment=i.fragment,this.viewBehaviorFactories=i.viewBehaviorFactories,this.hostBehaviorFactories=i.hostBehaviorFactories,this.targetOffset=i.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const t=this.fragment.cloneNode(!0),i=this.viewBehaviorFactories,o=new Array(this.behaviorCount),s=h.createTemplateWalker(t);let n=0,r=this.targetOffset,a=s.nextNode();for(let e=i.length;n<e;++n){const e=i[n],t=e.targetIndex;for(;null!==a;){if(r===t){o[n]=e.createBehavior(a);break}a=s.nextNode(),r++}}if(this.hasHostBehaviors){const t=this.hostBehaviorFactories;for(let i=0,s=t.length;i<s;++i,++n)o[n]=t[i].createBehavior(e)}return new _(t,o)}render(e,t,i){"string"==typeof t&&(t=document.getElementById(t)),void 0===i&&(i=t);const o=this.create(i);return o.bind(e,$),o.appendTo(t),o}}const W=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function K(e,...t){const i=[];let o="";for(let s=0,n=e.length-1;s<n;++s){const n=e[s];let r=t[s];if(o+=n,r instanceof G){const e=r;r=()=>e}if("function"==typeof r&&(r=new L(r)),r instanceof k){const e=W.exec(n);null!==e&&(r.targetName=e[2])}r instanceof w?(o+=r.createPlaceholder(i.length),i.push(r)):o+=r}return o+=e[e.length-1],new G(o,i)}class X{constructor(){this.targets=new WeakSet,this.behaviors=null}addStylesTo(e){this.targets.add(e)}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}}function Y(e){return e.map((e=>e instanceof X?Y(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}function Q(e){return e.map((e=>e instanceof X?e.behaviors:null)).reduce(((e,t)=>null===t?e:(null===e&&(e=[]),e.concat(t))),null)}X.create=(()=>{if(h.supportsAdoptedStyleSheets){const e=new Map;return t=>new Z(t,e)}return e=>new ee(e)})();class Z extends X{constructor(e,t){super(),this.styles=e,this.styleSheetCache=t,this._styleSheets=void 0,this.behaviors=Q(e)}get styleSheets(){if(void 0===this._styleSheets){const e=this.styles,t=this.styleSheetCache;this._styleSheets=Y(e).map((e=>{if(e instanceof CSSStyleSheet)return e;let i=t.get(e);return void 0===i&&(i=new CSSStyleSheet,i.replaceSync(e),t.set(e,i)),i}))}return this._styleSheets}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(e)}removeStylesFrom(e){const t=this.styleSheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e))),super.removeStylesFrom(e)}}let J=0;class ee extends X{constructor(e){super(),this.styles=e,this.behaviors=null,this.behaviors=Q(e),this.styleSheets=Y(e),this.styleClass="fast-style-class-"+ ++J}addStylesTo(e){const t=this.styleSheets,i=this.styleClass;e=this.normalizeTarget(e);for(let o=0;o<t.length;o++){const s=document.createElement("style");s.innerHTML=t[o],s.className=i,e.append(s)}super.addStylesTo(e)}removeStylesFrom(e){const t=(e=this.normalizeTarget(e)).querySelectorAll(`.${this.styleClass}`);for(let i=0,o=t.length;i<o;++i)e.removeChild(t[i]);super.removeStylesFrom(e)}isAttachedTo(e){return super.isAttachedTo(this.normalizeTarget(e))}normalizeTarget(e){return e===document?document.body:e}}const te={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e},ie={toView(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t.toString()},fromView(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}};class oe{constructor(e,t,i=t.toLowerCase(),o="reflect",s){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=i,this.mode=o,this.converter=s,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===o&&void 0===s&&(this.converter=te)}setValue(e,t){const i=e[this.fieldName],o=this.converter;void 0!==o&&(t=o.fromView(t)),i!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](i,t),e.$fastController.notify(this.name))}getValue(e){return m.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,i=this.guards;i.has(e)||"fromView"===t||h.queueUpdate((()=>{i.add(e);const o=e[this.fieldName];switch(t){case"reflect":const t=this.converter;h.setAttribute(e,this.attribute,void 0!==t?t.toView(o):o);break;case"boolean":h.setBooleanAttribute(e,this.attribute,o)}i.delete(e)}))}static collect(e,...t){const i=[];t.push(e.attributes);for(let o=0,s=t.length;o<s;++o){const s=t[o];if(void 0!==s)for(let t=0,o=s.length;t<o;++t){const o=s[t];"string"==typeof o?i.push(new oe(e,o)):i.push(new oe(e,o.property,o.attribute,o.mode,o.converter))}}return i}}function se(e,t){let i;function o(e,t){arguments.length>1&&(i.property=t);const o=e.constructor.attributes||(e.constructor.attributes=[]);o.push(i)}return arguments.length>1?(i={},void o(e,t)):(i=void 0===e?{}:e,o)}const ne={mode:"open"},re={},ae=i.getById(4,(()=>{const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t)})}));class le{constructor(e,t=e.definition){"string"==typeof t&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const i=oe.collect(e,t.attributes),o=new Array(i.length),s={},n={};for(let e=0,t=i.length;e<t;++e){const t=i[e];o[e]=t.attribute,s[t.name]=t,n[t.attribute]=t}this.attributes=i,this.observedAttributes=o,this.propertyLookup=s,this.attributeLookup=n,this.shadowOptions=void 0===t.shadowOptions?ne:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ne),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?re:Object.assign(Object.assign({},re),t.elementOptions),this.styles=void 0===t.styles?void 0:Array.isArray(t.styles)?X.create(t.styles):t.styles instanceof X?t.styles:X.create([t.styles])}get isDefined(){return!!ae.getByType(this.type)}define(e=customElements){const t=this.type;if(ae.register(this)){const e=this.attributes,i=t.prototype;for(let t=0,o=e.length;t<o;++t)m.defineProperty(i,e[t]);Reflect.defineProperty(t,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return e.get(this.name)||e.define(this.name,t,this.elementOptions),this}}le.forType=ae.getByType;const ce=new WeakMap,he={bubbles:!0,composed:!0,cancelable:!0};function de(e){return e.shadowRoot||ce.get(e)||null}class ue extends f{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=e,this.definition=t;const i=t.shadowOptions;if(void 0!==i){const t=e.attachShadow(i);"closed"===i.mode&&ce.set(e,t)}const o=m.getAccessors(e);if(o.length>0){const t=this.boundObservables=Object.create(null);for(let i=0,s=o.length;i<s;++i){const s=o[i].name,n=e[s];void 0!==n&&(delete e[s],t[s]=n)}}}get isConnected(){return m.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,m.notify(this,"isConnected")}get template(){return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get styles(){return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||null===e||this.addStyles(e))}addStyles(e){const t=de(this.element)||this.element.getRootNode();if(e instanceof HTMLStyleElement)t.append(e);else if(!e.isAttachedTo(t)){const i=e.behaviors;e.addStylesTo(t),null!==i&&this.addBehaviors(i)}}removeStyles(e){const t=de(this.element)||this.element.getRootNode();if(e instanceof HTMLStyleElement)t.removeChild(e);else if(e.isAttachedTo(t)){const i=e.behaviors;e.removeStylesFrom(t),null!==i&&this.removeBehaviors(i)}}addBehaviors(e){const t=this.behaviors||(this.behaviors=new Map),i=e.length,o=[];for(let s=0;s<i;++s){const i=e[s];t.has(i)?t.set(i,t.get(i)+1):(t.set(i,1),o.push(i))}if(this._isConnected){const e=this.element;for(let t=0;t<o.length;++t)o[t].bind(e,$)}}removeBehaviors(e,t=!1){const i=this.behaviors;if(null===i)return;const o=e.length,s=[];for(let n=0;n<o;++n){const o=e[n];if(i.has(o)){const e=i.get(o)-1;0===e||t?i.delete(o)&&s.push(o):i.set(o,e)}}if(this._isConnected){const e=this.element;for(let t=0;t<s.length;++t)s[t].unbind(e)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,$);const t=this.behaviors;if(null!==t)for(const[i]of t)i.bind(e,$);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;for(const[i]of t)i.unbind(e)}}onAttributeChangedCallback(e,t,i){const o=this.definition.attributeLookup[e];void 0!==o&&o.onAttributeChangedCallback(this.element,i)}emit(e,t,i){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},he),i)))}finishInitialization(){const e=this.element,t=this.boundObservables;if(null!==t){const i=Object.keys(t);for(let o=0,s=i.length;o<s;++o){const s=i[o];e[s]=t[s]}this.boundObservables=null}const i=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():i.template&&(this._template=i.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():i.styles&&(this._styles=i.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(e){const t=this.element,i=de(t)||t;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||h.removeChildNodes(i),e&&(this.view=e.render(t,i,t))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const i=le.forType(e.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return e.$fastController=new ue(e,i)}}function pe(e){return class extends e{constructor(){super(),ue.forCustomElement(this)}$emit(e,t,i){return this.$fastController.emit(e,t,i)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,i){this.$fastController.onAttributeChangedCallback(e,t,i)}}}const ge=Object.assign(pe(HTMLElement),{from:e=>pe(e),define:(e,t)=>new le(e,t).define().type});class be{createCSS(){return""}createBehavior(){}}function fe(e,t){const i=[];let o="";const s=[];for(let n=0,r=e.length-1;n<r;++n){o+=e[n];let r=t[n];if(r instanceof be){const e=r.createBehavior();r=r.createCSS(),e&&s.push(e)}r instanceof X||r instanceof CSSStyleSheet?(""!==o.trim()&&(i.push(o),o=""),i.push(r)):o+=r}return o+=e[e.length-1],""!==o.trim()&&i.push(o),{styles:i,behaviors:s}}function me(e,...t){const{styles:i,behaviors:o}=fe(e,t),s=X.create(i);return o.length&&s.withBehaviors(...o),s}class ve extends be{constructor(e,t){super(),this.behaviors=t,this.css="";const i=e.reduce(((e,t)=>("string"==typeof t?this.css+=t:e.push(t),e)),[]);i.length&&(this.styles=X.create(i))}createBehavior(){return this}createCSS(){return this.css}bind(e){this.styles&&e.$fastController.addStyles(this.styles),this.behaviors.length&&e.$fastController.addBehaviors(this.behaviors)}unbind(e){this.styles&&e.$fastController.removeStyles(this.styles),this.behaviors.length&&e.$fastController.removeBehaviors(this.behaviors)}}function ye(e,...t){const{styles:i,behaviors:o}=fe(e,t);return new ve(i,o)}function xe(e,t,i){return{index:e,removed:t,addedCount:i}}function $e(e,t,i,s,n,r){let a=0,l=0;const c=Math.min(i-t,r-n);if(0===t&&0===n&&(a=function(e,t,i){for(let o=0;o<i;++o)if(e[o]!==t[o])return o;return i}(e,s,c)),i===e.length&&r===s.length&&(l=function(e,t,i){let o=e.length,s=t.length,n=0;for(;n<i&&e[--o]===t[--s];)n++;return n}(e,s,c-a)),n+=a,r-=l,(i-=l)-(t+=a)==0&&r-n==0)return o;if(t===i){const e=xe(t,[],0);for(;n<r;)e.removed.push(s[n++]);return[e]}if(n===r)return[xe(t,[],i-t)];const h=function(e){let t=e.length-1,i=e[0].length-1,o=e[t][i];const s=[];for(;t>0||i>0;){if(0===t){s.push(2),i--;continue}if(0===i){s.push(3),t--;continue}const n=e[t-1][i-1],r=e[t-1][i],a=e[t][i-1];let l;l=r<a?r<n?r:n:a<n?a:n,l===n?(n===o?s.push(0):(s.push(1),o=n),t--,i--):l===r?(s.push(3),t--,o=r):(s.push(2),i--,o=a)}return s.reverse(),s}(function(e,t,i,o,s,n){const r=n-s+1,a=i-t+1,l=new Array(r);let c,h;for(let e=0;e<r;++e)l[e]=new Array(a),l[e][0]=e;for(let e=0;e<a;++e)l[0][e]=e;for(let i=1;i<r;++i)for(let n=1;n<a;++n)e[t+n-1]===o[s+i-1]?l[i][n]=l[i-1][n-1]:(c=l[i-1][n]+1,h=l[i][n-1]+1,l[i][n]=c<h?c:h);return l}(e,t,i,s,n,r)),d=[];let u,p=t,g=n;for(let e=0;e<h.length;++e)switch(h[e]){case 0:void 0!==u&&(d.push(u),u=void 0),p++,g++;break;case 1:void 0===u&&(u=xe(p,[],0)),u.addedCount++,p++,u.removed.push(s[g]),g++;break;case 2:void 0===u&&(u=xe(p,[],0)),u.addedCount++,p++;break;case 3:void 0===u&&(u=xe(p,[],0)),u.removed.push(s[g]),g++}return void 0!==u&&d.push(u),d}const we=Array.prototype.push;function ke(e,t,i,o){const s=xe(t,i,o);let n=!1,r=0;for(let t=0;t<e.length;t++){const i=e[t];if(i.index+=r,n)continue;const o=(a=s.index,l=s.index+s.removed.length,c=i.index,h=i.index+i.addedCount,l<c||h<a?-1:l===c||h===a?0:a<c?l<h?l-c:h-c:h<l?h-a:l-a);if(o>=0){e.splice(t,1),t--,r-=i.addedCount-i.removed.length,s.addedCount+=i.addedCount-o;const a=s.removed.length+i.removed.length-o;if(s.addedCount||a){let e=i.removed;if(s.index<i.index){const t=s.removed.slice(0,i.index-s.index);we.apply(t,e),e=t}if(s.index+s.removed.length>i.index+i.addedCount){const t=s.removed.slice(i.index+i.addedCount-s.index);we.apply(e,t)}s.removed=e,i.index<s.index&&(s.index=i.index)}else n=!0}else if(s.index<i.index){n=!0,e.splice(t,0,s),t++;const o=s.addedCount-s.removed.length;i.index+=o,r+=o}}var a,l,c,h;n||e.push(s)}function Ce(e,t){let i=[];const o=function(e){const t=[];for(let i=0,o=e.length;i<o;i++){const o=e[i];ke(t,o.index,o.removed,o.addedCount)}return t}(t);for(let t=0,s=o.length;t<s;++t){const s=o[t];1!==s.addedCount||1!==s.removed.length?i=i.concat($e(e,s.index,s.index+s.addedCount,s.removed,0,s.removed.length)):s.removed[0]!==e[s.index]&&i.push(s)}return i}let Ie=!1;function Te(e,t){let i=e.index;const o=t.length;return i>o?i=o-e.addedCount:i<0&&(i=o+e.removed.length+i-e.addedCount),i<0&&(i=0),e.index=i,e}class De extends b{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(e,"$fastController",{value:this,enumerable:!1})}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.needsQueue&&(this.needsQueue=!1,h.queueUpdate(this))}reset(e){this.oldCollection=e,this.needsQueue&&(this.needsQueue=!1,h.queueUpdate(this))}flush(){const e=this.splices,t=this.oldCollection;if(void 0===e&&void 0===t)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const i=void 0===t?Ce(this.source,e):$e(this.source,0,this.source.length,t,0,t.length);this.notify(i)}}class Oe{constructor(e,t){this.target=e,this.propertyName=t}bind(e){e[this.propertyName]=this.target}unbind(){}}function Fe(e){return new C("fast-ref",Oe,e)}function Ee(e,t){const i="function"==typeof t?t:()=>t;return(t,o)=>e(t,o)?i(t,o):null}function Re(e,t,i,o){e.bind(t[i],o)}function Se(e,t,i,o){const s=Object.create(o);s.index=i,s.length=t.length,e.bind(t[i],s)}Object.freeze({positioning:!1,recycle:!0});class Ve{constructor(e,t,i,o,s,n){this.location=e,this.itemsBinding=t,this.templateBinding=o,this.options=n,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=Re,this.itemsBindingObserver=m.binding(t,this,i),this.templateBindingObserver=m.binding(o,this,s),n.positioning&&(this.bindView=Se)}bind(e,t){this.source=e,this.originalContext=t,this.childContext=Object.create(t),this.childContext.parent=e,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(e,this.originalContext),this.template=this.templateBindingObserver.observe(e,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(e,t){e===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):e===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(t)}observeItems(e=!1){if(!this.items)return void(this.items=o);const t=this.itemsObserver,i=this.itemsObserver=m.getNotifier(this.items),s=t!==i;s&&null!==t&&t.unsubscribe(this),(s||e)&&i.subscribe(this)}updateViews(e){const t=this.childContext,i=this.views,o=[],s=this.bindView;let n=0;for(let t=0,s=e.length;t<s;++t){const s=e[t],r=s.removed;o.push(...i.splice(s.index+n,r.length)),n-=s.addedCount}const r=this.items,a=this.template;for(let n=0,l=e.length;n<l;++n){const l=e[n];let c=l.index;const h=c+l.addedCount;for(;c<h;++c){const e=i[c],n=e?e.firstChild:this.location,l=this.options.recycle&&o.length>0?o.shift():a.create();i.splice(c,0,l),s(l,r,c,t),l.insertBefore(n)}}for(let e=0,t=o.length;e<t;++e)o[e].dispose();if(this.options.positioning)for(let e=0,t=i.length;e<t;++e){const o=i[e].context;o.length=t,o.index=e}}refreshAllViews(e=!1){const t=this.items,i=this.childContext,o=this.template,s=this.location,n=this.bindView;let r=t.length,a=this.views,l=a.length;if((0===r||e)&&(_.disposeContiguousBatch(a),l=0),0===l){this.views=a=new Array(r);for(let e=0;e<r;++e){const r=o.create();n(r,t,e,i),a[e]=r,r.insertBefore(s)}}else{let e=0;for(;e<r;++e)if(e<l){n(a[e],t,e,i)}else{const r=o.create();n(r,t,e,i),a.push(r),r.insertBefore(s)}const c=a.splice(e,l-e);for(e=0,r=c.length;e<r;++e)c[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,i=e.length;t<i;++t)e[t].unbind()}}class Ae extends w{constructor(e,t,i){super(),this.itemsBinding=e,this.templateBinding=t,this.options=i,this.createPlaceholder=h.createBlockPlaceholder,function(){if(Ie)return;Ie=!0,m.setArrayObserverFactory((e=>new De(e)));const e=Array.prototype;if(e.$fastPatch)return;Reflect.defineProperty(e,"$fastPatch",{value:1,enumerable:!1});const t=e.pop,i=e.push,o=e.reverse,s=e.shift,n=e.sort,r=e.splice,a=e.unshift;e.pop=function(){const e=this.length>0,i=t.apply(this,arguments),o=this.$fastController;return void 0!==o&&e&&o.addSplice(xe(this.length,[i],0)),i},e.push=function(){const e=i.apply(this,arguments),t=this.$fastController;return void 0!==t&&t.addSplice(Te(xe(this.length-arguments.length,[],arguments.length),this)),e},e.reverse=function(){let e;const t=this.$fastController;void 0!==t&&(t.flush(),e=this.slice());const i=o.apply(this,arguments);return void 0!==t&&t.reset(e),i},e.shift=function(){const e=this.length>0,t=s.apply(this,arguments),i=this.$fastController;return void 0!==i&&e&&i.addSplice(xe(0,[t],0)),t},e.sort=function(){let e;const t=this.$fastController;void 0!==t&&(t.flush(),e=this.slice());const i=n.apply(this,arguments);return void 0!==t&&t.reset(e),i},e.splice=function(){const e=r.apply(this,arguments),t=this.$fastController;return void 0!==t&&t.addSplice(Te(xe(+arguments[0],e,arguments.length>2?arguments.length-2:0),this)),e},e.unshift=function(){const e=a.apply(this,arguments),t=this.$fastController;return void 0!==t&&t.addSplice(Te(xe(0,[],arguments.length),this)),e}}(),this.isItemsBindingVolatile=m.isVolatileBinding(e),this.isTemplateBindingVolatile=m.isVolatileBinding(t)}createBehavior(e){return new Ve(e,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Le(e){return e?function(t,i,o){return 1===t.nodeType&&t.matches(e)}:function(e,t,i){return 1===e.nodeType}}class ze{constructor(e,t){this.target=e,this.options=t,this.source=null}bind(e){const t=this.options.property;this.shouldUpdate=m.getAccessors(e).some((e=>e.name===t)),this.source=e,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(o),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let e=this.getNodes();return void 0!==this.options.filter&&(e=e.filter(this.options.filter)),e}updateTarget(e){this.source[this.options.property]=e}}class Pe extends ze{constructor(e,t){super(e,t)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function He(e){return"string"==typeof e&&(e={property:e}),new C("fast-slotted",Pe,e)}class Ne extends ze{constructor(e,t){super(e,t),this.observer=null,t.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Me(e){return"string"==typeof e&&(e={property:e}),new C("fast-children",Ne,e)}class Be{handleStartContentChange(){this.startContainer.classList.toggle("start",this.start.assignedNodes().length>0)}handleEndContentChange(){this.endContainer.classList.toggle("end",this.end.assignedNodes().length>0)}}const je=(e,t)=>K`<span part="end" ${Fe("endContainer")} class=${e=>t.end?"end":void 0}><slot name="end" ${Fe("end")} @slotchange="${e=>e.handleEndContentChange()}">${t.end||""}</slot></span>`,Ue=(e,t)=>K`<span part="start" ${Fe("startContainer")} class="${e=>t.start?"start":void 0}"><slot name="start" ${Fe("start")} @slotchange="${e=>e.handleStartContentChange()}">${t.start||""}</slot></span>`;K`<span part="end" ${Fe("endContainer")}><slot name="end" ${Fe("end")} @slotchange="${e=>e.handleEndContentChange()}"></slot></span>`,K`<span part="start" ${Fe("startContainer")}><slot name="start" ${Fe("start")} @slotchange="${e=>e.handleStartContentChange()}"></slot></span>`;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function qe(e,t,i,o){var s,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(n<3?s(r):n>3?s(t,i,r):s(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}const _e=new Map;"metadata"in Reflect||(Reflect.metadata=function(e,t){return function(i){Reflect.defineMetadata(e,t,i)}},Reflect.defineMetadata=function(e,t,i){let o=_e.get(i);void 0===o&&_e.set(i,o=new Map),o.set(e,t)},Reflect.getOwnMetadata=function(e,t){const i=_e.get(t);if(void 0!==i)return i.get(e)});class Ge{constructor(e,t){this.container=e,this.key=t}instance(e){return this.registerResolver(0,e)}singleton(e){return this.registerResolver(1,e)}transient(e){return this.registerResolver(2,e)}callback(e){return this.registerResolver(3,e)}cachedCallback(e){return this.registerResolver(3,gt(e))}aliasTo(e){return this.registerResolver(5,e)}registerResolver(e,t){const{container:i,key:o}=this;return this.container=this.key=void 0,i.registerResolver(o,new it(o,e,t))}}function We(e){const t=e.slice(),i=Object.keys(e),o=i.length;let s;for(let n=0;n<o;++n)s=i[n],wt(s)||(t[s]=e[s]);return t}const Ke=Object.freeze({none(e){throw Error(`${e.toString()} not registered, did you forget to add @singleton()?`)},singleton:e=>new it(e,1,e),transient:e=>new it(e,2,e)}),Xe=Object.freeze({default:Object.freeze({parentLocator:()=>null,responsibleForOwnerRequests:!1,defaultResolver:Ke.singleton})}),Ye=new Map;function Qe(e){return t=>Reflect.getOwnMetadata(e,t)}let Ze=null;const Je=Object.freeze({createContainer:e=>new ut(null,Object.assign({},Xe.default,e)),findResponsibleContainer(e){const t=e.$$container$$;return t&&t.responsibleForOwnerRequests?t:Je.findParentContainer(e)},findParentContainer(e){const t=new CustomEvent(ht,{bubbles:!0,composed:!0,cancelable:!0,detail:{container:void 0}});return e.dispatchEvent(t),t.detail.container||Je.getOrCreateDOMContainer()},getOrCreateDOMContainer:(e,t)=>e?e.$$container$$||new ut(e,Object.assign({},Xe.default,t,{parentLocator:Je.findParentContainer})):Ze||(Ze=new ut(null,Object.assign({},Xe.default,t,{parentLocator:()=>null}))),getDesignParamtypes:Qe("design:paramtypes"),getAnnotationParamtypes:Qe("di:paramtypes"),getOrCreateAnnotationParamTypes(e){let t=this.getAnnotationParamtypes(e);return void 0===t&&Reflect.defineMetadata("di:paramtypes",t=[],e),t},getDependencies(e){let t=Ye.get(e);if(void 0===t){const i=e.inject;if(void 0===i){const i=Je.getDesignParamtypes(e),o=Je.getAnnotationParamtypes(e);if(void 0===i)if(void 0===o){const i=Object.getPrototypeOf(e);t="function"==typeof i&&i!==Function.prototype?We(Je.getDependencies(i)):[]}else t=We(o);else if(void 0===o)t=We(i);else{t=We(i);let e,s=o.length;for(let i=0;i<s;++i)e=o[i],void 0!==e&&(t[i]=e);const n=Object.keys(o);let r;s=n.length;for(let e=0;e<s;++e)r=n[e],wt(r)||(t[r]=o[r])}}else t=We(i);Ye.set(e,t)}return t},defineProperty(e,t,i,o=!1){const s=`$di_${t}`;Reflect.defineProperty(e,t,{get:function(){let e=this[s];if(void 0===e){const n=this instanceof HTMLElement?Je.findResponsibleContainer(this):Je.getOrCreateDOMContainer();if(e=n.get(i),this[s]=e,o&&this instanceof ge){const o=this.$fastController,n=()=>{Je.findResponsibleContainer(this).get(i)!==this[s]&&(this[s]=e,o.notify(t))};o.subscribe({handleChange:n},"isConnected")}}return e}})},createInterface(e,t){const i="function"==typeof e?e:t,o="string"==typeof e?e:e&&"friendlyName"in e&&e.friendlyName||vt,s="string"!=typeof e&&(e&&"respectConnection"in e&&e.respectConnection||!1),n=function(e,t,i){if(null==e||void 0!==new.target)throw new Error(`No registration for interface: '${n.friendlyName}'`);if(t)Je.defineProperty(e,t,n,s);else{Je.getOrCreateAnnotationParamTypes(e)[i]=n}};return n.$isInterface=!0,n.friendlyName=null==o?"(anonymous)":o,null!=i&&(n.register=function(e,t){return i(new Ge(e,null!=t?t:n))}),n.toString=function(){return`InterfaceSymbol<${n.friendlyName}>`},n},inject:(...e)=>function(t,i,o){if("number"==typeof o){const i=Je.getOrCreateAnnotationParamTypes(t),s=e[0];void 0!==s&&(i[o]=s)}else if(i)Je.defineProperty(t,i,e[0]);else{const i=o?Je.getOrCreateAnnotationParamTypes(o.value):Je.getOrCreateAnnotationParamTypes(t);let s;for(let t=0;t<e.length;++t)s=e[t],void 0!==s&&(i[t]=s)}},transient:e=>(e.register=function(t){return bt.transient(e,e).register(t)},e.registerInRequestor=!1,e),singleton:(e,t=tt)=>(e.register=function(t){return bt.singleton(e,e).register(t)},e.registerInRequestor=t.scoped,e)}),et=Je.createInterface("Container");Je.inject;const tt={scoped:!1};class it{constructor(e,t,i){this.key=e,this.strategy=t,this.state=i,this.resolving=!1}get $isResolver(){return!0}register(e){return e.registerResolver(this.key,this)}resolve(e,t){switch(this.strategy){case 0:return this.state;case 1:if(this.resolving)throw new Error(`Cyclic dependency found: ${this.state.name}`);return this.resolving=!0,this.state=e.getFactory(this.state).construct(t),this.strategy=0,this.resolving=!1,this.state;case 2:{const i=e.getFactory(this.state);if(null===i)throw new Error(`Resolver for ${String(this.key)} returned a null factory`);return i.construct(t)}case 3:return this.state(e,t,this);case 4:return this.state[0].resolve(e,t);case 5:return t.get(this.state);default:throw new Error(`Invalid resolver strategy specified: ${this.strategy}.`)}}getFactory(e){var t,i,o;switch(this.strategy){case 1:case 2:return e.getFactory(this.state);case 5:return null!==(o=null===(i=null===(t=e.getResolver(this.state))||void 0===t?void 0:t.getFactory)||void 0===i?void 0:i.call(t,e))&&void 0!==o?o:null;default:return null}}}function ot(e){return this.get(e)}function st(e,t){return t(e)}class nt{constructor(e,t){this.Type=e,this.dependencies=t,this.transformers=null}construct(e,t){let i;return i=void 0===t?new this.Type(...this.dependencies.map(ot,e)):new this.Type(...this.dependencies.map(ot,e),...t),null==this.transformers?i:this.transformers.reduce(st,i)}registerTransformer(e){(this.transformers||(this.transformers=[])).push(e)}}const rt={$isResolver:!0,resolve:(e,t)=>t};function at(e){return"function"==typeof e.register}function lt(e){return function(e){return at(e)&&"boolean"==typeof e.registerInRequestor}(e)&&e.registerInRequestor}const ct=new Set(["Array","ArrayBuffer","Boolean","DataView","Date","Error","EvalError","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Number","Object","Promise","RangeError","ReferenceError","RegExp","Set","SharedArrayBuffer","String","SyntaxError","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakSet"]),ht="__DI_LOCATE_PARENT__",dt=new Map;class ut{constructor(e,t){this.owner=e,this.config=t,this._parent=void 0,this.registerDepth=0,this.context=null,null!==e&&(e.$$container$$=this),this.resolvers=new Map,this.resolvers.set(et,rt),e instanceof Node&&e.addEventListener(ht,(e=>{e.composedPath()[0]!==this.owner&&(e.detail.container=this,e.stopImmediatePropagation())}))}get parent(){return void 0===this._parent&&(this._parent=this.config.parentLocator(this.owner)),this._parent}get depth(){return null===this.parent?0:this.parent.depth+1}get responsibleForOwnerRequests(){return this.config.responsibleForOwnerRequests}registerWithContext(e,...t){return this.context=e,this.register(...t),this.context=null,this}register(...e){if(100==++this.registerDepth)throw new Error("Unable to autoregister dependency");let t,i,o,s,n;const r=this.context;for(let a=0,l=e.length;a<l;++a)if(t=e[a],yt(t))if(at(t))t.register(this,r);else if(void 0!==t.prototype)bt.singleton(t,t).register(this);else for(i=Object.keys(t),s=0,n=i.length;s<n;++s)o=t[i[s]],yt(o)&&(at(o)?o.register(this,r):this.register(o));return--this.registerDepth,this}registerResolver(e,t){ft(e);const i=this.resolvers,o=i.get(e);return null==o?i.set(e,t):o instanceof it&&4===o.strategy?o.state.push(t):i.set(e,new it(e,4,[o,t])),t}registerTransformer(e,t){const i=this.getResolver(e);if(null==i)return!1;if(i.getFactory){const e=i.getFactory(this);return null!=e&&(e.registerTransformer(t),!0)}return!1}getResolver(e,t=!0){if(ft(e),void 0!==e.resolve)return e;let i,o=this;for(;null!=o;){if(i=o.resolvers.get(e),null!=i)return i;if(null==o.parent){const i=lt(e)?this:o;return t?this.jitRegister(e,i):null}o=o.parent}return null}has(e,t=!1){return!!this.resolvers.has(e)||!(!t||null==this.parent)&&this.parent.has(e,!0)}get(e){if(ft(e),e.$isResolver)return e.resolve(this,this);let t,i=this;for(;null!=i;){if(t=i.resolvers.get(e),null!=t)return t.resolve(i,this);if(null==i.parent){const o=lt(e)?this:i;return t=this.jitRegister(e,o),t.resolve(i,this)}i=i.parent}throw new Error(`Unable to resolve key: ${e}`)}getAll(e,t=!1){ft(e);const i=this;let s,n=i;if(t){let t=o;for(;null!=n;)s=n.resolvers.get(e),null!=s&&(t=t.concat(mt(s,n,i))),n=n.parent;return t}for(;null!=n;){if(s=n.resolvers.get(e),null!=s)return mt(s,n,i);if(n=n.parent,null==n)return o}return o}getFactory(e){let t=dt.get(e);if(void 0===t){if(xt(e))throw new Error(`${e.name} is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.`);dt.set(e,t=new nt(e,Je.getDependencies(e)))}return t}registerFactory(e,t){dt.set(e,t)}createChild(e){return new ut(null,Object.assign({},this.config,e,{parentLocator:()=>this}))}jitRegister(e,t){if("function"!=typeof e)throw new Error(`Attempted to jitRegister something that is not a constructor: '${e}'. Did you forget to register this dependency?`);if(ct.has(e.name))throw new Error(`Attempted to jitRegister an intrinsic type: ${e.name}. Did you forget to add @inject(Key)`);if(at(e)){const i=e.register(t);if(!(i instanceof Object)||null==i.resolve){const i=t.resolvers.get(e);if(null!=i)return i;throw new Error("A valid resolver was not returned from the static register method")}return i}if(e.$isInterface)throw new Error(`Attempted to jitRegister an interface: ${e.friendlyName}`);{const i=this.config.defaultResolver(e,t);return t.resolvers.set(e,i),i}}}const pt=new WeakMap;function gt(e){return function(t,i,o){if(pt.has(o))return pt.get(o);const s=e(t,i,o);return pt.set(o,s),s}}const bt=Object.freeze({instance:(e,t)=>new it(e,0,t),singleton:(e,t)=>new it(e,1,t),transient:(e,t)=>new it(e,2,t),callback:(e,t)=>new it(e,3,t),cachedCallback:(e,t)=>new it(e,3,gt(t)),aliasTo:(e,t)=>new it(t,5,e)});function ft(e){if(null==e)throw new Error("key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?")}function mt(e,t,i){if(e instanceof it&&4===e.strategy){const o=e.state;let s=o.length;const n=new Array(s);for(;s--;)n[s]=o[s].resolve(t,i);return n}return[e.resolve(t,i)]}const vt="(anonymous)";function yt(e){return"object"==typeof e&&null!==e||"function"==typeof e}const xt=function(){const e=new WeakMap;let t=!1,i="",o=0;return function(s){return t=e.get(s),void 0===t&&(i=s.toString(),o=i.length,t=o>=29&&o<=100&&125===i.charCodeAt(o-1)&&i.charCodeAt(o-2)<=32&&93===i.charCodeAt(o-3)&&101===i.charCodeAt(o-4)&&100===i.charCodeAt(o-5)&&111===i.charCodeAt(o-6)&&99===i.charCodeAt(o-7)&&32===i.charCodeAt(o-8)&&101===i.charCodeAt(o-9)&&118===i.charCodeAt(o-10)&&105===i.charCodeAt(o-11)&&116===i.charCodeAt(o-12)&&97===i.charCodeAt(o-13)&&110===i.charCodeAt(o-14)&&88===i.charCodeAt(o-15),e.set(s,t)),t}}(),$t={};function wt(e){switch(typeof e){case"number":return e>=0&&(0|e)===e;case"string":{const t=$t[e];if(void 0!==t)return t;const i=e.length;if(0===i)return $t[e]=!1;let o=0;for(let t=0;t<i;++t)if(o=e.charCodeAt(t),0===t&&48===o&&i>1||o<48||o>57)return $t[e]=!1;return $t[e]=!0}default:return!1}}function kt(e){return`${e.toLowerCase()}:presentation`}const Ct=new Map,It=Object.freeze({define(e,t,i){const o=kt(e);void 0===Ct.get(o)?Ct.set(o,t):Ct.set(o,!1),i.register(bt.instance(o,t))},forTag(e,t){const i=kt(e),o=Ct.get(i);if(!1===o){return Je.findResponsibleContainer(t).get(i)}return o||null}});class Tt{constructor(e,t){this.template=e||null,this.styles=void 0===t?null:Array.isArray(t)?X.create(t):t instanceof X?t:X.create([t])}applyTo(e){const t=e.$fastController;null===t.template&&(t.template=this.template),null===t.styles&&(t.styles=this.styles)}}class Dt extends ge{constructor(){super(...arguments),this._presentation=void 0}get $presentation(){return void 0===this._presentation&&(this._presentation=It.forTag(this.tagName,this)),this._presentation}templateChanged(){void 0!==this.template&&(this.$fastController.template=this.template)}stylesChanged(){void 0!==this.styles&&(this.$fastController.styles=this.styles)}connectedCallback(){null!==this.$presentation&&this.$presentation.applyTo(this),super.connectedCallback()}static compose(