@adia-ai/web-modules 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ var LE=Object.defineProperty;var B=(s,t)=>()=>(s&&(t=s(s=0)),t);var Yt=(s,t)=>{f
7
7
  `+c+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let a=+o[1],l=n.name;l[0]==="@"?(r.removeAttribute(l),e[a]={t:"e",n:r,name:l.slice(1),c:void 0,_fx:null}):l[0]==="."?(r.removeAttribute(l),e[a]={t:"p",n:r,name:NO(r,l.slice(1)),c:void 0,_fx:null,_resolved:!1}):l[0]==="?"?(r.removeAttribute(l),console.warn(`[template] Lit-style boolean attribute "${l}=" is not supported.
8
8
  Element: <${r.tagName.toLowerCase()}>
9
9
  Use .${l.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
10
- See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),e[a]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):e[a]={t:"a",n:r,name:l,c:void 0,_fx:null}}return e}function Oh(s){for(let t of s)t&&t._fx&&(t._fx(),t._fx=null)}function Pd(s){if(s.n.nodeType===1&&s.n[$d])return s.n;let t=document.createElement("span");return t.style.display="contents",t[$d]=!0,s.n.replaceWith(t),s.n=t,t}function Qd(s,t){if(t!==s.c){if(s.t==="n")if(t!=null&&t._directive)t._commit(Pd(s));else if(zO(t))er(t,Pd(s));else if(Array.isArray(t)){let e=Pd(s);e.replaceChildren();for(let i of t)if(zO(i)){let r=document.createElement("span");r.style.display="contents",e.appendChild(r),er(i,r)}else e.appendChild(document.createTextNode(i??""))}else if(t instanceof Node)s.n.replaceWith(t),s.n=t;else if(s.n[$d]){let e=document.createTextNode(t??"");s.n.replaceWith(e),s.n=e}else s.n.textContent=t??"";else if(s.t==="a")t==null||t===!1?s.n.removeAttribute(s.name):s.n.setAttribute(s.name,t===!0?"":t);else if(s.t==="p"){if(!s._resolved){let e=NO(s.n,s.name);e!==s.name&&(s.name=e),s._resolved=!0}s.n[s.name]=t}else s.t==="e"&&(_O(s.c)&&s.n.removeEventListener(s.name,s.c),_O(t)&&s.n.addEventListener(s.name,t));s.c=t}}function VE(s,t){for(let e=0;e<s.length;e++){let i=s[e];if(!i)continue;let r=t[e],n=i.t!=="e"&&typeof r=="function",o=!n&&i.t!=="e"&&Cd(r);if(i._fx&&!n&&!o&&(i._fx(),i._fx=null),n){i._fx||(i._fx=as(()=>Qd(i,r())));continue}if(o){i._fx||(i._fx=as(()=>Qd(i,r.value)));continue}Qd(i,r)}}function WE(s,t,e){return{_directive:!0,_commit(i){let r=i[ir]||new Map,n=new Map,o=[];for(let l=0;l<s.length;l++){let h=t(s[l],l);if(n.has(h))continue;o.push(h);let c=e(s[l],l);if(r.has(h)){let u=r.get(h);er(c,u),n.set(h,u)}else{let u=document.createElement("span");u.style.display="contents",er(c,u),n.set(h,u)}}for(let[l,h]of r)n.has(l)||(h._i&&Oh(h._i.p),h.remove());let a=null;for(let l=o.length-1;l>=0;l--){let h=n.get(o[l]);(h.nextSibling!==a||h.parentNode!==i)&&i.insertBefore(h,a),a=h}i[ir]=n}}}var $d,ir,qO,XO,bh,wa,ZO,zO,_O,Td=B(()=>{"use strict";Ct();[$d,ir]=[Symbol(),Symbol()];qO=new WeakMap;XO={classname:"className",innertext:"innerText",innerhtml:"innerHTML",outerhtml:"outerHTML",textcontent:"textContent",tabindex:"tabIndex",arialabel:"ariaLabel",ariadescribedby:"ariaDescribedBy",arialabelledby:"ariaLabelledBy",ariarole:"role",contenteditable:"contentEditable",readonly:"readOnly",maxlength:"maxLength",minlength:"minLength",colspan:"colSpan",rowspan:"rowSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",usemap:"useMap",ismap:"isMap",accesskey:"accessKey",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",defaultselected:"defaultSelected"};bh="http://www.w3.org/2000/svg",wa="http://www.w3.org/1998/Math/MathML",ZO="http://www.w3.org/1999/xhtml";zO=s=>s!=null&&typeof s=="object"&&s.strings,_O=s=>typeof s=="function"||s!=null&&typeof s.handleEvent=="function"});function VO(s){if(!s.name)throw new Error("Trait requires a name");if(!s.setup)throw new Error(`Trait "${s.name}" requires a setup function`);if(!s.category)throw new Error(`Trait "${s.name}" requires a category`);if(!jO.has(s.category))throw new Error(`Trait "${s.name}" has unknown category "${s.category}". Known: ${[...jO].join(", ")}`);if(!s.description)throw new Error(`Trait "${s.name}" requires a description`);let t=Object.freeze({name:s.name,category:s.category,description:s.description,attributes:Object.freeze(s.attributes||[]),events:Object.freeze(s.events||[]),config:Object.freeze(s.config||[])});function e(){let i=null;return{schema:t,connect(r,n){i=s.setup({host:r,...n||{}})},disconnect(r){i&&(i(),i=null);for(let n of t.attributes)r.hasAttribute(n)&&(console.warn(`Trait "${t.name}": attribute "${n}" still present after disconnect`),r.removeAttribute(n))}}}return e.schema=t,yh.set(s.name,e),e}function WO(s){return yh.get(s)||null}function Zq(s){return yh.get(s)?.schema||null}function Bq(){return[...yh.keys()]}var yh,jO,Ld=B(()=>{"use strict";yh=new Map,jO=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"])});function UE(s,t){s[ka]=new Map,s[Md]=new Map;for(let[e,i]of Object.entries(t)){let r=i.attribute??e.toLowerCase(),n=i.type??String,o=qi(i.default??void 0);s[Md].set(e,o),Object.defineProperty(s,e,{get(){return o.value},set(a){let l=o.peek();Object.is(l,a)||(s[ka].set(e,l),o.value=a,i.reflect&&FE(s,r,a,n))},configurable:!0})}}function FE(s,t,e,i){i===Boolean?e?s.setAttribute(t,""):s.removeAttribute(t):e==null?s.removeAttribute(t):s.setAttribute(t,String(e))}function HE(s){if(Object.hasOwn(s,"_sa"))return;s._sa=!0;let t=s.styles;if(!t)return;let e=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...e.filter(i=>!document.adoptedStyleSheets.includes(i))]}function UO(s){if(Object.hasOwn(s,"_pp"))return;s._pp={};let t=s.parts;if(t)for(let[e,i]of Object.entries(t)){let r=document.createElement("template");r.innerHTML=i,s._pp[e]=r.content.firstElementChild}}var Md,ka,YE,x,$=B(()=>{"use strict";Ct();Td();Ct();Td();Ld();Md=Symbol(),ka=Symbol();YE=(s,t)=>t===Boolean?s!==null:t===Number?s===null?null:+s:s;x=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([e,i])=>i.attribute??e.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#t=[];#e=[];#i=[];#s=null;#r=null;#n=null;#a=qi(0);constructor(){super(),this.internals=this.attachInternals(),UE(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),HE(t),UO(t),F(()=>this.connected()),this.#t.push(as(()=>{for(let i of this[Md].values())i.value;this.#a.value;let e=t.template(this);if(e&&er(e,this),this.render(),this[ka].size){let i=new Map(this[ka]);this[ka].clear(),this.updated(i)}},{host:this.localName,onError:this.onError?e=>this.onError(e):null})),this.#n||(this.#n=new Set);for(let e of t.traits)this.#l(e);this.#c(),this.#s&&this.#o()}disconnectedCallback(){this._i&&Oh(this._i.p);for(let t of this.#t)t();this.#t.length=0;for(let t of this.#i)t.value=void 0;this.#i.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#n?.clear(),this.#r?.(),this.#r=null,this.#s?.disconnect?.(this),this.disconnected()}#o(){let t=this.#s;t.connect?.(this),this.#r=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#s}set controller(t){this.#r?.(),this.#r=null,this.#s?.disconnect?.(this),this.#s=t,t&&this.isConnected&&this.#o()}#l(t,{declarative:e=!1}={}){this.#n.add(t);let i=t();i.connect(this,{host:this,signal:qi,computed:Ed,effect:as}),e&&(i._declarative=!0),this.#e.push(i)}addTrait(t){return this.#n||(this.#n=new Set),this.#n.has(t)?this:(this.#l(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let e of t.split(/\s+/).filter(Boolean)){let i=WO(e);if(!i){console.warn(`<${this.localName}> traits="${e}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(i)||this.#l(i,{declarative:!0})}}#h(){if(!this.#n)return;let t=[];for(let e of this.#e)if(e._declarative){e.disconnect(this);for(let i of this.#n)if(i.schema?.name&&e.schema?.name===i.schema.name){this.#n.delete(i);break}}else t.push(e);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,e,i){if(t==="traits"){this.isConnected&&this.#h();return}for(let[r,n]of Object.entries(this.constructor.properties))if((n.attribute??r.toLowerCase())===t){this[r]=YE(i,n.type??String);break}}static template=()=>null;static create(t={}){let e=this._tag??customElements.getName?.(this);if(!e)throw new Error("Component not registered");let i=document.createElement(e);for(let[r,n]of Object.entries(t))i[r]=n;return i}signal(t){let e=qi(t);return this.#i.push(e),e}ensure(t){for(let n of this.children)if(n.getAttribute("slot")===t)return n;let e=this.#u(t);if(e)return e;UO(this.constructor);let i=this.constructor._pp?.[t];if(!i)return null;let r=i.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(t){for(let i of this.children)if(i.getAttribute("slot")===t){i.remove();return}let e=this.#u(t);e&&e.remove()}#u(t){for(let e of this.querySelectorAll(`[slot="${t}"]`)){let i=e.parentElement,r=!0;for(;i&&i!==this;){if(i.localName.includes("-")){r=!1;break}i=i.parentElement}if(r&&i===this)return e}return null}reconcile(t,e,i,r){let n=t[ir]||new Map,o=new Map,a=[];for(let h=0;h<e.length;h++){let c=e[h],u=i(c,h);if(o.has(u))continue;let d=n.get(u);d?r(c,h,d):d=r(c,h,null),o.set(u,d),a.push(u)}for(let[h,c]of n)o.has(h)||c.remove();let l=null;for(let h=a.length-1;h>=0;h--){let c=o.get(a[h]);(c.nextSibling!==l||c.parentNode!==t)&&t.insertBefore(c,l),l=c}t[ir]=o}connected(){}render(){}disconnected(){}updated(t){}}});function vy(s,t,e,i){switch(s){case-2:return e<t;case-1:return i>=t&&e<t;case 0:return e<t&&i>t;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function La(s,t,e,i){for(var r;s.from==s.to||(e<1?s.from>=t:s.from>t)||(e>-1?s.to<=t:s.to<t);){let o=!i&&s instanceof le&&s.index<0?null:s.parent;if(!o)return s;s=o}let n=i?0:tt.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof le&&o.index<0&&((r=a.enter(t,e,n))===null||r===void 0?void 0:r.from)!=o.from&&(s=a);for(;;){let o=s.enter(t,e,n);if(!o)return s;s=o}}function xy(s,t,e,i){let r=s.cursor(),n=[];if(!r.firstChild())return n;if(e!=null){for(let o=!1;!o;)if(o=r.type.is(e),!r.nextSibling())return n}for(;;){if(i!=null&&r.type.is(i))return n;if(r.type.is(t)&&n.push(r.node),!r.nextSibling())return i==null?n:[]}}function Kd(s,t,e=t.length-1){for(let i=s;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}function Sy(s){if(!s.length)return null;let t=0,e=s[0];for(let n=1;n<s.length;n++){let o=s[n];(o.from>e.from||o.to<e.to)&&(e=o,t=n)}let i=e instanceof le&&e.index<0?null:e.parent,r=s.slice();return i?r[t]=i:r.splice(t,1),new tf(r,e)}function o$(s,t,e){let i=s.resolveInner(t,e),r=null;for(let n=i instanceof le?i:i.context.parent;n;n=n.parent)if(n.index<0){let o=n.parent;(r||(r=[i])).push(o.resolve(t,e)),n=o}else{let o=fi.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new le(o.tree,o.overlay[0].from+n.from,-1,n);(r||(r=[i])).push(La(a,t,e,!1))}}return r?Sy(r):i}function ef(s){return s.children.some(t=>t instanceof pi||!t.type.isAnonymous||ef(t))}function a$(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:r=1024,reused:n=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(e)?new Gd(e,e.length):e,l=i.types,h=0,c=0;function u(k,E,A,C,T,Q){let{id:D,start:R,end:_,size:V}=a,U=c,J=h;if(V<0)if(a.next(),V==-1){let xt=n[D];A.push(xt),C.push(R-k);return}else if(V==-3){h=D;return}else if(V==-4){c=D;return}else throw new RangeError(`Unrecognized record size: ${V}`);let rt=l[D],ut,ot,bt=R-k;if(_-R<=r&&(ot=b(a.pos-E,T))){let xt=new Uint16Array(ot.size-ot.skip),Ot=a.pos-ot.size,Et=xt.length;for(;a.pos>Ot;)Et=g(ot.start,xt,Et);ut=new pi(xt,_-ot.start,i),bt=ot.start-k}else{let xt=a.pos-V;a.next();let Ot=[],Et=[],Tt=D>=o?D:-1,Ft=0,rs=_;for(;a.pos>xt;)Tt>=0&&a.id==Tt&&a.size>=0?(a.end<=rs-r&&(p(Ot,Et,R,Ft,a.end,rs,Tt,U,J),Ft=Ot.length,rs=a.end),a.next()):Q>2500?d(R,xt,Ot,Et):u(R,xt,Ot,Et,Tt,Q+1);if(Tt>=0&&Ft>0&&Ft<Ot.length&&p(Ot,Et,R,Ft,R,rs,Tt,U,J),Ot.reverse(),Et.reverse(),Tt>-1&&Ft>0){let wO=f(rt,J);ut=sf(rt,Ot,Et,0,Ot.length,0,_-R,wO,wO)}else ut=m(rt,Ot,Et,_-R,U-_,J)}A.push(ut),C.push(bt)}function d(k,E,A,C){let T=[],Q=0,D=-1;for(;a.pos>E;){let{id:R,start:_,end:V,size:U}=a;if(U>4)a.next();else{if(D>-1&&_<D)break;D<0&&(D=V-r),T.push(R,_,V),Q++,a.next()}}if(Q){let R=new Uint16Array(Q*4),_=T[T.length-2];for(let V=T.length-3,U=0;V>=0;V-=3)R[U++]=T[V],R[U++]=T[V+1]-_,R[U++]=T[V+2]-_,R[U++]=U;A.push(new pi(R,T[2]-_,i)),C.push(_-k)}}function f(k,E){return(A,C,T)=>{let Q=0,D=A.length-1,R,_;if(D>=0&&(R=A[D])instanceof Y){if(!D&&R.type==k&&R.length==T)return R;(_=R.prop(z.lookAhead))&&(Q=C[D]+R.length+_)}return m(k,A,C,T,Q,E)}}function p(k,E,A,C,T,Q,D,R,_){let V=[],U=[];for(;k.length>C;)V.push(k.pop()),U.push(E.pop()+A-T);k.push(m(i.types[D],V,U,Q-T,R-Q,_)),E.push(T-A)}function m(k,E,A,C,T,Q,D){if(Q){let R=[z.contextHash,Q];D=D?[R].concat(D):[R]}if(T>25){let R=[z.lookAhead,T];D=D?[R].concat(D):[R]}return new Y(k,E,A,C,D)}function b(k,E){let A=a.fork(),C=0,T=0,Q=0,D=A.end-r,R={size:0,start:0,skip:0};t:for(let _=A.pos-k;A.pos>_;){let V=A.size;if(A.id==E&&V>=0){R.size=C,R.start=T,R.skip=Q,Q+=4,C+=4,A.next();continue}let U=A.pos-V;if(V<0||U<_||A.start<D)break;let J=A.id>=o?4:0,rt=A.start;for(A.next();A.pos>U;){if(A.size<0)if(A.size==-3||A.size==-4)J+=4;else break t;else A.id>=o&&(J+=4);A.next()}T=rt,C+=V,Q+=J}return(E<0||C==k)&&(R.size=C,R.start=T,R.skip=Q),R.size>4?R:void 0}function g(k,E,A){let{id:C,start:T,end:Q,size:D}=a;if(a.next(),D>=0&&C<o){let R=A;if(D>4){let _=a.pos-(D-4);for(;a.pos>_;)A=g(k,E,A)}E[--A]=R,E[--A]=Q-k,E[--A]=T-k,E[--A]=C}else D==-3?h=C:D==-4&&(c=C);return A}let y=[],v=[];for(;a.pos>0;)u(s.start||0,s.bufferStart||0,y,v,-1,0);let w=(t=s.length)!==null&&t!==void 0?t:y.length?v[0]+y[0].length:0;return new Y(l[s.topID],y.reverse(),v.reverse(),w)}function $h(s,t){if(!s.isAnonymous||t instanceof pi||t.type!=s)return 1;let e=wy.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof Y)){e=1;break}e+=$h(s,i)}wy.set(t,e)}return e}function sf(s,t,e,i,r,n,o,a,l){let h=0;for(let p=i;p<r;p++)h+=$h(s,t[p]);let c=Math.ceil(h*1.5/8),u=[],d=[];function f(p,m,b,g,y){for(let v=b;v<g;){let w=v,k=m[v],E=$h(s,p[v]);for(v++;v<g;v++){let A=$h(s,p[v]);if(E+A>=c)break;E+=A}if(v==w+1){if(E>c){let A=p[w];f(A.children,A.positions,0,A.children.length,m[w]+y);continue}u.push(p[w])}else{let A=m[v-1]+p[v-1].length-k;u.push(sf(s,p,m,w,v,k,A,null,l))}d.push(k+y-n)}}return f(t,e,i,r,0),(a||l)(u,d,o)}function ms(s){return(t,e,i,r)=>new af(t,s,e,i,r)}function ky(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}function l$(s,t,e){for(let i of s){if(i.from>=e)break;if(i.to>t)return i.from<=t&&i.to>=e?2:1}return 0}function Ay(s,t,e,i,r,n){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),r.push(o-n)}}function h$(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let r=s.tree,n=r.children.indexOf(i),o=r.children[n],a=o.buffer,l=[n];function h(c,u,d,f,p,m){let b=e[m],g=[],y=[];Ay(o,c,b,g,y,f);let v=a[b+1],w=a[b+2];l.push(g.length);let k=m?h(b+4,a[b+3],o.set.types[a[b]],v,w-v,m-1):t.toTree();return g.push(k),y.push(v-f),Ay(o,a[b+3],u,g,y,f),new Y(d,g,y,p)}r.children[n]=h(0,a.length,dt.none,0,o.length,e.length-1);for(let c of l){let u=s.tree.children[c],d=s.tree.positions[c];s.yield(new le(u,d+s.from,c,s._tree))}}function Ey(s,t){let e=null,i=t;for(let r=1,n=0;r<s.length;r++){let o=s[r-1].to,a=s[r].from;for(;n<i.length;n++){let l=i[n];if(l.from>=a)break;l.to<=o||(e||(i=e=t.slice()),l.from<o?(e[n]=new ae(l.from,o),l.to>a&&e.splice(n+1,0,new ae(a,l.to))):l.to>a?e[n--]=new ae(a,l.to):e.splice(n--,1))}}return i}function c$(s,t,e,i){let r=0,n=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=r==s.length?1e9:o?s[r].to:s[r].from,u=n==t.length?1e9:a?t[n].to:t[n].from;if(o!=a){let d=Math.max(l,e),f=Math.min(c,u,i);d<f&&h.push(new ae(d,f))}if(l=Math.min(c,u),l==1e9)break;c==l&&(o?(o=!1,r++):o=!0),u==l&&(a?(a=!1,n++):a=!0)}return h}function Cy(s,t){let e=[];for(let{pos:i,mount:r,frag:n}of s){let o=i+(r.overlay?r.overlay[0].from:0),a=o+r.tree.length,l=Math.max(n.from,o),h=Math.min(n.to,a);if(r.overlay){let c=r.overlay.map(d=>new ae(d.from+i,d.to+i)),u=c$(t,c,l,h);for(let d=0,f=l;;d++){let p=d==u.length,m=p?h:u[d].from;if(m>f&&e.push(new Fe(f,m,r.tree,-o,n.from>=f||n.openStart,n.to<=m||n.openEnd)),p)break;f=u[d].to}}else e.push(new Fe(l,h,r.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}return e}var hf,r$,ae,z,fi,n$,dt,Ye,Eh,yy,tt,Y,Gd,pi,Ch,le,Jd,ds,tf,fs,wy,ps,Fe,He,rf,Ph,nf,of,af,Qh,lf,Be=B(()=>{hf=1024,r$=0,ae=class{constructor(t,e){this.from=t,this.to=e}},z=class{constructor(t={}){this.id=r$++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=dt.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};z.closedBy=new z({deserialize:s=>s.split(" ")}),z.openedBy=new z({deserialize:s=>s.split(" ")}),z.group=new z({deserialize:s=>s.split(" ")}),z.isolate=new z({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),z.contextHash=new z({perNode:!0}),z.lookAhead=new z({perNode:!0}),z.mounted=new z({perNode:!0});fi=class{constructor(t,e,i,r=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=r}static get(t){return t&&t.props&&t.props[z.mounted.id]}},n$=Object.create(null),dt=class s{constructor(t,e,i,r=0){this.name=t,this.props=e,this.id=i,this.flags=r}static define(t){let e=t.props&&t.props.length?Object.create(null):n$,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new s(t.name||"",e,t.id,i);if(t.props){for(let n of t.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(z.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let r of i.split(" "))e[r]=t[i];return i=>{for(let r=i.prop(z.group),n=-1;n<(r?r.length:0);n++){let o=e[n<0?i.name:r[n]];if(o)return o}}}};dt.none=new dt("",Object.create(null),0,8);Ye=class s{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let r=null;for(let n of t){let o=n(i);if(o){r||(r=Object.assign({},i.props));let a=o[1],l=o[0];l.combine&&l.id in r&&(a=l.combine(r[l.id],a)),r[l.id]=a}}e.push(r?new dt(i.name,r,i.id,i.flags):i)}return new s(e)}},Eh=new WeakMap,yy=new WeakMap;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(tt||(tt={}));Y=class s{constructor(t,e,i,r,n){if(this.type=t,this.children=e,this.positions=i,this.length=r,this.props=null,n&&n.length){this.props=Object.create(null);for(let[o,a]of n)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=fi.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let r=i.toString();r&&(e&&(e+=","),e+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new fs(this.topNode,t)}cursorAt(t,e=0,i=0){let r=Eh.get(this)||this.topNode,n=new fs(r);return n.moveTo(t,e),Eh.set(this,n._tree),n}get topNode(){return new le(this,0,0,null)}resolve(t,e=0){let i=La(Eh.get(this)||this.topNode,t,e,!1);return Eh.set(this,i),i}resolveInner(t,e=0){let i=La(yy.get(this)||this.topNode,t,e,!0);return yy.set(this,i),i}resolveStack(t,e=0){return o$(this,t,e)}iterate(t){let{enter:e,leave:i,from:r=0,to:n=this.length}=t,o=t.mode||0,a=(o&tt.IncludeAnonymous)>0;for(let l=this.cursor(o|tt.IncludeAnonymous);;){let h=!1;if(l.from<=n&&l.to>=r&&(!a&&l.type.isAnonymous||e(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:sf(dt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,r)=>new s(this.type,e,i,r,this.propValues),t.makeTree||((e,i,r)=>new s(dt.none,e,i,r)))}static build(t){return a$(t)}};Y.empty=new Y(dt.none,[],[],0);Gd=class s{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s(this.buffer,this.index)}},pi=class s{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return dt.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],r=this.set.types[e],n=r.name;if(/\W/.test(n)&&!r.isError&&(n=JSON.stringify(n)),t+=4,i==t)return n;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return n+"("+o.join(",")+")"}findChild(t,e,i,r,n){let{buffer:o}=this,a=-1;for(let l=t;l!=e&&!(vy(n,r,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(t,e,i){let r=this.buffer,n=new Uint16Array(e-t),o=0;for(let a=t,l=0;a<e;){n[l++]=r[a++],n[l++]=r[a++]-i;let h=n[l++]=r[a++]-i;n[l++]=r[a++]-t,o=Math.max(o,h)}return new s(n,o,this.set)}};Ch=class{cursor(t=0){return new fs(this,t)}getChild(t,e=null,i=null){let r=xy(this,t,e,i);return r.length?r[0]:null}getChildren(t,e=null,i=null){return xy(this,t,e,i)}resolve(t,e=0){return La(this,t,e,!1)}resolveInner(t,e=0){return La(this,t,e,!0)}matchContext(t){return Kd(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let r=e.lastChild;if(!r||r.to!=e.to)break;r.type.isError&&r.from==r.to?(i=e,e=r.prevSibling):e=r}return i}get node(){return this}get next(){return this.parent}},le=class s extends Ch{constructor(t,e,i,r){super(),this._tree=t,this.from=e,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,r,n=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=e>0?a.length:-1;t!=h;t+=e){let c=a[t],u=l[t]+o.from,d;if(!(!(n&tt.EnterBracketed&&c instanceof Y&&(d=fi.get(c))&&!d.overlay&&d.bracketed&&i>=u&&i<=u+c.length)&&!vy(r,i,u,u+c.length))){if(c instanceof pi){if(n&tt.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,i-u,r);if(f>-1)return new ds(new Jd(o,c,t,u),null,f)}else if(n&tt.IncludeAnonymous||!c.type.isAnonymous||ef(c)){let f;if(!(n&tt.IgnoreMounts)&&(f=fi.get(c))&&!f.overlay)return new s(f.tree,u,t,o);let p=new s(c,u,t,o);return n&tt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?c.children.length-1:0,e,i,r,n)}}}if(n&tt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let r;if(!(i&tt.IgnoreOverlays)&&(r=fi.get(this._tree))&&r.overlay){let n=t-this.from,o=i&tt.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((e>0||o?a<=n:a<n)&&(e<0||o?l>=n:l>n))return new s(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};Jd=class{constructor(t,e,i,r){this.parent=t,this.buffer=e,this.index=i,this.start=r}},ds=class s extends Ch{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.context.start,i);return n<0?null:new s(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&tt.ExcludeBuffers)return null;let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return n<0?null:new s(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new s(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new s(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,r=this.index+4,n=i.buffer[this.index+3];if(n>r){let o=i.buffer[this.index+1];t.push(i.slice(r,n,o)),e.push(0)}return new Y(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};tf=class{constructor(t,e){this.heads=t,this.node=e}get next(){return Sy(this.heads)}};fs=class{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~tt.EnterBracketed,t instanceof le)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:r}=this.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}yield(t){return t?t instanceof le?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:r}=this.buffer,n=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.buffer.start,i);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&tt.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&tt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&tt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(e.findChild(r,this.index,-1,0,4))}else{let r=e.buffer[this.index+3];if(r<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(r.buffer.buffer[n+3]<this.index)return!1;({index:e,parent:i}=r)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let n=e+t,o=t<0?-1:i._tree.children.length;n!=o;n+=t){let a=i._tree.children[n];if(this.mode&tt.IncludeAnonymous||a instanceof pi||!a.type.isAnonymous||ef(a))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let r=this.index,n=this.stack.length;n>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;e=o,i=n+1;break t}r=this.stack[--n]}for(let r=i;r<this.stack.length;r++)e=new ds(this.buffer,e,this.stack[r]);return this.bufferNode=new ds(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&e&&e(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(t){if(!this.buffer)return Kd(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let r=t.length-1,n=this.stack.length-1;r>=0;n--){if(n<0)return Kd(this._tree,t,r);let o=i[e.buffer[this.stack[n]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}};wy=new WeakMap;ps=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof ds?this.setBuffer(t.context.buffer,t.index,e):t instanceof le&&this.map.set(t.tree,e)}get(t){return t instanceof ds?this.getBuffer(t.context.buffer,t.index):t instanceof le?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Fe=class s{constructor(t,e,i,r,n=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=r,this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let r=[new s(0,t.length,t,0,!1,i)];for(let n of e)n.to>t.length&&r.push(n);return r}static applyChanges(t,e,i=128){if(!e.length)return t;let r=[],n=1,o=t.length?t[0]:null;for(let a=0,l=0,h=0;;a++){let c=a<e.length?e[a]:null,u=c?c.fromA:1e9;if(u-l>=i)for(;o&&o.from<u;){let d=o;if(l>=d.from||u<=d.to||h){let f=Math.max(d.from,l)-h,p=Math.min(d.to,u)-h;d=f>=p?null:new s(f,p,d.tree,d.offset+h,a>0,!!c)}if(d&&r.push(d),o.to>u)break;o=n<t.length?t[n++]:null}if(!c)break;l=c.toA,h=c.toA-c.toB}return r}},He=class{startParse(t,e,i){return typeof t=="string"&&(t=new rf(t)),i=i?i.length?i.map(r=>new ae(r.from,r.to)):[new ae(0,0)]:[new ae(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let r=this.startParse(t,e,i);for(;;){let n=r.advance();if(n)return n}}},rf=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};Ph=class{constructor(t,e,i,r,n,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=r,this.target=n,this.from=o}};nf=class{constructor(t,e,i,r,n,o,a,l){this.parser=t,this.predicate=e,this.mounts=i,this.index=r,this.start=n,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}},of=new z({perNode:!0}),af=class{constructor(t,e,i,r,n){this.nest=e,this.input=i,this.fragments=r,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Y(i.type,i.children,i.positions,i.length,i.propValues.concat([[of,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[z.mounted.id]=new fi(e,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new lf(this.fragments),e=null,i=null,r=new fs(new le(this.baseTree,this.ranges[0].from,0,null),tt.IncludeAnonymous|tt.IgnoreMounts);t:for(let n,o;;){let a=!0,l;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)a=!1;else if(t.hasNode(r)){if(e){let h=e.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let u=c.from+h.pos,d=c.to+h.pos;u>=r.from&&d<=r.to&&!e.ranges.some(f=>f.from<d&&f.to>u)&&e.ranges.push({from:u,to:d})}}a=!1}else if(i&&(o=l$(i.ranges,r.from,r.to)))a=o!=2;else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.from<r.to||!n.overlay)){r.tree||(h$(r),e&&e.depth++,i&&i.depth++);let h=t.findMounts(r.from,n.parser);if(typeof n.overlay=="function")e=new nf(n.parser,n.overlay,h,this.inner.length,r.from,!!n.bracketed,r.tree,e);else{let c=Ey(this.ranges,n.overlay||(r.from<r.to?[new ae(r.from,r.to)]:[]));c.length&&ky(c),(c.length||!n.overlay)&&this.inner.push(new Ph(n.parser,c.length?n.parser.startParse(this.input,Cy(h,c),c):n.parser.startParse(""),n.overlay?n.overlay.map(u=>new ae(u.from-r.from,u.to-r.from)):null,!!n.bracketed,r.tree,c.length?c[0].from:r.from)),n.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):a=!1}}else if(e&&(l=e.predicate(r))&&(l===!0&&(l=new ae(r.from,r.to)),l.from<l.to)){let h=e.ranges.length-1;h>=0&&e.ranges[h].to==l.from?e.ranges[h]={from:e.ranges[h].from,to:l.to}:e.ranges.push(l)}if(a&&r.firstChild())e&&e.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break t;if(e&&!--e.depth){let h=Ey(this.ranges,e.ranges);h.length&&(ky(h),this.inner.splice(e.index,0,new Ph(e.parser,e.parser.startParse(this.input,Cy(e.mounts,h),h),e.ranges.map(c=>new ae(c.from-e.start,c.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}};Qh=class{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(tt.IncludeAnonymous|tt.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)if(!(e.to>=t&&e.enter(i,1,tt.IgnoreOverlays|tt.ExcludeBuffers)))if(e.to<=t)e.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(e.children.length&&e.positions[0]==0&&e.children[0]instanceof Y)e=e.children[0];else break}return!1}},lf=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(e=i.tree.prop(of))!==null&&e!==void 0?e:i.to,this.inner=new Qh(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(of))!==null&&t!==void 0?t:e.to,this.inner=new Qh(e.tree,-e.offset)}}findMounts(t,e){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(i=n.tree)===null||i===void 0?void 0:i.prop(z.mounted);if(o&&o.parser==e)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=n.to)break;l.tree==this.curFrag.tree&&r.push({frag:l,pos:n.from-l.offset,mount:o})}}}return r}}});function Ma(s,t=Uint16Array){if(typeof s!="string")return s;let e=null;for(let i=0,r=0;i<s.length;){let n=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){n=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),n+=l,a)break;n*=46}e?e[r++]=n:e=new t(n)}return e}function Py(s,t,e,i,r,n){let o=0,a=1<<i,{dialect:l}=e.p.parser;t:for(;(a&s[o])!=0;){let h=s[o+1];for(let f=o+3;f<h;f+=2)if((s[f+1]&a)>0){let p=s[f];if(l.allows(p)&&(t.token.value==-1||t.token.value==p||u$(p,t.token.value,r,n))){t.acceptToken(p);break}}let c=t.next,u=0,d=s[o+2];if(t.next<0&&d>u&&s[h+d*3-3]==65535){o=s[h+d*3-1];continue t}for(;u<d;){let f=u+d>>1,p=h+f+(f<<1),m=s[p],b=s[p+1]||65536;if(c<m)d=f;else if(c>=b)u=f+1;else{o=s[p+2],t.advance();continue t}}break}}function Qy(s,t,e){for(let i=t,r;(r=s[i])!=65535;i++)if(r==e)return i-t;return-1}function u$(s,t,e,i){let r=Qy(e,i,t);return r<0||Qy(e,i,s)<r}function Ty(s,t,e){let i=s.cursor(tt.IncludeAnonymous);for(i.moveTo(t);;)if(!(e<0?i.childBefore(t):i.childAfter(t)))for(;;){if((e<0?i.to<t:i.from>t)&&!i.type.isError)return e<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(s.length,Math.max(i.from+1,t+25));if(e<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return e<0?0:s.length}}function Ly(s,t){for(let e=0;e<t.length;e++){let i=t[e];if(i.pos==s.pos&&i.sameState(s)){t[e].score<s.score&&(t[e]=s);return}}t.push(s)}function mi(s,t){return s[t]|s[t+1]<<16}function d$(s){let t=null;for(let e of s){let i=e.p.stoppedAt;(e.pos==e.p.stream.end||i!=null&&e.pos>i)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function My(s){if(s.external){let t=s.extend?1:0;return(e,i)=>s.external(e,i)<<1|t}return s.get}var Th,Lh,cf,uf,An,$y,Mh,Ni,gi,ft,xe,df,ff,pf,mf,gf,bf,bi,Ht,gs=B(()=>{Be();Th=class s{constructor(t,e,i,r,n,o,a,l,h,c=0,u){this.p=t,this.stack=e,this.state=i,this.reducePos=r,this.pos=n,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=h,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let r=t.parser.context;return new s(t,[],e,i,i,0,[],0,r?new Lh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,r=t&65535,{parser:n}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=n.dynamicPrecedence(r);if(a&&(this.score+=a),i==0){r<n.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(n.getGoto(this.state,r,!0),this.reducePos),r<n.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(i-1)*3-(t&262144?6:0),h=l?this.stack[l-2]:this.p.ranges[0].from;r<n.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((e=this.p.parser.nodeSet.types[r])===null||e===void 0)&&e.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let u=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-u;if(r<n.minRepeatTerm||t&131072){let f=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,h,f,d+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=n.getGoto(f,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,h)}storeNode(t,e,i,r=4,n=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(e==i)return;if(this.buffer[o-2]>=e){this.buffer[o-2]=i;return}}}if(!n||this.pos==i)this.buffer.push(t,e,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>i;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(t,e,i,r){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let n=t,{parser:o}=this.p;this.pos=r;let a=o.stateFlag(n,1);!a&&(r>i||e<=o.maxNode)&&(this.reducePos=r),this.pushState(n,a?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,r,4)}else this.pos=r,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,r,4)}apply(t,e,i,r){t&65536?this.reduce(t):this.shift(t,e,i,r)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(e,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),r=t.bufferBase+e;for(;t&&r==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new cf(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(i==0)return!1;if((i&65536)==0)return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let r=[];for(let n=0,o;n<e.length;n+=2)(o=e[n+1])!=this.state&&this.p.parser.hasAction(o,t)&&r.push(e[n],o);if(this.stack.length<120)for(let n=0;r.length<8&&n<e.length;n+=2){let o=e[n+1];r.some((a,l)=>l&1&&a==o)||r.push(e[n],o)}e=r}let i=[];for(let r=0;r<e.length&&i.length<4;r+=2){let n=e[r+1];if(n==this.state)continue;let o=this.split();o.pushState(n,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(e[r],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let i=e>>19,r=e&65535,n=this.stack.length-i*3;if(n<0||t.getGoto(this.stack[n],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(r,n)=>{if(!e.includes(r))return e.push(r),t.allActions(r,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&t.getGoto(this.stack[h],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,n+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new Lh(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Lh=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},cf=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=r}},uf=class s{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new s(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new s(this.stack,this.pos,this.index)}};An=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},$y=new An,Mh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,r=this.rangeIndex,n=this.pos+t;for(;n<i.from;){if(!r)return null;let o=this.ranges[--r];n-=i.from-o.to,i=o}for(;e<0?n>i.to:n>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];n+=o.from-i.to,i=o}return n}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,i,r;if(e>=0&&e<this.chunk.length)i=this.pos+t,r=this.chunk.charCodeAt(e);else{let n=this.resolveOffset(t,1);if(n==null)return-1;if(i=n,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=i;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=i}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$y,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let r of this.ranges){if(r.from>=e)break;r.to>t&&(i+=this.input.read(Math.max(r.from,t),Math.min(r.to,e)))}return i}},Ni=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;Py(this.data,t,e,this.id,i.data,i.tokenPrecTable)}};Ni.prototype.contextual=Ni.prototype.fallback=Ni.prototype.extend=!1;gi=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?Ma(t):t}token(t,e){let i=t.pos,r=0;for(;;){let n=t.next<0,o=t.resolveOffset(1,1);if(Py(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,o==null)break;t.reset(o,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}};gi.prototype.contextual=Ni.prototype.fallback=Ni.prototype.extend=!1;ft=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};xe=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),df=null;ff=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Ty(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Ty(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let i=this.trees[e],r=this.index[e];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=i.children[r],o=this.start[e]+i.positions[r];if(o>t)return this.nextStart=o,null;if(n instanceof Y){if(o==t){if(o<this.safeFrom)return null;let a=o+n.length;if(a<=this.safeTo){let l=n.prop(z.lookAhead);if(!l||a+l<this.fragment.to)return n}}this.index[e]++,o+n.length>=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+n.length}}},pf=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new An)}getActions(t){let e=0,i=null,{parser:r}=t.p,{tokenizers:n}=r,o=r.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let h=0;h<n.length;h++){if((1<<h&o)==0)continue;let c=n[h],u=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||u.start!=t.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,c,t),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let d=e;if(u.extended>-1&&(e=this.addActions(t,u.extended,u.end,e)),e=this.addActions(t,u.value,u.end,e),!c.extend&&(i=u,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),!i&&t.pos==this.stream.end&&(i=new An,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new An,{pos:i,p:r}=t;return e.start=i,e.end=Math.min(i+1,r.stream.end),e.value=i==r.stream.end?r.parser.eofTerm:0,e}updateCachedToken(t,e,i){let r=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(r,t),i),t.value>-1){let{parser:n}=i.p;for(let o=0;o<n.specialized.length;o++)if(n.specialized[o]==t.value){let a=n.specializers[o](this.stream.read(t.start,t.end),i);if(a>=0&&i.p.parser.dialect.allows(a>>1)){(a&1)==0?t.value=a>>1:t.extended=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,e,i,r){for(let n=0;n<r;n+=3)if(this.actions[n]==t)return r;return this.actions[r++]=t,this.actions[r++]=e,this.actions[r++]=i,r}addActions(t,e,i,r){let{state:n}=t,{parser:o}=t.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(n,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=mi(a,h+2);else{r==0&&a[h+1]==2&&(r=this.putAction(mi(a,h+2),e,i,r));break}a[h]==e&&(r=this.putAction(mi(a,h+1),e,i,r))}return r}},mf=class{constructor(t,e,i,r){this.parser=t,this.input=e,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Mh(e,r),this.tokens=new pf(t,this.stream),this.topTerm=t.top[1];let{from:n}=r[0];this.stacks=[Th.start(this,t.top[0],n)],this.fragments=i.length&&this.stream.end-n>t.bufferLength*4?new ff(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],r,n;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let a=t[o];for(;;){if(this.tokens.mainToken=null,a.pos>e)i.push(a);else{if(this.advanceStack(a,i,t))continue;{r||(r=[],n=[]),r.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}}break}}if(!i.length){let o=r&&d$(r);if(o)return xe&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw xe&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,i);if(o)return xe&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>e)&&this.recovering--}else if(i.length>1){t:for(let o=0;o<i.length-1;o++){let a=i[o];for(let l=o+1;l<i.length;l++){let h=i[l];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue t}}}i.length>12&&(i.sort((o,a)=>a.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,i){let r=t.pos,{parser:n}=this,o=xe?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,c=h?t.curContext.hash:0;for(let u=this.fragments.nodeAt(r);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?n.getGoto(t.state,u.type.id):-1;if(d>-1&&u.length&&(!h||(u.prop(z.contextHash)||0)==c))return t.useNode(u,d),xe&&console.log(o+this.stackID(t)+` (via reuse of ${n.getName(u.type.id)})`),!0;if(!(u instanceof Y)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof Y&&u.positions[0]==0)u=f;else break}}let a=n.stateSlot(t.state,4);if(a>0)return t.reduce(a),xe&&console.log(o+this.stackID(t)+` (via always-reduce ${n.getName(a&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let h=0;h<l.length;){let c=l[h++],u=l[h++],d=l[h++],f=h==l.length||!i,p=f?t:t.split(),m=this.tokens.mainToken;if(p.apply(c,u,m?m.start:p.pos,d),xe&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${n.getName(c&65535)}`} for ${n.getName(u)} @ ${r}${p==t?"":", split"})`),f)return!0;p.pos>r?e.push(p):i.push(p)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Ly(t,e),!0}}runRecovery(t,e,i){let r=null,n=!1;for(let o=0;o<t.length;o++){let a=t[o],l=e[o<<1],h=e[(o<<1)+1],c=xe?this.stackID(a)+" -> ":"";if(a.deadEnd&&(n||(n=!0,a.restart(),xe&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let u=a.split(),d=c;for(let f=0;f<10&&u.forceReduce()&&(xe&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));f++)xe&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))xe&&console.log(c+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,i);this.stream.end>a.pos?(h==a.pos&&(h++,l=0),a.recoverByDelete(l,h),xe&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Ly(a,i)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(t){return t.close(),Y.build({buffer:uf.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(df||(df=new WeakMap)).get(t);return e||df.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};gf=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||this.disabled[t]==0}},bf=s=>s,bi=class{constructor(t){this.start=t.start,this.shift=t.shift||bf,this.reduce=t.reduce||bf,this.reuse=t.reuse||bf,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},Ht=class s extends He{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let a=0;a<t.repeatNodeCount;a++)e.push("");let i=Object.keys(t.topRules).map(a=>t.topRules[a][1]),r=[];for(let a=0;a<e.length;a++)r.push([]);function n(a,l,h){r[a].push([l,l.deserialize(String(h))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=z[l]);for(let h=1;h<a.length;){let c=a[h++];if(c>=0)n(c,l,a[h++]);else{let u=a[h+-c];for(let d=-c;d>0;d--)n(a[h++],l,u);h++}}}this.nodeSet=new Ye(e.map((a,l)=>dt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:i.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=Ma(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(My),this.states=Ma(t.states,Uint32Array),this.data=Ma(t.stateData),this.goto=Ma(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new Ni(o,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let r=new mf(this,t,e,i);for(let n of this.wrappers)r=n(r,t,e,i);return r}getGoto(t,e,i=!1){let r=this.goto;if(e>=r[0])return-1;for(let n=r[e+1];;){let o=r[n++],a=o&1,l=r[n++];if(a&&i)return l;for(let h=n+(o>>1);n<h;n++)if(r[n]==t)return l;if(a)return-1}}hasAction(t,e){let i=this.data;for(let r=0;r<2;r++)for(let n=this.stateSlot(t,r?2:1),o;;n+=3){if((o=i[n])==65535)if(i[n+1]==1)o=i[n=mi(i,n+2)];else{if(i[n+1]==2)return mi(i,n+2);break}if(o==e||o==0)return mi(i,n+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,i=>i==e?!0:null)}allActions(t,e){let i=this.stateSlot(t,4),r=i?e(i):void 0;for(let n=this.stateSlot(t,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=mi(this.data,n+2);else break;r=e(mi(this.data,n+1))}return r}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=mi(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];e.some((n,o)=>o&1&&n==r)||e.push(this.data[i],r)}}return e}configure(t){let e=Object.assign(Object.create(s.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(i=>{let r=t.tokenizers.find(n=>n.from==i);return r?r.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,r)=>{let n=t.specializers.find(a=>a.from==i.external);if(!n)return i;let o=Object.assign(Object.assign({},i),{external:n.to});return e.specializers[r]=My(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let n of t.split(" ")){let o=e.indexOf(n);o>=0&&(i[o]=!0)}let r=null;for(let n=0;n<e.length;n++)if(!i[n])for(let o=this.dialects[e[n]],a;(a=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[a]=1;return new gf(t,i,r)}static deserialize(t){return new s(t)}}});function m$(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function g$(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function Lt(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let r of e.split(" "))if(r){let n=[],o=2,a=r;for(let u=0;;){if(a=="..."&&u>0&&u+3==r.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+r);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==r.length)break;let f=r[u++];if(u==r.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+r);a=r.slice(u)}let l=n.length-1,h=n[l];if(!h)throw new RangeError("Invalid path: "+r);let c=new bs(i,o,l>0?n.slice(0,l):null);t[h]=c.sort(t[h])}}return Ry.add(t)}function Xh(s,t){let e=Object.create(null);for(let n of s)if(!Array.isArray(n.tag))e[n.tag.id]=n.class;else for(let o of n.tag)e[o.id]=n.class;let{scope:i,all:r=null}=t||{};return{style:n=>{let o=r;for(let a of n)for(let l of a.set){let h=e[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function b$(s,t){let e=null;for(let i of s){let r=i.style(t);r&&(e=e?e+" "+r:r)}return e}function Nh(s,t,e,i=0,r=s.length){let n=new Of(i,Array.isArray(t)?t:[t],e);n.highlightRange(s.cursor(),i,r,"",n.highlighters),n.flush(r)}function O$(s,t,e,i,r,n=0,o=s.length){let a=n;function l(h,c){if(!(h<=a)){for(let u=s.slice(a,h),d=0;;){let f=u.indexOf(`
10
+ See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),e[a]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):e[a]={t:"a",n:r,name:l,c:void 0,_fx:null}}return e}function Oh(s){for(let t of s)t&&t._fx&&(t._fx(),t._fx=null)}function Pd(s){if(s.n.nodeType===1&&s.n[$d])return s.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[$d]=!0,s.n.replaceWith(t),s.n=t,t}function Qd(s,t){if(t!==s.c){if(s.t==="n")if(t!=null&&t._directive)t._commit(Pd(s));else if(zO(t))er(t,Pd(s));else if(Array.isArray(t)){let e=Pd(s);e.replaceChildren();for(let i of t)if(zO(i)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),e.appendChild(r),er(i,r)}else e.appendChild(document.createTextNode(i??""))}else if(t instanceof Node)s.n.replaceWith(t),s.n=t;else if(s.n[$d]){let e=document.createTextNode(t??"");s.n.replaceWith(e),s.n=e}else s.n.textContent=t??"";else if(s.t==="a")t==null||t===!1?s.n.removeAttribute(s.name):s.n.setAttribute(s.name,t===!0?"":t);else if(s.t==="p"){if(!s._resolved){let e=NO(s.n,s.name);e!==s.name&&(s.name=e),s._resolved=!0}s.n[s.name]=t}else s.t==="e"&&(_O(s.c)&&s.n.removeEventListener(s.name,s.c),_O(t)&&s.n.addEventListener(s.name,t));s.c=t}}function VE(s,t){for(let e=0;e<s.length;e++){let i=s[e];if(!i)continue;let r=t[e],n=i.t!=="e"&&typeof r=="function",o=!n&&i.t!=="e"&&Cd(r);if(i._fx&&!n&&!o&&(i._fx(),i._fx=null),n){i._fx||(i._fx=as(()=>Qd(i,r())));continue}if(o){i._fx||(i._fx=as(()=>Qd(i,r.value)));continue}Qd(i,r)}}function WE(s,t,e){return{_directive:!0,_commit(i){let r=i[ir]||new Map,n=new Map,o=[];for(let l=0;l<s.length;l++){let h=t(s[l],l);if(n.has(h))continue;o.push(h);let c=e(s[l],l);if(r.has(h)){let u=r.get(h);er(c,u),n.set(h,u)}else{let u=document.createElement("span");u.style.display="contents",u.setAttribute("role","presentation"),er(c,u),n.set(h,u)}}for(let[l,h]of r)n.has(l)||(h._i&&Oh(h._i.p),h.remove());let a=null;for(let l=o.length-1;l>=0;l--){let h=n.get(o[l]);(h.nextSibling!==a||h.parentNode!==i)&&i.insertBefore(h,a),a=h}i[ir]=n}}}var $d,ir,qO,XO,bh,wa,ZO,zO,_O,Td=B(()=>{"use strict";Ct();[$d,ir]=[Symbol(),Symbol()];qO=new WeakMap;XO={classname:"className",innertext:"innerText",innerhtml:"innerHTML",outerhtml:"outerHTML",textcontent:"textContent",tabindex:"tabIndex",arialabel:"ariaLabel",ariadescribedby:"ariaDescribedBy",arialabelledby:"ariaLabelledBy",ariarole:"role",contenteditable:"contentEditable",readonly:"readOnly",maxlength:"maxLength",minlength:"minLength",colspan:"colSpan",rowspan:"rowSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",usemap:"useMap",ismap:"isMap",accesskey:"accessKey",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",defaultselected:"defaultSelected"};bh="http://www.w3.org/2000/svg",wa="http://www.w3.org/1998/Math/MathML",ZO="http://www.w3.org/1999/xhtml";zO=s=>s!=null&&typeof s=="object"&&s.strings,_O=s=>typeof s=="function"||s!=null&&typeof s.handleEvent=="function"});function VO(s){if(!s.name)throw new Error("Trait requires a name");if(!s.setup)throw new Error(`Trait "${s.name}" requires a setup function`);if(!s.category)throw new Error(`Trait "${s.name}" requires a category`);if(!jO.has(s.category))throw new Error(`Trait "${s.name}" has unknown category "${s.category}". Known: ${[...jO].join(", ")}`);if(!s.description)throw new Error(`Trait "${s.name}" requires a description`);let t=Object.freeze({name:s.name,category:s.category,description:s.description,attributes:Object.freeze(s.attributes||[]),events:Object.freeze(s.events||[]),config:Object.freeze(s.config||[])});function e(){let i=null;return{schema:t,connect(r,n){i=s.setup({host:r,...n||{}})},disconnect(r){i&&(i(),i=null);for(let n of t.attributes)r.hasAttribute(n)&&(console.warn(`Trait "${t.name}": attribute "${n}" still present after disconnect`),r.removeAttribute(n))}}}return e.schema=t,yh.set(s.name,e),e}function WO(s){return yh.get(s)||null}function Zq(s){return yh.get(s)?.schema||null}function Bq(){return[...yh.keys()]}var yh,jO,Ld=B(()=>{"use strict";yh=new Map,jO=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"])});function UE(s,t){s[ka]=new Map,s[Md]=new Map;for(let[e,i]of Object.entries(t)){let r=i.attribute??e.toLowerCase(),n=i.type??String,o=qi(i.default??void 0);s[Md].set(e,o),Object.defineProperty(s,e,{get(){return o.value},set(a){let l=o.peek();Object.is(l,a)||(s[ka].set(e,l),o.value=a,i.reflect&&FE(s,r,a,n))},configurable:!0})}}function FE(s,t,e,i){i===Boolean?e?s.setAttribute(t,""):s.removeAttribute(t):e==null?s.removeAttribute(t):s.setAttribute(t,String(e))}function HE(s){if(Object.hasOwn(s,"_sa"))return;s._sa=!0;let t=s.styles;if(!t)return;let e=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...e.filter(i=>!document.adoptedStyleSheets.includes(i))]}function UO(s){if(Object.hasOwn(s,"_pp"))return;s._pp={};let t=s.parts;if(t)for(let[e,i]of Object.entries(t)){let r=document.createElement("template");r.innerHTML=i,s._pp[e]=r.content.firstElementChild}}var Md,ka,YE,x,$=B(()=>{"use strict";Ct();Td();Ct();Td();Ld();Md=Symbol(),ka=Symbol();YE=(s,t)=>t===Boolean?s!==null:t===Number?s===null?null:+s:s;x=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([e,i])=>i.attribute??e.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#t=[];#e=[];#i=[];#s=null;#r=null;#n=null;#a=qi(0);constructor(){super(),this.internals=this.attachInternals(),UE(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),HE(t),UO(t),F(()=>this.connected()),this.#t.push(as(()=>{for(let i of this[Md].values())i.value;this.#a.value;let e=t.template(this);if(e&&er(e,this),this.render(),this[ka].size){let i=new Map(this[ka]);this[ka].clear(),this.updated(i)}},{host:this.localName,onError:this.onError?e=>this.onError(e):null})),this.#n||(this.#n=new Set);for(let e of t.traits)this.#l(e);this.#c(),this.#s&&this.#o()}disconnectedCallback(){this._i&&Oh(this._i.p);for(let t of this.#t)t();this.#t.length=0;for(let t of this.#i)t.value=void 0;this.#i.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#n?.clear(),this.#r?.(),this.#r=null,this.#s?.disconnect?.(this),this.disconnected()}#o(){let t=this.#s;t.connect?.(this),this.#r=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#s}set controller(t){this.#r?.(),this.#r=null,this.#s?.disconnect?.(this),this.#s=t,t&&this.isConnected&&this.#o()}#l(t,{declarative:e=!1}={}){this.#n.add(t);let i=t();i.connect(this,{host:this,signal:qi,computed:Ed,effect:as}),e&&(i._declarative=!0),this.#e.push(i)}addTrait(t){return this.#n||(this.#n=new Set),this.#n.has(t)?this:(this.#l(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let e of t.split(/\s+/).filter(Boolean)){let i=WO(e);if(!i){console.warn(`<${this.localName}> traits="${e}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(i)||this.#l(i,{declarative:!0})}}#h(){if(!this.#n)return;let t=[];for(let e of this.#e)if(e._declarative){e.disconnect(this);for(let i of this.#n)if(i.schema?.name&&e.schema?.name===i.schema.name){this.#n.delete(i);break}}else t.push(e);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,e,i){if(t==="traits"){this.isConnected&&this.#h();return}for(let[r,n]of Object.entries(this.constructor.properties))if((n.attribute??r.toLowerCase())===t){this[r]=YE(i,n.type??String);break}}static template=()=>null;static create(t={}){let e=this._tag??customElements.getName?.(this);if(!e)throw new Error("Component not registered");let i=document.createElement(e);for(let[r,n]of Object.entries(t))i[r]=n;return i}signal(t){let e=qi(t);return this.#i.push(e),e}ensure(t){for(let n of this.children)if(n.getAttribute("slot")===t)return n;let e=this.#u(t);if(e)return e;UO(this.constructor);let i=this.constructor._pp?.[t];if(!i)return null;let r=i.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(t){for(let i of this.children)if(i.getAttribute("slot")===t){i.remove();return}let e=this.#u(t);e&&e.remove()}#u(t){for(let e of this.querySelectorAll(`[slot="${t}"]`)){let i=e.parentElement,r=!0;for(;i&&i!==this;){if(i.localName.includes("-")){r=!1;break}i=i.parentElement}if(r&&i===this)return e}return null}reconcile(t,e,i,r){let n=t[ir]||new Map,o=new Map,a=[];for(let h=0;h<e.length;h++){let c=e[h],u=i(c,h);if(o.has(u))continue;let d=n.get(u);d?r(c,h,d):d=r(c,h,null),o.set(u,d),a.push(u)}for(let[h,c]of n)o.has(h)||c.remove();let l=null;for(let h=a.length-1;h>=0;h--){let c=o.get(a[h]);(c.nextSibling!==l||c.parentNode!==t)&&t.insertBefore(c,l),l=c}t[ir]=o}connected(){}render(){}disconnected(){}updated(t){}}});function vy(s,t,e,i){switch(s){case-2:return e<t;case-1:return i>=t&&e<t;case 0:return e<t&&i>t;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function La(s,t,e,i){for(var r;s.from==s.to||(e<1?s.from>=t:s.from>t)||(e>-1?s.to<=t:s.to<t);){let o=!i&&s instanceof le&&s.index<0?null:s.parent;if(!o)return s;s=o}let n=i?0:tt.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof le&&o.index<0&&((r=a.enter(t,e,n))===null||r===void 0?void 0:r.from)!=o.from&&(s=a);for(;;){let o=s.enter(t,e,n);if(!o)return s;s=o}}function xy(s,t,e,i){let r=s.cursor(),n=[];if(!r.firstChild())return n;if(e!=null){for(let o=!1;!o;)if(o=r.type.is(e),!r.nextSibling())return n}for(;;){if(i!=null&&r.type.is(i))return n;if(r.type.is(t)&&n.push(r.node),!r.nextSibling())return i==null?n:[]}}function Kd(s,t,e=t.length-1){for(let i=s;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}function Sy(s){if(!s.length)return null;let t=0,e=s[0];for(let n=1;n<s.length;n++){let o=s[n];(o.from>e.from||o.to<e.to)&&(e=o,t=n)}let i=e instanceof le&&e.index<0?null:e.parent,r=s.slice();return i?r[t]=i:r.splice(t,1),new tf(r,e)}function o$(s,t,e){let i=s.resolveInner(t,e),r=null;for(let n=i instanceof le?i:i.context.parent;n;n=n.parent)if(n.index<0){let o=n.parent;(r||(r=[i])).push(o.resolve(t,e)),n=o}else{let o=fi.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new le(o.tree,o.overlay[0].from+n.from,-1,n);(r||(r=[i])).push(La(a,t,e,!1))}}return r?Sy(r):i}function ef(s){return s.children.some(t=>t instanceof pi||!t.type.isAnonymous||ef(t))}function a$(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:r=1024,reused:n=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(e)?new Gd(e,e.length):e,l=i.types,h=0,c=0;function u(k,E,A,C,T,Q){let{id:D,start:R,end:_,size:V}=a,U=c,J=h;if(V<0)if(a.next(),V==-1){let xt=n[D];A.push(xt),C.push(R-k);return}else if(V==-3){h=D;return}else if(V==-4){c=D;return}else throw new RangeError(`Unrecognized record size: ${V}`);let rt=l[D],ut,ot,bt=R-k;if(_-R<=r&&(ot=b(a.pos-E,T))){let xt=new Uint16Array(ot.size-ot.skip),Ot=a.pos-ot.size,Et=xt.length;for(;a.pos>Ot;)Et=g(ot.start,xt,Et);ut=new pi(xt,_-ot.start,i),bt=ot.start-k}else{let xt=a.pos-V;a.next();let Ot=[],Et=[],Tt=D>=o?D:-1,Ft=0,rs=_;for(;a.pos>xt;)Tt>=0&&a.id==Tt&&a.size>=0?(a.end<=rs-r&&(p(Ot,Et,R,Ft,a.end,rs,Tt,U,J),Ft=Ot.length,rs=a.end),a.next()):Q>2500?d(R,xt,Ot,Et):u(R,xt,Ot,Et,Tt,Q+1);if(Tt>=0&&Ft>0&&Ft<Ot.length&&p(Ot,Et,R,Ft,R,rs,Tt,U,J),Ot.reverse(),Et.reverse(),Tt>-1&&Ft>0){let wO=f(rt,J);ut=sf(rt,Ot,Et,0,Ot.length,0,_-R,wO,wO)}else ut=m(rt,Ot,Et,_-R,U-_,J)}A.push(ut),C.push(bt)}function d(k,E,A,C){let T=[],Q=0,D=-1;for(;a.pos>E;){let{id:R,start:_,end:V,size:U}=a;if(U>4)a.next();else{if(D>-1&&_<D)break;D<0&&(D=V-r),T.push(R,_,V),Q++,a.next()}}if(Q){let R=new Uint16Array(Q*4),_=T[T.length-2];for(let V=T.length-3,U=0;V>=0;V-=3)R[U++]=T[V],R[U++]=T[V+1]-_,R[U++]=T[V+2]-_,R[U++]=U;A.push(new pi(R,T[2]-_,i)),C.push(_-k)}}function f(k,E){return(A,C,T)=>{let Q=0,D=A.length-1,R,_;if(D>=0&&(R=A[D])instanceof Y){if(!D&&R.type==k&&R.length==T)return R;(_=R.prop(z.lookAhead))&&(Q=C[D]+R.length+_)}return m(k,A,C,T,Q,E)}}function p(k,E,A,C,T,Q,D,R,_){let V=[],U=[];for(;k.length>C;)V.push(k.pop()),U.push(E.pop()+A-T);k.push(m(i.types[D],V,U,Q-T,R-Q,_)),E.push(T-A)}function m(k,E,A,C,T,Q,D){if(Q){let R=[z.contextHash,Q];D=D?[R].concat(D):[R]}if(T>25){let R=[z.lookAhead,T];D=D?[R].concat(D):[R]}return new Y(k,E,A,C,D)}function b(k,E){let A=a.fork(),C=0,T=0,Q=0,D=A.end-r,R={size:0,start:0,skip:0};t:for(let _=A.pos-k;A.pos>_;){let V=A.size;if(A.id==E&&V>=0){R.size=C,R.start=T,R.skip=Q,Q+=4,C+=4,A.next();continue}let U=A.pos-V;if(V<0||U<_||A.start<D)break;let J=A.id>=o?4:0,rt=A.start;for(A.next();A.pos>U;){if(A.size<0)if(A.size==-3||A.size==-4)J+=4;else break t;else A.id>=o&&(J+=4);A.next()}T=rt,C+=V,Q+=J}return(E<0||C==k)&&(R.size=C,R.start=T,R.skip=Q),R.size>4?R:void 0}function g(k,E,A){let{id:C,start:T,end:Q,size:D}=a;if(a.next(),D>=0&&C<o){let R=A;if(D>4){let _=a.pos-(D-4);for(;a.pos>_;)A=g(k,E,A)}E[--A]=R,E[--A]=Q-k,E[--A]=T-k,E[--A]=C}else D==-3?h=C:D==-4&&(c=C);return A}let y=[],v=[];for(;a.pos>0;)u(s.start||0,s.bufferStart||0,y,v,-1,0);let w=(t=s.length)!==null&&t!==void 0?t:y.length?v[0]+y[0].length:0;return new Y(l[s.topID],y.reverse(),v.reverse(),w)}function $h(s,t){if(!s.isAnonymous||t instanceof pi||t.type!=s)return 1;let e=wy.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof Y)){e=1;break}e+=$h(s,i)}wy.set(t,e)}return e}function sf(s,t,e,i,r,n,o,a,l){let h=0;for(let p=i;p<r;p++)h+=$h(s,t[p]);let c=Math.ceil(h*1.5/8),u=[],d=[];function f(p,m,b,g,y){for(let v=b;v<g;){let w=v,k=m[v],E=$h(s,p[v]);for(v++;v<g;v++){let A=$h(s,p[v]);if(E+A>=c)break;E+=A}if(v==w+1){if(E>c){let A=p[w];f(A.children,A.positions,0,A.children.length,m[w]+y);continue}u.push(p[w])}else{let A=m[v-1]+p[v-1].length-k;u.push(sf(s,p,m,w,v,k,A,null,l))}d.push(k+y-n)}}return f(t,e,i,r,0),(a||l)(u,d,o)}function ms(s){return(t,e,i,r)=>new af(t,s,e,i,r)}function ky(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}function l$(s,t,e){for(let i of s){if(i.from>=e)break;if(i.to>t)return i.from<=t&&i.to>=e?2:1}return 0}function Ay(s,t,e,i,r,n){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),r.push(o-n)}}function h$(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let r=s.tree,n=r.children.indexOf(i),o=r.children[n],a=o.buffer,l=[n];function h(c,u,d,f,p,m){let b=e[m],g=[],y=[];Ay(o,c,b,g,y,f);let v=a[b+1],w=a[b+2];l.push(g.length);let k=m?h(b+4,a[b+3],o.set.types[a[b]],v,w-v,m-1):t.toTree();return g.push(k),y.push(v-f),Ay(o,a[b+3],u,g,y,f),new Y(d,g,y,p)}r.children[n]=h(0,a.length,dt.none,0,o.length,e.length-1);for(let c of l){let u=s.tree.children[c],d=s.tree.positions[c];s.yield(new le(u,d+s.from,c,s._tree))}}function Ey(s,t){let e=null,i=t;for(let r=1,n=0;r<s.length;r++){let o=s[r-1].to,a=s[r].from;for(;n<i.length;n++){let l=i[n];if(l.from>=a)break;l.to<=o||(e||(i=e=t.slice()),l.from<o?(e[n]=new ae(l.from,o),l.to>a&&e.splice(n+1,0,new ae(a,l.to))):l.to>a?e[n--]=new ae(a,l.to):e.splice(n--,1))}}return i}function c$(s,t,e,i){let r=0,n=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=r==s.length?1e9:o?s[r].to:s[r].from,u=n==t.length?1e9:a?t[n].to:t[n].from;if(o!=a){let d=Math.max(l,e),f=Math.min(c,u,i);d<f&&h.push(new ae(d,f))}if(l=Math.min(c,u),l==1e9)break;c==l&&(o?(o=!1,r++):o=!0),u==l&&(a?(a=!1,n++):a=!0)}return h}function Cy(s,t){let e=[];for(let{pos:i,mount:r,frag:n}of s){let o=i+(r.overlay?r.overlay[0].from:0),a=o+r.tree.length,l=Math.max(n.from,o),h=Math.min(n.to,a);if(r.overlay){let c=r.overlay.map(d=>new ae(d.from+i,d.to+i)),u=c$(t,c,l,h);for(let d=0,f=l;;d++){let p=d==u.length,m=p?h:u[d].from;if(m>f&&e.push(new Fe(f,m,r.tree,-o,n.from>=f||n.openStart,n.to<=m||n.openEnd)),p)break;f=u[d].to}}else e.push(new Fe(l,h,r.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}return e}var hf,r$,ae,z,fi,n$,dt,Ye,Eh,yy,tt,Y,Gd,pi,Ch,le,Jd,ds,tf,fs,wy,ps,Fe,He,rf,Ph,nf,of,af,Qh,lf,Be=B(()=>{hf=1024,r$=0,ae=class{constructor(t,e){this.from=t,this.to=e}},z=class{constructor(t={}){this.id=r$++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=dt.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};z.closedBy=new z({deserialize:s=>s.split(" ")}),z.openedBy=new z({deserialize:s=>s.split(" ")}),z.group=new z({deserialize:s=>s.split(" ")}),z.isolate=new z({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),z.contextHash=new z({perNode:!0}),z.lookAhead=new z({perNode:!0}),z.mounted=new z({perNode:!0});fi=class{constructor(t,e,i,r=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=r}static get(t){return t&&t.props&&t.props[z.mounted.id]}},n$=Object.create(null),dt=class s{constructor(t,e,i,r=0){this.name=t,this.props=e,this.id=i,this.flags=r}static define(t){let e=t.props&&t.props.length?Object.create(null):n$,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new s(t.name||"",e,t.id,i);if(t.props){for(let n of t.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(z.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let r of i.split(" "))e[r]=t[i];return i=>{for(let r=i.prop(z.group),n=-1;n<(r?r.length:0);n++){let o=e[n<0?i.name:r[n]];if(o)return o}}}};dt.none=new dt("",Object.create(null),0,8);Ye=class s{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let r=null;for(let n of t){let o=n(i);if(o){r||(r=Object.assign({},i.props));let a=o[1],l=o[0];l.combine&&l.id in r&&(a=l.combine(r[l.id],a)),r[l.id]=a}}e.push(r?new dt(i.name,r,i.id,i.flags):i)}return new s(e)}},Eh=new WeakMap,yy=new WeakMap;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(tt||(tt={}));Y=class s{constructor(t,e,i,r,n){if(this.type=t,this.children=e,this.positions=i,this.length=r,this.props=null,n&&n.length){this.props=Object.create(null);for(let[o,a]of n)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=fi.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let r=i.toString();r&&(e&&(e+=","),e+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new fs(this.topNode,t)}cursorAt(t,e=0,i=0){let r=Eh.get(this)||this.topNode,n=new fs(r);return n.moveTo(t,e),Eh.set(this,n._tree),n}get topNode(){return new le(this,0,0,null)}resolve(t,e=0){let i=La(Eh.get(this)||this.topNode,t,e,!1);return Eh.set(this,i),i}resolveInner(t,e=0){let i=La(yy.get(this)||this.topNode,t,e,!0);return yy.set(this,i),i}resolveStack(t,e=0){return o$(this,t,e)}iterate(t){let{enter:e,leave:i,from:r=0,to:n=this.length}=t,o=t.mode||0,a=(o&tt.IncludeAnonymous)>0;for(let l=this.cursor(o|tt.IncludeAnonymous);;){let h=!1;if(l.from<=n&&l.to>=r&&(!a&&l.type.isAnonymous||e(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:sf(dt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,r)=>new s(this.type,e,i,r,this.propValues),t.makeTree||((e,i,r)=>new s(dt.none,e,i,r)))}static build(t){return a$(t)}};Y.empty=new Y(dt.none,[],[],0);Gd=class s{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s(this.buffer,this.index)}},pi=class s{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return dt.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],r=this.set.types[e],n=r.name;if(/\W/.test(n)&&!r.isError&&(n=JSON.stringify(n)),t+=4,i==t)return n;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return n+"("+o.join(",")+")"}findChild(t,e,i,r,n){let{buffer:o}=this,a=-1;for(let l=t;l!=e&&!(vy(n,r,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(t,e,i){let r=this.buffer,n=new Uint16Array(e-t),o=0;for(let a=t,l=0;a<e;){n[l++]=r[a++],n[l++]=r[a++]-i;let h=n[l++]=r[a++]-i;n[l++]=r[a++]-t,o=Math.max(o,h)}return new s(n,o,this.set)}};Ch=class{cursor(t=0){return new fs(this,t)}getChild(t,e=null,i=null){let r=xy(this,t,e,i);return r.length?r[0]:null}getChildren(t,e=null,i=null){return xy(this,t,e,i)}resolve(t,e=0){return La(this,t,e,!1)}resolveInner(t,e=0){return La(this,t,e,!0)}matchContext(t){return Kd(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let r=e.lastChild;if(!r||r.to!=e.to)break;r.type.isError&&r.from==r.to?(i=e,e=r.prevSibling):e=r}return i}get node(){return this}get next(){return this.parent}},le=class s extends Ch{constructor(t,e,i,r){super(),this._tree=t,this.from=e,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,r,n=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=e>0?a.length:-1;t!=h;t+=e){let c=a[t],u=l[t]+o.from,d;if(!(!(n&tt.EnterBracketed&&c instanceof Y&&(d=fi.get(c))&&!d.overlay&&d.bracketed&&i>=u&&i<=u+c.length)&&!vy(r,i,u,u+c.length))){if(c instanceof pi){if(n&tt.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,i-u,r);if(f>-1)return new ds(new Jd(o,c,t,u),null,f)}else if(n&tt.IncludeAnonymous||!c.type.isAnonymous||ef(c)){let f;if(!(n&tt.IgnoreMounts)&&(f=fi.get(c))&&!f.overlay)return new s(f.tree,u,t,o);let p=new s(c,u,t,o);return n&tt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?c.children.length-1:0,e,i,r,n)}}}if(n&tt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let r;if(!(i&tt.IgnoreOverlays)&&(r=fi.get(this._tree))&&r.overlay){let n=t-this.from,o=i&tt.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((e>0||o?a<=n:a<n)&&(e<0||o?l>=n:l>n))return new s(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};Jd=class{constructor(t,e,i,r){this.parent=t,this.buffer=e,this.index=i,this.start=r}},ds=class s extends Ch{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.context.start,i);return n<0?null:new s(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&tt.ExcludeBuffers)return null;let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return n<0?null:new s(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new s(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new s(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,r=this.index+4,n=i.buffer[this.index+3];if(n>r){let o=i.buffer[this.index+1];t.push(i.slice(r,n,o)),e.push(0)}return new Y(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};tf=class{constructor(t,e){this.heads=t,this.node=e}get next(){return Sy(this.heads)}};fs=class{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~tt.EnterBracketed,t instanceof le)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:r}=this.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}yield(t){return t?t instanceof le?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:r}=this.buffer,n=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.buffer.start,i);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&tt.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&tt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&tt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(e.findChild(r,this.index,-1,0,4))}else{let r=e.buffer[this.index+3];if(r<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(r.buffer.buffer[n+3]<this.index)return!1;({index:e,parent:i}=r)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let n=e+t,o=t<0?-1:i._tree.children.length;n!=o;n+=t){let a=i._tree.children[n];if(this.mode&tt.IncludeAnonymous||a instanceof pi||!a.type.isAnonymous||ef(a))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let r=this.index,n=this.stack.length;n>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;e=o,i=n+1;break t}r=this.stack[--n]}for(let r=i;r<this.stack.length;r++)e=new ds(this.buffer,e,this.stack[r]);return this.bufferNode=new ds(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&e&&e(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(t){if(!this.buffer)return Kd(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let r=t.length-1,n=this.stack.length-1;r>=0;n--){if(n<0)return Kd(this._tree,t,r);let o=i[e.buffer[this.stack[n]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}};wy=new WeakMap;ps=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof ds?this.setBuffer(t.context.buffer,t.index,e):t instanceof le&&this.map.set(t.tree,e)}get(t){return t instanceof ds?this.getBuffer(t.context.buffer,t.index):t instanceof le?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Fe=class s{constructor(t,e,i,r,n=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=r,this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let r=[new s(0,t.length,t,0,!1,i)];for(let n of e)n.to>t.length&&r.push(n);return r}static applyChanges(t,e,i=128){if(!e.length)return t;let r=[],n=1,o=t.length?t[0]:null;for(let a=0,l=0,h=0;;a++){let c=a<e.length?e[a]:null,u=c?c.fromA:1e9;if(u-l>=i)for(;o&&o.from<u;){let d=o;if(l>=d.from||u<=d.to||h){let f=Math.max(d.from,l)-h,p=Math.min(d.to,u)-h;d=f>=p?null:new s(f,p,d.tree,d.offset+h,a>0,!!c)}if(d&&r.push(d),o.to>u)break;o=n<t.length?t[n++]:null}if(!c)break;l=c.toA,h=c.toA-c.toB}return r}},He=class{startParse(t,e,i){return typeof t=="string"&&(t=new rf(t)),i=i?i.length?i.map(r=>new ae(r.from,r.to)):[new ae(0,0)]:[new ae(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let r=this.startParse(t,e,i);for(;;){let n=r.advance();if(n)return n}}},rf=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};Ph=class{constructor(t,e,i,r,n,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=r,this.target=n,this.from=o}};nf=class{constructor(t,e,i,r,n,o,a,l){this.parser=t,this.predicate=e,this.mounts=i,this.index=r,this.start=n,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}},of=new z({perNode:!0}),af=class{constructor(t,e,i,r,n){this.nest=e,this.input=i,this.fragments=r,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Y(i.type,i.children,i.positions,i.length,i.propValues.concat([[of,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[z.mounted.id]=new fi(e,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new lf(this.fragments),e=null,i=null,r=new fs(new le(this.baseTree,this.ranges[0].from,0,null),tt.IncludeAnonymous|tt.IgnoreMounts);t:for(let n,o;;){let a=!0,l;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)a=!1;else if(t.hasNode(r)){if(e){let h=e.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let u=c.from+h.pos,d=c.to+h.pos;u>=r.from&&d<=r.to&&!e.ranges.some(f=>f.from<d&&f.to>u)&&e.ranges.push({from:u,to:d})}}a=!1}else if(i&&(o=l$(i.ranges,r.from,r.to)))a=o!=2;else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.from<r.to||!n.overlay)){r.tree||(h$(r),e&&e.depth++,i&&i.depth++);let h=t.findMounts(r.from,n.parser);if(typeof n.overlay=="function")e=new nf(n.parser,n.overlay,h,this.inner.length,r.from,!!n.bracketed,r.tree,e);else{let c=Ey(this.ranges,n.overlay||(r.from<r.to?[new ae(r.from,r.to)]:[]));c.length&&ky(c),(c.length||!n.overlay)&&this.inner.push(new Ph(n.parser,c.length?n.parser.startParse(this.input,Cy(h,c),c):n.parser.startParse(""),n.overlay?n.overlay.map(u=>new ae(u.from-r.from,u.to-r.from)):null,!!n.bracketed,r.tree,c.length?c[0].from:r.from)),n.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):a=!1}}else if(e&&(l=e.predicate(r))&&(l===!0&&(l=new ae(r.from,r.to)),l.from<l.to)){let h=e.ranges.length-1;h>=0&&e.ranges[h].to==l.from?e.ranges[h]={from:e.ranges[h].from,to:l.to}:e.ranges.push(l)}if(a&&r.firstChild())e&&e.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break t;if(e&&!--e.depth){let h=Ey(this.ranges,e.ranges);h.length&&(ky(h),this.inner.splice(e.index,0,new Ph(e.parser,e.parser.startParse(this.input,Cy(e.mounts,h),h),e.ranges.map(c=>new ae(c.from-e.start,c.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}};Qh=class{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(tt.IncludeAnonymous|tt.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)if(!(e.to>=t&&e.enter(i,1,tt.IgnoreOverlays|tt.ExcludeBuffers)))if(e.to<=t)e.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(e.children.length&&e.positions[0]==0&&e.children[0]instanceof Y)e=e.children[0];else break}return!1}},lf=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(e=i.tree.prop(of))!==null&&e!==void 0?e:i.to,this.inner=new Qh(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(of))!==null&&t!==void 0?t:e.to,this.inner=new Qh(e.tree,-e.offset)}}findMounts(t,e){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(i=n.tree)===null||i===void 0?void 0:i.prop(z.mounted);if(o&&o.parser==e)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=n.to)break;l.tree==this.curFrag.tree&&r.push({frag:l,pos:n.from-l.offset,mount:o})}}}return r}}});function Ma(s,t=Uint16Array){if(typeof s!="string")return s;let e=null;for(let i=0,r=0;i<s.length;){let n=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){n=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),n+=l,a)break;n*=46}e?e[r++]=n:e=new t(n)}return e}function Py(s,t,e,i,r,n){let o=0,a=1<<i,{dialect:l}=e.p.parser;t:for(;(a&s[o])!=0;){let h=s[o+1];for(let f=o+3;f<h;f+=2)if((s[f+1]&a)>0){let p=s[f];if(l.allows(p)&&(t.token.value==-1||t.token.value==p||u$(p,t.token.value,r,n))){t.acceptToken(p);break}}let c=t.next,u=0,d=s[o+2];if(t.next<0&&d>u&&s[h+d*3-3]==65535){o=s[h+d*3-1];continue t}for(;u<d;){let f=u+d>>1,p=h+f+(f<<1),m=s[p],b=s[p+1]||65536;if(c<m)d=f;else if(c>=b)u=f+1;else{o=s[p+2],t.advance();continue t}}break}}function Qy(s,t,e){for(let i=t,r;(r=s[i])!=65535;i++)if(r==e)return i-t;return-1}function u$(s,t,e,i){let r=Qy(e,i,t);return r<0||Qy(e,i,s)<r}function Ty(s,t,e){let i=s.cursor(tt.IncludeAnonymous);for(i.moveTo(t);;)if(!(e<0?i.childBefore(t):i.childAfter(t)))for(;;){if((e<0?i.to<t:i.from>t)&&!i.type.isError)return e<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(s.length,Math.max(i.from+1,t+25));if(e<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return e<0?0:s.length}}function Ly(s,t){for(let e=0;e<t.length;e++){let i=t[e];if(i.pos==s.pos&&i.sameState(s)){t[e].score<s.score&&(t[e]=s);return}}t.push(s)}function mi(s,t){return s[t]|s[t+1]<<16}function d$(s){let t=null;for(let e of s){let i=e.p.stoppedAt;(e.pos==e.p.stream.end||i!=null&&e.pos>i)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function My(s){if(s.external){let t=s.extend?1:0;return(e,i)=>s.external(e,i)<<1|t}return s.get}var Th,Lh,cf,uf,An,$y,Mh,Ni,gi,ft,xe,df,ff,pf,mf,gf,bf,bi,Ht,gs=B(()=>{Be();Th=class s{constructor(t,e,i,r,n,o,a,l,h,c=0,u){this.p=t,this.stack=e,this.state=i,this.reducePos=r,this.pos=n,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=h,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let r=t.parser.context;return new s(t,[],e,i,i,0,[],0,r?new Lh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,r=t&65535,{parser:n}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=n.dynamicPrecedence(r);if(a&&(this.score+=a),i==0){r<n.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(n.getGoto(this.state,r,!0),this.reducePos),r<n.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(i-1)*3-(t&262144?6:0),h=l?this.stack[l-2]:this.p.ranges[0].from;r<n.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((e=this.p.parser.nodeSet.types[r])===null||e===void 0)&&e.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let u=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-u;if(r<n.minRepeatTerm||t&131072){let f=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,h,f,d+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=n.getGoto(f,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,h)}storeNode(t,e,i,r=4,n=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(e==i)return;if(this.buffer[o-2]>=e){this.buffer[o-2]=i;return}}}if(!n||this.pos==i)this.buffer.push(t,e,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>i;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(t,e,i,r){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let n=t,{parser:o}=this.p;this.pos=r;let a=o.stateFlag(n,1);!a&&(r>i||e<=o.maxNode)&&(this.reducePos=r),this.pushState(n,a?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,r,4)}else this.pos=r,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,r,4)}apply(t,e,i,r){t&65536?this.reduce(t):this.shift(t,e,i,r)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(e,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),r=t.bufferBase+e;for(;t&&r==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new cf(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(i==0)return!1;if((i&65536)==0)return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let r=[];for(let n=0,o;n<e.length;n+=2)(o=e[n+1])!=this.state&&this.p.parser.hasAction(o,t)&&r.push(e[n],o);if(this.stack.length<120)for(let n=0;r.length<8&&n<e.length;n+=2){let o=e[n+1];r.some((a,l)=>l&1&&a==o)||r.push(e[n],o)}e=r}let i=[];for(let r=0;r<e.length&&i.length<4;r+=2){let n=e[r+1];if(n==this.state)continue;let o=this.split();o.pushState(n,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(e[r],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let i=e>>19,r=e&65535,n=this.stack.length-i*3;if(n<0||t.getGoto(this.stack[n],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(r,n)=>{if(!e.includes(r))return e.push(r),t.allActions(r,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&t.getGoto(this.stack[h],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,n+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new Lh(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Lh=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},cf=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=r}},uf=class s{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new s(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new s(this.stack,this.pos,this.index)}};An=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},$y=new An,Mh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,r=this.rangeIndex,n=this.pos+t;for(;n<i.from;){if(!r)return null;let o=this.ranges[--r];n-=i.from-o.to,i=o}for(;e<0?n>i.to:n>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];n+=o.from-i.to,i=o}return n}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,i,r;if(e>=0&&e<this.chunk.length)i=this.pos+t,r=this.chunk.charCodeAt(e);else{let n=this.resolveOffset(t,1);if(n==null)return-1;if(i=n,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=i;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=i}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$y,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let r of this.ranges){if(r.from>=e)break;r.to>t&&(i+=this.input.read(Math.max(r.from,t),Math.min(r.to,e)))}return i}},Ni=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;Py(this.data,t,e,this.id,i.data,i.tokenPrecTable)}};Ni.prototype.contextual=Ni.prototype.fallback=Ni.prototype.extend=!1;gi=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?Ma(t):t}token(t,e){let i=t.pos,r=0;for(;;){let n=t.next<0,o=t.resolveOffset(1,1);if(Py(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,o==null)break;t.reset(o,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}};gi.prototype.contextual=Ni.prototype.fallback=Ni.prototype.extend=!1;ft=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};xe=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),df=null;ff=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Ty(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Ty(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let i=this.trees[e],r=this.index[e];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=i.children[r],o=this.start[e]+i.positions[r];if(o>t)return this.nextStart=o,null;if(n instanceof Y){if(o==t){if(o<this.safeFrom)return null;let a=o+n.length;if(a<=this.safeTo){let l=n.prop(z.lookAhead);if(!l||a+l<this.fragment.to)return n}}this.index[e]++,o+n.length>=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+n.length}}},pf=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new An)}getActions(t){let e=0,i=null,{parser:r}=t.p,{tokenizers:n}=r,o=r.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let h=0;h<n.length;h++){if((1<<h&o)==0)continue;let c=n[h],u=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||u.start!=t.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,c,t),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let d=e;if(u.extended>-1&&(e=this.addActions(t,u.extended,u.end,e)),e=this.addActions(t,u.value,u.end,e),!c.extend&&(i=u,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),!i&&t.pos==this.stream.end&&(i=new An,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new An,{pos:i,p:r}=t;return e.start=i,e.end=Math.min(i+1,r.stream.end),e.value=i==r.stream.end?r.parser.eofTerm:0,e}updateCachedToken(t,e,i){let r=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(r,t),i),t.value>-1){let{parser:n}=i.p;for(let o=0;o<n.specialized.length;o++)if(n.specialized[o]==t.value){let a=n.specializers[o](this.stream.read(t.start,t.end),i);if(a>=0&&i.p.parser.dialect.allows(a>>1)){(a&1)==0?t.value=a>>1:t.extended=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,e,i,r){for(let n=0;n<r;n+=3)if(this.actions[n]==t)return r;return this.actions[r++]=t,this.actions[r++]=e,this.actions[r++]=i,r}addActions(t,e,i,r){let{state:n}=t,{parser:o}=t.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(n,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=mi(a,h+2);else{r==0&&a[h+1]==2&&(r=this.putAction(mi(a,h+2),e,i,r));break}a[h]==e&&(r=this.putAction(mi(a,h+1),e,i,r))}return r}},mf=class{constructor(t,e,i,r){this.parser=t,this.input=e,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Mh(e,r),this.tokens=new pf(t,this.stream),this.topTerm=t.top[1];let{from:n}=r[0];this.stacks=[Th.start(this,t.top[0],n)],this.fragments=i.length&&this.stream.end-n>t.bufferLength*4?new ff(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],r,n;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let a=t[o];for(;;){if(this.tokens.mainToken=null,a.pos>e)i.push(a);else{if(this.advanceStack(a,i,t))continue;{r||(r=[],n=[]),r.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}}break}}if(!i.length){let o=r&&d$(r);if(o)return xe&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw xe&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,i);if(o)return xe&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>e)&&this.recovering--}else if(i.length>1){t:for(let o=0;o<i.length-1;o++){let a=i[o];for(let l=o+1;l<i.length;l++){let h=i[l];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue t}}}i.length>12&&(i.sort((o,a)=>a.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,i){let r=t.pos,{parser:n}=this,o=xe?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,c=h?t.curContext.hash:0;for(let u=this.fragments.nodeAt(r);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?n.getGoto(t.state,u.type.id):-1;if(d>-1&&u.length&&(!h||(u.prop(z.contextHash)||0)==c))return t.useNode(u,d),xe&&console.log(o+this.stackID(t)+` (via reuse of ${n.getName(u.type.id)})`),!0;if(!(u instanceof Y)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof Y&&u.positions[0]==0)u=f;else break}}let a=n.stateSlot(t.state,4);if(a>0)return t.reduce(a),xe&&console.log(o+this.stackID(t)+` (via always-reduce ${n.getName(a&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let h=0;h<l.length;){let c=l[h++],u=l[h++],d=l[h++],f=h==l.length||!i,p=f?t:t.split(),m=this.tokens.mainToken;if(p.apply(c,u,m?m.start:p.pos,d),xe&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${n.getName(c&65535)}`} for ${n.getName(u)} @ ${r}${p==t?"":", split"})`),f)return!0;p.pos>r?e.push(p):i.push(p)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Ly(t,e),!0}}runRecovery(t,e,i){let r=null,n=!1;for(let o=0;o<t.length;o++){let a=t[o],l=e[o<<1],h=e[(o<<1)+1],c=xe?this.stackID(a)+" -> ":"";if(a.deadEnd&&(n||(n=!0,a.restart(),xe&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let u=a.split(),d=c;for(let f=0;f<10&&u.forceReduce()&&(xe&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));f++)xe&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))xe&&console.log(c+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,i);this.stream.end>a.pos?(h==a.pos&&(h++,l=0),a.recoverByDelete(l,h),xe&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Ly(a,i)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(t){return t.close(),Y.build({buffer:uf.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(df||(df=new WeakMap)).get(t);return e||df.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};gf=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||this.disabled[t]==0}},bf=s=>s,bi=class{constructor(t){this.start=t.start,this.shift=t.shift||bf,this.reduce=t.reduce||bf,this.reuse=t.reuse||bf,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},Ht=class s extends He{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let a=0;a<t.repeatNodeCount;a++)e.push("");let i=Object.keys(t.topRules).map(a=>t.topRules[a][1]),r=[];for(let a=0;a<e.length;a++)r.push([]);function n(a,l,h){r[a].push([l,l.deserialize(String(h))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=z[l]);for(let h=1;h<a.length;){let c=a[h++];if(c>=0)n(c,l,a[h++]);else{let u=a[h+-c];for(let d=-c;d>0;d--)n(a[h++],l,u);h++}}}this.nodeSet=new Ye(e.map((a,l)=>dt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:i.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=Ma(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(My),this.states=Ma(t.states,Uint32Array),this.data=Ma(t.stateData),this.goto=Ma(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new Ni(o,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let r=new mf(this,t,e,i);for(let n of this.wrappers)r=n(r,t,e,i);return r}getGoto(t,e,i=!1){let r=this.goto;if(e>=r[0])return-1;for(let n=r[e+1];;){let o=r[n++],a=o&1,l=r[n++];if(a&&i)return l;for(let h=n+(o>>1);n<h;n++)if(r[n]==t)return l;if(a)return-1}}hasAction(t,e){let i=this.data;for(let r=0;r<2;r++)for(let n=this.stateSlot(t,r?2:1),o;;n+=3){if((o=i[n])==65535)if(i[n+1]==1)o=i[n=mi(i,n+2)];else{if(i[n+1]==2)return mi(i,n+2);break}if(o==e||o==0)return mi(i,n+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,i=>i==e?!0:null)}allActions(t,e){let i=this.stateSlot(t,4),r=i?e(i):void 0;for(let n=this.stateSlot(t,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=mi(this.data,n+2);else break;r=e(mi(this.data,n+1))}return r}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=mi(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];e.some((n,o)=>o&1&&n==r)||e.push(this.data[i],r)}}return e}configure(t){let e=Object.assign(Object.create(s.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(i=>{let r=t.tokenizers.find(n=>n.from==i);return r?r.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,r)=>{let n=t.specializers.find(a=>a.from==i.external);if(!n)return i;let o=Object.assign(Object.assign({},i),{external:n.to});return e.specializers[r]=My(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let n of t.split(" ")){let o=e.indexOf(n);o>=0&&(i[o]=!0)}let r=null;for(let n=0;n<e.length;n++)if(!i[n])for(let o=this.dialects[e[n]],a;(a=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[a]=1;return new gf(t,i,r)}static deserialize(t){return new s(t)}}});function m$(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function g$(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function Lt(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let r of e.split(" "))if(r){let n=[],o=2,a=r;for(let u=0;;){if(a=="..."&&u>0&&u+3==r.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+r);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==r.length)break;let f=r[u++];if(u==r.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+r);a=r.slice(u)}let l=n.length-1,h=n[l];if(!h)throw new RangeError("Invalid path: "+r);let c=new bs(i,o,l>0?n.slice(0,l):null);t[h]=c.sort(t[h])}}return Ry.add(t)}function Xh(s,t){let e=Object.create(null);for(let n of s)if(!Array.isArray(n.tag))e[n.tag.id]=n.class;else for(let o of n.tag)e[o.id]=n.class;let{scope:i,all:r=null}=t||{};return{style:n=>{let o=r;for(let a of n)for(let l of a.set){let h=e[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function b$(s,t){let e=null;for(let i of s){let r=i.style(t);r&&(e=e?e+" "+r:r)}return e}function Nh(s,t,e,i=0,r=s.length){let n=new Of(i,Array.isArray(t)?t:[t],e);n.highlightRange(s.cursor(),i,r,"",n.highlighters),n.flush(r)}function O$(s,t,e,i,r,n=0,o=s.length){let a=n;function l(h,c){if(!(h<=a)){for(let u=s.slice(a,h),d=0;;){let f=u.indexOf(`
11
11
  `,d),p=f<0?u.length:f;if(p>d&&i(u.slice(d,p),c),f<0)break;r(),d=f+1}a=h}}Nh(t,e,(h,c,u)=>{l(h,""),l(c,u)},n,o),l(o,"")}function Iy(s){let t=s.type.prop(Ry);for(;t&&t.context&&!s.matchContext(t.context);)t=t.next;return t||null}var f$,he,p$,Rh,Ry,bs,Of,q,Ih,Zi,Dy,qy,Bi,Dh,yf,Ge,Os,Ke,Je,vf,Ra,qh,O,y$,ti=B(()=>{Be();f$=0,he=class s{constructor(t,e,i,r){this.name=t,this.set=e,this.base=i,this.modified=r,this.id=f$++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i=typeof t=="string"?t:"?";if(t instanceof s&&(e=t),e?.base)throw new Error("Can not derive from a modified tag");let r=new s(i,[],null,[]);if(r.set.push(r),e)for(let n of e.set)r.set.push(n);return r}static defineModifier(t){let e=new Rh(t);return i=>i.modified.indexOf(e)>-1?i:Rh.get(i.base||i,i.modified.concat(e).sort((r,n)=>r.id-n.id))}},p$=0,Rh=class s{constructor(t){this.name=t,this.instances=[],this.id=p$++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(a=>a.base==t&&m$(e,a.modified));if(i)return i;let r=[],n=new he(t.name,r,t,e);for(let a of e)a.instances.push(n);let o=g$(e);for(let a of t.set)if(!a.modified.length)for(let l of o)r.push(s.get(a,l));return n}};Ry=new z({combine(s,t){let e,i,r;for(;s||t;){if(!s||t&&s.depth>=t.depth?(r=t,t=t.next):(r=s,s=s.next),e&&e.mode==r.mode&&!r.context&&!e.context)continue;let n=new bs(r.tags,r.mode,r.context);e?e.next=n:i=n,e=n}return i}}),bs=class{constructor(t,e,i,r){this.tags=t,this.mode=e,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}};bs.empty=new bs([],2,null);Of=class{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,r,n){let{type:o,from:a,to:l}=t;if(a>=i||l<=e)return;o.isTop&&(n=this.highlighters.filter(f=>!f.scope||f.scope(o)));let h=r,c=Iy(t)||bs.empty,u=b$(n,c.tags);if(u&&(h&&(h+=" "),h+=u,c.mode==1&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(e,a),h),c.opaque)return;let d=t.tree&&t.tree.prop(z.mounted);if(d&&d.overlay){let f=t.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),m=t.firstChild();for(let b=0,g=a;;b++){let y=b<d.overlay.length?d.overlay[b]:null,v=y?y.from+a:l,w=Math.max(e,g),k=Math.min(i,v);if(w<k&&m)for(;t.from<k&&(this.highlightRange(t,w,k,r,n),this.startSpan(Math.min(k,t.to),h),!(t.to>=v||!t.nextSibling())););if(!y||v>i)break;g=y.to+a,g>e&&(this.highlightRange(f.cursor(),Math.max(e,y.from+a),Math.min(i,g),"",p),this.startSpan(Math.min(i,g),h))}m&&t.parent()}else if(t.firstChild()){d&&(r="");do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,r,n),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}};q=he.define,Ih=q(),Zi=q(),Dy=q(Zi),qy=q(Zi),Bi=q(),Dh=q(Bi),yf=q(Bi),Ge=q(),Os=q(Ge),Ke=q(),Je=q(),vf=q(),Ra=q(vf),qh=q(),O={comment:Ih,lineComment:q(Ih),blockComment:q(Ih),docComment:q(Ih),name:Zi,variableName:q(Zi),typeName:Dy,tagName:q(Dy),propertyName:qy,attributeName:q(qy),className:q(Zi),labelName:q(Zi),namespace:q(Zi),macroName:q(Zi),literal:Bi,string:Dh,docString:q(Dh),character:q(Dh),attributeValue:q(Dh),number:yf,integer:q(yf),float:q(yf),bool:q(Bi),regexp:q(Bi),escape:q(Bi),color:q(Bi),url:q(Bi),keyword:Ke,self:q(Ke),null:q(Ke),atom:q(Ke),unit:q(Ke),modifier:q(Ke),operatorKeyword:q(Ke),controlKeyword:q(Ke),definitionKeyword:q(Ke),moduleKeyword:q(Ke),operator:Je,derefOperator:q(Je),arithmeticOperator:q(Je),logicOperator:q(Je),bitwiseOperator:q(Je),compareOperator:q(Je),updateOperator:q(Je),definitionOperator:q(Je),typeOperator:q(Je),controlOperator:q(Je),punctuation:vf,separator:q(vf),bracket:Ra,angleBracket:q(Ra),squareBracket:q(Ra),paren:q(Ra),brace:q(Ra),content:Ge,heading:Os,heading1:q(Os),heading2:q(Os),heading3:q(Os),heading4:q(Os),heading5:q(Os),heading6:q(Os),contentSeparator:q(Ge),list:q(Ge),quote:q(Ge),emphasis:q(Ge),strong:q(Ge),link:q(Ge),monospace:q(Ge),strikethrough:q(Ge),inserted:q(),deleted:q(),changed:q(),invalid:q(),meta:qh,documentMeta:q(qh),annotation:q(qh),processingInstruction:q(qh),definition:he.defineModifier("definition"),constant:he.defineModifier("constant"),function:he.defineModifier("function"),standard:he.defineModifier("standard"),local:he.defineModifier("local"),special:he.defineModifier("special")};for(let s in O){let t=O[s];t instanceof he&&(t.name=s)}y$=Xh([{tag:O.link,class:"tok-link"},{tag:O.heading,class:"tok-heading"},{tag:O.emphasis,class:"tok-emphasis"},{tag:O.strong,class:"tok-strong"},{tag:O.keyword,class:"tok-keyword"},{tag:O.atom,class:"tok-atom"},{tag:O.bool,class:"tok-bool"},{tag:O.url,class:"tok-url"},{tag:O.labelName,class:"tok-labelName"},{tag:O.inserted,class:"tok-inserted"},{tag:O.deleted,class:"tok-deleted"},{tag:O.literal,class:"tok-literal"},{tag:O.string,class:"tok-string"},{tag:O.number,class:"tok-number"},{tag:[O.regexp,O.escape,O.special(O.string)],class:"tok-string2"},{tag:O.variableName,class:"tok-variableName"},{tag:O.local(O.variableName),class:"tok-variableName tok-local"},{tag:O.definition(O.variableName),class:"tok-variableName tok-definition"},{tag:O.special(O.variableName),class:"tok-variableName2"},{tag:O.definition(O.propertyName),class:"tok-propertyName tok-definition"},{tag:O.typeName,class:"tok-typeName"},{tag:O.namespace,class:"tok-namespace"},{tag:O.className,class:"tok-className"},{tag:O.macroName,class:"tok-macroName"},{tag:O.propertyName,class:"tok-propertyName"},{tag:O.operator,class:"tok-operator"},{tag:O.comment,class:"tok-comment"},{tag:O.meta,class:"tok-meta"},{tag:O.invalid,class:"tok-invalid"},{tag:O.punctuation,class:"tok-punctuation"}])});var v$,xf,Xy=B(()=>{gs();ti();v$=Lt({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),xf=Ht.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[v$],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0})});function x$(s){if(s<768)return!1;for(let t=0,e=Ia.length;;){let i=t+e>>1;if(s<Ia[i])e=i;else if(s>=Sf[i])t=i+1;else return!0;if(t==e)return!1}}function Ny(s){return s>=127462&&s<=127487}function cj(s){for(let t=0;t<Ia.length;t++)if(Sf[t]>s)return Ia[t]<=s;return!1}function Vy(s,t,e=!0,i=!0){return(e?By:S$)(s,t,i)}function By(s,t,e){if(t==s.length)return t;t&&zy(s.charCodeAt(t))&&_y(s.charCodeAt(t-1))&&t--;let i=wf(s,t);for(t+=jy(i);t<s.length;){let r=wf(s,t);if(i==Zy||r==Zy||e&&x$(r))t+=jy(r),i=r;else if(Ny(r)){let n=0,o=t-2;for(;o>=0&&Ny(wf(s,o));)n++,o-=2;if(n%2==0)break;t+=2}else break}return t}function S$(s,t,e){for(;t>0;){let i=By(s,t-2,e);if(i<t)return i;t--}return 0}function wf(s,t){let e=s.charCodeAt(t);if(!_y(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return zy(i)?(e-55296<<10)+(i-56320)+65536:e}function zy(s){return s>=56320&&s<57344}function _y(s){return s>=55296&&s<56320}function jy(s){return s<65536?1:2}var Ia,Sf,Zy,Wy=B(()=>{Ia=[],Sf=[];(()=>{let s="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<s.length;t++)(t%2?Sf:Ia).push(e=e+s[t])})();Zy=8205});function w$(s){let t=-1;for(let e of s)t+=e.length+1;return t}function Zh(s,t,e=0,i=1e9){for(let r=0,n=0,o=!0;n<s.length&&r<=i;n++){let a=s[n],l=r+a.length;l>=e&&(l>i&&(a=a.slice(0,i-r)),r<e&&(a=a.slice(e-r)),o?(t[t.length-1]+=a,o=!1):t.push(a)),r=l+1}return t}function Uy(s,t,e){return Zh(s,[""],t,e)}function Cn(s,t,e){return t=Math.max(0,Math.min(s.length,t)),[t,Math.max(t,Math.min(s.length,e))]}function kt(s,t,e=!0,i=!0){return Vy(s,t,e,i)}function k$(s){return s>=56320&&s<57344}function A$(s){return s>=55296&&s<56320}function zt(s,t){let e=s.charCodeAt(t);if(!A$(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return k$(i)?(e-55296<<10)+(i-56320)+65536:e}function Jh(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function $e(s){return s<65536?1:2}function Zt(s,t,e,i=!1){if(t==0&&e<=0)return;let r=s.length-2;r>=0&&e<=0&&e==s[r+1]?s[r]+=t:r>=0&&t==0&&s[r]==0?s[r+1]+=e:i?(s[r]+=t,s[r+1]+=e):s.push(t,e)}function zi(s,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<s.length)s[s.length-1]=s[s.length-1].append(e);else{for(;s.length<i;)s.push(K.empty);s.push(e)}}function Af(s,t,e){let i=s.inserted;for(let r=0,n=0,o=0;o<s.sections.length;){let a=s.sections[o++],l=s.sections[o++];if(l<0)r+=a,n+=a;else{let h=r,c=n,u=K.empty;for(;h+=a,c+=l,l&&i&&(u=u.append(i[o-2>>1])),!(e||o==s.sections.length||s.sections[o+1]<0);)a=s.sections[o++],l=s.sections[o++];t(r,h,n,c,u),r=h,n=c}}}function Ef(s,t,e,i=!1){let r=[],n=i?[]:null,o=new vs(s),a=new vs(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);Zt(r,h,-1),o.forward(h),a.forward(h)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!e))){let h=a.len;for(Zt(r,a.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&l<o.i&&o.len<=c&&(Zt(r,0,o.ins),n&&zi(n,r,o.text),l=o.i),o.forward(c),h-=c}a.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(a.ins==-1){let u=Math.min(c,a.len);h+=u,c-=u,a.forward(u)}else if(a.ins==0&&a.len<c)c-=a.len,a.next();else break;Zt(r,h,l<o.i?o.ins:0),n&&l<o.i&&zi(n,r,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&a.done)return n?Bt.createSet(r,n):ei.create(r);throw new Error("Mismatched change set lengths")}}}function Fy(s,t,e=!1){let i=[],r=e?[]:null,n=new vs(s),o=new vs(t);for(let a=!1;;){if(n.done&&o.done)return r?Bt.createSet(i,r):ei.create(i);if(n.ins==0)Zt(i,n.len,0,a),n.next();else if(o.len==0&&!o.done)Zt(i,0,o.ins,a),r&&zi(r,i,o.text),o.next();else{if(n.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(n.len2,o.len),h=i.length;if(n.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Zt(i,l,c,a),r&&c&&zi(r,i,o.text)}else o.ins==-1?(Zt(i,n.off?0:n.len,l,a),r&&zi(r,i,n.textBit(l))):(Zt(i,n.off?0:n.len,o.off?0:o.ins,a),r&&!o.off&&zi(r,i,o.text));a=(n.ins>l||o.ins>=0&&o.len>l)&&(a||i.length>h),n.forward2(l),o.forward(l)}}}}function Yy(s,t){for(let e of s.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}function $f(s,t){return s==t||s.length==t.length&&s.every((e,i)=>e===t[i])}function Hy(s,t,e){if(s.length!=t.length)return!1;for(let i=0;i<s.length;i++)if(!e(s[i],t[i]))return!1;return!0}function Pf(s,t){let e=!1;for(let i of t)Xa(s,i)&1&&(e=!0);return e}function E$(s,t,e){let i=e.map(l=>s[l.id]),r=e.map(l=>l.type),n=i.filter(l=>!(l&1)),o=s[t.id]>>1;function a(l){let h=[];for(let c=0;c<i.length;c++){let u=Uh(l,i[c]);if(r[c]==2)for(let d of u)h.push(d);else h.push(u)}return t.combine(h)}return{create(l){for(let h of i)Xa(l,h);return l.values[o]=a(l),1},update(l,h){if(!Pf(l,n))return 0;let c=a(l);return t.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,h){let c=Pf(l,i),u=h.config.facets[t.id],d=h.facet(t);if(u&&!c&&$f(e,u))return l.values[o]=d,0;let f=a(l);return t.compare(f,d)?(l.values[o]=d,0):(l.values[o]=f,1)}}}function Da(s){return t=>new Vh(t,s)}function C$(s,t,e){let i=[[],[],[],[],[]],r=new Map;function n(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let h=i[l].indexOf(o);h>-1&&i[l].splice(h,1),o instanceof qa&&e.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let h of o)n(h,a);else if(o instanceof qa){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),n(h,a)}else if(o instanceof Vh)n(o.inner,o.prec);else if(o instanceof mt)i[a].push(o),o.provides&&n(o.provides,a);else if(o instanceof $n)i[a].push(o),o.facet.extensions&&n(o.facet.extensions,Ss.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(h,a)}}return n(s,Ss.default),i.reduce((o,a)=>o.concat(a))}function Xa(s,t){if(t&1)return 2;let e=t>>1,i=s.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[e]=4;let r=s.computeSlot(s,s.config.dynamicSlots[e]);return s.status[e]=2|r}function Uh(s,t){return t&1?s.config.staticValues[t>>1]:s.values[t>>1]}function $$(s,t){let e=[];for(let i=0,r=0;;){let n,o;if(i<s.length&&(r==t.length||t[r]>=s[i]))n=s[i++],o=s[i++];else if(r<t.length)n=t[r++],o=t[r++];else return e;!e.length||e[e.length-1]<n?e.push(n,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function sv(s,t,e){var i;let r,n,o;return e?(r=t.changes,n=Bt.empty(t.changes.length),o=s.changes.compose(t.changes)):(r=t.changes.map(s.changes),n=s.changes.mapDesc(t.changes,!0),o=s.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(n):(i=s.selection)===null||i===void 0?void 0:i.map(r),effects:W.mapEffects(s.effects,r).concat(W.mapEffects(t.effects,n)),annotations:s.annotations.length?s.annotations.concat(t.annotations):t.annotations,scrollIntoView:s.scrollIntoView||t.scrollIntoView}}function Tf(s,t,e){let i=t.selection,r=Pn(t.annotations);return t.userEvent&&(r=r.concat(yt.userEvent.of(t.userEvent))),{changes:t.changes instanceof Bt?t.changes:Bt.of(t.changes||[],e,s.facet(Ky)),selection:i&&(i instanceof P?i:P.single(i.anchor,i.head)),effects:Pn(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function rv(s,t,e){let i=Tf(s,t.length?t[0]:{},s.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let n=1;n<t.length;n++){t[n].filter===!1&&(e=!1);let o=!!t[n].sequential;i=sv(i,Tf(s,t[n],o?i.changes.newLength:s.doc.length),o)}let r=yt.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Q$(e?P$(r):r)}function P$(s){let t=s.startState,e=!0;for(let r of t.facet(Jy)){let n=r(s);if(n===!1){e=!1;break}Array.isArray(n)&&(e=e===!0?n:$$(e,n))}if(e!==!0){let r,n;if(e===!1)n=s.changes.invertedDesc,r=Bt.empty(t.doc.length);else{let o=s.changes.filter(e);r=o.changes,n=o.filtered.mapDesc(o.changes).invertedDesc}s=yt.create(t,r,s.selection&&s.selection.map(n),W.mapEffects(s.effects,n),s.annotations,s.scrollIntoView)}let i=t.facet(tv);for(let r=i.length-1;r>=0;r--){let n=i[r](s);n instanceof yt?s=n:Array.isArray(n)&&n.length==1&&n[0]instanceof yt?s=n[0]:s=rv(t,Pn(n),!1)}return s}function Q$(s){let t=s.startState,e=t.facet(ev),i=s;for(let r=e.length-1;r>=0;r--){let n=e[r](s);n&&Object.keys(n).length&&(i=sv(i,Tf(t,n,s.changes.newLength),!0))}return i==s?s:yt.create(t,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}function Pn(s){return s==null?T$:Array.isArray(s)?s:[s]}function M$(s){if(Lf)return Lf.test(s);for(let t=0;t<s.length;t++){let e=s[t];if(/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||L$.test(e)))return!0}return!1}function R$(s){return t=>{if(!/\S/.test(t))return pt.Space;if(M$(t))return pt.Word;for(let e=0;e<s.length;e++)if(t.indexOf(s[e])>-1)return pt.Word;return pt.Other}}function Kt(s,t,e={}){let i={};for(let r of s)for(let n of Object.keys(r)){let o=r[n],a=i[n];if(a===void 0)i[n]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(e,n))i[n]=e[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let r in t)i[r]===void 0&&(i[r]=t[r]);return i}function Mf(s,t){return s==t||s.constructor==t.constructor&&s.eq(t)}function Rf(s,t){return s.from-t.from||s.value.startSide-t.value.startSide}function I$(s){if(s.length>1)for(let t=s[0],e=1;e<s.length;e++){let i=s[e];if(Rf(t,i)>0)return s.slice().sort(Rf);t=i}return s}function nv(s,t,e){let i=new Map;for(let n of s)for(let o=0;o<n.chunk.length;o++)n.chunk[o].maxPoint<=0&&i.set(n.chunk[o],n.chunkPos[o]);let r=new Set;for(let n of t)for(let o=0;o<n.chunk.length;o++){let a=i.get(n.chunk[o]);a!=null&&(e?e.mapPos(a):a)==n.chunkPos[o]&&!e?.touchesRange(a,a+n.chunk[o].length)&&r.add(n.chunk[o])}return r}function Df(s,t){for(let e=s[t];;){let i=(t<<1)+1;if(i>=s.length)break;let r=s[i];if(i+1<s.length&&r.compare(s[i+1])>=0&&(r=s[i+1],i++),e.compare(r)<0)break;s[i]=e,s[t]=r,t=i}}function ov(s,t,e,i,r,n){s.goto(t),e.goto(i);let o=i+r,a=i,l=i-t,h=!!n.boundChange;for(let c=!1;;){let u=s.to+l-e.to,d=u||s.endSide-e.endSide,f=d<0?s.to+l:e.to,p=Math.min(f,o);if(s.point||e.point?(s.point&&e.point&&Mf(s.point,e.point)&&qf(s.activeForPoint(s.to),e.activeForPoint(e.to))||n.comparePoint(a,p,s.point,e.point),c=!1):(c&&n.boundChange(a),p>a&&!qf(s.active,e.active)&&n.compareRange(a,p,s.active,e.active),h&&p<o&&(u||s.openEnd(f)!=e.openEnd(f))&&(c=!0)),f>o)break;a=f,d<=0&&s.next(),d>=0&&e.next()}}function qf(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!=t[e]&&!Mf(s[e],t[e]))return!1;return!0}function Gh(s,t){for(let e=t,i=s.length-1;e<i;e++)s[e]=s[e+1];s.pop()}function Kh(s,t,e){for(let i=s.length-1;i>=t;i--)s[i+1]=s[i];s[t]=e}function av(s,t){let e=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||s[r].endSide-s[e].endSide)<0&&(e=r,i=t[r]);return e}function _t(s,t,e=s.length){let i=0;for(let r=0;r<e&&r<s.length;)s.charCodeAt(r)==9?(i+=t-i%t,r++):(i++,r=kt(s,r));return i}function Za(s,t,e,i){for(let r=0,n=0;;){if(n>=t)return r;if(r==s.length)break;n+=s.charCodeAt(r)==9?e-n%e:1,r=kt(s,r)}return i===!0?-1:s.length}var K,Se,En,ys,Bh,zh,_h,kf,wt,ei,Bt,vs,xs,P,Cf,X,$n,jh,mt,Ss,ce,Vh,_i,qa,Wh,Gy,Qf,Ky,Jy,tv,ev,iv,Gt,Fh,Yh,W,yt,T$,pt,L$,Lf,nt,we,Qn,If,H,ke,Hh,Na,ws,ii=B(()=>{Wy();K=class s{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=Cn(this,t,e);let r=[];return this.decompose(0,t,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(e,this.length,r,1),En.from(r,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Cn(this,t,e);let i=[];return this.decompose(t,e,i,0),En.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),r=new ys(this),n=new ys(t);for(let o=e,a=e;;){if(r.next(o),n.next(o),o=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(a+=r.value.length,r.done||a>=i)return!0}}iter(t=1){return new ys(this,t)}iterRange(t,e=this.length){return new Bh(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let r=this.line(t).from;i=this.iterRange(r,Math.max(r,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new zh(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?s.empty:t.length<=32?new Se(t):En.from(Se.split(t,[]))}},Se=class s extends K{constructor(t,e=w$(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,r){for(let n=0;;n++){let o=this.text[n],a=r+o.length;if((e?i:a)>=t)return new _h(r,a,i,o);r=a+1,i++}}decompose(t,e,i,r){let n=t<=0&&e>=this.length?this:new s(Uy(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(r&1){let o=i.pop(),a=Zh(n.text,o.text.slice(),0,n.length);if(a.length<=32)i.push(new s(a,o.length+n.length));else{let l=a.length>>1;i.push(new s(a.slice(0,l)),new s(a.slice(l)))}}else i.push(n)}replace(t,e,i){if(!(i instanceof s))return super.replace(t,e,i);[t,e]=Cn(this,t,e);let r=Zh(this.text,Zh(i.text,Uy(this.text,0,t)),e),n=this.length+i.length-(e-t);return r.length<=32?new s(r,n):En.from(s.split(r,[]),n)}sliceString(t,e=this.length,i=`
12
12
  `){[t,e]=Cn(this,t,e);let r="";for(let n=0,o=0;n<=e&&o<this.text.length;o++){let a=this.text[o],l=n+a.length;n>t&&o&&(r+=i),t<l&&e>n&&(r+=a.slice(Math.max(0,t-n),e-n)),n=l+1}return r}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],r=-1;for(let n of t)i.push(n),r+=n.length+1,i.length==32&&(e.push(new s(i,r)),i=[],r=-1);return r>-1&&e.push(new s(i,r)),e}},En=class s extends K{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,r){for(let n=0;;n++){let o=this.children[n],a=r+o.length,l=i+o.lines-1;if((e?l:a)>=t)return o.lineInner(t,e,i,r);r=a+1,i=l+1}}decompose(t,e,i,r){for(let n=0,o=0;o<=e&&n<this.children.length;n++){let a=this.children[n],l=o+a.length;if(t<=l&&e>=o){let h=r&((o<=t?1:0)|(l>=e?2:0));o>=t&&l<=e&&!h?i.push(a):a.decompose(t-o,e-o,i,h)}o=l+1}}replace(t,e,i){if([t,e]=Cn(this,t,e),i.lines<this.lines)for(let r=0,n=0;r<this.children.length;r++){let o=this.children[r],a=n+o.length;if(t>=n&&e<=a){let l=o.replace(t-n,e-n,i),h=this.lines-o.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let c=this.children.slice();return c[r]=l,new s(c,this.length-(e-t)+i.length)}return super.replace(n,a,l)}n=a+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
13
13
  `){[t,e]=Cn(this,t,e);let r="";for(let n=0,o=0;n<this.children.length&&o<=e;n++){let a=this.children[n],l=o+a.length;o>t&&n&&(r+=i),t<l&&e>o&&(r+=a.sliceString(t-o,e-o,i)),o=l+1}return r}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof s))return 0;let i=0,[r,n,o,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=e,n+=e){if(r==o||n==a)return i;let l=this.children[r],h=t.children[n];if(l!=h)return i+l.scanIdentical(h,e);i+=l.length+1}}static from(t,e=t.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let f of t)i+=f.lines;if(i<32){let f=[];for(let p of t)p.flatten(f);return new Se(f,e)}let r=Math.max(32,i>>5),n=r<<1,o=r>>1,a=[],l=0,h=-1,c=[];function u(f){let p;if(f.lines>n&&f instanceof s)for(let m of f.children)u(m);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof Se&&l&&(p=c[c.length-1])instanceof Se&&f.lines+p.lines<=32?(l+=f.lines,h+=f.length+1,c[c.length-1]=new Se(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>r&&d(),l+=f.lines,h+=f.length+1,c.push(f))}function d(){l!=0&&(a.push(c.length==1?c[0]:s.from(c,h)),h=-1,l=c.length=0)}for(let f of t)u(f);return d(),a.length==1?a[0]:new s(a,e)}};K.empty=new Se([""],0);ys=class{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof Se?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],n=this.offsets[i],o=n>>1,a=r instanceof Se?r.text.length:r.children.length;if(o==(e>0?a:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
@@ -203,7 +203,7 @@ Correct shape for <chart-ui x="label" y="value">:
203
203
  `),r=i.filter(o=>o.trim().length>0).map(o=>o.match(/^[ \t]*/)[0].length),n=r.length?Math.min(...r):0;return n>0?i.map(o=>o.slice(n)).join(`
204
204
  `):e}async#u(){if(this.#r||this.#i)return;let t=this.#s,e=qb(this.language);this.#r=!0;try{let i=await Promise.resolve().then(()=>(Db(),Ib)),r=null;try{r=(await i.importWithTimeout(i.languages[e],`lang-${e}`))?.extension??null}catch(n){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"language",language:e,error:n}}))}if(t!==this.#s||!this.isConnected)return;this.#d(i,r,e)}catch(i){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"core",error:i}})),console.warn("[code-ui] CodeMirror failed to load; staying on static fallback.",i)}finally{this.#r=!1}}#d(t,e,i){let{EditorState:r,EditorView:n,Compartment:o,lineNumbers:a,placeholder:l,syntaxHighlighting:h,history:c,historyKeymap:u,defaultKeymap:d,indentWithTab:f,keymap:p,adiaBaseTheme:m,adiaHighlightStyle:b,lintGutter:g,jsonLinter:y}=t,v=this.querySelector(":scope > pre"),w=v?v.querySelector("code")?.textContent??"":"",k=this.text||w||"";this.#a=k;let E=document.createElement("div");E.setAttribute("data-cm-mount",""),v?v.replaceWith(E):this.appendChild(E);let A=[m,h(b)];this.editable&&A.push(c(),p.of([{key:"Mod-s",run:C=>(this.#b(C),!0)},...d,...u,f]),n.updateListener.of(C=>{if(!C.docChanged)return;let T=C.state.doc.toString();this.#m(T),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:T}}))}),n.domEventHandlers({focus:(C,T)=>(this.#n=T.state.doc.toString(),!1),blur:(C,T)=>{let Q=T.state.doc.toString();return this.#n!==null&&Q!==this.#n&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:Q}})),this.#n=null,!1}})),this.#o=new o,A.push(this.#o.of(this.#f(n,r))),e&&A.push(e),this.lineNumbers&&A.push(a()),this.placeholder&&A.push(l(this.placeholder)),this.editable&&i==="json"&&A.push(y,g()),this.#i=new n({parent:E,state:r.create({doc:k,extensions:A})}),this.editable&&this.#m(k)}#f(t,e){return this.editable&&!this.disabled&&!this.readonly?[]:[t.editable.of(!1),e.readOnly.of(!0)]}async#p(){if(!this.#i||!this.#o)return;let t=await Promise.resolve().then(()=>(Db(),Ib));this.#i.dispatch({effects:this.#o.reconfigure(this.#f(t.EditorView,t.EditorState))})}get form(){return this.internals.form}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}#m(t){this.editable&&(t=t??this.value??"",this.internals.setFormValue(t),this.#g(t))}#g(t){return t=t??"",this.required&&!t.trim()?(this.internals.setValidity({valueMissing:!0},this.getAttribute("data-msg-required")||"This field is required.",this),this.setAttribute("aria-invalid","true"),!1):(this.internals.setValidity({}),this.removeAttribute("aria-invalid"),!0)}formResetCallback(){this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:this.#a}}):this.text=this.#a}formDisabledCallback(t){this.disabled=t}formStateRestoreCallback(t,e){typeof t=="string"&&(this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:t}}):this.text=t)}#b(t){this.dispatchEvent(new CustomEvent("save",{bubbles:!0,cancelable:!0,detail:{value:t.state.doc.toString()}}))}get value(){return this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??this.text??""}set value(t){this.text=String(t??"")}#O(){let t=this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??"";t&&navigator.clipboard.writeText(t).then(()=>{let e=this.querySelector(':scope > header [slot="copy"]');if(!e)return;let i=e.textContent;e.textContent="Copied!",this.#e!=null&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#e=null,e.textContent=i},1500)})}render(){let t=this.querySelector(':scope > header [slot="label"]');if(t&&this.language&&(t.textContent=this.language),this.#p(),!this.inline&&this.text!=="")if(this.#i){if(this.editable&&this.#i.hasFocus)return;let e=this.#i.state.doc.toString();e!==this.text&&this.#i.dispatch({changes:{from:0,to:e.length,insert:this.text}})}else{let e=this.querySelector(":scope > pre > code");e&&e.textContent!==this.text&&(e.textContent=this.text)}}};S("code-ui",ao);$();function s1(s){let t=s.replace(/=""(?=[\s/>])/g,"").replace(/\t/g," ").split(`
205
205
  `);for(;t.length&&t[0].trim()==="";)t.shift();for(;t.length&&t[t.length-1].trim()==="";)t.pop();let e=o=>o.match(/^ */)[0].length,i=t.slice(1).filter(o=>o.trim()),r=(i.length?i:t.filter(o=>o.trim())).map(e),n=r.length?Math.min(...r):0;return t.map(o=>o.slice(Math.min(n,e(o)))).join(`
206
- `)}var lo=class extends x{static properties={layout:{type:String,default:"",reflect:!0},codeFirst:{type:Boolean,default:!1,reflect:!0,attribute:"code-first"},language:{type:String,default:"html",reflect:!0},rows:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e(t,e,i){let r=document.createElement("div");r.setAttribute("data-preview-render",""),r.innerHTML=t;let n=document.createElement("div");n.setAttribute("data-preview-code","");let o=document.createElement("code-ui");return o.setAttribute("language",e),o.textContent=t.replace(/\s+data-chunk(?:-[a-z]+)?="[^"]*"/g,""),n.appendChild(o),i?[n,r]:[r,n]}connected(){if(this.querySelector(":scope > [data-preview-render], :scope > [data-preview-row]"))return;!this.hasAttribute("rows")&&!this.hasAttribute("layout")&&this.setAttribute("layout","split");let t=this.getAttribute("language")||"html",e=this.hasAttribute("code-first");if(this.hasAttribute("rows")){let r=[...this.children],n=[];for(let o of r){let a=o.getAttribute("data-preview-label");a!=null&&o.removeAttribute("data-preview-label");let l=o.hasAttribute("data-preview-unwrap");l&&o.removeAttribute("data-preview-unwrap");let h=s1(l?o.innerHTML:o.outerHTML),c=document.createElement("div");c.setAttribute("data-preview-row","");let u=this.#e(h,t,e);a&&u.find(f=>f.hasAttribute("data-preview-render"))?.setAttribute("data-preview-label",a),c.append(...u),n.push(c)}if(n.length){this.replaceChildren(...n),this.#r();return}}let i=s1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#r()}#i=()=>{if(this.hasAttribute("rows"))for(let t of this.querySelectorAll(":scope > [data-preview-row]")){let e=t.querySelector(":scope > [data-preview-render]");e&&e.scrollWidth>e.clientWidth+4&&t.setAttribute("data-stack","")}else if(this.getAttribute("layout")==="split"){let t=this.querySelector(":scope > [data-preview-render]");t&&t.scrollWidth>t.clientWidth+4&&this.setAttribute("layout","stack")}};#s=()=>requestAnimationFrame(this.#i);#r(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};S("preview-ui",lo);$();var ho=class extends x{static properties={divider:{type:Boolean,default:!1,reflect:!0},spacing:{type:String,default:"md",reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},selectedKey:{type:String,default:"",reflect:!0,attribute:"selected-key"}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#r),this.addEventListener("keydown",this.#n))}disconnected(){this.removeEventListener("click",this.#r),this.removeEventListener("keydown",this.#n),this.#t=!1}render(){if(!this.selectable){for(let r of this.#e())r.removeAttribute("aria-selected"),r.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let r of e){let n=this.#i(r),o=n&&n===t;r.setAttribute("aria-selected",o?"true":"false"),r.setAttribute("tabindex",o?"0":"-1"),o&&(i=r)}!i&&e.length&&e[0].setAttribute("tabindex","0")}#e(){return[...this.children].filter(t=>t.tagName==="LIST-ITEM-UI"||t.getAttribute?.("role")==="listitem")}#i(t){return t.id||t.getAttribute("data-key")||""}#s(t,{focus:e=!1}={}){if(!this.selectable||!t)return;let i=this.selectedKey||"";t!==i&&(this.selectedKey=t,this.dispatchEvent(new CustomEvent("selection-change",{detail:{key:t,previousKey:i},bubbles:!0})),e&&[...this.#e()].find(n=>this.#i(n)===t)?.focus?.())}#r=t=>{if(!this.selectable)return;let e=t.target.closest?.('[role="listitem"]');if(!e||e.parentElement!==this)return;let i=this.#i(e);i&&this.#s(i)};#n=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,r=e.indexOf(i);if(r<0)return;let n=r;switch(t.key){case"ArrowDown":n=Math.min(e.length-1,r+1);break;case"ArrowUp":n=Math.max(0,r-1);break;case"Home":n=0;break;case"End":n=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[r]);o&&this.#s(o);return}default:return}n!==r&&(t.preventDefault(),e[n]?.focus?.())}},co=class extends x{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.#s()}#t(t){for(let e of this.children)if(e.matches(t))return e;return null}#e(t){return t.dataset.listStamped="1",t}#i(t){return t?.dataset?.listStamped==="1"}#s(){if(!this.#t('[slot="content"]')){if(this.icon){let t=this.#t('[slot="icon"]')||this.#t("icon-ui");t||(t=this.#e(document.createElement("icon-ui")),t.setAttribute("slot","icon"),this.prepend(t)),t.setAttribute("name",this.icon)}if(this.text){let t=this.#t('[slot="text"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","text"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.text)}if(this.description){let t=this.#t('[slot="description"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","description"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.description)}}}render(){let t=this.#t('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let r=this.#e(document.createElement("icon-ui"));r.setAttribute("slot","icon"),r.setAttribute("name",this.icon),this.prepend(r)}else this.#i(t)&&t.remove();let e=this.#t('[slot="text"]');if(this.text)if(e)this.#i(e)&&(e.textContent=this.text);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","text"),r.textContent=this.text,this.appendChild(r)}else this.#i(e)&&e.remove();let i=this.#t('[slot="description"]');if(this.description)if(i)this.#i(i)&&(i.textContent=this.description);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","description"),r.textContent=this.description,this.appendChild(r)}else this.#i(i)&&i.remove()}};S("list-ui",ho),S("list-item-ui",co);$();var uo=class extends x{static properties={items:{type:Array,default:[],reflect:!1},itemSize:{type:Number,default:0,reflect:!0,attribute:"item-size"},itemSizeRem:{type:Number,default:0,reflect:!0,attribute:"item-size-rem"},estimatedSize:{type:Number,default:48,reflect:!0,attribute:"estimated-size"},overscan:{type:Number,default:3,reflect:!0},direction:{type:String,default:"vertical",reflect:!0},pinBottom:{type:Boolean,default:!1,reflect:!0,attribute:"pin-bottom"},startIndex:{type:Number,default:0,reflect:!1,attribute:"start-index"},loading:{type:Boolean,default:!1,reflect:!0}};static parts={phantom:"<div data-phantom></div>",window:"<div data-window></div>",sentinelTop:'<div data-sentinel="top"></div>',sentinelBottom:'<div data-sentinel="bottom"></div>'};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=(t,e)=>t&&typeof t=="object"&&"id"in t?t.id:e;#a=new Map;#o=new Map;#l=1e5;#c=-1;#h=-1;#u=0;#d=!0;#f=null;#p=null;#m=()=>{this.#P();let t=this.#A();this.#u=t,this.#d=this.#E()};#g=t=>{let e=t.target.closest?.("[data-row]");if(!e||e.parentElement!==this.#e)return;let i=Number(e.dataset.index);if(!Number.isInteger(i)||i<0)return;let r=this.items?.[i];r!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:r,index:i},bubbles:!0}))};#b=t=>{if(t.target!==this)return;let e=this.#w()||this.estimatedSize||48,i=this.#k(),r=0;switch(t.key){case"ArrowDown":r=+e;break;case"ArrowUp":r=-e;break;case"PageDown":r=+i;break;case"PageUp":r=-i;break;case" ":r=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let n=this.#A();this.#C(n+r)};#O=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let r=this.#c>=0?this.#c:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:r},bubbles:!0}))}else if(i==="bottom"){let r=this.items||[],n=this.#h>=0?this.#h:r.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:n},bubbles:!0}))}}};#y=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let r=i.target;if(!r||r.parentElement!==this.#e)continue;let n=Number(r.dataset.index);if(!Number.isInteger(n))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(n)!==a&&(this.#o.set(n,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:n,height:a},bubbles:!0})),e=!0)}e&&(this.#X(),this.#T(),this.#P())};connected(){this.setAttribute("role",this.getAttribute("role")||"list"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.#t=this.ensure("phantom"),this.#e=this.ensure("window"),this.#i=this.ensure("sentinelTop"),this.#s=this.ensure("sentinelBottom"),typeof IntersectionObserver<"u"&&(this.#p=new IntersectionObserver(this.#O,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#y)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#g),this.addEventListener("keydown",this.#b),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#g),this.removeEventListener("keydown",this.#b),this.#p?.disconnect(),this.#p=null,this.#f?.disconnect(),this.#f=null,this.#a.clear()}render(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=this.pinBottom&&(this.#d||this.#E());t.length===0?this.setAttribute("empty",""):this.removeAttribute("empty"),this.setAttribute("aria-rowcount",String(t.length)),this.loading?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy"),this.#T(),this.#P(),e&&this.scrollToBottom(),this.#d=this.#E()}set renderRow(t){this.#r=typeof t=="function"?t:null,this.#a.clear(),this.#P()}get renderRow(){return this.#r}set keyFn(t){this.#n=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#P()}get keyFn(){return this.#n}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let r=this.items||[];if(!r.length)return;let n=Math.max(0,Math.min(r.length-1,t|0)),o=this.#S(n),a=this.#k(),l=this.#v(n),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#C(Math.max(0,h),e)}scrollToTop(){this.#C(0)}scrollToBottom(){let t=this.#x();this.#C(Math.max(0,t))}getVisibleRange(){return{startIndex:this.#c,endIndex:this.#h}}invalidateMeasurements(t=0){if(t<=0)this.#o.clear();else for(let e of[...this.#o.keys()])e>=t&&this.#o.delete(e);this.#T(),this.#P()}#w(){if(this.itemSize>0)return this.itemSize;if(this.itemSizeRem>0){let t=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return this.itemSizeRem*t}return 0}#v(t){let e=this.#w();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#S(t){let e=this.#w();if(e>0)return t*e;let i=0;for(let r=0;r<t;r++)i+=this.#v(r);return i}#x(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#w();if(i>0)return e*i;let r=0,n=this.estimatedSize||48;for(let o=0;o<e;o++)r+=this.#o.get(o)??n;return r}#k(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#C(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#E(){let t=this.#A(),e=this.#k(),i=this.#x();return t+e>=i-1}#T(){if(!this.#t)return;let t=this.#x();this.direction==="horizontal"?(this.#t.style.width=`${t}px`,this.#t.style.height="1px"):(this.#t.style.height=`${t}px`,this.#t.style.width="1px")}#Q(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return{start:0,end:0};let i=this.#k(),r=this.#A(),n=this.#w(),o,a;if(n>0)o=Math.floor(r/n),a=Math.ceil((r+i)/n);else{let h=this.estimatedSize||48,c=0;o=0;for(let d=0;d<e;d++){let f=this.#o.get(d)??h;if(c+f>r){o=d;break}c+=f}a=o;let u=0;for(let d=o;d<e;d++){let f=this.#o.get(d)??h;if(u+=f,a=d+1,u>=i)break}}let l=Math.max(0,this.overscan|0);return o=Math.max(0,o-l),a=Math.min(e,a+l),{start:o,end:a}}#P(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:r}=this.#Q(),n=this.#S(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${n}px)`:this.#e.style.transform=`translateY(${n}px)`,this.loading?this.#$(r-i):this.#I(t,i,r),(i!==this.#c||r!==this.#h)&&(this.#c=i,this.#h=r,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:r,items:t.slice(i,r)},bubbles:!0})))}#I(t,e,i){if(!this.#e)return;let r=new Set,n=this.#r??this.#L();for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l);r.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#M(h,l,n),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)r.has(l)||(this.#f?.unobserve(h),h.parentElement===this.#e&&h.remove(),this.#a.delete(l));let a=this.#e.firstChild;for(let l of o)l!==a&&this.#e.insertBefore(l,a),a=l.nextSibling;for(;a;){let l=a.nextSibling;a.remove(),a=l}if(this.itemSize<=0&&this.itemSizeRem<=0&&this.#f)for(let l of o)this.#f.observe(l)}#$(t){if(!this.#e)return;this.#e.replaceChildren(),this.#a.clear();let e=Math.max(1,Math.min(20,t|0||5)),i=this.querySelector(':scope > template[slot="loading"]');for(let r=0;r<e;r++){let n=document.createElement("div");if(n.setAttribute("data-row",""),n.setAttribute("data-skeleton-row",""),n.dataset.index=String(r),i?.content)n.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");n.appendChild(o)}this.#e.appendChild(n)}}#M(t,e,i){let r=document.createElement("div");r.setAttribute("data-row",""),r.setAttribute("role","listitem"),r.dataset.index=String(e),r.setAttribute("aria-rowindex",String(e+1));let n=null;if(typeof i=="function")try{n=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(n instanceof Node)r.appendChild(n);else if(n!=null)r.textContent=String(n);else if(t!=null&&typeof t=="object"&&"text"in t){let o=document.createElement("list-item-ui");o.setAttribute("text",String(t.text)),"description"in t&&o.setAttribute("description",String(t.description)),"icon"in t&&o.setAttribute("icon",String(t.icon)),r.appendChild(o)}else t!=null&&(r.textContent=String(t));return r}#L(){let t=this.querySelector(":scope > template:not([slot])");if(!t)return null;this.#D==null&&(this.#D=t.innerHTML);let e=this.#D;return(i,r)=>{let n=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":FI(String(h))}),o=document.createElement("template");return o.innerHTML=n,o.content.cloneNode(!0)}}#D=null;#X(){if(this.#o.size<=this.#l)return;let t=this.#o.size-this.#l,e=0;for(let i of this.#o.keys())if(this.#o.delete(i),++e>=t)break}};function FI(s){return s.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}S("list-window-ui",uo);$();var fo=class extends x{static properties={open:{type:Boolean,default:!1,reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},gap:{type:Number,default:4,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=null;#r=null;connected(){this.#i||(this.#i=!0,this.addEventListener("click",this.#d),this.addEventListener("keydown",this.#f))}render(){this.open?this.#a():this.#o()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#n(){if(this.#e)return this.#e;let t=document.createElement("div");return t.setAttribute("data-menu-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.addEventListener("toggle",this.#O),t.addEventListener("click",this.#p),t.addEventListener("keydown",this.#m),this.appendChild(t),this.#e=t,t}#a(){let t=this.querySelector('[slot="trigger"]');if(!t)return;let e=this.#n(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui");for(let r of i)e.contains(r)||e.appendChild(r);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=ct(t,e,{placement:this.placement,gap:this.gap}),this.#u&&(this.#u=!1,this.#r=requestAnimationFrame(()=>{this.#r=null,this.#c(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#g),document.addEventListener("keydown",this.#b,!0)})}#o(){this.#t?.(),this.#t=null;let t=this.#e;if(t){t.matches(":popover-open")&&t.hidePopover?.();let e=t.querySelectorAll("menu-item-ui, menu-divider-ui");for(let i of e)this.insertBefore(i,t)}this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#r!=null&&(cancelAnimationFrame(this.#r),this.#r=null),document.removeEventListener("pointerdown",this.#g),document.removeEventListener("keydown",this.#b,!0)}#l(){return Array.from(this.#e?.querySelectorAll("menu-item-ui")??[]).filter(t=>!t.disabled)}#c(t){let e=this.#l();if(!e.length)return;let i=(t+e.length)%e.length,r=e[i];r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})}#h(){return this.#l().indexOf(document.activeElement)}#u=!1;#d=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.#u=!1,this.open=!this.open)};#f=t=>{let e=this.querySelector('[slot="trigger"]');!e||!(t.target===e||e.contains(t.target))||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#u=!0,this.open=!0)};#p=t=>{let e=t.target.closest("menu-item-ui");!e||e.disabled||(this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.value,text:e.text}})),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0}))};#m=t=>{let e=this.#l();if(!e.length)return;let i=this.#h();switch(t.key){case"ArrowDown":t.preventDefault(),this.#c(i+1);break;case"ArrowUp":t.preventDefault(),this.#c(i-1);break;case"Home":t.preventDefault(),this.#c(0);break;case"End":t.preventDefault(),this.#c(e.length-1);break;case"Enter":case" ":{t.preventDefault(),(e[i]??e[0])?.click();break}}};#g=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#b=t=>{t.key==="Escape"&&this.open?(t.stopPropagation(),t.preventDefault(),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0})):t.key==="Tab"&&this.open&&(this.open=!1)};#O=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#O),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},po=class extends x{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","menuitem"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.#s(),this.#r()}#t(t){return t.dataset.menuItemStamped="1",t}#e(t){return t?.dataset?.menuItemStamped==="1"}#i(t){for(let e of this.children)if(e.matches(t))return e;return null}#s(){if(!this.#i('[slot="text"]')){if(this.icon&&!this.#i('[slot="icon"]')){let t=this.#t(document.createElement("icon-ui"));t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=this.#t(document.createElement("span"));t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}}}#r(){this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}render(){let t=this.#i('[slot="icon"]');if(this.icon)if(t)this.#e(t)&&t.setAttribute("name",this.icon);else{let i=this.#t(document.createElement("icon-ui"));i.setAttribute("slot","icon"),i.setAttribute("name",this.icon),this.prepend(i)}else this.#e(t)&&t.remove();let e=this.#i('[slot="text"]');this.#e(e)&&(e.textContent=this.text),this.#r()}},mo=class extends x{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}};S("menu-ui",fo),S("menu-item-ui",po),S("menu-divider-ui",mo);$();var r1=500,go=class extends x{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:r1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#r=null;#n=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#c(),this.#w(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#n=i,t==null||e==null){let r=i.getBoundingClientRect();t=r.left+r.width/2,e=r.top+r.height/2}this.#O(t,e)}}close(t="manual"){this.#y(t)}#l(){this.#s=this.#h();for(let t of this.#s)t.addEventListener("contextmenu",this.#u),t.addEventListener("touchstart",this.#d,{passive:!0}),t.addEventListener("touchend",this.#f),t.addEventListener("touchcancel",this.#f),t.addEventListener("keydown",this.#p)}#c(){for(let t of this.#s)t.removeEventListener("contextmenu",this.#u),t.removeEventListener("touchstart",this.#d),t.removeEventListener("touchend",this.#f),t.removeEventListener("touchcancel",this.#f),t.removeEventListener("keydown",this.#p);this.#s=[]}#h(){if(this.for)try{return[...document.querySelectorAll(this.for)]}catch(t){return console.warn(`[context-menu-ui] invalid [for] selector: ${this.for}`,t),[]}for(let t of this.children){let e=t.tagName.toLowerCase();if(e!=="menu-item-ui"&&e!=="menu-divider-ui")return[t]}return[]}#u=t=>{t.defaultPrevented||this.#m()&&(t.preventDefault(),this.#n=t.currentTarget,this.#O(t.clientX,t.clientY))};#d=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#r=setTimeout(()=>{this.#n=t.currentTarget,this.#O(e.clientX,e.clientY)},this.longPressMs??r1))};#f=()=>{this.#r&&clearTimeout(this.#r),this.#r=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#n=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#g(){if(this.#t)return this.#t;let t=document.createElement("div");return t.setAttribute("data-context-menu-surface",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.setAttribute("aria-label",this.getAttribute("aria-label")||"Context menu"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#x),document.body.appendChild(t),this.#t=t,t}#b(t,e){if(!this.#e){let i=document.createElement("div");i.setAttribute("data-context-menu-anchor",""),i.style.cssText="position:fixed;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(i),this.#e=i}return this.#e.style.left=`${t}px`,this.#e.style.top=`${e}px`,this.#e}#O(t,e){let i=this.#g();i.replaceChildren();for(let o of[...this.children]){let a=o.tagName.toLowerCase();(a==="menu-item-ui"||a==="menu-divider-ui")&&i.appendChild(o.cloneNode(!0))}try{i.showPopover()}catch{}let r=this.#b(t,e);this.#i?.(),this.#i=ct(r,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let n=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>n?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#n,x:t,y:e}}))}#y(t="manual"){if(this.open){this.open=!1,this.#w(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#n?.focus?.()}catch{}}}#w(){this.#S(),this.#i?.(),this.#i=null;try{this.#t?.hidePopover()}catch{}this.#e&&(this.#e.remove(),this.#e=null)}#v(){this.#a=t=>{this.#t?.contains(t.target)||this.#y("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#y("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#S(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#x=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",r=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:r}})),this.#y("select")}};S("context-menu-ui",go);$();var bo=class extends x{static properties={};static template=()=>null};S("visually-hidden-ui",bo);$();var Oo=class extends x{static properties={target:{type:String,default:"#main",reflect:!0},text:{type:String,default:"Skip to main content",reflect:!0}};static template=({target:t,text:e})=>it`<a href="${t}" data-skip-link>${e}</a>`;connected(){super.connected(),this.addEventListener("click",this.#t)}disconnected(){super.disconnected(),this.removeEventListener("click",this.#t)}#t=t=>{if(!t.target.closest("[data-skip-link]"))return;let i=this.target.replace(/^#/,""),r=document.getElementById(i);r&&queueMicrotask(()=>{r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!1})})}};S("skip-nav-ui",Oo);$();var yo=class extends x{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};S("mark-ui",yo);var vo=class extends M{static properties={...M.properties,placeholder:{type:String,default:"Click to edit",reflect:!0},editing:{type:Boolean,default:!1,reflect:!0},commit:{type:String,default:"blur",reflect:!0}};static template=()=>null;#t="";#e=!1;#i=!1;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","textbox"),!this.hasAttribute("tabindex")&&!this.disabled&&this.setAttribute("tabindex","0"),this.value&&this.textContent.trim()===""?this.textContent=this.value:!this.value&&this.textContent.trim()&&(this.value=this.textContent.trim(),this.syncValue()),this.#e||(this.#e=!0,this.addEventListener("click",this.#s),this.addEventListener("keydown",this.#r),this.addEventListener("focus",this.#n),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#r),this.removeEventListener("focus",this.#n),this.removeEventListener("blur",this.#a),this.#e=!1}startEdit(){this.editing||this.disabled||this.readonly||(this.#t=this.value||"",this.editing=!0,this.setAttribute("contenteditable","plaintext-only"),this.dispatchEvent(new CustomEvent("edit-start",{bubbles:!0})),queueMicrotask(()=>{this.focus(),this.#o()}))}commitEdit(){if(!this.editing)return;let t=(this.textContent||"").trim(),e=this.#t;this.editing=!1,this.removeAttribute("contenteditable"),this.textContent!==t&&(this.textContent=t),t!==e&&(this.value=t,this.syncValue(t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:t,oldValue:e}}))),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!0}}))}cancelEdit(){this.editing&&(this.editing=!1,this.removeAttribute("contenteditable"),this.textContent=this.#t,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0})),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!1}})))}#s=t=>{this.disabled||this.readonly||this.editing||(t.preventDefault(),this.startEdit())};#r=t=>{if(this.editing)t.key==="Enter"?(t.preventDefault(),this.#i=!0,this.commitEdit(),this.blur()):t.key==="Escape"&&(t.preventDefault(),this.#i=!0,this.cancelEdit(),this.blur());else if(t.key==="Enter"||t.key===" "){if(this.disabled||this.readonly)return;t.preventDefault(),this.startEdit()}};#n=()=>{};#a=()=>{if(this.editing){if(this.#i){this.#i=!1;return}this.commit==="blur"?this.commitEdit():this.commit==="enter"&&this.cancelEdit()}};#o(){let t=document.createRange();t.selectNodeContents(this);let e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(t))}};S("inline-edit-ui",vo);$();var xo=class extends x{static properties={active:{type:Boolean,default:!1,reflect:!0},step:{type:Number,default:0,reflect:!1},autoStart:{type:Boolean,default:!1,reflect:!0,attribute:"auto-start"},storageKey:{type:String,default:"",reflect:!0,attribute:"storage-key"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=null;connected(){super.connected(),this.autoStart&&!this.#o()&&requestAnimationFrame(()=>{this.isConnected&&this.autoStart&&this.start()})}disconnected(){super.disconnected(),this.#h()}start(){if(!this.active){if(!this.#a.length){console.warn("[tour-ui] start() called with no <tour-step> children \u2014 nothing to render.");return}this.step=0,this.active=!0,this.#c(),this.#u(),this.dispatchEvent(new CustomEvent("tour-start",{bubbles:!0,detail:{step:0}}))}}next(){if(!this.active)return;let t=this.#a.length;if(this.step>=t-1){this.finish();return}let e=this.step;this.step=e+1,this.#u(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:e,to:this.step,totalSteps:t}}))}previous(){if(!this.active||this.step<=0)return;let t=this.step;this.step=t-1,this.#u(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:t,to:this.step,totalSteps:this.#a.length}}))}skip(){if(!this.active)return;let t=this.#a.length,e=this.step;this.#l(),this.active=!1,this.#h(),this.dispatchEvent(new CustomEvent("tour-skip",{bubbles:!0,detail:{step:e,totalSteps:t}}))}finish(){if(!this.active)return;let t=this.#a.length;this.#l(),this.active=!1,this.#h(),this.dispatchEvent(new CustomEvent("tour-finish",{bubbles:!0,detail:{totalSteps:t}}))}get#a(){return[...this.querySelectorAll(":scope > tour-step-ui")]}#o(){if(!this.storageKey)return!1;try{return localStorage.getItem(this.storageKey)==="done"}catch{return!1}}#l(){if(this.storageKey)try{localStorage.setItem(this.storageKey,"done")}catch{}}#c(){if(!this.#t){let t=document.createElement("div");t.setAttribute("data-tour-spotlight",""),t.setAttribute("aria-hidden","true"),document.body.appendChild(t),this.#t=t}if(!this.#e){let t=document.createElement("div");t.setAttribute("data-tour-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#p),document.body.appendChild(t),this.#e=t}this.#s=()=>this.#f(),this.#r=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#r,!0),this.#n=t=>{this.active&&(t.key==="Escape"?(t.preventDefault(),this.skip()):t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.previous()))},document.addEventListener("keydown",this.#n)}#h(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#r&&window.removeEventListener("scroll",this.#r,!0),this.#n&&document.removeEventListener("keydown",this.#n),this.#s=this.#r=this.#n=null;try{this.#e?.hidePopover?.()}catch{}this.#e?.removeEventListener("click",this.#p),this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null}#u(){let t=this.#a[this.step];if(!t)return;let e=this.#a.length,i=this.step===e-1,r=this.step===0,n=t.getAttribute("title")||"",o=t.getAttribute("placement")||"bottom",a=t.getAttribute("target")||"",l=a?document.querySelector(a):null;this.#d=l,this.#f();let h=`${this.step+1} of ${e}`,c=t.innerHTML;this.#e.innerHTML=`
206
+ `)}var lo=class extends x{static properties={layout:{type:String,default:"",reflect:!0},codeFirst:{type:Boolean,default:!1,reflect:!0,attribute:"code-first"},language:{type:String,default:"html",reflect:!0},rows:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e(t,e,i){let r=document.createElement("div");r.setAttribute("data-preview-render",""),r.innerHTML=t;let n=document.createElement("div");n.setAttribute("data-preview-code","");let o=document.createElement("code-ui");return o.setAttribute("language",e),o.textContent=t.replace(/\s+data-chunk(?:-[a-z]+)?="[^"]*"/g,""),n.appendChild(o),i?[n,r]:[r,n]}connected(){if(this.querySelector(":scope > [data-preview-render], :scope > [data-preview-row]"))return;!this.hasAttribute("rows")&&!this.hasAttribute("layout")&&this.setAttribute("layout","split");let t=this.getAttribute("language")||"html",e=this.hasAttribute("code-first");if(this.hasAttribute("rows")){let r=[...this.children],n=[];for(let o of r){let a=o.getAttribute("data-preview-label");a!=null&&o.removeAttribute("data-preview-label");let l=o.hasAttribute("data-preview-unwrap");l&&o.removeAttribute("data-preview-unwrap");let h=s1(l?o.innerHTML:o.outerHTML),c=document.createElement("div");c.setAttribute("data-preview-row","");let u=this.#e(h,t,e);a&&u.find(f=>f.hasAttribute("data-preview-render"))?.setAttribute("data-preview-label",a),c.append(...u),n.push(c)}if(n.length){this.replaceChildren(...n),this.#r();return}}let i=s1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#r()}#i=()=>{if(this.hasAttribute("rows"))for(let t of this.querySelectorAll(":scope > [data-preview-row]")){let e=t.querySelector(":scope > [data-preview-render]");e&&e.scrollWidth>e.clientWidth+4&&t.setAttribute("data-stack","")}else if(this.getAttribute("layout")==="split"){let t=this.querySelector(":scope > [data-preview-render]");t&&t.scrollWidth>t.clientWidth+4&&this.setAttribute("layout","stack")}};#s=()=>requestAnimationFrame(this.#i);#r(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};S("preview-ui",lo);$();var ho=class extends x{static properties={divider:{type:Boolean,default:!1,reflect:!0},spacing:{type:String,default:"md",reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},selectedKey:{type:String,default:"",reflect:!0,attribute:"selected-key"}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#r),this.addEventListener("keydown",this.#n))}disconnected(){this.removeEventListener("click",this.#r),this.removeEventListener("keydown",this.#n),this.#t=!1}render(){if(!this.selectable){for(let r of this.#e())r.removeAttribute("aria-selected"),r.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let r of e){let n=this.#i(r),o=n&&n===t;r.setAttribute("aria-selected",o?"true":"false"),r.setAttribute("tabindex",o?"0":"-1"),o&&(i=r)}!i&&e.length&&e[0].setAttribute("tabindex","0")}#e(){return[...this.children].filter(t=>t.tagName==="LIST-ITEM-UI"||t.getAttribute?.("role")==="listitem")}#i(t){return t.id||t.getAttribute("data-key")||""}#s(t,{focus:e=!1}={}){if(!this.selectable||!t)return;let i=this.selectedKey||"";t!==i&&(this.selectedKey=t,this.dispatchEvent(new CustomEvent("selection-change",{detail:{key:t,previousKey:i},bubbles:!0})),e&&[...this.#e()].find(n=>this.#i(n)===t)?.focus?.())}#r=t=>{if(!this.selectable)return;let e=t.target.closest?.('[role="listitem"]');if(!e||e.parentElement!==this)return;let i=this.#i(e);i&&this.#s(i)};#n=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,r=e.indexOf(i);if(r<0)return;let n=r;switch(t.key){case"ArrowDown":n=Math.min(e.length-1,r+1);break;case"ArrowUp":n=Math.max(0,r-1);break;case"Home":n=0;break;case"End":n=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[r]);o&&this.#s(o);return}default:return}n!==r&&(t.preventDefault(),e[n]?.focus?.())}},co=class extends x{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.#s()}#t(t){for(let e of this.children)if(e.matches(t))return e;return null}#e(t){return t.dataset.listStamped="1",t}#i(t){return t?.dataset?.listStamped==="1"}#s(){if(!this.#t('[slot="content"]')){if(this.icon){let t=this.#t('[slot="icon"]')||this.#t("icon-ui");t||(t=this.#e(document.createElement("icon-ui")),t.setAttribute("slot","icon"),this.prepend(t)),t.setAttribute("name",this.icon)}if(this.text){let t=this.#t('[slot="text"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","text"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.text)}if(this.description){let t=this.#t('[slot="description"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","description"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.description)}}}render(){let t=this.#t('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let r=this.#e(document.createElement("icon-ui"));r.setAttribute("slot","icon"),r.setAttribute("name",this.icon),this.prepend(r)}else this.#i(t)&&t.remove();let e=this.#t('[slot="text"]');if(this.text)if(e)this.#i(e)&&(e.textContent=this.text);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","text"),r.textContent=this.text,this.appendChild(r)}else this.#i(e)&&e.remove();let i=this.#t('[slot="description"]');if(this.description)if(i)this.#i(i)&&(i.textContent=this.description);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","description"),r.textContent=this.description,this.appendChild(r)}else this.#i(i)&&i.remove()}};S("list-ui",ho),S("list-item-ui",co);$();var uo=class extends x{static properties={items:{type:Array,default:[],reflect:!1},itemSize:{type:Number,default:0,reflect:!0,attribute:"item-size"},itemSizeRem:{type:Number,default:0,reflect:!0,attribute:"item-size-rem"},estimatedSize:{type:Number,default:48,reflect:!0,attribute:"estimated-size"},overscan:{type:Number,default:3,reflect:!0},direction:{type:String,default:"vertical",reflect:!0},pinBottom:{type:Boolean,default:!1,reflect:!0,attribute:"pin-bottom"},startIndex:{type:Number,default:0,reflect:!1,attribute:"start-index"},loading:{type:Boolean,default:!1,reflect:!0}};static parts={phantom:"<div data-phantom></div>",window:"<div data-window></div>",sentinelTop:'<div data-sentinel="top"></div>',sentinelBottom:'<div data-sentinel="bottom"></div>'};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=(t,e)=>t&&typeof t=="object"&&"id"in t?t.id:e;#a=new Map;#o=new Map;#l=1e5;#c=-1;#h=-1;#u=0;#d=!0;#f=null;#p=null;#m=()=>{this.#P();let t=this.#A();this.#u=t,this.#d=this.#E()};#g=t=>{let e=t.target.closest?.("[data-row]");if(!e||e.parentElement!==this.#e)return;let i=Number(e.dataset.index);if(!Number.isInteger(i)||i<0)return;let r=this.items?.[i];r!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:r,index:i},bubbles:!0}))};#b=t=>{if(t.target!==this)return;let e=this.#w()||this.estimatedSize||48,i=this.#k(),r=0;switch(t.key){case"ArrowDown":r=+e;break;case"ArrowUp":r=-e;break;case"PageDown":r=+i;break;case"PageUp":r=-i;break;case" ":r=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let n=this.#A();this.#C(n+r)};#O=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let r=this.#c>=0?this.#c:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:r},bubbles:!0}))}else if(i==="bottom"){let r=this.items||[],n=this.#h>=0?this.#h:r.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:n},bubbles:!0}))}}};#y=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let r=i.target;if(!r||r.parentElement!==this.#e)continue;let n=Number(r.dataset.index);if(!Number.isInteger(n))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(n)!==a&&(this.#o.set(n,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:n,height:a},bubbles:!0})),e=!0)}e&&(this.#X(),this.#T(),this.#P())};connected(){this.setAttribute("role",this.getAttribute("role")||"list"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.#t=this.ensure("phantom"),this.#e=this.ensure("window"),this.#i=this.ensure("sentinelTop"),this.#s=this.ensure("sentinelBottom"),typeof IntersectionObserver<"u"&&(this.#p=new IntersectionObserver(this.#O,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#y)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#g),this.addEventListener("keydown",this.#b),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#g),this.removeEventListener("keydown",this.#b),this.#p?.disconnect(),this.#p=null,this.#f?.disconnect(),this.#f=null,this.#a.clear()}render(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=this.pinBottom&&(this.#d||this.#E());t.length===0?this.setAttribute("empty",""):this.removeAttribute("empty"),this.setAttribute("aria-rowcount",String(t.length)),this.loading?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy"),this.#T(),this.#P(),e&&this.scrollToBottom(),this.#d=this.#E()}set renderRow(t){this.#r=typeof t=="function"?t:null,this.#a.clear(),this.#P()}get renderRow(){return this.#r}set keyFn(t){this.#n=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#P()}get keyFn(){return this.#n}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let r=this.items||[];if(!r.length)return;let n=Math.max(0,Math.min(r.length-1,t|0)),o=this.#S(n),a=this.#k(),l=this.#v(n),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#C(Math.max(0,h),e)}scrollToTop(){this.#C(0)}scrollToBottom(){let t=this.#x();this.#C(Math.max(0,t))}getVisibleRange(){return{startIndex:this.#c,endIndex:this.#h}}invalidateMeasurements(t=0){if(t<=0)this.#o.clear();else for(let e of[...this.#o.keys()])e>=t&&this.#o.delete(e);this.#T(),this.#P()}#w(){if(this.itemSize>0)return this.itemSize;if(this.itemSizeRem>0){let t=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return this.itemSizeRem*t}return 0}#v(t){let e=this.#w();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#S(t){let e=this.#w();if(e>0)return t*e;let i=0;for(let r=0;r<t;r++)i+=this.#v(r);return i}#x(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#w();if(i>0)return e*i;let r=0,n=this.estimatedSize||48;for(let o=0;o<e;o++)r+=this.#o.get(o)??n;return r}#k(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#C(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#E(){let t=this.#A(),e=this.#k(),i=this.#x();return t+e>=i-1}#T(){if(!this.#t)return;let t=this.#x();this.direction==="horizontal"?(this.#t.style.width=`${t}px`,this.#t.style.height="1px"):(this.#t.style.height=`${t}px`,this.#t.style.width="1px")}#Q(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return{start:0,end:0};let i=this.#k(),r=this.#A(),n=this.#w(),o,a;if(n>0)o=Math.floor(r/n),a=Math.ceil((r+i)/n);else{let h=this.estimatedSize||48,c=0;o=0;for(let d=0;d<e;d++){let f=this.#o.get(d)??h;if(c+f>r){o=d;break}c+=f}a=o;let u=0;for(let d=o;d<e;d++){let f=this.#o.get(d)??h;if(u+=f,a=d+1,u>=i)break}}let l=Math.max(0,this.overscan|0);return o=Math.max(0,o-l),a=Math.min(e,a+l),{start:o,end:a}}#P(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:r}=this.#Q(),n=this.#S(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${n}px)`:this.#e.style.transform=`translateY(${n}px)`,this.loading?this.#$(r-i):this.#I(t,i,r),(i!==this.#c||r!==this.#h)&&(this.#c=i,this.#h=r,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:r,items:t.slice(i,r)},bubbles:!0})))}#I(t,e,i){if(!this.#e)return;let r=new Set,n=this.#r??this.#L();for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l);r.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#M(h,l,n),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)r.has(l)||(this.#f?.unobserve(h),h.parentElement===this.#e&&h.remove(),this.#a.delete(l));let a=this.#e.firstChild;for(let l of o)l!==a&&this.#e.insertBefore(l,a),a=l.nextSibling;for(;a;){let l=a.nextSibling;a.remove(),a=l}if(this.itemSize<=0&&this.itemSizeRem<=0&&this.#f)for(let l of o)this.#f.observe(l)}#$(t){if(!this.#e)return;this.#e.replaceChildren(),this.#a.clear();let e=Math.max(1,Math.min(20,t|0||5)),i=this.querySelector(':scope > template[slot="loading"]');for(let r=0;r<e;r++){let n=document.createElement("div");if(n.setAttribute("data-row",""),n.setAttribute("data-skeleton-row",""),n.dataset.index=String(r),i?.content)n.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");n.appendChild(o)}this.#e.appendChild(n)}}#M(t,e,i){let r=document.createElement("div");r.setAttribute("data-row",""),r.setAttribute("role","listitem"),r.dataset.index=String(e),r.setAttribute("aria-rowindex",String(e+1));let n=null;if(typeof i=="function")try{n=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(n instanceof Node)r.appendChild(n);else if(n!=null)r.textContent=String(n);else if(t!=null&&typeof t=="object"&&"text"in t){let o=document.createElement("list-item-ui");o.setAttribute("text",String(t.text)),"description"in t&&o.setAttribute("description",String(t.description)),"icon"in t&&o.setAttribute("icon",String(t.icon)),r.appendChild(o)}else t!=null&&(r.textContent=String(t));return r}#L(){let t=this.querySelector(":scope > template:not([slot])");if(!t)return null;this.#D==null&&(this.#D=t.innerHTML);let e=this.#D;return(i,r)=>{let n=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":FI(String(h))}),o=document.createElement("template");return o.innerHTML=n,o.content.cloneNode(!0)}}#D=null;#X(){if(this.#o.size<=this.#l)return;let t=this.#o.size-this.#l,e=0;for(let i of this.#o.keys())if(this.#o.delete(i),++e>=t)break}};function FI(s){return s.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}S("list-window-ui",uo);$();var fo=class extends x{static properties={open:{type:Boolean,default:!1,reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},gap:{type:Number,default:4,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=null;#r=null;connected(){this.#i||(this.#i=!0,this.addEventListener("click",this.#d),this.addEventListener("keydown",this.#f))}render(){this.open?this.#a():this.#o()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#n(){if(this.#e)return this.#e;let t=document.createElement("div");return t.setAttribute("data-menu-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.addEventListener("toggle",this.#O),t.addEventListener("click",this.#p),t.addEventListener("keydown",this.#m),this.appendChild(t),this.#e=t,t}#a(){let t=this.querySelector('[slot="trigger"]');if(!t)return;let e=this.#n(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui");for(let r of i)e.contains(r)||e.appendChild(r);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=ct(t,e,{placement:this.placement,gap:this.gap}),this.#u&&(this.#u=!1,this.#r=requestAnimationFrame(()=>{this.#r=null,this.#c(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#g),document.addEventListener("keydown",this.#b,!0)})}#o(){this.#t?.(),this.#t=null;let t=this.#e;if(t){t.matches(":popover-open")&&t.hidePopover?.();let e=t.querySelectorAll("menu-item-ui, menu-divider-ui");for(let i of e)this.insertBefore(i,t)}this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#r!=null&&(cancelAnimationFrame(this.#r),this.#r=null),document.removeEventListener("pointerdown",this.#g),document.removeEventListener("keydown",this.#b,!0)}#l(){return Array.from(this.#e?.querySelectorAll("menu-item-ui")??[]).filter(t=>!t.disabled)}#c(t){let e=this.#l();if(!e.length)return;let i=(t+e.length)%e.length,r=e[i];r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})}#h(){return this.#l().indexOf(document.activeElement)}#u=!1;#d=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.#u=!1,this.open=!this.open)};#f=t=>{let e=this.querySelector('[slot="trigger"]');!e||!(t.target===e||e.contains(t.target))||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#u=!0,this.open=!0)};#p=t=>{let e=t.target.closest("menu-item-ui");!e||e.disabled||(this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.value,text:e.text}})),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0}))};#m=t=>{let e=this.#l();if(!e.length)return;let i=this.#h();switch(t.key){case"ArrowDown":t.preventDefault(),this.#c(i+1);break;case"ArrowUp":t.preventDefault(),this.#c(i-1);break;case"Home":t.preventDefault(),this.#c(0);break;case"End":t.preventDefault(),this.#c(e.length-1);break;case"Enter":case" ":{t.preventDefault(),(e[i]??e[0])?.click();break}}};#g=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#b=t=>{t.key==="Escape"&&this.open?(t.stopPropagation(),t.preventDefault(),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0})):t.key==="Tab"&&this.open&&(this.open=!1)};#O=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#O),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},po=class extends x{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.closest('[role="menu"], [role="menubar"]')?(this.setAttribute("role","menuitem"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.#s(),this.#r()}#t(t){return t.dataset.menuItemStamped="1",t}#e(t){return t?.dataset?.menuItemStamped==="1"}#i(t){for(let e of this.children)if(e.matches(t))return e;return null}#s(){if(!this.#i('[slot="text"]')){if(this.icon&&!this.#i('[slot="icon"]')){let t=this.#t(document.createElement("icon-ui"));t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=this.#t(document.createElement("span"));t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}}}#r(){this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}render(){let t=this.#i('[slot="icon"]');if(this.icon)if(t)this.#e(t)&&t.setAttribute("name",this.icon);else{let i=this.#t(document.createElement("icon-ui"));i.setAttribute("slot","icon"),i.setAttribute("name",this.icon),this.prepend(i)}else this.#e(t)&&t.remove();let e=this.#i('[slot="text"]');this.#e(e)&&(e.textContent=this.text),this.#r()}},mo=class extends x{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}};S("menu-ui",fo),S("menu-item-ui",po),S("menu-divider-ui",mo);$();var r1=500,go=class extends x{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:r1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#r=null;#n=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#c(),this.#w(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#n=i,t==null||e==null){let r=i.getBoundingClientRect();t=r.left+r.width/2,e=r.top+r.height/2}this.#O(t,e)}}close(t="manual"){this.#y(t)}#l(){this.#s=this.#h();for(let t of this.#s)t.addEventListener("contextmenu",this.#u),t.addEventListener("touchstart",this.#d,{passive:!0}),t.addEventListener("touchend",this.#f),t.addEventListener("touchcancel",this.#f),t.addEventListener("keydown",this.#p)}#c(){for(let t of this.#s)t.removeEventListener("contextmenu",this.#u),t.removeEventListener("touchstart",this.#d),t.removeEventListener("touchend",this.#f),t.removeEventListener("touchcancel",this.#f),t.removeEventListener("keydown",this.#p);this.#s=[]}#h(){if(this.for)try{return[...document.querySelectorAll(this.for)]}catch(t){return console.warn(`[context-menu-ui] invalid [for] selector: ${this.for}`,t),[]}for(let t of this.children){let e=t.tagName.toLowerCase();if(e!=="menu-item-ui"&&e!=="menu-divider-ui")return[t]}return[]}#u=t=>{t.defaultPrevented||this.#m()&&(t.preventDefault(),this.#n=t.currentTarget,this.#O(t.clientX,t.clientY))};#d=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#r=setTimeout(()=>{this.#n=t.currentTarget,this.#O(e.clientX,e.clientY)},this.longPressMs??r1))};#f=()=>{this.#r&&clearTimeout(this.#r),this.#r=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#n=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#g(){if(this.#t)return this.#t;let t=document.createElement("div");return t.setAttribute("data-context-menu-surface",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.setAttribute("aria-label",this.getAttribute("aria-label")||"Context menu"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#x),document.body.appendChild(t),this.#t=t,t}#b(t,e){if(!this.#e){let i=document.createElement("div");i.setAttribute("data-context-menu-anchor",""),i.style.cssText="position:fixed;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(i),this.#e=i}return this.#e.style.left=`${t}px`,this.#e.style.top=`${e}px`,this.#e}#O(t,e){let i=this.#g();i.replaceChildren();for(let o of[...this.children]){let a=o.tagName.toLowerCase();(a==="menu-item-ui"||a==="menu-divider-ui")&&i.appendChild(o.cloneNode(!0))}try{i.showPopover()}catch{}let r=this.#b(t,e);this.#i?.(),this.#i=ct(r,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let n=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>n?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#n,x:t,y:e}}))}#y(t="manual"){if(this.open){this.open=!1,this.#w(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#n?.focus?.()}catch{}}}#w(){this.#S(),this.#i?.(),this.#i=null;try{this.#t?.hidePopover()}catch{}this.#e&&(this.#e.remove(),this.#e=null)}#v(){this.#a=t=>{this.#t?.contains(t.target)||this.#y("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#y("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#S(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#x=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",r=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:r}})),this.#y("select")}};S("context-menu-ui",go);$();var bo=class extends x{static properties={};static template=()=>null};S("visually-hidden-ui",bo);$();var Oo=class extends x{static properties={target:{type:String,default:"#main",reflect:!0},text:{type:String,default:"Skip to main content",reflect:!0}};static template=({target:t,text:e})=>it`<a href="${t}" data-skip-link>${e}</a>`;connected(){super.connected(),this.addEventListener("click",this.#t)}disconnected(){super.disconnected(),this.removeEventListener("click",this.#t)}#t=t=>{if(!t.target.closest("[data-skip-link]"))return;let i=this.target.replace(/^#/,""),r=document.getElementById(i);r&&queueMicrotask(()=>{r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!1})})}};S("skip-nav-ui",Oo);$();var yo=class extends x{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};S("mark-ui",yo);var vo=class extends M{static properties={...M.properties,placeholder:{type:String,default:"Click to edit",reflect:!0},editing:{type:Boolean,default:!1,reflect:!0},commit:{type:String,default:"blur",reflect:!0}};static template=()=>null;#t="";#e=!1;#i=!1;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","textbox"),!this.hasAttribute("tabindex")&&!this.disabled&&this.setAttribute("tabindex","0"),this.value&&this.textContent.trim()===""?this.textContent=this.value:!this.value&&this.textContent.trim()&&(this.value=this.textContent.trim(),this.syncValue()),this.#e||(this.#e=!0,this.addEventListener("click",this.#s),this.addEventListener("keydown",this.#r),this.addEventListener("focus",this.#n),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#r),this.removeEventListener("focus",this.#n),this.removeEventListener("blur",this.#a),this.#e=!1}startEdit(){this.editing||this.disabled||this.readonly||(this.#t=this.value||"",this.editing=!0,this.setAttribute("contenteditable","plaintext-only"),this.dispatchEvent(new CustomEvent("edit-start",{bubbles:!0})),queueMicrotask(()=>{this.focus(),this.#o()}))}commitEdit(){if(!this.editing)return;let t=(this.textContent||"").trim(),e=this.#t;this.editing=!1,this.removeAttribute("contenteditable"),this.textContent!==t&&(this.textContent=t),t!==e&&(this.value=t,this.syncValue(t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:t,oldValue:e}}))),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!0}}))}cancelEdit(){this.editing&&(this.editing=!1,this.removeAttribute("contenteditable"),this.textContent=this.#t,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0})),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!1}})))}#s=t=>{this.disabled||this.readonly||this.editing||(t.preventDefault(),this.startEdit())};#r=t=>{if(this.editing)t.key==="Enter"?(t.preventDefault(),this.#i=!0,this.commitEdit(),this.blur()):t.key==="Escape"&&(t.preventDefault(),this.#i=!0,this.cancelEdit(),this.blur());else if(t.key==="Enter"||t.key===" "){if(this.disabled||this.readonly)return;t.preventDefault(),this.startEdit()}};#n=()=>{};#a=()=>{if(this.editing){if(this.#i){this.#i=!1;return}this.commit==="blur"?this.commitEdit():this.commit==="enter"&&this.cancelEdit()}};#o(){let t=document.createRange();t.selectNodeContents(this);let e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(t))}};S("inline-edit-ui",vo);$();var xo=class extends x{static properties={active:{type:Boolean,default:!1,reflect:!0},step:{type:Number,default:0,reflect:!1},autoStart:{type:Boolean,default:!1,reflect:!0,attribute:"auto-start"},storageKey:{type:String,default:"",reflect:!0,attribute:"storage-key"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=null;connected(){super.connected(),this.autoStart&&!this.#o()&&requestAnimationFrame(()=>{this.isConnected&&this.autoStart&&this.start()})}disconnected(){super.disconnected(),this.#h()}start(){if(!this.active){if(!this.#a.length){console.warn("[tour-ui] start() called with no <tour-step> children \u2014 nothing to render.");return}this.step=0,this.active=!0,this.#c(),this.#u(),this.dispatchEvent(new CustomEvent("tour-start",{bubbles:!0,detail:{step:0}}))}}next(){if(!this.active)return;let t=this.#a.length;if(this.step>=t-1){this.finish();return}let e=this.step;this.step=e+1,this.#u(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:e,to:this.step,totalSteps:t}}))}previous(){if(!this.active||this.step<=0)return;let t=this.step;this.step=t-1,this.#u(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:t,to:this.step,totalSteps:this.#a.length}}))}skip(){if(!this.active)return;let t=this.#a.length,e=this.step;this.#l(),this.active=!1,this.#h(),this.dispatchEvent(new CustomEvent("tour-skip",{bubbles:!0,detail:{step:e,totalSteps:t}}))}finish(){if(!this.active)return;let t=this.#a.length;this.#l(),this.active=!1,this.#h(),this.dispatchEvent(new CustomEvent("tour-finish",{bubbles:!0,detail:{totalSteps:t}}))}get#a(){return[...this.querySelectorAll(":scope > tour-step-ui")]}#o(){if(!this.storageKey)return!1;try{return localStorage.getItem(this.storageKey)==="done"}catch{return!1}}#l(){if(this.storageKey)try{localStorage.setItem(this.storageKey,"done")}catch{}}#c(){if(!this.#t){let t=document.createElement("div");t.setAttribute("data-tour-spotlight",""),t.setAttribute("aria-hidden","true"),document.body.appendChild(t),this.#t=t}if(!this.#e){let t=document.createElement("div");t.setAttribute("data-tour-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#p),document.body.appendChild(t),this.#e=t}this.#s=()=>this.#f(),this.#r=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#r,!0),this.#n=t=>{this.active&&(t.key==="Escape"?(t.preventDefault(),this.skip()):t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.previous()))},document.addEventListener("keydown",this.#n)}#h(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#r&&window.removeEventListener("scroll",this.#r,!0),this.#n&&document.removeEventListener("keydown",this.#n),this.#s=this.#r=this.#n=null;try{this.#e?.hidePopover?.()}catch{}this.#e?.removeEventListener("click",this.#p),this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null}#u(){let t=this.#a[this.step];if(!t)return;let e=this.#a.length,i=this.step===e-1,r=this.step===0,n=t.getAttribute("title")||"",o=t.getAttribute("placement")||"bottom",a=t.getAttribute("target")||"",l=a?document.querySelector(a):null;this.#d=l,this.#f();let h=`${this.step+1} of ${e}`,c=t.innerHTML;this.#e.innerHTML=`
207
207
  <div data-tour-header>
208
208
  <span data-tour-indicator>${h}</span>
209
209
  <span></span>