@aegis-framework/pandora 0.7.0 → 0.8.0

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.
package/README.md CHANGED
@@ -472,6 +472,12 @@ class ModalDialog extends Component {
472
472
  onSaveClick(e: Event) {
473
473
  this.save();
474
474
  }
475
+
476
+ // The element that matched comes second
477
+ @Listen('click', { delegate: '[data-remove]' })
478
+ onRemove(e: MouseEvent, button: HTMLButtonElement) {
479
+ this.remove(button.dataset.remove);
480
+ }
475
481
  }
476
482
  ```
477
483
 
@@ -480,12 +486,16 @@ class ModalDialog extends Component {
480
486
  | Option | Type | Default | Description |
481
487
  |--------|------|---------|-------------|
482
488
  | `target` | `'self' \| 'window' \| 'document' \| string` | `'self'` | Where to attach the listener. A CSS selector string queries within the component. |
483
- | `delegate` | `string` | -- | CSS selector for event delegation. The handler only fires when `event.target.closest(delegate)` matches. |
489
+ | `delegate` | `string` | -- | CSS selector for event delegation. The handler only fires for an event that comes from an element matching it, and gets that element as its second argument. |
484
490
  | `capture` | `boolean` | `false` | Use capture phase |
485
491
  | `passive` | `boolean` | `false` | Mark as passive |
486
492
  | `once` | `boolean` | `false` | Remove after first fire |
487
493
 
488
- **Event delegation:** With `delegate` set, the listener attaches to the component (or `target`), but the handler only fires when the event originates from a descendant matching the selector. This is the same delegation pattern you'd recognize from jQuery, Backbone, and most UI frameworks -- handy for dynamic children without re-attaching listeners every render.
494
+ **Event delegation:** With `delegate` set, the listener attaches to the component (or `target`), but the handler only fires when the event originates from an element matching the selector. This is the same delegation pattern you'd recognize from jQuery, Backbone, and most UI frameworks -- handy for dynamic children without re-attaching listeners every render.
495
+
496
+ - **The matched element comes second.** The handler gets `(event, matched)`, where `matched` is the element that fit the selector: the button, not the icon inside it that was clicked.
497
+ - **The search stops at the listening element.** It runs from where the event started up to the element the listener is on: the component, or the `target` element. That element may match itself, as with `closest()`, but nothing above it does, so a component placed inside a matching element doesn't fire for every event. With `target: 'document'` or `'window'`, the whole document is in range.
498
+ - **Shadow roots:** a listener on a `ShadowComponent` searches its own shadow root and the children slotted into it. It doesn't look inside another component's shadow root. Events that don't cross a shadow boundary (`change`, `submit` and other events that aren't `composed`) never reach the host, so listen for those with a `target` inside the shadow root.
489
499
 
490
500
  ### @Emitter(eventName)
491
501
 
@@ -1,19 +1,19 @@
1
- (()=>{var $n=Object.defineProperty;var Rn=(e)=>e;function kn(e,t){this[e]=Rn.bind(null,t)}var $e=(e,t)=>{for(var n in t)$n(e,n,{get:t[n],enumerable:!0,configurable:!0,set:kn.bind(t,n)})};var We={};$e(We,{AsyncDirective:()=>M,Attribute:()=>pn,ClassList:()=>vn,Component:()=>S,Computed:()=>_n,Directive:()=>b,Emitter:()=>wn,Listen:()=>bn,PartType:()=>g,Property:()=>hn,Query:()=>mn,QueryAll:()=>yn,Register:()=>on,Registry:()=>A,ShadowComponent:()=>Cn,Slot:()=>gn,State:()=>un,Style:()=>rn,Subscribe:()=>fn,TemplateResultType:()=>ct,Types:()=>Tn,Util:()=>Be,VERSION:()=>Ue,Watch:()=>an,addDecoratorEffect:()=>T,addTeardown:()=>K,asyncAppend:()=>yt,asyncReplace:()=>mt,cache:()=>bt,choose:()=>_t,classMap:()=>vt,clearPart:()=>J,createRef:()=>Rt,createState:()=>En,directive:()=>m,getCommittedValue:()=>F,getDirectiveClass:()=>ht,guard:()=>wt,html:()=>st,ifDefined:()=>St,insertPart:()=>k,isCompiledTemplateResult:()=>ye,isDirectiveResult:()=>ut,isPrimitive:()=>me,isSingleExpression:()=>X,isTemplateResult:()=>ae,join:()=>Ct,keyed:()=>At,live:()=>Et,map:()=>Tt,noChange:()=>y,nothing:()=>f,range:()=>$t,reactive:()=>Ve,reactiveFields:()=>je,ref:()=>Lt,removePart:()=>Z,render:()=>N,repeat:()=>xt,setChildPartValue:()=>L,setCommittedValue:()=>P,styleMap:()=>Dt,svg:()=>ot,templateContent:()=>Mt,testing:()=>Fe,unsafeHTML:()=>It,unsafeMathML:()=>Nt,unsafeSVG:()=>Ht,until:()=>Bt,when:()=>Ut});var Be={};$e(Be,{ATTR_HANDLERS:()=>V,DECORATOR_EFFECTS:()=>W,DECORATOR_TEARDOWNS:()=>G,LISTEN_HANDLERS:()=>j,PENDING_ATTRIBUTE_WRITES:()=>ee,PROP_ATTRIBUTES:()=>E,REACTIVE_FIELDS:()=>v,STYLE_METADATA:()=>ue,SUBSCRIBE_HANDLERS:()=>I,WATCH_HANDLERS:()=>w,addDecoratorEffect:()=>T,addTeardown:()=>K,callAsync:()=>he,deserializeCSS:()=>te,isTemplateResult:()=>we,parseAttributeValue:()=>x,reactive:()=>Ve,reactiveFields:()=>je,recordBatchedChange:()=>pe,resolveListenerTarget:()=>qe,writePendingAttributes:()=>He});var Fe={};$e(Fe,{flush:()=>Gn,mount:()=>Qn,resetRegistry:()=>Kn,whenReady:()=>An});var Tn={};var Re=globalThis,Ke=(e)=>e,fe=Re.trustedTypes,Qe=fe?fe.createPolicy("lit-html",{createHTML:(e)=>e}):void 0;var D=`lit$${Math.random().toFixed(9).slice(2)}$`,ke="?"+D,Ln=`<${ke}>`,U=document,oe=()=>U.createComment(""),re=(e)=>e===null||typeof e!="object"&&typeof e!="function",Le=Array.isArray,tt=(e)=>Le(e)||typeof e?.[Symbol.iterator]=="function";var se=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ye=/-->/g,Xe=/>/g,q=RegExp(`>|[
1
+ (()=>{var Rn=Object.defineProperty;var kn=(e)=>e;function Ln(e,t){this[e]=kn.bind(null,t)}var $e=(e,t)=>{for(var n in t)Rn(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Ln.bind(t,n)})};var Ge={};$e(Ge,{AsyncDirective:()=>M,Attribute:()=>fn,ClassList:()=>wn,Component:()=>S,Computed:()=>vn,Directive:()=>b,Emitter:()=>Sn,Listen:()=>_n,PartType:()=>g,Property:()=>pn,Query:()=>yn,QueryAll:()=>gn,Register:()=>rn,Registry:()=>A,ShadowComponent:()=>An,Slot:()=>bn,State:()=>hn,Style:()=>an,Subscribe:()=>mn,TemplateResultType:()=>ut,Types:()=>$n,Util:()=>Ue,VERSION:()=>ze,Watch:()=>dn,addDecoratorEffect:()=>T,addTeardown:()=>K,asyncAppend:()=>gt,asyncReplace:()=>yt,cache:()=>_t,choose:()=>vt,classMap:()=>wt,clearPart:()=>J,createRef:()=>kt,createState:()=>Tn,directive:()=>m,getCommittedValue:()=>F,getDirectiveClass:()=>pt,guard:()=>St,html:()=>ot,ifDefined:()=>Ct,insertPart:()=>k,isCompiledTemplateResult:()=>ye,isDirectiveResult:()=>ht,isPrimitive:()=>me,isSingleExpression:()=>X,isTemplateResult:()=>ae,join:()=>At,keyed:()=>Et,live:()=>Tt,map:()=>$t,noChange:()=>y,nothing:()=>f,range:()=>Rt,reactive:()=>Ve,reactiveFields:()=>je,ref:()=>Pt,removePart:()=>Z,render:()=>N,repeat:()=>Ot,setChildPartValue:()=>L,setCommittedValue:()=>P,styleMap:()=>Mt,svg:()=>rt,templateContent:()=>It,testing:()=>We,unsafeHTML:()=>Nt,unsafeMathML:()=>Ht,unsafeSVG:()=>jt,until:()=>Ut,when:()=>zt});var Ue={};$e(Ue,{ATTR_HANDLERS:()=>V,DECORATOR_EFFECTS:()=>W,DECORATOR_TEARDOWNS:()=>G,LISTEN_HANDLERS:()=>j,PENDING_ATTRIBUTE_WRITES:()=>ee,PROP_ATTRIBUTES:()=>E,REACTIVE_FIELDS:()=>v,STYLE_METADATA:()=>ue,SUBSCRIBE_HANDLERS:()=>I,WATCH_HANDLERS:()=>w,addDecoratorEffect:()=>T,addTeardown:()=>K,callAsync:()=>he,deserializeCSS:()=>te,findDelegateMatch:()=>Be,isTemplateResult:()=>we,parseAttributeValue:()=>x,reactive:()=>Ve,reactiveFields:()=>je,recordBatchedChange:()=>pe,resolveListenerTarget:()=>qe,writePendingAttributes:()=>He});var We={};$e(We,{flush:()=>Qn,mount:()=>Xn,resetRegistry:()=>Yn,whenReady:()=>En});var $n={};var Re=globalThis,Qe=(e)=>e,fe=Re.trustedTypes,Ye=fe?fe.createPolicy("lit-html",{createHTML:(e)=>e}):void 0;var D=`lit$${Math.random().toFixed(9).slice(2)}$`,ke="?"+D,Pn=`<${ke}>`,U=document,oe=()=>U.createComment(""),re=(e)=>e===null||typeof e!="object"&&typeof e!="function",Le=Array.isArray,nt=(e)=>Le(e)||typeof e?.[Symbol.iterator]=="function";var se=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xe=/-->/g,Ze=/>/g,q=RegExp(`>|[
2
2
  \f\r](?:([^\\s"'>=/]+)([
3
3
  \f\r]*=[
4
4
  \f\r]*(?:[^
5
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ze=/'/g,Je=/"/g,nt=/^(?:script|style|textarea|title)$/i,Pe=(e)=>(t,...n)=>({_$litType$:e,strings:t,values:n}),st=Pe(1),ot=Pe(2),Xn=Pe(3),y=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),et=new WeakMap,B=U.createTreeWalker(U,129);function rt(e,t){if(!Le(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qe!==void 0?Qe.createHTML(t):t}var it=(e,t)=>{let n=e.length-1,s=[],o,i=t===2?"<svg>":t===3?"<math>":"",r=se;for(let a=0;a<n;a++){let d=e[a],u,l,c=-1,h=0;for(;h<d.length&&(r.lastIndex=h,l=r.exec(d),l!==null);)h=r.lastIndex,r===se?l[1]==="!--"?r=Ye:l[1]!==void 0?r=Xe:l[2]!==void 0?(nt.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=q):l[3]!==void 0&&(r=q):r===q?l[0]===">"?(r=o??se,c=-1):l[1]===void 0?c=-2:(c=r.lastIndex-l[2].length,u=l[1],r=l[3]===void 0?q:l[3]==='"'?Je:Ze):r===Je||r===Ze?r=q:r===Ye||r===Xe?r=se:(r=q,o=void 0);let p=r===q&&e[a+1].startsWith("/>")?" ":"";i+=r===se?d+Ln:c>=0?(s.push(u),d.slice(0,c)+"$lit$"+d.slice(c)+D+p):d+D+(c===-2?a:p)}return[rt(e,i+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class ie{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let o=0,i=0,r=e.length-1,a=this.parts,[d,u]=it(e,t);if(this.el=ie.createElement(d,n),B.currentNode=this.el.content,t===2||t===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=B.nextNode())!==null&&a.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(let l of s.getAttributeNames())if(l.endsWith("$lit$")){let c=u[i++],h=s.getAttribute(l).split(D),p=/([.?@])?(.*)/.exec(c);a.push({type:1,index:o,name:p[2],strings:h,ctor:p[1]==="."?Oe:p[1]==="?"?De:p[1]==="@"?Me:Y}),s.removeAttribute(l)}else l.startsWith(D)&&(a.push({type:6,index:o}),s.removeAttribute(l));if(nt.test(s.tagName)){let l=s.textContent.split(D),c=l.length-1;if(c>0){s.textContent=fe?fe.emptyScript:"";for(let h=0;h<c;h++)s.append(l[h],oe()),B.nextNode(),a.push({type:2,index:++o});s.append(l[c],oe())}}}else if(s.nodeType===8)if(s.data===ke)a.push({type:2,index:o});else{let l=-1;for(;(l=s.data.indexOf(D,l+1))!==-1;)a.push({type:7,index:o}),l+=D.length-1}o++}}static createElement(e,t){let n=U.createElement("template");return n.innerHTML=e,n}}function z(e,t,n=e,s){if(t===y)return t;let o=s!==void 0?n._$Co?.[s]:n._$Cl,i=re(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(e),o._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=o:n._$Cl=o),o!==void 0&&(t=z(e,o._$AS(e,t.values),o,s)),t}class xe{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,s=(e?.creationScope??U).importNode(t,!0);B.currentNode=s;let o=B.nextNode(),i=0,r=0,a=n[0];for(;a!==void 0;){if(i===a.index){let d;a.type===2?d=new Q(o,o.nextSibling,this,e):a.type===1?d=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(d=new Ie(o,this,e)),this._$AV.push(d),a=n[++r]}i!==a?.index&&(o=B.nextNode(),i++)}return B.currentNode=U,s}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=z(this,e,t),re(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==y&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):tt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&re(this._$AH)?this._$AA.nextSibling.data=e:this.T(U.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ie.createElement(rt(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new xe(s,this),i=o.u(this.options);o.p(t),this.T(i),this._$AH=o}}_$AC(e){let t=et.get(e.strings);return t===void 0&&et.set(e.strings,t=new ie(e)),t}k(e){Le(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,s=0;for(let o of e)s===t.length?t.push(n=new Q(this.O(oe()),this.O(oe()),this,this.options)):n=t[s],n._$AI(o),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ke(e).nextSibling;Ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=f}_$AI(e,t=this,n,s){let o=this.strings,i=!1;if(o===void 0)e=z(this,e,t,0),i=!re(e)||e!==this._$AH&&e!==y,i&&(this._$AH=e);else{let r=e,a,d;for(e=o[0],a=0;a<o.length-1;a++)d=z(this,r[n+a],t,a),d===y&&(d=this._$AH[a]),i||=!re(d)||d!==this._$AH[a],d===f?e=f:e!==f&&(e+=(d??"")+o[a+1]),this._$AH[a]=d}i&&!s&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Oe extends Y{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}}class De extends Y{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}}class Me extends Y{constructor(e,t,n,s,o){super(e,t,n,s,o),this.type=5}_$AI(e,t=this){if((e=z(this,e,t,0)??f)===y)return;let n=this._$AH,s=e===f&&n!==f||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==f&&(n===f||s);s&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Ie{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){z(this,e)}}var at={M:"$lit$",P:D,A:ke,C:1,L:it,R:xe,D:tt,V:z,I:Q,H:Y,N:De,U:Me,B:Oe,F:Ie},Pn=Re.litHtmlPolyfillSupport;Pn?.(ie,Q),(Re.litHtmlVersions??=[]).push("3.3.3");var N=(e,t,n)=>{let s=n?.renderBefore??t,o=s._$litPart$;if(o===void 0){let i=n?.renderBefore??null;s._$litPart$=o=new Q(t.insertBefore(oe(),i),i,void 0,n??{})}return o._$AI(e),o};var{I:xn}=at,dt=(e)=>e,me=(e)=>e===null||typeof e!="object"&&typeof e!="function",ct={HTML:1,SVG:2,MATHML:3},ae=(e,t)=>t===void 0?e?._$litType$!==void 0:e?._$litType$===t,ye=(e)=>e?._$litType$?.h!=null,ut=(e)=>e?._$litDirective$!==void 0,ht=(e)=>e?._$litDirective$,X=(e)=>e.strings===void 0,lt=()=>document.createComment(""),k=(e,t,n)=>{let s=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(n===void 0){let i=s.insertBefore(lt(),o),r=s.insertBefore(lt(),o);n=new xn(i,r,e,e.options)}else{let i=n._$AB.nextSibling,r=n._$AM,a=r!==e;if(a){let d;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(d=e._$AU)!==r._$AU&&n._$AP(d)}if(i!==o||a){let d=n._$AA;for(;d!==i;){let u=dt(d).nextSibling;dt(s).insertBefore(d,o),d=u}}}return n},L=(e,t,n=e)=>(e._$AI(t,n),e),On={},P=(e,t=On)=>e._$AH=t,F=(e)=>e._$AH,Z=(e)=>{e._$AR(),e._$AA.remove()},J=(e)=>{e._$AR()};var g={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m=(e)=>(...t)=>({_$litDirective$:e,values:t});class b{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}var de=(e,t)=>{let n=e._$AN;if(n===void 0)return!1;for(let s of n)s._$AO?.(t,!1),de(s,t);return!0},ge=(e)=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},pt=(e)=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),In(t)}};function Dn(e){this._$AN!==void 0?(ge(this),this._$AM=e,pt(this)):this._$AM=e}function Mn(e,t=!1,n=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let i=n;i<s.length;i++)de(s[i],!1),ge(s[i]);else s!=null&&(de(s,!1),ge(s));else de(this,e)}var In=(e)=>{e.type==g.CHILD&&(e._$AP??=Mn,e._$AQ??=Dn)};class M extends b{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),pt(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(de(this,e),ge(this))}setValue(e){if(X(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}var ft=async(e,t)=>{for await(let n of e)if(await t(n)===!1)return};class le{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}}class ce{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((e)=>this.Z=e)}resume(){this.Z?.(),this.Y=this.Z=void 0}}class be extends M{constructor(){super(...arguments),this._$CK=new le(this),this._$CX=new ce}render(e,t){return y}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return y;this._$CJ=t;let s=0,{_$CK:o,_$CX:i}=this;return ft(t,async(r)=>{for(;i.get();)await i.get();let a=o.deref();if(a!==void 0){if(a._$CJ!==t)return!1;n!==void 0&&(r=n(r,s)),a.commitValue(r,s),s++}return!0}),y}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}var mt=m(be);var yt=m(class extends be{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(e,t){return this._$Ctt=e,super.update(e,t)}commitValue(e,t){t===0&&J(this._$Ctt);let n=k(this._$Ctt);L(n,e)}});var gt=(e)=>ye(e)?e._$litType$.h:e.strings,bt=m(class extends b{constructor(e){super(e),this.et=new WeakMap}render(e){return[e]}update(e,[t]){let n=ae(this.it)?gt(this.it):null,s=ae(t)?gt(t):null;if(n!==null&&(s===null||n!==s)){let o=F(e).pop(),i=this.et.get(n);if(i===void 0){let r=document.createDocumentFragment();i=N(f,r),i.setConnected(!1),this.et.set(n,i)}P(i,[o]),k(i,void 0,o)}if(s!==null){if(n===null||n!==s){let o=this.et.get(s);if(o!==void 0){let i=F(o).pop();J(e),k(e,void 0,i),P(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}});var _t=(e,t,n)=>{for(let s of t)if(s[0]===e)return(0,s[1])();return n?.()};var vt=m(class extends b{constructor(e){if(super(e),e.type!==g.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t)=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((s)=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let n=e.element.classList;for(let s of this.st)s in t||(n.remove(s),this.st.delete(s));for(let s in t){let o=!!t[s];o===this.st.has(s)||this.nt?.has(s)||(o?(n.add(s),this.st.add(s)):(n.remove(s),this.st.delete(s)))}return y}});var Nn={},wt=m(class extends b{constructor(){super(...arguments),this.ot=Nn}render(e,t){return t()}update(e,[t,n]){if(Array.isArray(t)){if(Array.isArray(this.ot)&&this.ot.length===t.length&&t.every((s,o)=>s===this.ot[o]))return y}else if(this.ot===t)return y;return this.ot=Array.isArray(t)?Array.from(t):t,this.render(t,n)}});var St=(e)=>e??f;function*Ct(e,t){let n=typeof t=="function";if(e!==void 0){let s=-1;for(let o of e)s>-1&&(yield n?t(s):t),s++,yield o}}var At=m(class extends b{constructor(){super(...arguments),this.key=f}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(P(e),this.key=t),n}});var Et=m(class extends b{constructor(e){if(super(e),e.type!==g.PROPERTY&&e.type!==g.ATTRIBUTE&&e.type!==g.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!X(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===y||t===f)return t;let{element:n,name:s}=e;if(e.type===g.PROPERTY){if(t===n[s])return y}else if(e.type===g.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(s))return y}else if(e.type===g.ATTRIBUTE&&n.getAttribute(s)===t+"")return y;return P(e),t}});function*Tt(e,t){if(e!==void 0){let n=0;for(let s of e)yield t(s,n++)}}function*$t(e,t,n=1){let s=t===void 0?0:e;t??=e;for(let o=s;n>0?o<t:t<o;o+=n)yield o}var Rt=()=>new kt;class kt{}var Ne=new WeakMap,Lt=m(class extends M{render(e){return f}update(e,[t]){let n=t!==this.G;return n&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(this.G!==void 0)if(this.isConnected||(e=void 0),typeof this.G=="function"){let t=this.ht??globalThis,n=Ne.get(t);n===void 0&&(n=new WeakMap,Ne.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ne.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Pt=(e,t,n)=>{let s=new Map;for(let o=t;o<=n;o++)s.set(e[o],o);return s},xt=m(class extends b{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);let o=[],i=[],r=0;for(let a of e)o[r]=s?s(a,r):r,i[r]=n(a,r),r++;return{values:i,keys:o}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){let o=F(e),{values:i,keys:r}=this.dt(t,n,s);if(!Array.isArray(o))return this.ut=r,i;let a=this.ut??=[],d=[],u,l,c=0,h=o.length-1,p=0,C=i.length-1;for(;c<=h&&p<=C;)if(o[c]===null)c++;else if(o[h]===null)h--;else if(a[c]===r[p])d[p]=L(o[c],i[p]),c++,p++;else if(a[h]===r[C])d[C]=L(o[h],i[C]),h--,C--;else if(a[c]===r[C])d[C]=L(o[c],i[C]),k(e,d[C+1],o[c]),c++,C--;else if(a[h]===r[p])d[p]=L(o[h],i[p]),k(e,o[c],o[h]),h--,p++;else if(u===void 0&&(u=Pt(r,p,C),l=Pt(a,c,h)),u.has(a[c]))if(u.has(a[h])){let O=l.get(r[p]),Te=O!==void 0?o[O]:null;if(Te===null){let Ge=k(e,o[c]);L(Ge,i[p]),d[p]=Ge}else d[p]=L(Te,i[p]),k(e,o[c],Te),o[O]=null;p++}else Z(o[h]),h--;else Z(o[c]),c++;for(;p<=C;){let O=k(e,d[C+1]);L(O,i[p]),d[p++]=O}for(;c<=h;){let O=o[c++];O!==null&&Z(O)}return this.ut=r,P(e,d),y}});var Ot="important",Hn=" !"+Ot,Dt=m(class extends b{constructor(e){if(super(e),e.type!==g.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let s=e[n];return s==null?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?n.removeProperty(s):n[s]=null);for(let s in t){let o=t[s];if(o!=null){this.ft.add(s);let i=typeof o=="string"&&o.endsWith(Hn);s.includes("-")||i?n.setProperty(s,i?o.slice(0,-11):o,i?Ot:""):n[s]=o}}return y}});var Mt=m(class extends b{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("templateContent can only be used in child bindings")}render(e){return this.vt===e?y:(this.vt=e,document.importNode(e.content,!0))}});class H extends b{constructor(e){if(super(e),this.it=f,e.type!==g.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===y)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}H.directiveName="unsafeHTML",H.resultType=1;var It=m(H);class _e extends H{}_e.directiveName="unsafeMath",_e.resultType=3;var Nt=m(_e);class ve extends H{}ve.directiveName="unsafeSVG",ve.resultType=2;var Ht=m(ve);var jt=(e)=>!me(e)&&typeof e.then=="function",Vt=1073741823;class qt extends M{constructor(){super(...arguments),this._$Cwt=Vt,this._$Cbt=[],this._$CK=new le(this),this._$CX=new ce}render(...e){return e.find((t)=>!jt(t))??y}update(e,t){let n=this._$Cbt,s=n.length;this._$Cbt=t;let o=this._$CK,i=this._$CX;this.isConnected||this.disconnected();for(let r=0;r<t.length&&!(r>this._$Cwt);r++){let a=t[r];if(!jt(a))return this._$Cwt=r,a;r<s&&a===n[r]||(this._$Cwt=Vt,s=0,Promise.resolve(a).then(async(d)=>{for(;i.get();)await i.get();let u=o.deref();if(u!==void 0){let l=u._$Cbt.indexOf(a);l>-1&&l<u._$Cwt&&(u._$Cwt=l,u.setValue(d))}}))}return y}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}var Bt=m(qt);function Ut(e,t,n){return e?t(e):n?.(e)}var zt=(e,t)=>{let n=t.getAttribute("data-key"),s=null;if(n!==null)s=`[data-key="${CSS.escape(n)}"]`;else if(t.id!=="")s=`#${CSS.escape(t.id)}`;let o=[],i=t;while(!0){let r=i.parentNode;if(r===null)return null;if(o.unshift({index:Array.prototype.indexOf.call(r.children,i),tagName:i.tagName}),r===e)return{selector:s,path:o};i=r}},Ft=(e,t)=>{if(t.selector!==null){let s=e.querySelector(t.selector);if(s!==null)return s}let n=e;for(let s of t.path){let o=n.children[s.index];if(o===void 0||o.tagName!==s.tagName)return null;n=o}return n===e?null:n},jn=(e)=>{if(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement))return null;if(e.selectionStart===null||e.selectionEnd===null)return null;return{start:e.selectionStart,end:e.selectionEnd,direction:e.selectionDirection??"none"}},Vn=(e)=>{if(e instanceof ShadowRoot)return e.activeElement;let t=document.activeElement;return t!==null&&t!==e&&e.contains(t)?t:null},Wt=(e,t)=>{let n=Vn(e),s=n===null?null:zt(e,n),o=n===null?null:jn(n),i=[];for(let r of t){if(t.delete(r),!e.contains(r)||r.scrollTop===0&&r.scrollLeft===0)continue;let a=zt(e,r);if(a!==null)i.push({locator:a,top:r.scrollTop,left:r.scrollLeft})}return()=>{for(let{locator:a,top:d,left:u}of i){let l=Ft(e,a);if(l!==null)l.scrollTop=d,l.scrollLeft=u,t.add(l)}if(s===null||n?.isConnected)return;let r=Ft(e,s);if(!(r instanceof HTMLElement||r instanceof SVGElement))return;if(r.focus({preventScroll:!0}),o!==null&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement))try{r.setSelectionRange(o.start,o.end,o.direction)}catch{}}};var E=Symbol("pandora:propAttributes"),W=Symbol("pandora:decoratorEffects"),G=Symbol("pandora:decoratorTeardowns"),w=Symbol("pandora:watchHandlers"),v=Symbol("pandora:reactiveFields"),j=Symbol("pandora:listenHandlers"),ue=Symbol("pandora:styleMetadata"),V=Symbol("pandora:attrHandlers"),I=Symbol("pandora:subscribeHandlers"),ee=Symbol("pandora:pendingAttributeWrites"),Gt=new Map,he=(e,t,...n)=>{try{let s=e.apply(t,n);return s instanceof Promise?s:Promise.resolve(s)}catch(s){return Promise.reject(s)}},we=(e)=>e!==null&&typeof e==="object"&&("_$litType$"in e),te=(e,t="",n=0)=>{let s=Object.keys(e),o="";for(let i of s){let r=e[i];if(typeof r==="object"&&r!==null){if(t&&!i.startsWith("@"))if(i.startsWith("&"))o+=`${i.replace(/&/g,t)} {
5
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Je=/'/g,et=/"/g,st=/^(?:script|style|textarea|title)$/i,Pe=(e)=>(t,...n)=>({_$litType$:e,strings:t,values:n}),ot=Pe(1),rt=Pe(2),Jn=Pe(3),y=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),tt=new WeakMap,B=U.createTreeWalker(U,129);function it(e,t){if(!Le(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ye!==void 0?Ye.createHTML(t):t}var at=(e,t)=>{let n=e.length-1,s=[],o,i=t===2?"<svg>":t===3?"<math>":"",r=se;for(let a=0;a<n;a++){let d=e[a],u,l,c=-1,h=0;for(;h<d.length&&(r.lastIndex=h,l=r.exec(d),l!==null);)h=r.lastIndex,r===se?l[1]==="!--"?r=Xe:l[1]!==void 0?r=Ze:l[2]!==void 0?(st.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=q):l[3]!==void 0&&(r=q):r===q?l[0]===">"?(r=o??se,c=-1):l[1]===void 0?c=-2:(c=r.lastIndex-l[2].length,u=l[1],r=l[3]===void 0?q:l[3]==='"'?et:Je):r===et||r===Je?r=q:r===Xe||r===Ze?r=se:(r=q,o=void 0);let p=r===q&&e[a+1].startsWith("/>")?" ":"";i+=r===se?d+Pn:c>=0?(s.push(u),d.slice(0,c)+"$lit$"+d.slice(c)+D+p):d+D+(c===-2?a:p)}return[it(e,i+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class ie{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let o=0,i=0,r=e.length-1,a=this.parts,[d,u]=at(e,t);if(this.el=ie.createElement(d,n),B.currentNode=this.el.content,t===2||t===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=B.nextNode())!==null&&a.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(let l of s.getAttributeNames())if(l.endsWith("$lit$")){let c=u[i++],h=s.getAttribute(l).split(D),p=/([.?@])?(.*)/.exec(c);a.push({type:1,index:o,name:p[2],strings:h,ctor:p[1]==="."?Oe:p[1]==="?"?De:p[1]==="@"?Me:Y}),s.removeAttribute(l)}else l.startsWith(D)&&(a.push({type:6,index:o}),s.removeAttribute(l));if(st.test(s.tagName)){let l=s.textContent.split(D),c=l.length-1;if(c>0){s.textContent=fe?fe.emptyScript:"";for(let h=0;h<c;h++)s.append(l[h],oe()),B.nextNode(),a.push({type:2,index:++o});s.append(l[c],oe())}}}else if(s.nodeType===8)if(s.data===ke)a.push({type:2,index:o});else{let l=-1;for(;(l=s.data.indexOf(D,l+1))!==-1;)a.push({type:7,index:o}),l+=D.length-1}o++}}static createElement(e,t){let n=U.createElement("template");return n.innerHTML=e,n}}function z(e,t,n=e,s){if(t===y)return t;let o=s!==void 0?n._$Co?.[s]:n._$Cl,i=re(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(e),o._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=o:n._$Cl=o),o!==void 0&&(t=z(e,o._$AS(e,t.values),o,s)),t}class xe{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,s=(e?.creationScope??U).importNode(t,!0);B.currentNode=s;let o=B.nextNode(),i=0,r=0,a=n[0];for(;a!==void 0;){if(i===a.index){let d;a.type===2?d=new Q(o,o.nextSibling,this,e):a.type===1?d=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(d=new Ie(o,this,e)),this._$AV.push(d),a=n[++r]}i!==a?.index&&(o=B.nextNode(),i++)}return B.currentNode=U,s}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=z(this,e,t),re(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==y&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):nt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&re(this._$AH)?this._$AA.nextSibling.data=e:this.T(U.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ie.createElement(it(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new xe(s,this),i=o.u(this.options);o.p(t),this.T(i),this._$AH=o}}_$AC(e){let t=tt.get(e.strings);return t===void 0&&tt.set(e.strings,t=new ie(e)),t}k(e){Le(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,s=0;for(let o of e)s===t.length?t.push(n=new Q(this.O(oe()),this.O(oe()),this,this.options)):n=t[s],n._$AI(o),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Qe(e).nextSibling;Qe(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=f}_$AI(e,t=this,n,s){let o=this.strings,i=!1;if(o===void 0)e=z(this,e,t,0),i=!re(e)||e!==this._$AH&&e!==y,i&&(this._$AH=e);else{let r=e,a,d;for(e=o[0],a=0;a<o.length-1;a++)d=z(this,r[n+a],t,a),d===y&&(d=this._$AH[a]),i||=!re(d)||d!==this._$AH[a],d===f?e=f:e!==f&&(e+=(d??"")+o[a+1]),this._$AH[a]=d}i&&!s&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Oe extends Y{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}}class De extends Y{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}}class Me extends Y{constructor(e,t,n,s,o){super(e,t,n,s,o),this.type=5}_$AI(e,t=this){if((e=z(this,e,t,0)??f)===y)return;let n=this._$AH,s=e===f&&n!==f||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==f&&(n===f||s);s&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Ie{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){z(this,e)}}var dt={M:"$lit$",P:D,A:ke,C:1,L:at,R:xe,D:nt,V:z,I:Q,H:Y,N:De,U:Me,B:Oe,F:Ie},xn=Re.litHtmlPolyfillSupport;xn?.(ie,Q),(Re.litHtmlVersions??=[]).push("3.3.3");var N=(e,t,n)=>{let s=n?.renderBefore??t,o=s._$litPart$;if(o===void 0){let i=n?.renderBefore??null;s._$litPart$=o=new Q(t.insertBefore(oe(),i),i,void 0,n??{})}return o._$AI(e),o};var{I:On}=dt,lt=(e)=>e,me=(e)=>e===null||typeof e!="object"&&typeof e!="function",ut={HTML:1,SVG:2,MATHML:3},ae=(e,t)=>t===void 0?e?._$litType$!==void 0:e?._$litType$===t,ye=(e)=>e?._$litType$?.h!=null,ht=(e)=>e?._$litDirective$!==void 0,pt=(e)=>e?._$litDirective$,X=(e)=>e.strings===void 0,ct=()=>document.createComment(""),k=(e,t,n)=>{let s=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(n===void 0){let i=s.insertBefore(ct(),o),r=s.insertBefore(ct(),o);n=new On(i,r,e,e.options)}else{let i=n._$AB.nextSibling,r=n._$AM,a=r!==e;if(a){let d;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(d=e._$AU)!==r._$AU&&n._$AP(d)}if(i!==o||a){let d=n._$AA;for(;d!==i;){let u=lt(d).nextSibling;lt(s).insertBefore(d,o),d=u}}}return n},L=(e,t,n=e)=>(e._$AI(t,n),e),Dn={},P=(e,t=Dn)=>e._$AH=t,F=(e)=>e._$AH,Z=(e)=>{e._$AR(),e._$AA.remove()},J=(e)=>{e._$AR()};var g={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m=(e)=>(...t)=>({_$litDirective$:e,values:t});class b{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}var de=(e,t)=>{let n=e._$AN;if(n===void 0)return!1;for(let s of n)s._$AO?.(t,!1),de(s,t);return!0},ge=(e)=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},ft=(e)=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Nn(t)}};function Mn(e){this._$AN!==void 0?(ge(this),this._$AM=e,ft(this)):this._$AM=e}function In(e,t=!1,n=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let i=n;i<s.length;i++)de(s[i],!1),ge(s[i]);else s!=null&&(de(s,!1),ge(s));else de(this,e)}var Nn=(e)=>{e.type==g.CHILD&&(e._$AP??=In,e._$AQ??=Mn)};class M extends b{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ft(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(de(this,e),ge(this))}setValue(e){if(X(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}var mt=async(e,t)=>{for await(let n of e)if(await t(n)===!1)return};class le{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}}class ce{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((e)=>this.Z=e)}resume(){this.Z?.(),this.Y=this.Z=void 0}}class be extends M{constructor(){super(...arguments),this._$CK=new le(this),this._$CX=new ce}render(e,t){return y}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return y;this._$CJ=t;let s=0,{_$CK:o,_$CX:i}=this;return mt(t,async(r)=>{for(;i.get();)await i.get();let a=o.deref();if(a!==void 0){if(a._$CJ!==t)return!1;n!==void 0&&(r=n(r,s)),a.commitValue(r,s),s++}return!0}),y}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}var yt=m(be);var gt=m(class extends be{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(e,t){return this._$Ctt=e,super.update(e,t)}commitValue(e,t){t===0&&J(this._$Ctt);let n=k(this._$Ctt);L(n,e)}});var bt=(e)=>ye(e)?e._$litType$.h:e.strings,_t=m(class extends b{constructor(e){super(e),this.et=new WeakMap}render(e){return[e]}update(e,[t]){let n=ae(this.it)?bt(this.it):null,s=ae(t)?bt(t):null;if(n!==null&&(s===null||n!==s)){let o=F(e).pop(),i=this.et.get(n);if(i===void 0){let r=document.createDocumentFragment();i=N(f,r),i.setConnected(!1),this.et.set(n,i)}P(i,[o]),k(i,void 0,o)}if(s!==null){if(n===null||n!==s){let o=this.et.get(s);if(o!==void 0){let i=F(o).pop();J(e),k(e,void 0,i),P(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}});var vt=(e,t,n)=>{for(let s of t)if(s[0]===e)return(0,s[1])();return n?.()};var wt=m(class extends b{constructor(e){if(super(e),e.type!==g.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t)=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((s)=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let n=e.element.classList;for(let s of this.st)s in t||(n.remove(s),this.st.delete(s));for(let s in t){let o=!!t[s];o===this.st.has(s)||this.nt?.has(s)||(o?(n.add(s),this.st.add(s)):(n.remove(s),this.st.delete(s)))}return y}});var Hn={},St=m(class extends b{constructor(){super(...arguments),this.ot=Hn}render(e,t){return t()}update(e,[t,n]){if(Array.isArray(t)){if(Array.isArray(this.ot)&&this.ot.length===t.length&&t.every((s,o)=>s===this.ot[o]))return y}else if(this.ot===t)return y;return this.ot=Array.isArray(t)?Array.from(t):t,this.render(t,n)}});var Ct=(e)=>e??f;function*At(e,t){let n=typeof t=="function";if(e!==void 0){let s=-1;for(let o of e)s>-1&&(yield n?t(s):t),s++,yield o}}var Et=m(class extends b{constructor(){super(...arguments),this.key=f}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(P(e),this.key=t),n}});var Tt=m(class extends b{constructor(e){if(super(e),e.type!==g.PROPERTY&&e.type!==g.ATTRIBUTE&&e.type!==g.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!X(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===y||t===f)return t;let{element:n,name:s}=e;if(e.type===g.PROPERTY){if(t===n[s])return y}else if(e.type===g.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(s))return y}else if(e.type===g.ATTRIBUTE&&n.getAttribute(s)===t+"")return y;return P(e),t}});function*$t(e,t){if(e!==void 0){let n=0;for(let s of e)yield t(s,n++)}}function*Rt(e,t,n=1){let s=t===void 0?0:e;t??=e;for(let o=s;n>0?o<t:t<o;o+=n)yield o}var kt=()=>new Lt;class Lt{}var Ne=new WeakMap,Pt=m(class extends M{render(e){return f}update(e,[t]){let n=t!==this.G;return n&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(this.G!==void 0)if(this.isConnected||(e=void 0),typeof this.G=="function"){let t=this.ht??globalThis,n=Ne.get(t);n===void 0&&(n=new WeakMap,Ne.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ne.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var xt=(e,t,n)=>{let s=new Map;for(let o=t;o<=n;o++)s.set(e[o],o);return s},Ot=m(class extends b{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);let o=[],i=[],r=0;for(let a of e)o[r]=s?s(a,r):r,i[r]=n(a,r),r++;return{values:i,keys:o}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){let o=F(e),{values:i,keys:r}=this.dt(t,n,s);if(!Array.isArray(o))return this.ut=r,i;let a=this.ut??=[],d=[],u,l,c=0,h=o.length-1,p=0,C=i.length-1;for(;c<=h&&p<=C;)if(o[c]===null)c++;else if(o[h]===null)h--;else if(a[c]===r[p])d[p]=L(o[c],i[p]),c++,p++;else if(a[h]===r[C])d[C]=L(o[h],i[C]),h--,C--;else if(a[c]===r[C])d[C]=L(o[c],i[C]),k(e,d[C+1],o[c]),c++,C--;else if(a[h]===r[p])d[p]=L(o[h],i[p]),k(e,o[c],o[h]),h--,p++;else if(u===void 0&&(u=xt(r,p,C),l=xt(a,c,h)),u.has(a[c]))if(u.has(a[h])){let O=l.get(r[p]),Te=O!==void 0?o[O]:null;if(Te===null){let Ke=k(e,o[c]);L(Ke,i[p]),d[p]=Ke}else d[p]=L(Te,i[p]),k(e,o[c],Te),o[O]=null;p++}else Z(o[h]),h--;else Z(o[c]),c++;for(;p<=C;){let O=k(e,d[C+1]);L(O,i[p]),d[p++]=O}for(;c<=h;){let O=o[c++];O!==null&&Z(O)}return this.ut=r,P(e,d),y}});var Dt="important",jn=" !"+Dt,Mt=m(class extends b{constructor(e){if(super(e),e.type!==g.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let s=e[n];return s==null?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?n.removeProperty(s):n[s]=null);for(let s in t){let o=t[s];if(o!=null){this.ft.add(s);let i=typeof o=="string"&&o.endsWith(jn);s.includes("-")||i?n.setProperty(s,i?o.slice(0,-11):o,i?Dt:""):n[s]=o}}return y}});var It=m(class extends b{constructor(e){if(super(e),e.type!==g.CHILD)throw Error("templateContent can only be used in child bindings")}render(e){return this.vt===e?y:(this.vt=e,document.importNode(e.content,!0))}});class H extends b{constructor(e){if(super(e),this.it=f,e.type!==g.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===y)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}H.directiveName="unsafeHTML",H.resultType=1;var Nt=m(H);class _e extends H{}_e.directiveName="unsafeMath",_e.resultType=3;var Ht=m(_e);class ve extends H{}ve.directiveName="unsafeSVG",ve.resultType=2;var jt=m(ve);var Vt=(e)=>!me(e)&&typeof e.then=="function",qt=1073741823;class Bt extends M{constructor(){super(...arguments),this._$Cwt=qt,this._$Cbt=[],this._$CK=new le(this),this._$CX=new ce}render(...e){return e.find((t)=>!Vt(t))??y}update(e,t){let n=this._$Cbt,s=n.length;this._$Cbt=t;let o=this._$CK,i=this._$CX;this.isConnected||this.disconnected();for(let r=0;r<t.length&&!(r>this._$Cwt);r++){let a=t[r];if(!Vt(a))return this._$Cwt=r,a;r<s&&a===n[r]||(this._$Cwt=qt,s=0,Promise.resolve(a).then(async(d)=>{for(;i.get();)await i.get();let u=o.deref();if(u!==void 0){let l=u._$Cbt.indexOf(a);l>-1&&l<u._$Cwt&&(u._$Cwt=l,u.setValue(d))}}))}return y}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}var Ut=m(Bt);function zt(e,t,n){return e?t(e):n?.(e)}var Ft=(e,t)=>{let n=t.getAttribute("data-key"),s=null;if(n!==null)s=`[data-key="${CSS.escape(n)}"]`;else if(t.id!=="")s=`#${CSS.escape(t.id)}`;let o=[],i=t;while(!0){let r=i.parentNode;if(r===null)return null;if(o.unshift({index:Array.prototype.indexOf.call(r.children,i),tagName:i.tagName}),r===e)return{selector:s,path:o};i=r}},Wt=(e,t)=>{if(t.selector!==null){let s=e.querySelector(t.selector);if(s!==null)return s}let n=e;for(let s of t.path){let o=n.children[s.index];if(o===void 0||o.tagName!==s.tagName)return null;n=o}return n===e?null:n},Vn=(e)=>{if(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement))return null;if(e.selectionStart===null||e.selectionEnd===null)return null;return{start:e.selectionStart,end:e.selectionEnd,direction:e.selectionDirection??"none"}},qn=(e)=>{if(e instanceof ShadowRoot)return e.activeElement;let t=document.activeElement;return t!==null&&t!==e&&e.contains(t)?t:null},Gt=(e,t)=>{let n=qn(e),s=n===null?null:Ft(e,n),o=n===null?null:Vn(n),i=[];for(let r of t){if(t.delete(r),!e.contains(r)||r.scrollTop===0&&r.scrollLeft===0)continue;let a=Ft(e,r);if(a!==null)i.push({locator:a,top:r.scrollTop,left:r.scrollLeft})}return()=>{for(let{locator:a,top:d,left:u}of i){let l=Wt(e,a);if(l!==null)l.scrollTop=d,l.scrollLeft=u,t.add(l)}if(s===null||n?.isConnected)return;let r=Wt(e,s);if(!(r instanceof HTMLElement||r instanceof SVGElement))return;if(r.focus({preventScroll:!0}),o!==null&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement))try{r.setSelectionRange(o.start,o.end,o.direction)}catch{}}};var E=Symbol("pandora:propAttributes"),W=Symbol("pandora:decoratorEffects"),G=Symbol("pandora:decoratorTeardowns"),w=Symbol("pandora:watchHandlers"),v=Symbol("pandora:reactiveFields"),j=Symbol("pandora:listenHandlers"),ue=Symbol("pandora:styleMetadata"),V=Symbol("pandora:attrHandlers"),I=Symbol("pandora:subscribeHandlers"),ee=Symbol("pandora:pendingAttributeWrites"),Kt=new Map,he=(e,t,...n)=>{try{let s=e.apply(t,n);return s instanceof Promise?s:Promise.resolve(s)}catch(s){return Promise.reject(s)}},we=(e)=>e!==null&&typeof e==="object"&&("_$litType$"in e),te=(e,t="",n=0)=>{let s=Object.keys(e),o="";for(let i of s){let r=e[i];if(typeof r==="object"&&r!==null){if(t&&!i.startsWith("@"))if(i.startsWith("&"))o+=`${i.replace(/&/g,t)} {
6
6
  `;else if(i===":host")o+=`${t} {
7
7
  `;else o+=`${t} ${i} {
8
8
  `;else o+=`${i} {
9
9
  `;let a=Object.keys(r);for(let d of a){o+="\t".repeat(n);let u=r[d];if(typeof u==="object"&&u!==null){let l={};l[d]=u,o+=te(l,t,n+1)}else o+=` ${d}: ${u};
10
10
  `}o+=`}
11
11
  `}else o+="\t".repeat(n),o+=` ${i}: ${r};
12
- `}return o},T=(e,t)=>{if(!Object.hasOwn(e,W)){let n=e[W];e[W]=n?[...n]:[]}e[W].push(t)},K=(e,t)=>{if(!e[G])e[G]=[];e[G].push(t)},He=(e)=>{let t=e,n=t[ee];if(n===void 0)return;delete t[ee];for(let s of n.values())s()},je=(e)=>{let n=e[Symbol.metadata]?.[v];return new Set(n??[])},pe=(e,t)=>{let n=e;if(!n._batching||!n._batchedChanges)return!1;let s=n._batchedChanges.find((o)=>o.property===t.property);if(s){if(s.newValue=t.newValue,t.shouldRender)s.shouldRender=!0}else n._batchedChanges.push({...t});return!0},qn=(e)=>{let t=Gt.get(e);if(!t)t=Symbol(`__pandora_reactive_${e}`),Gt.set(e,t);return t},Ve=(e,t,n={})=>{let s=qn(t),o=n.equals??((r,a)=>r===a),i=n.render!==!1;if(e[s]===void 0)if(n.initialValue!==void 0)e[s]=n.initialValue;else{let r=Object.getOwnPropertyDescriptor(e,t);if(r&&"value"in r)e[s]=r.value}Object.defineProperty(e,t,{get(){return e[s]},set(r){let a=e[s];if(o(a,r))return;if(e[s]=r,n.onChange)n.onChange(r,a);if(pe(e,{property:t,oldValue:a,newValue:r,shouldRender:i,source:"reactive"}))return;if(typeof Symbol.metadata<"u"){let u=e.constructor[Symbol.metadata]?.[w];if(u){for(let l of u)if(l.property===t){let c=e[l.methodName];if(typeof c==="function")c.call(e,r,a)}}}if(typeof e.didChange==="function")e.didChange(t,a,r,"reactive");if(i&&typeof e._queueRender==="function")e._queueRender()},enumerable:!0,configurable:!0})},x=(e)=>{if(e===null)return;if(e===""||e==="true")return!0;if(e==="false")return!1;let t=e.trim();if(/^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(t)){let n=Number(t);if(Number.isFinite(n))return n}return e},qe=(e,t,n)=>{if(t==="window")return window;if(t==="document")return document;if(t&&t!=="self")return n?n(t):e.querySelector(t);return e};var Se=new WeakMap,Bn=new Set,Un=(e)=>{let t=Object.keys(e);if(t.length===0)return;let n=e,s=new Map;for(let o of t)s.set(o,n[o]),delete n[o];return s};class _ extends HTMLElement{_valuesBeforeUpgrade=Un(this);_scrolledElements=new Set;_connectedAs;_children;_connected;_isReady;_hasBeenMounted;_initRenderDone;_renderId;_renderQueued;_lastRenderType;_style;_batching;_batchedChanges;static _tag;static _template;static keepFocusAndScroll=!1;static _observedAttributes=[];static _styleSheet=null;static _sharedStyle={};static _onMount;static _onUnmount;static _onError;static _applyMiddleware;static _hasMiddleware;static _subscribe;static _getGlobalState;static _applyCurrentImplementation;static _activateSubscription(e,t){if(!_._subscribe)return;let n=e;if(n[t.unsubKey])n[t.unsubKey](),n[t.unsubKey]=void 0;n[t.unsubKey]=_._subscribe(t.stateKey,(o)=>{let i=n[t.valueKey];if(i===o)return;if(n[t.valueKey]=o,e.didChange(t.propertyKey,i,o,"consumer"),e.isReady)e._queueRender()});let s=_._getGlobalState?.(t.stateKey);if(s!==void 0)n[t.valueKey]=s}static get observedAttributes(){if(typeof Symbol.metadata<"u"){let t=this[Symbol.metadata]?.[E];if(t?.length)return[...new Set([...this._observedAttributes,...t])]}return this._observedAttributes}static set observedAttributes(e){this._observedAttributes=e}static get tag(){if(typeof this._tag>"u"){let e=this.name,t=e.match(/([A-Z])/g);if(t!==null)for(let n of t)e=e.replace(n,`-${n}`.toLowerCase());this._tag=e.slice(1)}return this._tag}static set tag(e){this._tag=e}static get template(){return this._template}static set template(e){if(this._template=e,e!==void 0)document.querySelectorAll(this.tag).forEach((t)=>{if(t instanceof _&&t._isReady)t.forceRender()})}constructor(){super();this._children="",this._connected=!1,this._isReady=!1,this._hasBeenMounted=!1,this._initRenderDone=!1,this._renderId=0,this._renderQueued=!1,this._style={},this._batching=!1,this._batchedChanges=[],this._trackScrolling(this)}static connectedInstances(){return Se.get(this)??Bn}_renderRoot(){return this}_trackScrolling(e){e.addEventListener("scroll",(t)=>{if(t.target instanceof Element&&t.target!==this)this._scrolledElements.add(t.target)},{capture:!0,passive:!0})}_assignValuesBeforeUpgrade(){let e=this._valuesBeforeUpgrade;if(e===void 0)return;this._valuesBeforeUpgrade=void 0;let t=this.constructor.tag;for(let[n,s]of e)try{this[n]=s}catch(o){console.warn(`[Pandora] <${t}> was given \`${n}\` before it was defined, and the value couldn't be kept: ${o.message}`)}}get slotContent(){return this._children}get isConnected(){return this._connected}get isReady(){return this._isReady}get isFirstMount(){return!this._hasBeenMounted}static _registryRegister;static register(){if(_._registryRegister)_._registryRegister(this.tag,this);else window.customElements.define(this.tag,this)}get isBatching(){return this._batching}batch(e){this._batching=!0,this._batchedChanges=[];try{e()}finally{this._batching=!1;let t=this._batchedChanges;if(this._batchedChanges=[],t.length>0){let n=!1;for(let{property:s,oldValue:o,newValue:i,shouldRender:r,source:a}of t){if(o===i)continue;if(r)n=!0;if(typeof Symbol.metadata<"u"){let u=this.constructor[Symbol.metadata]?.[w];if(u){for(let l of u)if(l.property===s){let c=this[l.methodName];if(typeof c==="function")c.call(this,i,o)}}}this.didChange(s,o,i,a)}if(n&&this._initRenderDone&&this._connected)this._queueRender()}}}_queueRender(){if(this._renderQueued||!this._connected)return;this._renderQueued=!0,queueMicrotask(()=>{if(this._renderQueued=!1,this._connected)this._render().catch((e)=>{let t=this.constructor.tag;if(_._onError)_._onError(e,this,t,"render");else{let n=this.id?`#${this.id}`:this.className?`.${this.className.split(/\s+/).join(".")}`:"";console.error(`[Pandora] Unhandled render error in <${t}${n}>:`,e,this)}})})}forceRender(){return this._render()}render(){}_applyLitRender(e){if(!this.hasAttribute("data-lit-rendered"))this.innerHTML="",this.setAttribute("data-lit-rendered","");N(e,this,{host:this})}_applyStringRender(e){if(e===""){this.innerHTML="";return}let t=document.createElement("template");t.innerHTML=e;let n=t.content.querySelector("slot");if(n!==null){let s=document.createElement("template");s.innerHTML=this._children,n.replaceWith(s.content),this.innerHTML="",this.appendChild(t.content)}else if(this.innerHTML=e,this._children!==""&&e.indexOf(this._children)===-1)this.innerHTML+=this._children}_resetRenderRoot(){this.innerHTML="",this.removeAttribute("data-lit-rendered"),delete this._$litPart$}async _render(){let e=++this._renderId,t=this.constructor,n=this.render;if(t._template!==void 0)n=()=>{if(typeof t._template==="function")return t._template.call(this,this);return t._template};let s=await he(n,this);if(e!==this._renderId)return;if(s===void 0||s===null){this._syncListenersAfterRender(),await he(this.didRender,this);return}let o=we(s)||s===f?"lit":"string";if(_._hasMiddleware?.("render")&&_._applyMiddleware)s=_._applyMiddleware("render",this,s,o);let i=we(s)||s===f,r=i?"lit":"string";if(!i&&typeof s!=="string"){let d=Array.isArray(s)?"an array":`a ${typeof s}`;throw TypeError(`[Pandora] <${t.tag}>'s render() returned ${d}. Return a string, an html\`\` template, \`nothing\` (to clear the content) or undefined (to leave it as it is). To render a list, put it in a template: html\`\${items}\`.`)}let a=!i&&t.keepFocusAndScroll?Wt(this._renderRoot(),this._scrolledElements):null;if(this._lastRenderType!==void 0&&this._lastRenderType!==r)this._resetRenderRoot();if(i)this._applyLitRender(s);else this._applyStringRender(s.trim()),a?.();this._lastRenderType=r,this._syncListenersAfterRender(),await he(this.didRender,this)}setStyle(e,t=!1){let n=this.constructor;if(!n._styleSheet)n._styleSheet=new CSSStyleSheet;let s="";if(typeof e==="object"){if(!Object.hasOwn(n,"_sharedStyle"))n._sharedStyle={};if(!t)n._sharedStyle={...n._sharedStyle,...e};else n._sharedStyle={...e};this._style=n._sharedStyle,s=te(n._sharedStyle,n.tag)}else if(typeof e==="string")if(!t)s=Array.from(n._styleSheet.cssRules||[]).map((i)=>i.cssText).join(`
12
+ `}return o},T=(e,t)=>{if(!Object.hasOwn(e,W)){let n=e[W];e[W]=n?[...n]:[]}e[W].push(t)},K=(e,t)=>{if(!e[G])e[G]=[];e[G].push(t)},He=(e)=>{let t=e,n=t[ee];if(n===void 0)return;delete t[ee];for(let s of n.values())s()},je=(e)=>{let n=e[Symbol.metadata]?.[v];return new Set(n??[])},pe=(e,t)=>{let n=e;if(!n._batching||!n._batchedChanges)return!1;let s=n._batchedChanges.find((o)=>o.property===t.property);if(s){if(s.newValue=t.newValue,t.shouldRender)s.shouldRender=!0}else n._batchedChanges.push({...t});return!0},Bn=(e)=>{let t=Kt.get(e);if(!t)t=Symbol(`__pandora_reactive_${e}`),Kt.set(e,t);return t},Ve=(e,t,n={})=>{let s=Bn(t),o=n.equals??((r,a)=>r===a),i=n.render!==!1;if(e[s]===void 0)if(n.initialValue!==void 0)e[s]=n.initialValue;else{let r=Object.getOwnPropertyDescriptor(e,t);if(r&&"value"in r)e[s]=r.value}Object.defineProperty(e,t,{get(){return e[s]},set(r){let a=e[s];if(o(a,r))return;if(e[s]=r,n.onChange)n.onChange(r,a);if(pe(e,{property:t,oldValue:a,newValue:r,shouldRender:i,source:"reactive"}))return;if(typeof Symbol.metadata<"u"){let u=e.constructor[Symbol.metadata]?.[w];if(u){for(let l of u)if(l.property===t){let c=e[l.methodName];if(typeof c==="function")c.call(e,r,a)}}}if(typeof e.didChange==="function")e.didChange(t,a,r,"reactive");if(i&&typeof e._queueRender==="function")e._queueRender()},enumerable:!0,configurable:!0})},x=(e)=>{if(e===null)return;if(e===""||e==="true")return!0;if(e==="false")return!1;let t=e.trim();if(/^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(t)){let n=Number(t);if(Number.isFinite(n))return n}return e},qe=(e,t,n)=>{if(t==="window")return window;if(t==="document")return document;if(t&&t!=="self")return n?n(t):e.querySelector(t);return e},Un=(e)=>e.nodeType===1,Be=(e,t,n)=>{let s=e.currentTarget;if(s===null)return null;let o=typeof s.getRootNode==="function"?s.getRootNode():n.ownerDocument??document,i=new Set([o]);if(s===n&&n.shadowRoot)i.add(n.shadowRoot);for(let r of e.composedPath()){if(Un(r)&&i.has(r.getRootNode())&&r.matches(t))return r;if(r===s)break}return null};var Se=new WeakMap,zn=new Set,Fn=(e)=>{let t=Object.keys(e);if(t.length===0)return;let n=e,s=new Map;for(let o of t)s.set(o,n[o]),delete n[o];return s};class _ extends HTMLElement{_valuesBeforeUpgrade=Fn(this);_scrolledElements=new Set;_connectedAs;_children;_connected;_isReady;_hasBeenMounted;_initRenderDone;_renderId;_renderQueued;_lastRenderType;_style;_batching;_batchedChanges;static _tag;static _template;static keepFocusAndScroll=!1;static _observedAttributes=[];static _styleSheet=null;static _sharedStyle={};static _onMount;static _onUnmount;static _onError;static _applyMiddleware;static _hasMiddleware;static _subscribe;static _getGlobalState;static _applyCurrentImplementation;static _activateSubscription(e,t){if(!_._subscribe)return;let n=e;if(n[t.unsubKey])n[t.unsubKey](),n[t.unsubKey]=void 0;n[t.unsubKey]=_._subscribe(t.stateKey,(o)=>{let i=n[t.valueKey];if(i===o)return;if(n[t.valueKey]=o,e.didChange(t.propertyKey,i,o,"consumer"),e.isReady)e._queueRender()});let s=_._getGlobalState?.(t.stateKey);if(s!==void 0)n[t.valueKey]=s}static get observedAttributes(){if(typeof Symbol.metadata<"u"){let t=this[Symbol.metadata]?.[E];if(t?.length)return[...new Set([...this._observedAttributes,...t])]}return this._observedAttributes}static set observedAttributes(e){this._observedAttributes=e}static get tag(){if(typeof this._tag>"u"){let e=this.name,t=e.match(/([A-Z])/g);if(t!==null)for(let n of t)e=e.replace(n,`-${n}`.toLowerCase());this._tag=e.slice(1)}return this._tag}static set tag(e){this._tag=e}static get template(){return this._template}static set template(e){if(this._template=e,e!==void 0)document.querySelectorAll(this.tag).forEach((t)=>{if(t instanceof _&&t._isReady)t.forceRender()})}constructor(){super();this._children="",this._connected=!1,this._isReady=!1,this._hasBeenMounted=!1,this._initRenderDone=!1,this._renderId=0,this._renderQueued=!1,this._style={},this._batching=!1,this._batchedChanges=[],this._trackScrolling(this)}static connectedInstances(){return Se.get(this)??zn}_renderRoot(){return this}_trackScrolling(e){e.addEventListener("scroll",(t)=>{if(t.target instanceof Element&&t.target!==this)this._scrolledElements.add(t.target)},{capture:!0,passive:!0})}_assignValuesBeforeUpgrade(){let e=this._valuesBeforeUpgrade;if(e===void 0)return;this._valuesBeforeUpgrade=void 0;let t=this.constructor.tag;for(let[n,s]of e)try{this[n]=s}catch(o){console.warn(`[Pandora] <${t}> was given \`${n}\` before it was defined, and the value couldn't be kept: ${o.message}`)}}get slotContent(){return this._children}get isConnected(){return this._connected}get isReady(){return this._isReady}get isFirstMount(){return!this._hasBeenMounted}static _registryRegister;static register(){if(_._registryRegister)_._registryRegister(this.tag,this);else window.customElements.define(this.tag,this)}get isBatching(){return this._batching}batch(e){this._batching=!0,this._batchedChanges=[];try{e()}finally{this._batching=!1;let t=this._batchedChanges;if(this._batchedChanges=[],t.length>0){let n=!1;for(let{property:s,oldValue:o,newValue:i,shouldRender:r,source:a}of t){if(o===i)continue;if(r)n=!0;if(typeof Symbol.metadata<"u"){let u=this.constructor[Symbol.metadata]?.[w];if(u){for(let l of u)if(l.property===s){let c=this[l.methodName];if(typeof c==="function")c.call(this,i,o)}}}this.didChange(s,o,i,a)}if(n&&this._initRenderDone&&this._connected)this._queueRender()}}}_queueRender(){if(this._renderQueued||!this._connected)return;this._renderQueued=!0,queueMicrotask(()=>{if(this._renderQueued=!1,this._connected)this._render().catch((e)=>{let t=this.constructor.tag;if(_._onError)_._onError(e,this,t,"render");else{let n=this.id?`#${this.id}`:this.className?`.${this.className.split(/\s+/).join(".")}`:"";console.error(`[Pandora] Unhandled render error in <${t}${n}>:`,e,this)}})})}forceRender(){return this._render()}render(){}_applyLitRender(e){if(!this.hasAttribute("data-lit-rendered"))this.innerHTML="",this.setAttribute("data-lit-rendered","");N(e,this,{host:this})}_applyStringRender(e){if(e===""){this.innerHTML="";return}let t=document.createElement("template");t.innerHTML=e;let n=t.content.querySelector("slot");if(n!==null){let s=document.createElement("template");s.innerHTML=this._children,n.replaceWith(s.content),this.innerHTML="",this.appendChild(t.content)}else if(this.innerHTML=e,this._children!==""&&e.indexOf(this._children)===-1)this.innerHTML+=this._children}_resetRenderRoot(){this.innerHTML="",this.removeAttribute("data-lit-rendered"),delete this._$litPart$}async _render(){let e=++this._renderId,t=this.constructor,n=this.render;if(t._template!==void 0)n=()=>{if(typeof t._template==="function")return t._template.call(this,this);return t._template};let s=await he(n,this);if(e!==this._renderId)return;if(s===void 0||s===null){this._syncListenersAfterRender(),await he(this.didRender,this);return}let o=we(s)||s===f?"lit":"string";if(_._hasMiddleware?.("render")&&_._applyMiddleware)s=_._applyMiddleware("render",this,s,o);let i=we(s)||s===f,r=i?"lit":"string";if(!i&&typeof s!=="string"){let d=Array.isArray(s)?"an array":`a ${typeof s}`;throw TypeError(`[Pandora] <${t.tag}>'s render() returned ${d}. Return a string, an html\`\` template, \`nothing\` (to clear the content) or undefined (to leave it as it is). To render a list, put it in a template: html\`\${items}\`.`)}let a=!i&&t.keepFocusAndScroll?Gt(this._renderRoot(),this._scrolledElements):null;if(this._lastRenderType!==void 0&&this._lastRenderType!==r)this._resetRenderRoot();if(i)this._applyLitRender(s);else this._applyStringRender(s.trim()),a?.();this._lastRenderType=r,this._syncListenersAfterRender(),await he(this.didRender,this)}setStyle(e,t=!1){let n=this.constructor;if(!n._styleSheet)n._styleSheet=new CSSStyleSheet;let s="";if(typeof e==="object"){if(!Object.hasOwn(n,"_sharedStyle"))n._sharedStyle={};if(!t)n._sharedStyle={...n._sharedStyle,...e};else n._sharedStyle={...e};this._style=n._sharedStyle,s=te(n._sharedStyle,n.tag)}else if(typeof e==="string")if(!t)s=Array.from(n._styleSheet.cssRules||[]).map((i)=>i.cssText).join(`
13
13
  `)+`
14
- `+e;else s=e,n._sharedStyle={},this._style={};if(n._styleSheet.replaceSync(s),!document.adoptedStyleSheets.includes(n._styleSheet))document.adoptedStyleSheets=[...document.adoptedStyleSheets,n._styleSheet];return n._sharedStyle}on(e,t,n){return this.addEventListener(e,t,n),this}off(e,t,n){return this.removeEventListener(e,t,n),this}once(e,t,n){let s=typeof n==="boolean"?{capture:n,once:!0}:{...n,once:!0};return this.addEventListener(e,t,s),this}emit(e,t,n){let s=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0,composed:!0,...n});return this.dispatchEvent(s)}query(e){return this.querySelector(e)}queryAll(e){return this.querySelectorAll(e)}_readyCallbacks;ready(e){if(this._isReady)queueMicrotask(e);else this._readyCallbacks??=[],this._readyCallbacks.push(e)}willMount(){}didMount(){}didRender(){}didReconnect(){}willUnmount(){}didUnmount(){}didChange(e,t,n,s){}_countAsConnected(){let e=this.constructor,t=Se.get(e);if(t===void 0)t=new Set,Se.set(e,t);t.add(this),this._connectedAs=e}_stopCountingAsConnected(){if(this._connectedAs!==void 0)Se.get(this._connectedAs)?.delete(this),this._connectedAs=void 0}async connectedCallback(){let e=this.constructor,t=e.tag;try{if(this._connected=!0,this._countAsConnected(),this.dataset.component=t,_._applyCurrentImplementation?.(this,t),typeof Symbol.metadata<"u"){let o=this.constructor[Symbol.metadata]?.[I];if(o)for(let i of o)_._activateSubscription(this,i)}let n=!this._hasBeenMounted;if(n)this._children=this.innerHTML.trim(),this._assignValuesBeforeUpgrade();if(He(this),n&&e._template===void 0){let s=document.querySelector(`template#${t}`);if(s)e._template=s.innerHTML}if(n&&typeof Symbol.metadata<"u"&&!Object.hasOwn(e,"_styleMetaApplied")){let o=e[Symbol.metadata]?.[ue];if(o)e._styleMetaApplied=!0,this.setStyle(o,!0)}if(await this.willMount(),await this._render(),this._initRenderDone=!0,n)await this.didMount();else await this.didReconnect();if(this._hasBeenMounted=!0,this._isReady=!0,this._readyCallbacks){for(let s of this._readyCallbacks)s();this._readyCallbacks=void 0}_._onMount?.(this,t),this.emit("pandora:ready",{firstMount:n,tag:t},{bubbles:!0,composed:!0})}catch(n){if(_._onError)_._onError(n,this,t,"connectedCallback");else throw n}}async disconnectedCallback(){let e=this.constructor,t=e.tag;this._connected=!1,this._isReady=!1,this._stopCountingAsConnected();try{if(this.emit("pandora:unmount",{tag:t},{bubbles:!0,composed:!0}),typeof Symbol.metadata<"u"){let s=e[Symbol.metadata]?.[I];if(s){let o=this;for(let i of s)if(o[i.unsubKey])o[i.unsubKey](),o[i.unsubKey]=void 0}}this._detachListeners(),await this.willUnmount(),await this.didUnmount(),_._onUnmount?.(this,t)}catch(n){if(_._onError)_._onError(n,this,t,"disconnectedCallback");else throw n}}attributeChangedCallback(e,t,n){if(typeof Symbol.metadata>"u")return;let o=this.constructor[Symbol.metadata],i=o?.[V];if(!i)return;let r=this;for(let a of i){if(a.attrName!==e)continue;if(r[a.settingKey])continue;let d=n!==null?x(n):void 0,u=r[a.valueKey];if(a.equals(u,d))continue;r[a.valueKey]=d;let l=o?.[w];if(l){for(let c of l)if(c.property===a.propertyKey){let h=this[c.methodName];if(typeof h==="function")h.call(this,d,u)}}if(this.didChange(a.propertyKey,u,d,"prop-attribute"),a.shouldRender&&this._initRenderDone&&this._connected)this._queueRender()}}_activeListeners=[];_listenersAttached=!1;_consumedOnceListeners=new Set;_listenerMetadata(){if(typeof Symbol.metadata>"u")return;return this.constructor[Symbol.metadata]?.[j]}static _isDynamicListenerTarget(e){return!!(e&&e!=="self"&&e!=="window"&&e!=="document")}_bindListener(e,t){let n=e.options;if(n?.once&&this._consumedOnceListeners.has(t))return!1;let s=this[e.methodName];if(typeof s!=="function")return!1;let o=_._isDynamicListenerTarget(n?.target),i=qe(this,n?.target,(u)=>this.query(u));if(!i)return!1;let r=s.bind(this),a={};if(n?.capture)a.capture=!0;if(n?.passive)a.passive=!0;let d;if(n?.delegate){let u=n.delegate,l=n?.once;d=(c)=>{if(c.target?.closest(u)){if(l)this._consumedOnceListeners.add(t),i.removeEventListener(e.event,d,a),this._activeListeners=this._activeListeners.filter((p)=>p.handler!==d);r(c)}}}else if(n?.once)d=(u)=>{this._consumedOnceListeners.add(t),this._activeListeners=this._activeListeners.filter((l)=>l.handler!==d),r(u)},a.once=!0;else d=r;return i.addEventListener(e.event,d,a),this._activeListeners.push({target:i,event:e.event,handler:d,options:a,dynamic:o,index:t}),!0}_attachListeners(){let e=this._listenerMetadata();if(!e)return;e.forEach((t,n)=>this._bindListener(t,n))}_refreshDynamicListeners(){let e=[];for(let n of this._activeListeners)if(n.dynamic)n.target.removeEventListener(n.event,n.handler,n.options);else e.push(n);this._activeListeners=e;let t=this._listenerMetadata();if(!t)return;t.forEach((n,s)=>{if(_._isDynamicListenerTarget(n.options?.target))this._bindListener(n,s)})}_syncListenersAfterRender(){if(this._listenersAttached)this._refreshDynamicListeners();else this._attachListeners(),this._listenersAttached=!0}_detachListeners(){for(let{target:e,event:t,handler:n,options:s}of this._activeListeners)e.removeEventListener(t,n,s);this._activeListeners=[],this._listenersAttached=!1,this._consumedOnceListeners.clear()}}var S=_;var Kt=Symbol("pandora:appliedImpl"),Qt=Symbol.for("@aegis-framework/pandora"),Ue="0.7.0";class ne{static _debug=!1;static components={};static implementations={};static state={};static subscribers={};static mountCallbacks=new Set;static unmountCallbacks=new Set;static errorCallbacks=new Set;static aliases={};static lazyLoaders={};static lazyLoadPromises={};static middleware={render:new Set};static _initialized=!1;static _init(){if(this._initialized)return;this._initialized=!0,S._onMount=(e,t)=>this._notifyMount(e,t),S._onUnmount=(e,t)=>this._notifyUnmount(e,t),S._onError=(e,t,n,s)=>this._notifyError(e,t,n,s),S._applyMiddleware=(e,t,n,s)=>this._applyMiddleware(e,t,n,s),S._hasMiddleware=(e)=>this._hasMiddleware(e),S._subscribe=(e,t)=>this.subscribe(e,t),S._getGlobalState=(e)=>this.getState(e),S._applyCurrentImplementation=(e,t)=>{let n=this.implementations[t];if(!n)return;let i=e[Kt]??e.constructor;if(n===i)return;this._applyImplementation(e,n,!1)}}static register(e,t){if(this._init(),typeof this.components[e]>"u")this.components[e]=t,this.implementations[e]=t,t.tag=e,window.customElements.define(e,t),this.components[e]._registered=!0,this.log(`Registered: <${e}>`);else throw Error(`[Pandora] <${e}> is already registered. Use Registry.evolve('${e}', NewClass) to swap its implementation.`)}static define(e,t){this.register(e,t)}static getImplementation(e){return this.implementations[e]||this.components[e]}static _applyImplementation(e,t,n=!1){let s=t.prototype,o=Object.getOwnPropertyNames(s),i=e;e[Kt]=t;for(let r of o){if(r==="constructor")continue;let a=Object.getOwnPropertyDescriptor(s,r);if(!a)continue;if(typeof a.value==="function")i[r]=a.value.bind(e);else if(a.get||a.set)Object.defineProperty(Object.getPrototypeOf(e),r,a)}try{let r=customElements.get(e.localName)??e.constructor??t,a=Reflect.construct(t,[],r);for(let d of Object.keys(a))if(!(d in i)||i[d]===void 0)i[d]=a[d]}catch(r){console.warn(`[Pandora] Could not construct temp instance of <${t.tag}> for default extraction:`,r)}if(typeof Symbol.metadata<"u"){let r=t[Symbol.metadata];if(r){let a=e.constructor;a[Symbol.metadata]=r}}if(typeof Symbol.metadata<"u"){let a=t[Symbol.metadata]?.[W];if(a?.length){let d=i[G];if(d)for(let u of d)u();i[G]=[];for(let u of a)u(e)}}e._detachListeners()}static evolve(e,t,n=!1){if(typeof this.components[e]>"u")throw Error(`[Pandora] Cannot evolve <${e}>: no component with that tag has been registered.`);this.implementations[e]=t,t._registered=!0;let s=[];for(let[o,i]of Object.entries(this.aliases))if(i===e)s.push(o),this.implementations[o]=t;if(this.log(`Evolved: <${e}>`),n){let o=[e,...s];for(let i of o)document.querySelectorAll(i).forEach((r)=>{if(r instanceof S&&r.isReady)this._applyImplementation(r,t,!0),r.forceRender()})}}static instances(e,t){if(typeof this.components[e]>"u")throw Error(`[Pandora] No component with tag <${e}> has been registered.`);if(typeof t==="function")document.querySelectorAll(e).forEach(t);else return document.querySelectorAll(e)}static instantiate(e,t={}){if(!this.has(e))throw Error(`[Pandora] No component with tag <${e}> has been registered.`);if(!this.components[e]._registered)this.register(e,this.components[e]);let n=document.createElement(this.components[e].tag);for(let[s,o]of Object.entries(t)){if(o===void 0||o===null)continue;if(n[s]=o,Object.getOwnPropertyDescriptor(n,s)?.set!==void 0)continue;if(typeof o==="boolean"){if(o)n.setAttribute(s,"")}else if(typeof o==="string"||typeof o==="number")n.setAttribute(s,String(o))}return n}static has(e){return typeof this.components[e]<"u"}static get(e){return this.components[e]}static setState(e,t){let n=this.state[e];if(this.state[e]=t,this.subscribers[e])this.subscribers[e].forEach((s)=>{s(t,n)})}static getState(e){return this.state[e]}static hasState(e){return e in this.state}static deleteState(e){if(e in this.state){let t=this.state[e];if(delete this.state[e],this.subscribers[e])this.subscribers[e].forEach((n)=>{n(void 0,t)});return!0}return!1}static subscribe(e,t){if(!this.subscribers[e])this.subscribers[e]=new Set;return this.subscribers[e].add(t),()=>{this.unsubscribe(e,t)}}static unsubscribe(e,t){if(this.subscribers[e])this.subscribers[e].delete(t)}static getAllState(){return{...this.state}}static clearState(){let e=Object.keys(this.state);for(let t of e)this.deleteState(t)}static clearSubscriptions(){for(let e of Object.keys(this.subscribers))this.subscribers[e]=new Set}static clearMiddleware(){for(let e of Object.keys(this.middleware))this.middleware[e]=new Set}static get debug(){return this._debug}static set debug(e){this._debug=e}static log(e,t){if(this._debug)if(t!==void 0)console.log(`[Pandora] ${e}`,t);else console.log(`[Pandora] ${e}`)}static list(){return Object.keys(this.components)}static stats(e){if(e){if(!this.has(e))throw Error(`[Pandora] No component with tag <${e}> has been registered.`);return{tag:e,instanceCount:document.querySelectorAll(e).length,isRegistered:this.components[e]?._registered??!1,isLazy:e in this.lazyLoaders}}return this.list().map((t)=>({tag:t,instanceCount:document.querySelectorAll(t).length,isRegistered:this.components[t]?._registered??!1,isLazy:t in this.lazyLoaders}))}static onMount(e){return this._init(),this.mountCallbacks.add(e),()=>this.mountCallbacks.delete(e)}static onUnmount(e){return this._init(),this.unmountCallbacks.add(e),()=>this.unmountCallbacks.delete(e)}static _notifyMount(e,t){this.log(`Mounted: <${t}>`),this.mountCallbacks.forEach((n)=>{try{n(e,t)}catch(s){console.error("[Pandora] Error in onMount callback:",s)}})}static _notifyUnmount(e,t){this.log(`Unmounted: <${t}>`),this.unmountCallbacks.forEach((n)=>{try{n(e,t)}catch(s){console.error("[Pandora] Error in onUnmount callback:",s)}})}static onError(e){return this._init(),this.errorCallbacks.add(e),()=>this.errorCallbacks.delete(e)}static _notifyError(e,t,n,s){if(this.log(`Error in <${n}> during ${s}:`,e),this.errorCallbacks.size===0)throw e;this.errorCallbacks.forEach((o)=>{try{o(e,t,n,s)}catch(i){console.error("[Pandora] Error in onError callback:",i)}})}static alias(e,t){if(!this.has(t))throw Error(`[Pandora] Cannot alias <${e}>: no component with tag <${t}> has been registered.`);if(this.has(e))throw Error(`[Pandora] Cannot alias <${e}>: a component with that tag already exists.`);this.aliases[e]=t;let n=this.getImplementation(t)??this.components[t],s=class extends n{static _tag=e};this.components[e]=s,this.implementations[e]=s,window.customElements.define(e,s),s._registered=!0,this.log(`Created alias: <${e}> -> <${t}>`)}static getOriginalTag(e){return this.aliases[e]}static isAlias(e){return e in this.aliases}static lazy(e,t){if(this._init(),this.has(e))throw Error(`[Pandora] Cannot register lazy <${e}>: a component with that tag already exists.`);this.lazyLoaders[e]=t;let n=ne;class s extends S{static _tag=e;_lazyLoaded=!1;async connectedCallback(){await n._loadLazyComponent(e);let o=n.getImplementation(e);if(o&&o!==s)ne._applyImplementation(this,o,!1),this._lazyLoaded=!0;await super.connectedCallback()}}this.components[e]=s,window.customElements.define(e,s),this.log(`Registered lazy component: <${e}>`)}static async _loadLazyComponent(e){if(this.lazyLoadPromises[e])return this.lazyLoadPromises[e];if(!(e in this.lazyLoaders))return;let t=this.lazyLoaders[e];return this.log(`Loading lazy component: <${e}>`),this.lazyLoadPromises[e]=(async()=>{try{let n=await t(),s="default"in n?n.default:n;delete this.lazyLoaders[e],this.implementations[e]=s,s._registered=!0,this.log(`Loaded lazy component: <${e}>`)}catch(n){throw console.error(`[Pandora] Failed to load lazy component <${e}>:`,n),n}finally{delete this.lazyLoadPromises[e]}})(),this.lazyLoadPromises[e]}static isLazy(e){return e in this.lazyLoaders}static async preload(e){if(this.isLazy(e))await this._loadLazyComponent(e)}static use(e,t){return this._init(),this.middleware[e].add(t),()=>this.middleware[e].delete(t)}static _applyMiddleware(e,t,n,s){let o=n;return this.middleware[e].forEach((i)=>{try{o=i(t,o,s)}catch(r){console.error(`[Pandora] Error in ${e} middleware:`,r)}}),o}static _hasMiddleware(e){return this.middleware[e].size>0}}S._registryRegister=(e,t)=>ne.register(e,t);var zn=(e,t,n=globalThis)=>{let s=n,o=s[Qt];if(o===void 0||o===null)return s[Qt]={version:t,registry:e},!0;if(o.registry===e)return!0;let i=o.version===t?`both are version ${t}`:`the first is version ${o.version}, this one is version ${t}`;return console.error(`[Pandora] Two copies of @aegis-framework/pandora are loaded (${i}). Each copy has its own Registry, so components, global state and middleware registered with one are unknown to the other, and a tag both define throws. To fix it, install a single copy (run \`npm ls @aegis-framework/pandora\` and dedupe it), import Pandora only by its package name, and don't load the browser bundle (pandora.browser.js) on a page that also bundles the package.`),!1};zn(ne,Ue);var A=ne;var Fn=new Set(["accessKey","autocapitalize","autocorrect","autofocus","className","contentEditable","dir","draggable","enterKeyHint","hidden","id","inert","innerHTML","innerText","inputMode","lang","nonce","outerHTML","part","popover","role","slot","spellcheck","style","tabIndex","textContent","title","translate","writingSuggestions"]),Yt=new WeakMap;Symbol.metadata??=Symbol("Symbol.metadata");var R=(e,t)=>{if(typeof t==="object"&&t!==null&&"kind"in t)return;throw TypeError(`[Pandora] @${e} was called as a legacy decorator. Pandora's decorators are standard decorators: remove "experimentalDecorators" from tsconfig.json (or set it to false), and if Babel compiles your code, set @babel/plugin-proposal-decorators to { version: "2023-11" }.`)},on=(e,t)=>(n,s)=>{R("Register",s);let o=s.metadata;if(o?.[E]){if(!Object.hasOwn(n,"_observedAttributes"))n._observedAttributes=[];for(let i of o[E])if(!n._observedAttributes.includes(i))n._observedAttributes.push(i)}if(o&&n[Symbol.metadata]===void 0)n[Symbol.metadata]=o;if(n.tag=e,!t?.defer)A.register(e,n);return n},rn=(e)=>(t,n)=>{R("Style",n);let s=n.metadata;return s[ue]=e,t},an=(e)=>(t,n)=>{R("Watch",n);let s=String(n.name),o=n.metadata;if(!Object.hasOwn(o,w)){let r=o[w];o[w]=r?[...r]:[]}o[w].push({property:e,methodName:s});let i=!1;n.addInitializer(function(){if(i)return;i=!0;let r=this;queueMicrotask(()=>{if(o[v]?.has(e)||Object.getOwnPropertyDescriptor(r,e)?.set)return;let d=r.constructor?.name||"<anonymous>";console.warn(`[Pandora] @Watch('${e}') on ${d}.${s}(): '${e}' is not reactive. Add @State, @Attribute, @Property, or @Subscribe to '${e}', or call reactive(this, '${e}') in the constructor — otherwise the watcher will never fire.`)})})},dn=(e,t)=>{if(typeof Symbol.metadata>"u")return[];let s=e.constructor[Symbol.metadata]?.[w];if(!s)return[];let o=[];for(let i of s)if(i.property===t){let r=e[i.methodName];if(typeof r==="function")o.push(r.bind(e))}return o},Wn=(e)=>{if(Fn.has(e)||/^aria[A-Z]/.test(e))return!0;return typeof HTMLElement<"u"&&e in HTMLElement.prototype},ze=(e,t,n)=>{if(!Wn(t))return;n.addInitializer(function(){let s=this.constructor,o=Yt.get(s);if(o===void 0)o=new Set,Yt.set(s,o);if(o.has(t))return;o.add(t),console.warn(`[Pandora] ${s.name||"A component"}: @${e}() ${t} has the name of the element's own \`${t}\` property and replaces it, so the browser's behavior for \`${t}\` stops working on this element and code that uses \`element.${t}\` gets the field instead. Rename the field.`)})},ln=(e,t,n)=>{let s=Object.getOwnPropertyDescriptor(e,t);if(s&&"value"in s&&s.value!==void 0&&e[n]===void 0)e[n]=s.value},cn=(e,t)=>{if(!Object.hasOwn(e,V)){let n=e[V];e[V]=n?[...n]:[]}e[V].push(t)},Xt=(e,t,n)=>{if(typeof n==="boolean")if(n)e.setAttribute(t,"");else e.removeAttribute(t);else if(typeof n==="string"||typeof n==="number")e.setAttribute(t,String(n))},Ce=(e,t,n)=>{if(e.isConnected){Xt(e,t,e[n]);return}let s=e[ee];if(s===void 0)s=new Map,e[ee]=s;s.set(t,()=>{if(!e.hasAttribute(t))Xt(e,t,e[n])})},Ae=(e,t,n,s,o,i=!0,r=(a,d)=>a===d)=>{if(ln(e,n,s),Object.defineProperty(e,n,{get(){if(e[s]!==void 0)return e[s];if(e.hasAttribute(t))return x(e.getAttribute(t));return},set(a){let d=e[s];if(e[s]=a,e[o]=!0,a===void 0||a===null)e.removeAttribute(t);else if(typeof a==="string"||typeof a==="number"||typeof a==="boolean")if(typeof a==="boolean")if(a)e.setAttribute(t,"");else e.removeAttribute(t);else e.setAttribute(t,String(a));if(e[o]=!1,!r(d,a)){if(!pe(e,{property:n,oldValue:d,newValue:a,shouldRender:i,source:"prop"})){let u=dn(e,n);for(let l of u)l(a,d);if(e.didChange(n,d,a,"prop"),i&&e._initRenderDone&&e.isConnected)e._queueRender()}}},enumerable:!0,configurable:!0}),e.isConnected&&e.hasAttribute(t))e[s]=x(e.getAttribute(t));K(e,()=>{delete e[n]})},Ee=(e,t,n,s,o="state",i=(r,a)=>r===a)=>{ln(e,t,n),Object.defineProperty(e,t,{get(){return e[n]},set(r){let a=e[n];if(i(a,r))return;if(e[n]=r,pe(e,{property:t,oldValue:a,newValue:r,shouldRender:s,source:o}))return;let d=dn(e,t);for(let u of d)u(r,a);if(e.didChange(t,a,r,o),s&&e._initRenderDone&&e.isConnected)e._queueRender()},enumerable:!0,configurable:!0}),K(e,()=>{delete e[t]})},un=(e)=>(t,n)=>{R("State",n);let s=String(n.name);ze("State",s,n);let o=e?.render!==!1,i=Symbol(`__pandora_state_${s}`),r,a=!1,d=n.metadata;if(!Object.hasOwn(d,v)){let u=d[v];d[v]=u?new Set(u):new Set}d[v].add(s),T(d,(u)=>{if(Ee(u,s,i,o),a&&u[i]===void 0)u[i]=r}),n.addInitializer(function(){let u=this,l=u[s];if(Ee(u,s,i,o),l!==void 0){if(u[i]=l,!a)r=l,a=!0}})},hn=(e)=>(t,n)=>{R("Property",n);let s=String(n.name);ze("Property",s,n);let o=Symbol(`__pandora_property_${s}`),i=e?.equals??((l,c)=>l===c),r=e?.attribute===!0?s:e?.attribute??!1,a,d=!1,u=n.metadata;if(!Object.hasOwn(u,v)){let l=u[v];u[v]=l?new Set(l):new Set}if(u[v].add(s),r!==!1){let l=Symbol(`__pandora_propSetting_${s}`);if(!Object.hasOwn(u,E)){let c=u[E];u[E]=c?[...c]:[]}if(!u[E].includes(r))u[E].push(r);cn(u,{attrName:r,propertyKey:s,valueKey:o,settingKey:l,shouldRender:!1,equals:i}),T(u,(c)=>{if(Ae(c,r,s,o,l,!1,i),d&&c[o]===void 0)if(c.hasAttribute(r))c[o]=x(c.getAttribute(r));else c[o]=a,Ce(c,r,s)}),n.addInitializer(function(){let c=this,h=c[s],p=c.hasAttribute(r),C=p?x(c.getAttribute(r)):void 0;if(Ae(c,r,s,o,l,!1,i),h!==void 0&&!d)a=h,d=!0;if(p)c[o]=C;else if(h!==void 0)c[o]=h,Ce(c,r,s)})}else T(u,(l)=>{if(Ee(l,s,o,!1,"property",i),d&&l[o]===void 0)l[o]=a}),n.addInitializer(function(){let l=this,c=l[s];if(Ee(l,s,o,!1,"property",i),c!==void 0){if(l[o]=c,!d)a=c,d=!0}})},pn=(e)=>(t,n)=>{R("Attribute",n);let s=String(n.name);ze("Attribute",s,n);let o,i=!0;if(typeof e==="object")o=s,i=e.render!==!1;else o=e??s;let r=Symbol(`__pandora_attr_${s}`),a=n.metadata;if(!Object.hasOwn(a,v)){let l=a[v];a[v]=l?new Set(l):new Set}a[v].add(s);let d,u=!1;{let l=Symbol(`__pandora_propSetting_${s}`);if(!Object.hasOwn(a,E)){let c=a[E];a[E]=c?[...c]:[]}if(!a[E].includes(o))a[E].push(o);cn(a,{attrName:o,propertyKey:s,valueKey:r,settingKey:l,shouldRender:i,equals:(c,h)=>c===h}),T(a,(c)=>{if(Ae(c,o,s,r,l,i),u&&c[r]===void 0)if(c.hasAttribute(o))c[r]=x(c.getAttribute(o));else c[r]=d,Ce(c,o,s)}),n.addInitializer(function(){let c=this,h=c[s],p=c.hasAttribute(o),C=p?x(c.getAttribute(o)):void 0;if(Ae(c,o,s,r,l,i),h!==void 0&&!u)d=h,u=!0;if(p)c[r]=C;else if(h!==void 0)c[r]=h,Ce(c,o,s)})}},Zt=(e,t,n,s,o)=>{if(Object.defineProperty(e,n,{get(){return e[o]},set(i){let r=e[o];if(r===i)return;if(e[o]=i,A.setState(t,i),e.didChange(n,r,i,"consumer"),e.isReady)e._queueRender()},enumerable:!0,configurable:!0}),e.isConnected)S._activateSubscription?.(e,{stateKey:t,propertyKey:n,unsubKey:s,valueKey:o});K(e,()=>{if(e[s])e[s](),e[s]=void 0;delete e[n]})},fn=(e)=>(t,n)=>{R("Subscribe",n);let s=String(n.name),o=Symbol(`__pandora_unsub_${s}`),i=Symbol(`__pandora_value_${s}`),r=n.metadata;if(!Object.hasOwn(r,v)){let a=r[v];r[v]=a?new Set(a):new Set}if(r[v].add(s),!Object.hasOwn(r,I)){let a=r[I];r[I]=a?[...a]:[]}r[I].push({stateKey:e,propertyKey:s,unsubKey:o,valueKey:i}),T(r,(a)=>{Zt(a,e,s,o,i)}),n.addInitializer(function(){Zt(this,e,s,o,i)})},Jt=(e,t,n)=>{Object.defineProperty(e,t,{get(){return e.query(n)},enumerable:!0,configurable:!0})},mn=(e)=>(t,n)=>{R("Query",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{Jt(i,s,e)}),n.addInitializer(function(){Jt(this,s,e)})},en=(e,t,n)=>{Object.defineProperty(e,t,{get(){return e.queryAll(n)},enumerable:!0,configurable:!0})},yn=(e)=>(t,n)=>{R("QueryAll",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{en(i,s,e)}),n.addInitializer(function(){en(this,s,e)})},tn=(e,t,n)=>{Object.defineProperty(e,t,{get(){return(e._shadowDOM||e.shadowRoot)?.querySelector(n)??null},enumerable:!0,configurable:!0})},gn=(e)=>(t,n)=>{R("Slot",n);let s=String(n.name),o=e?`slot[name="${e}"]`:"slot:not([name])",i=n.metadata;T(i,(r)=>{tn(r,s,o)}),n.addInitializer(function(){tn(this,s,o)})},bn=(e,t)=>(n,s)=>{R("Listen",s);let o=String(s.name),i=s.metadata;if(!Object.hasOwn(i,j)){let r=i[j];i[j]=r?[...r]:[]}i[j].push({event:e,methodName:o,options:t})},nn=(e,t,n,s,o)=>{e[`__invalidate_${t}`]=()=>{e[s]=!1},Object.defineProperty(e,t,{get(){if(!e[s])e[n]=o.call(e),e[s]=!0;return e[n]},enumerable:!0,configurable:!0})},_n=(...e)=>(t,n)=>{R("Computed",n);let s=String(n.name),o=Symbol(`__pandora_computed_cache_${s}`),i=Symbol(`__pandora_computed_valid_${s}`),r=n.metadata;for(let d of e){if(!Object.hasOwn(r,w)){let u=r[w];r[w]=u?[...u]:[]}r[w].push({property:d,methodName:`__invalidate_${s}`})}let a=t;return T(r,(d)=>{nn(d,s,o,i,a)}),n.addInitializer(function(){nn(this,s,o,i,a)}),t},vn=(e)=>(t,n)=>{R("ClassList",n);let s=n.metadata,o=[],i=[];for(let[a,d]of Object.entries(e))if(typeof d==="string"){if(o.push({className:a,propertyName:d}),!Object.hasOwn(s,w)){let l=s[w];s[w]=l?[...l]:[]}let u=`__classlist_${a}_${d}`;s[w].push({property:d,methodName:u}),t.prototype[u]=function(){this.classList.toggle(a,!!this[d])}}else i.push({className:a,conditionFn:d});if(i.length>0){let a=t.prototype.didChange;t.prototype.didChange=function(d,u,l,c){a?.call(this,d,u,l,c);for(let{className:h,conditionFn:p}of i)this.classList.toggle(h,p(this))}}let r=t.prototype.connectedCallback;return t.prototype.connectedCallback=async function(){await r?.call(this);for(let{className:a,propertyName:d}of o)this.classList.toggle(a,!!this[d]);for(let{className:a,conditionFn:d}of i)this.classList.toggle(a,d(this))},t},sn=(e,t,n)=>{Object.defineProperty(e,t,{value:(s)=>e.emit(n,s),writable:!1,enumerable:!0,configurable:!0})},wn=(e)=>(t,n)=>{R("Emitter",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{sn(i,s,e)}),n.addInitializer(function(){sn(this,s,e)})};class Sn extends S{_shadowDOM;static _styleSheet=null;static _sharedStyle={};constructor(){super();this._shadowDOM=this.attachShadow({mode:"open"}),this._trackScrolling(this._shadowDOM)}setStyle(e,t=!1){let n=this.constructor;if(!n._styleSheet)n._styleSheet=new CSSStyleSheet;let s="";if(typeof e==="object"){if(!Object.hasOwn(n,"_sharedStyle"))n._sharedStyle={};if(!t)n._sharedStyle={...n._sharedStyle,...e};else n._sharedStyle={...e};this._style=n._sharedStyle,s=te(n._sharedStyle)}else if(typeof e==="string")if(!t)s=Array.from(n._styleSheet.cssRules||[]).map((i)=>i.cssText).join(`
14
+ `+e;else s=e,n._sharedStyle={},this._style={};if(n._styleSheet.replaceSync(s),!document.adoptedStyleSheets.includes(n._styleSheet))document.adoptedStyleSheets=[...document.adoptedStyleSheets,n._styleSheet];return n._sharedStyle}on(e,t,n){return this.addEventListener(e,t,n),this}off(e,t,n){return this.removeEventListener(e,t,n),this}once(e,t,n){let s=typeof n==="boolean"?{capture:n,once:!0}:{...n,once:!0};return this.addEventListener(e,t,s),this}emit(e,t,n){let s=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0,composed:!0,...n});return this.dispatchEvent(s)}query(e){return this.querySelector(e)}queryAll(e){return this.querySelectorAll(e)}_readyCallbacks;ready(e){if(this._isReady)queueMicrotask(e);else this._readyCallbacks??=[],this._readyCallbacks.push(e)}willMount(){}didMount(){}didRender(){}didReconnect(){}willUnmount(){}didUnmount(){}didChange(e,t,n,s){}_countAsConnected(){let e=this.constructor,t=Se.get(e);if(t===void 0)t=new Set,Se.set(e,t);t.add(this),this._connectedAs=e}_stopCountingAsConnected(){if(this._connectedAs!==void 0)Se.get(this._connectedAs)?.delete(this),this._connectedAs=void 0}async connectedCallback(){let e=this.constructor,t=e.tag;try{if(this._connected=!0,this._countAsConnected(),this.dataset.component=t,_._applyCurrentImplementation?.(this,t),typeof Symbol.metadata<"u"){let o=this.constructor[Symbol.metadata]?.[I];if(o)for(let i of o)_._activateSubscription(this,i)}let n=!this._hasBeenMounted;if(n)this._children=this.innerHTML.trim(),this._assignValuesBeforeUpgrade();if(He(this),n&&e._template===void 0){let s=document.querySelector(`template#${t}`);if(s)e._template=s.innerHTML}if(n&&typeof Symbol.metadata<"u"&&!Object.hasOwn(e,"_styleMetaApplied")){let o=e[Symbol.metadata]?.[ue];if(o)e._styleMetaApplied=!0,this.setStyle(o,!0)}if(await this.willMount(),await this._render(),this._initRenderDone=!0,n)await this.didMount();else await this.didReconnect();if(this._hasBeenMounted=!0,this._isReady=!0,this._readyCallbacks){for(let s of this._readyCallbacks)s();this._readyCallbacks=void 0}_._onMount?.(this,t),this.emit("pandora:ready",{firstMount:n,tag:t},{bubbles:!0,composed:!0})}catch(n){if(_._onError)_._onError(n,this,t,"connectedCallback");else throw n}}async disconnectedCallback(){let e=this.constructor,t=e.tag;this._connected=!1,this._isReady=!1,this._stopCountingAsConnected();try{if(this.emit("pandora:unmount",{tag:t},{bubbles:!0,composed:!0}),typeof Symbol.metadata<"u"){let s=e[Symbol.metadata]?.[I];if(s){let o=this;for(let i of s)if(o[i.unsubKey])o[i.unsubKey](),o[i.unsubKey]=void 0}}this._detachListeners(),await this.willUnmount(),await this.didUnmount(),_._onUnmount?.(this,t)}catch(n){if(_._onError)_._onError(n,this,t,"disconnectedCallback");else throw n}}attributeChangedCallback(e,t,n){if(typeof Symbol.metadata>"u")return;let o=this.constructor[Symbol.metadata],i=o?.[V];if(!i)return;let r=this;for(let a of i){if(a.attrName!==e)continue;if(r[a.settingKey])continue;let d=n!==null?x(n):void 0,u=r[a.valueKey];if(a.equals(u,d))continue;r[a.valueKey]=d;let l=o?.[w];if(l){for(let c of l)if(c.property===a.propertyKey){let h=this[c.methodName];if(typeof h==="function")h.call(this,d,u)}}if(this.didChange(a.propertyKey,u,d,"prop-attribute"),a.shouldRender&&this._initRenderDone&&this._connected)this._queueRender()}}_activeListeners=[];_listenersAttached=!1;_consumedOnceListeners=new Set;_listenerMetadata(){if(typeof Symbol.metadata>"u")return;return this.constructor[Symbol.metadata]?.[j]}static _isDynamicListenerTarget(e){return!!(e&&e!=="self"&&e!=="window"&&e!=="document")}_bindListener(e,t){let n=e.options;if(n?.once&&this._consumedOnceListeners.has(t))return!1;let s=this[e.methodName];if(typeof s!=="function")return!1;let o=_._isDynamicListenerTarget(n?.target),i=qe(this,n?.target,(u)=>this.query(u));if(!i)return!1;let r=s.bind(this),a={};if(n?.capture)a.capture=!0;if(n?.passive)a.passive=!0;let d;if(n?.delegate){let u=n.delegate,l=n?.once;d=(c)=>{let h=Be(c,u,this);if(h){if(l)this._consumedOnceListeners.add(t),i.removeEventListener(e.event,d,a),this._activeListeners=this._activeListeners.filter((p)=>p.handler!==d);r(c,h)}}}else if(n?.once)d=(u)=>{this._consumedOnceListeners.add(t),this._activeListeners=this._activeListeners.filter((l)=>l.handler!==d),r(u)},a.once=!0;else d=r;return i.addEventListener(e.event,d,a),this._activeListeners.push({target:i,event:e.event,handler:d,options:a,dynamic:o,index:t}),!0}_attachListeners(){let e=this._listenerMetadata();if(!e)return;e.forEach((t,n)=>this._bindListener(t,n))}_refreshDynamicListeners(){let e=[];for(let n of this._activeListeners)if(n.dynamic)n.target.removeEventListener(n.event,n.handler,n.options);else e.push(n);this._activeListeners=e;let t=this._listenerMetadata();if(!t)return;t.forEach((n,s)=>{if(_._isDynamicListenerTarget(n.options?.target))this._bindListener(n,s)})}_syncListenersAfterRender(){if(this._listenersAttached)this._refreshDynamicListeners();else this._attachListeners(),this._listenersAttached=!0}_detachListeners(){for(let{target:e,event:t,handler:n,options:s}of this._activeListeners)e.removeEventListener(t,n,s);this._activeListeners=[],this._listenersAttached=!1,this._consumedOnceListeners.clear()}}var S=_;var Qt=Symbol("pandora:appliedImpl"),Yt=Symbol.for("@aegis-framework/pandora"),ze="0.8.0";class ne{static _debug=!1;static components={};static implementations={};static state={};static subscribers={};static mountCallbacks=new Set;static unmountCallbacks=new Set;static errorCallbacks=new Set;static aliases={};static lazyLoaders={};static lazyLoadPromises={};static middleware={render:new Set};static _initialized=!1;static _init(){if(this._initialized)return;this._initialized=!0,S._onMount=(e,t)=>this._notifyMount(e,t),S._onUnmount=(e,t)=>this._notifyUnmount(e,t),S._onError=(e,t,n,s)=>this._notifyError(e,t,n,s),S._applyMiddleware=(e,t,n,s)=>this._applyMiddleware(e,t,n,s),S._hasMiddleware=(e)=>this._hasMiddleware(e),S._subscribe=(e,t)=>this.subscribe(e,t),S._getGlobalState=(e)=>this.getState(e),S._applyCurrentImplementation=(e,t)=>{let n=this.implementations[t];if(!n)return;let i=e[Qt]??e.constructor;if(n===i)return;this._applyImplementation(e,n,!1)}}static register(e,t){if(this._init(),typeof this.components[e]>"u")this.components[e]=t,this.implementations[e]=t,t.tag=e,window.customElements.define(e,t),this.components[e]._registered=!0,this.log(`Registered: <${e}>`);else throw Error(`[Pandora] <${e}> is already registered. Use Registry.evolve('${e}', NewClass) to swap its implementation.`)}static define(e,t){this.register(e,t)}static getImplementation(e){return this.implementations[e]||this.components[e]}static _applyImplementation(e,t,n=!1){let s=t.prototype,o=Object.getOwnPropertyNames(s),i=e;e[Qt]=t;for(let r of o){if(r==="constructor")continue;let a=Object.getOwnPropertyDescriptor(s,r);if(!a)continue;if(typeof a.value==="function")i[r]=a.value.bind(e);else if(a.get||a.set)Object.defineProperty(Object.getPrototypeOf(e),r,a)}try{let r=customElements.get(e.localName)??e.constructor??t,a=Reflect.construct(t,[],r);for(let d of Object.keys(a))if(!(d in i)||i[d]===void 0)i[d]=a[d]}catch(r){console.warn(`[Pandora] Could not construct temp instance of <${t.tag}> for default extraction:`,r)}if(typeof Symbol.metadata<"u"){let r=t[Symbol.metadata];if(r){let a=e.constructor;a[Symbol.metadata]=r}}if(typeof Symbol.metadata<"u"){let a=t[Symbol.metadata]?.[W];if(a?.length){let d=i[G];if(d)for(let u of d)u();i[G]=[];for(let u of a)u(e)}}e._detachListeners()}static evolve(e,t,n=!1){if(typeof this.components[e]>"u")throw Error(`[Pandora] Cannot evolve <${e}>: no component with that tag has been registered.`);this.implementations[e]=t,t._registered=!0;let s=[];for(let[o,i]of Object.entries(this.aliases))if(i===e)s.push(o),this.implementations[o]=t;if(this.log(`Evolved: <${e}>`),n){let o=[e,...s];for(let i of o)document.querySelectorAll(i).forEach((r)=>{if(r instanceof S&&r.isReady)this._applyImplementation(r,t,!0),r.forceRender()})}}static instances(e,t){if(typeof this.components[e]>"u")throw Error(`[Pandora] No component with tag <${e}> has been registered.`);if(typeof t==="function")document.querySelectorAll(e).forEach(t);else return document.querySelectorAll(e)}static instantiate(e,t={}){if(!this.has(e))throw Error(`[Pandora] No component with tag <${e}> has been registered.`);if(!this.components[e]._registered)this.register(e,this.components[e]);let n=document.createElement(this.components[e].tag);for(let[s,o]of Object.entries(t)){if(o===void 0||o===null)continue;if(n[s]=o,Object.getOwnPropertyDescriptor(n,s)?.set!==void 0)continue;if(typeof o==="boolean"){if(o)n.setAttribute(s,"")}else if(typeof o==="string"||typeof o==="number")n.setAttribute(s,String(o))}return n}static has(e){return typeof this.components[e]<"u"}static get(e){return this.components[e]}static setState(e,t){let n=this.state[e];if(this.state[e]=t,this.subscribers[e])this.subscribers[e].forEach((s)=>{s(t,n)})}static getState(e){return this.state[e]}static hasState(e){return e in this.state}static deleteState(e){if(e in this.state){let t=this.state[e];if(delete this.state[e],this.subscribers[e])this.subscribers[e].forEach((n)=>{n(void 0,t)});return!0}return!1}static subscribe(e,t){if(!this.subscribers[e])this.subscribers[e]=new Set;return this.subscribers[e].add(t),()=>{this.unsubscribe(e,t)}}static unsubscribe(e,t){if(this.subscribers[e])this.subscribers[e].delete(t)}static getAllState(){return{...this.state}}static clearState(){let e=Object.keys(this.state);for(let t of e)this.deleteState(t)}static clearSubscriptions(){for(let e of Object.keys(this.subscribers))this.subscribers[e]=new Set}static clearMiddleware(){for(let e of Object.keys(this.middleware))this.middleware[e]=new Set}static get debug(){return this._debug}static set debug(e){this._debug=e}static log(e,t){if(this._debug)if(t!==void 0)console.log(`[Pandora] ${e}`,t);else console.log(`[Pandora] ${e}`)}static list(){return Object.keys(this.components)}static stats(e){if(e){if(!this.has(e))throw Error(`[Pandora] No component with tag <${e}> has been registered.`);return{tag:e,instanceCount:document.querySelectorAll(e).length,isRegistered:this.components[e]?._registered??!1,isLazy:e in this.lazyLoaders}}return this.list().map((t)=>({tag:t,instanceCount:document.querySelectorAll(t).length,isRegistered:this.components[t]?._registered??!1,isLazy:t in this.lazyLoaders}))}static onMount(e){return this._init(),this.mountCallbacks.add(e),()=>this.mountCallbacks.delete(e)}static onUnmount(e){return this._init(),this.unmountCallbacks.add(e),()=>this.unmountCallbacks.delete(e)}static _notifyMount(e,t){this.log(`Mounted: <${t}>`),this.mountCallbacks.forEach((n)=>{try{n(e,t)}catch(s){console.error("[Pandora] Error in onMount callback:",s)}})}static _notifyUnmount(e,t){this.log(`Unmounted: <${t}>`),this.unmountCallbacks.forEach((n)=>{try{n(e,t)}catch(s){console.error("[Pandora] Error in onUnmount callback:",s)}})}static onError(e){return this._init(),this.errorCallbacks.add(e),()=>this.errorCallbacks.delete(e)}static _notifyError(e,t,n,s){if(this.log(`Error in <${n}> during ${s}:`,e),this.errorCallbacks.size===0)throw e;this.errorCallbacks.forEach((o)=>{try{o(e,t,n,s)}catch(i){console.error("[Pandora] Error in onError callback:",i)}})}static alias(e,t){if(!this.has(t))throw Error(`[Pandora] Cannot alias <${e}>: no component with tag <${t}> has been registered.`);if(this.has(e))throw Error(`[Pandora] Cannot alias <${e}>: a component with that tag already exists.`);this.aliases[e]=t;let n=this.getImplementation(t)??this.components[t],s=class extends n{static _tag=e};this.components[e]=s,this.implementations[e]=s,window.customElements.define(e,s),s._registered=!0,this.log(`Created alias: <${e}> -> <${t}>`)}static getOriginalTag(e){return this.aliases[e]}static isAlias(e){return e in this.aliases}static lazy(e,t){if(this._init(),this.has(e))throw Error(`[Pandora] Cannot register lazy <${e}>: a component with that tag already exists.`);this.lazyLoaders[e]=t;let n=ne;class s extends S{static _tag=e;_lazyLoaded=!1;async connectedCallback(){await n._loadLazyComponent(e);let o=n.getImplementation(e);if(o&&o!==s)ne._applyImplementation(this,o,!1),this._lazyLoaded=!0;await super.connectedCallback()}}this.components[e]=s,window.customElements.define(e,s),this.log(`Registered lazy component: <${e}>`)}static async _loadLazyComponent(e){if(this.lazyLoadPromises[e])return this.lazyLoadPromises[e];if(!(e in this.lazyLoaders))return;let t=this.lazyLoaders[e];return this.log(`Loading lazy component: <${e}>`),this.lazyLoadPromises[e]=(async()=>{try{let n=await t(),s="default"in n?n.default:n;delete this.lazyLoaders[e],this.implementations[e]=s,s._registered=!0,this.log(`Loaded lazy component: <${e}>`)}catch(n){throw console.error(`[Pandora] Failed to load lazy component <${e}>:`,n),n}finally{delete this.lazyLoadPromises[e]}})(),this.lazyLoadPromises[e]}static isLazy(e){return e in this.lazyLoaders}static async preload(e){if(this.isLazy(e))await this._loadLazyComponent(e)}static use(e,t){return this._init(),this.middleware[e].add(t),()=>this.middleware[e].delete(t)}static _applyMiddleware(e,t,n,s){let o=n;return this.middleware[e].forEach((i)=>{try{o=i(t,o,s)}catch(r){console.error(`[Pandora] Error in ${e} middleware:`,r)}}),o}static _hasMiddleware(e){return this.middleware[e].size>0}}S._registryRegister=(e,t)=>ne.register(e,t);var Wn=(e,t,n=globalThis)=>{let s=n,o=s[Yt];if(o===void 0||o===null)return s[Yt]={version:t,registry:e},!0;if(o.registry===e)return!0;let i=o.version===t?`both are version ${t}`:`the first is version ${o.version}, this one is version ${t}`;return console.error(`[Pandora] Two copies of @aegis-framework/pandora are loaded (${i}). Each copy has its own Registry, so components, global state and middleware registered with one are unknown to the other, and a tag both define throws. To fix it, install a single copy (run \`npm ls @aegis-framework/pandora\` and dedupe it), import Pandora only by its package name, and don't load the browser bundle (pandora.browser.js) on a page that also bundles the package.`),!1};Wn(ne,ze);var A=ne;var Gn=new Set(["accessKey","autocapitalize","autocorrect","autofocus","className","contentEditable","dir","draggable","enterKeyHint","hidden","id","inert","innerHTML","innerText","inputMode","lang","nonce","outerHTML","part","popover","role","slot","spellcheck","style","tabIndex","textContent","title","translate","writingSuggestions"]),Xt=new WeakMap;Symbol.metadata??=Symbol("Symbol.metadata");var R=(e,t)=>{if(typeof t==="object"&&t!==null&&"kind"in t)return;throw TypeError(`[Pandora] @${e} was called as a legacy decorator. Pandora's decorators are standard decorators: remove "experimentalDecorators" from tsconfig.json (or set it to false), and if Babel compiles your code, set @babel/plugin-proposal-decorators to { version: "2023-11" }.`)},rn=(e,t)=>(n,s)=>{R("Register",s);let o=s.metadata;if(o?.[E]){if(!Object.hasOwn(n,"_observedAttributes"))n._observedAttributes=[];for(let i of o[E])if(!n._observedAttributes.includes(i))n._observedAttributes.push(i)}if(o&&n[Symbol.metadata]===void 0)n[Symbol.metadata]=o;if(n.tag=e,!t?.defer)A.register(e,n);return n},an=(e)=>(t,n)=>{R("Style",n);let s=n.metadata;return s[ue]=e,t},dn=(e)=>(t,n)=>{R("Watch",n);let s=String(n.name),o=n.metadata;if(!Object.hasOwn(o,w)){let r=o[w];o[w]=r?[...r]:[]}o[w].push({property:e,methodName:s});let i=!1;n.addInitializer(function(){if(i)return;i=!0;let r=this;queueMicrotask(()=>{if(o[v]?.has(e)||Object.getOwnPropertyDescriptor(r,e)?.set)return;let d=r.constructor?.name||"<anonymous>";console.warn(`[Pandora] @Watch('${e}') on ${d}.${s}(): '${e}' is not reactive. Add @State, @Attribute, @Property, or @Subscribe to '${e}', or call reactive(this, '${e}') in the constructor — otherwise the watcher will never fire.`)})})},ln=(e,t)=>{if(typeof Symbol.metadata>"u")return[];let s=e.constructor[Symbol.metadata]?.[w];if(!s)return[];let o=[];for(let i of s)if(i.property===t){let r=e[i.methodName];if(typeof r==="function")o.push(r.bind(e))}return o},Kn=(e)=>{if(Gn.has(e)||/^aria[A-Z]/.test(e))return!0;return typeof HTMLElement<"u"&&e in HTMLElement.prototype},Fe=(e,t,n)=>{if(!Kn(t))return;n.addInitializer(function(){let s=this.constructor,o=Xt.get(s);if(o===void 0)o=new Set,Xt.set(s,o);if(o.has(t))return;o.add(t),console.warn(`[Pandora] ${s.name||"A component"}: @${e}() ${t} has the name of the element's own \`${t}\` property and replaces it, so the browser's behavior for \`${t}\` stops working on this element and code that uses \`element.${t}\` gets the field instead. Rename the field.`)})},cn=(e,t,n)=>{let s=Object.getOwnPropertyDescriptor(e,t);if(s&&"value"in s&&s.value!==void 0&&e[n]===void 0)e[n]=s.value},un=(e,t)=>{if(!Object.hasOwn(e,V)){let n=e[V];e[V]=n?[...n]:[]}e[V].push(t)},Zt=(e,t,n)=>{if(typeof n==="boolean")if(n)e.setAttribute(t,"");else e.removeAttribute(t);else if(typeof n==="string"||typeof n==="number")e.setAttribute(t,String(n))},Ce=(e,t,n)=>{if(e.isConnected){Zt(e,t,e[n]);return}let s=e[ee];if(s===void 0)s=new Map,e[ee]=s;s.set(t,()=>{if(!e.hasAttribute(t))Zt(e,t,e[n])})},Ae=(e,t,n,s,o,i=!0,r=(a,d)=>a===d)=>{if(cn(e,n,s),Object.defineProperty(e,n,{get(){if(e[s]!==void 0)return e[s];if(e.hasAttribute(t))return x(e.getAttribute(t));return},set(a){let d=e[s];if(e[s]=a,e[o]=!0,a===void 0||a===null)e.removeAttribute(t);else if(typeof a==="string"||typeof a==="number"||typeof a==="boolean")if(typeof a==="boolean")if(a)e.setAttribute(t,"");else e.removeAttribute(t);else e.setAttribute(t,String(a));if(e[o]=!1,!r(d,a)){if(!pe(e,{property:n,oldValue:d,newValue:a,shouldRender:i,source:"prop"})){let u=ln(e,n);for(let l of u)l(a,d);if(e.didChange(n,d,a,"prop"),i&&e._initRenderDone&&e.isConnected)e._queueRender()}}},enumerable:!0,configurable:!0}),e.isConnected&&e.hasAttribute(t))e[s]=x(e.getAttribute(t));K(e,()=>{delete e[n]})},Ee=(e,t,n,s,o="state",i=(r,a)=>r===a)=>{cn(e,t,n),Object.defineProperty(e,t,{get(){return e[n]},set(r){let a=e[n];if(i(a,r))return;if(e[n]=r,pe(e,{property:t,oldValue:a,newValue:r,shouldRender:s,source:o}))return;let d=ln(e,t);for(let u of d)u(r,a);if(e.didChange(t,a,r,o),s&&e._initRenderDone&&e.isConnected)e._queueRender()},enumerable:!0,configurable:!0}),K(e,()=>{delete e[t]})},hn=(e)=>(t,n)=>{R("State",n);let s=String(n.name);Fe("State",s,n);let o=e?.render!==!1,i=Symbol(`__pandora_state_${s}`),r,a=!1,d=n.metadata;if(!Object.hasOwn(d,v)){let u=d[v];d[v]=u?new Set(u):new Set}d[v].add(s),T(d,(u)=>{if(Ee(u,s,i,o),a&&u[i]===void 0)u[i]=r}),n.addInitializer(function(){let u=this,l=u[s];if(Ee(u,s,i,o),l!==void 0){if(u[i]=l,!a)r=l,a=!0}})},pn=(e)=>(t,n)=>{R("Property",n);let s=String(n.name);Fe("Property",s,n);let o=Symbol(`__pandora_property_${s}`),i=e?.equals??((l,c)=>l===c),r=e?.attribute===!0?s:e?.attribute??!1,a,d=!1,u=n.metadata;if(!Object.hasOwn(u,v)){let l=u[v];u[v]=l?new Set(l):new Set}if(u[v].add(s),r!==!1){let l=Symbol(`__pandora_propSetting_${s}`);if(!Object.hasOwn(u,E)){let c=u[E];u[E]=c?[...c]:[]}if(!u[E].includes(r))u[E].push(r);un(u,{attrName:r,propertyKey:s,valueKey:o,settingKey:l,shouldRender:!1,equals:i}),T(u,(c)=>{if(Ae(c,r,s,o,l,!1,i),d&&c[o]===void 0)if(c.hasAttribute(r))c[o]=x(c.getAttribute(r));else c[o]=a,Ce(c,r,s)}),n.addInitializer(function(){let c=this,h=c[s],p=c.hasAttribute(r),C=p?x(c.getAttribute(r)):void 0;if(Ae(c,r,s,o,l,!1,i),h!==void 0&&!d)a=h,d=!0;if(p)c[o]=C;else if(h!==void 0)c[o]=h,Ce(c,r,s)})}else T(u,(l)=>{if(Ee(l,s,o,!1,"property",i),d&&l[o]===void 0)l[o]=a}),n.addInitializer(function(){let l=this,c=l[s];if(Ee(l,s,o,!1,"property",i),c!==void 0){if(l[o]=c,!d)a=c,d=!0}})},fn=(e)=>(t,n)=>{R("Attribute",n);let s=String(n.name);Fe("Attribute",s,n);let o,i=!0;if(typeof e==="object")o=s,i=e.render!==!1;else o=e??s;let r=Symbol(`__pandora_attr_${s}`),a=n.metadata;if(!Object.hasOwn(a,v)){let l=a[v];a[v]=l?new Set(l):new Set}a[v].add(s);let d,u=!1;{let l=Symbol(`__pandora_propSetting_${s}`);if(!Object.hasOwn(a,E)){let c=a[E];a[E]=c?[...c]:[]}if(!a[E].includes(o))a[E].push(o);un(a,{attrName:o,propertyKey:s,valueKey:r,settingKey:l,shouldRender:i,equals:(c,h)=>c===h}),T(a,(c)=>{if(Ae(c,o,s,r,l,i),u&&c[r]===void 0)if(c.hasAttribute(o))c[r]=x(c.getAttribute(o));else c[r]=d,Ce(c,o,s)}),n.addInitializer(function(){let c=this,h=c[s],p=c.hasAttribute(o),C=p?x(c.getAttribute(o)):void 0;if(Ae(c,o,s,r,l,i),h!==void 0&&!u)d=h,u=!0;if(p)c[r]=C;else if(h!==void 0)c[r]=h,Ce(c,o,s)})}},Jt=(e,t,n,s,o)=>{if(Object.defineProperty(e,n,{get(){return e[o]},set(i){let r=e[o];if(r===i)return;if(e[o]=i,A.setState(t,i),e.didChange(n,r,i,"consumer"),e.isReady)e._queueRender()},enumerable:!0,configurable:!0}),e.isConnected)S._activateSubscription?.(e,{stateKey:t,propertyKey:n,unsubKey:s,valueKey:o});K(e,()=>{if(e[s])e[s](),e[s]=void 0;delete e[n]})},mn=(e)=>(t,n)=>{R("Subscribe",n);let s=String(n.name),o=Symbol(`__pandora_unsub_${s}`),i=Symbol(`__pandora_value_${s}`),r=n.metadata;if(!Object.hasOwn(r,v)){let a=r[v];r[v]=a?new Set(a):new Set}if(r[v].add(s),!Object.hasOwn(r,I)){let a=r[I];r[I]=a?[...a]:[]}r[I].push({stateKey:e,propertyKey:s,unsubKey:o,valueKey:i}),T(r,(a)=>{Jt(a,e,s,o,i)}),n.addInitializer(function(){Jt(this,e,s,o,i)})},en=(e,t,n)=>{Object.defineProperty(e,t,{get(){return e.query(n)},enumerable:!0,configurable:!0})},yn=(e)=>(t,n)=>{R("Query",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{en(i,s,e)}),n.addInitializer(function(){en(this,s,e)})},tn=(e,t,n)=>{Object.defineProperty(e,t,{get(){return e.queryAll(n)},enumerable:!0,configurable:!0})},gn=(e)=>(t,n)=>{R("QueryAll",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{tn(i,s,e)}),n.addInitializer(function(){tn(this,s,e)})},nn=(e,t,n)=>{Object.defineProperty(e,t,{get(){return(e._shadowDOM||e.shadowRoot)?.querySelector(n)??null},enumerable:!0,configurable:!0})},bn=(e)=>(t,n)=>{R("Slot",n);let s=String(n.name),o=e?`slot[name="${e}"]`:"slot:not([name])",i=n.metadata;T(i,(r)=>{nn(r,s,o)}),n.addInitializer(function(){nn(this,s,o)})},_n=(e,t)=>(n,s)=>{R("Listen",s);let o=String(s.name),i=s.metadata;if(!Object.hasOwn(i,j)){let r=i[j];i[j]=r?[...r]:[]}i[j].push({event:e,methodName:o,options:t})},sn=(e,t,n,s,o)=>{e[`__invalidate_${t}`]=()=>{e[s]=!1},Object.defineProperty(e,t,{get(){if(!e[s])e[n]=o.call(e),e[s]=!0;return e[n]},enumerable:!0,configurable:!0})},vn=(...e)=>(t,n)=>{R("Computed",n);let s=String(n.name),o=Symbol(`__pandora_computed_cache_${s}`),i=Symbol(`__pandora_computed_valid_${s}`),r=n.metadata;for(let d of e){if(!Object.hasOwn(r,w)){let u=r[w];r[w]=u?[...u]:[]}r[w].push({property:d,methodName:`__invalidate_${s}`})}let a=t;return T(r,(d)=>{sn(d,s,o,i,a)}),n.addInitializer(function(){sn(this,s,o,i,a)}),t},wn=(e)=>(t,n)=>{R("ClassList",n);let s=n.metadata,o=[],i=[];for(let[a,d]of Object.entries(e))if(typeof d==="string"){if(o.push({className:a,propertyName:d}),!Object.hasOwn(s,w)){let l=s[w];s[w]=l?[...l]:[]}let u=`__classlist_${a}_${d}`;s[w].push({property:d,methodName:u}),t.prototype[u]=function(){this.classList.toggle(a,!!this[d])}}else i.push({className:a,conditionFn:d});if(i.length>0){let a=t.prototype.didChange;t.prototype.didChange=function(d,u,l,c){a?.call(this,d,u,l,c);for(let{className:h,conditionFn:p}of i)this.classList.toggle(h,p(this))}}let r=t.prototype.connectedCallback;return t.prototype.connectedCallback=async function(){await r?.call(this);for(let{className:a,propertyName:d}of o)this.classList.toggle(a,!!this[d]);for(let{className:a,conditionFn:d}of i)this.classList.toggle(a,d(this))},t},on=(e,t,n)=>{Object.defineProperty(e,t,{value:(s)=>e.emit(n,s),writable:!1,enumerable:!0,configurable:!0})},Sn=(e)=>(t,n)=>{R("Emitter",n);let s=String(n.name),o=n.metadata;T(o,(i)=>{on(i,s,e)}),n.addInitializer(function(){on(this,s,e)})};class Cn extends S{_shadowDOM;static _styleSheet=null;static _sharedStyle={};constructor(){super();this._shadowDOM=this.attachShadow({mode:"open"}),this._trackScrolling(this._shadowDOM)}setStyle(e,t=!1){let n=this.constructor;if(!n._styleSheet)n._styleSheet=new CSSStyleSheet;let s="";if(typeof e==="object"){if(!Object.hasOwn(n,"_sharedStyle"))n._sharedStyle={};if(!t)n._sharedStyle={...n._sharedStyle,...e};else n._sharedStyle={...e};this._style=n._sharedStyle,s=te(n._sharedStyle)}else if(typeof e==="string")if(!t)s=Array.from(n._styleSheet.cssRules||[]).map((i)=>i.cssText).join(`
15
15
  `)+`
16
- `+e;else s=e,n._sharedStyle={},this._style={};return n._styleSheet.replaceSync(s),this._shadowDOM.adoptedStyleSheets=[n._styleSheet],n._sharedStyle}_renderRoot(){return this._shadowDOM}_applyLitRender(e){N(e,this._shadowDOM,{host:this})}_resetRenderRoot(){while(this._shadowDOM.firstChild)this._shadowDOM.firstChild.remove();delete this._shadowDOM._$litPart$}_applyStringRender(e){while(this._shadowDOM.firstChild)this._shadowDOM.firstChild.remove();if(e==="")return;let t=document.createElement("template");t.innerHTML=e,this._shadowDOM.appendChild(t.content)}get shadowRoot(){return this._shadowDOM}set shadowRoot(e){throw Error("ShadowComponent shadowRoot can not be overwritten.")}query(e){return this._shadowDOM.querySelector(e)}queryAll(e){return this._shadowDOM.querySelectorAll(e)}}var Cn=Sn;var Gn=async()=>{await new Promise((e)=>queueMicrotask(e)),await new Promise((e)=>queueMicrotask(e))},An=(e,t=5000)=>{let n=e;if(n.isReady)return Promise.resolve();return new Promise((s,o)=>{let i=()=>{clearTimeout(a),clearInterval(d),e.removeEventListener("pandora:ready",r)},r=()=>{if(n.isReady)i(),s()},a=setTimeout(()=>{i(),o(Error(`Component <${e.tagName.toLowerCase()}> did not become ready within ${t}ms`))},t);e.addEventListener("pandora:ready",r);let d=setInterval(r,16)})},Kn=()=>{A.clearState(),A.clearSubscriptions(),A.clearMiddleware()},Qn=async(e,t,n)=>{let s=t??document.body,o=document.createElement("div");o.innerHTML=`<${e}>${n??""}</${e}>`;let i=o.firstElementChild;return s.appendChild(i),await An(i),i};var En=(e,t)=>{if(t!==void 0&&!A.hasState(e))A.setState(e,t);return{key:e,get(){return A.getState(e)},set(n){A.setState(e,n)},subscribe(n){return A.subscribe(e,n)},has(){return A.hasState(e)},delete(){A.deleteState(e)}}};if(typeof window==="object")window.Pandora=We;})();
16
+ `+e;else s=e,n._sharedStyle={},this._style={};return n._styleSheet.replaceSync(s),this._shadowDOM.adoptedStyleSheets=[n._styleSheet],n._sharedStyle}_renderRoot(){return this._shadowDOM}_applyLitRender(e){N(e,this._shadowDOM,{host:this})}_resetRenderRoot(){while(this._shadowDOM.firstChild)this._shadowDOM.firstChild.remove();delete this._shadowDOM._$litPart$}_applyStringRender(e){while(this._shadowDOM.firstChild)this._shadowDOM.firstChild.remove();if(e==="")return;let t=document.createElement("template");t.innerHTML=e,this._shadowDOM.appendChild(t.content)}get shadowRoot(){return this._shadowDOM}set shadowRoot(e){throw Error("ShadowComponent shadowRoot can not be overwritten.")}query(e){return this._shadowDOM.querySelector(e)}queryAll(e){return this._shadowDOM.querySelectorAll(e)}}var An=Cn;var Qn=async()=>{await new Promise((e)=>queueMicrotask(e)),await new Promise((e)=>queueMicrotask(e))},En=(e,t=5000)=>{let n=e;if(n.isReady)return Promise.resolve();return new Promise((s,o)=>{let i=()=>{clearTimeout(a),clearInterval(d),e.removeEventListener("pandora:ready",r)},r=()=>{if(n.isReady)i(),s()},a=setTimeout(()=>{i(),o(Error(`Component <${e.tagName.toLowerCase()}> did not become ready within ${t}ms`))},t);e.addEventListener("pandora:ready",r);let d=setInterval(r,16)})},Yn=()=>{A.clearState(),A.clearSubscriptions(),A.clearMiddleware()},Xn=async(e,t,n)=>{let s=t??document.body,o=document.createElement("div");o.innerHTML=`<${e}>${n??""}</${e}>`;let i=o.firstElementChild;return s.appendChild(i),await En(i),i};var Tn=(e,t)=>{if(t!==void 0&&!A.hasState(e))A.setState(e,t);return{key:e,get(){return A.getState(e)},set(n){A.setState(e,n)},subscribe(n){return A.subscribe(e,n)},has(){return A.hasState(e)},delete(){A.deleteState(e)}}};if(typeof window==="object")window.Pandora=Ge;})();
17
17
 
18
- //# debugId=10FAEBCFFBE35C2564756E2164756E21
18
+ //# debugId=9C73753088659A9464756E2164756E21
19
19
  //# sourceMappingURL=pandora.browser.js.map