@adia-ai/web-components 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/components/card/card.css +1 -1
- package/components/col/col.a2ui.json +1 -1
- package/components/col/col.css +1 -1
- package/components/col/col.d.ts +1 -1
- package/components/col/col.yaml +6 -3
- package/components/grid/grid.a2ui.json +1 -1
- package/components/grid/grid.css +4 -3
- package/components/grid/grid.d.ts +1 -1
- package/components/grid/grid.yaml +5 -3
- package/components/menu/menu.class.js +14 -2
- package/components/row/row.a2ui.json +1 -1
- package/components/row/row.css +6 -4
- package/components/row/row.d.ts +1 -1
- package/components/row/row.yaml +4 -2
- package/components/stat/stat.css +1 -1
- package/components/swiper/swiper.css +1 -1
- package/components/tree/tree.class.js +89 -16
- package/components/tree/tree.test.js +49 -0
- package/core/template.js +9 -0
- package/core/template.test.js +36 -0
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +3 -3
- package/package.json +1 -1
- package/styles/api/sizing.css +52 -16
- package/styles/foundation/space.css +20 -4
- package/styles/prose.css +7 -4
- package/styles/type/roles.css +5 -0
- package/styles/typography.css +1 -1
|
@@ -7,7 +7,7 @@ var tA=Object.defineProperty;var V=(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=r.name;l[0]==="@"?(n.removeAttribute(l),e[a]={t:"e",n,name:l.slice(1),c:void 0,_fx:null}):l[0]==="."?(n.removeAttribute(l),e[a]={t:"p",n,name:BO(n,l.slice(1)),c:void 0,_fx:null,_resolved:!1}):l[0]==="?"?(n.removeAttribute(l),console.warn(`[template] Lit-style boolean attribute "${l}=" is not supported.
|
|
8
8
|
Element: <${n.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,name:l,c:void 0,_fx:null}}return e}function zl(s){for(let t of s)t&&t._fx&&(t._fx(),t._fx=null)}function zu(s){if(s.n.nodeType===1&&s.n[Bu])return s.n;let t=document.createElement("span");return t.style.display="contents",t[Bu]=!0,s.n.replaceWith(t),s.n=t,t}function Vu(s,t){if(t!==s.c){if(s.t==="n")if(t!=null&&t._directive)t._commit(zu(s));else if(jO(t))Hs(t,zu(s));else if(Array.isArray(t)){let e=zu(s);e.replaceChildren();for(let i of t)if(jO(i)){let n=document.createElement("span");n.style.display="contents",e.appendChild(n),Hs(i,n)}else e.appendChild(document.createTextNode(i??""))}else if(t instanceof Node)s.n.replaceWith(t),s.n=t;else if(s.n[Bu]){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=BO(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 fA(s,t){for(let e=0;e<s.length;e++){let i=s[e];if(!i)continue;let n=t[e],r=i.t!=="e"&&typeof n=="function",o=!r&&i.t!=="e"&&Nu(n);if(i._fx&&!r&&!o&&(i._fx(),i._fx=null),r){i._fx||(i._fx=rs(()=>Vu(i,n())));continue}if(o){i._fx||(i._fx=rs(()=>Vu(i,n.value)));continue}Vu(i,n)}}function pA(s,t,e){return{_directive:!0,_commit(i){let n=i[Ks]||new Map,r=new Map,o=[];for(let l=0;l<s.length;l++){let h=t(s[l],l);if(r.has(h))continue;o.push(h);let c=e(s[l],l);if(n.has(h)){let u=n.get(h);Hs(c,u),r.set(h,u)}else{let u=document.createElement("span");u.style.display="contents",Hs(c,u),r.set(h,u)}}for(let[l,h]of n)r.has(l)||(h._i&&zl(h._i.p),h.remove());let a=null;for(let l=o.length-1;l>=0;l--){let h=r.get(o[l]);(h.nextSibling!==a||h.parentNode!==i)&&i.insertBefore(h,a),a=h}i[Ks]=r}}}var Bu,Ks,qO,NO,Bl,da,zO,jO,_O,ju=V(()=>{"use strict";je();[Bu,Ks]=[Symbol(),Symbol()];qO=new WeakMap;NO={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"};Bl="http://www.w3.org/2000/svg",da="http://www.w3.org/1998/Math/MathML",zO="http://www.w3.org/1999/xhtml";jO=s=>s!=null&&typeof s=="object"&&s.strings,_O=s=>typeof s=="function"||s!=null&&typeof s.handleEvent=="function"});function YO(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(!WO.has(s.category))throw new Error(`Trait "${s.name}" has unknown category "${s.category}". Known: ${[...WO].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(n,r){i=s.setup({host:n,...r||{}})},disconnect(n){i&&(i(),i=null);for(let r of t.attributes)n.hasAttribute(r)&&(console.warn(`Trait "${t.name}": attribute "${r}" still present after disconnect`),n.removeAttribute(r))}}}return e.schema=t,Vl.set(s.name,e),e}function FO(s){return Vl.get(s)||null}function SI(s){return Vl.get(s)?.schema||null}function wI(){return[...Vl.keys()]}var Vl,WO,_u=V(()=>{"use strict";Vl=new Map,WO=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"])});function mA(s,t){s[fa]=new Map,s[Wu]=new Map;for(let[e,i]of Object.entries(t)){let n=i.attribute??e.toLowerCase(),r=i.type??String,o=Ii(i.default??void 0);s[Wu].set(e,o),Object.defineProperty(s,e,{get(){return o.value},set(a){let l=o.peek();Object.is(l,a)||(s[fa].set(e,l),o.value=a,i.reflect&&gA(s,n,a,r))},configurable:!0})}}function gA(s,t,e,i){i===Boolean?e?s.setAttribute(t,""):s.removeAttribute(t):e==null?s.removeAttribute(t):s.setAttribute(t,String(e))}function bA(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 n=document.createElement("template");n.innerHTML=i,s._pp[e]=n.content.firstElementChild}}var Wu,fa,OA,k,Q=V(()=>{"use strict";je();ju();je();ju();_u();Wu=Symbol(),fa=Symbol();OA=(s,t)=>t===Boolean?s!==null:t===Number?s===null?null:+s:s;k=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;#n=null;#r=null;#a=Ii(0);constructor(){super(),this.internals=this.attachInternals(),mA(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),bA(t),UO(t),Tt(()=>this.connected()),this.#t.push(rs(()=>{for(let i of this[Wu].values())i.value;this.#a.value;let e=t.template(this);if(e&&Hs(e,this),this.render(),this[fa].size){let i=new Map(this[fa]);this[fa].clear(),this.updated(i)}},{host:this.localName,onError:this.onError?e=>this.onError(e):null})),this.#r||(this.#r=new Set);for(let e of t.traits)this.#l(e);this.#c(),this.#s&&this.#o()}disconnectedCallback(){this._i&&zl(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.#r?.clear(),this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.disconnected()}#o(){let t=this.#s;t.connect?.(this),this.#n=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#s}set controller(t){this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.#s=t,t&&this.isConnected&&this.#o()}#l(t,{declarative:e=!1}={}){this.#r.add(t);let i=t();i.connect(this,{host:this,signal:Ii,computed:qu,effect:rs}),e&&(i._declarative=!0),this.#e.push(i)}addTrait(t){return this.#r||(this.#r=new Set),this.#r.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=FO(e);if(!i){console.warn(`<${this.localName}> traits="${e}" \u2014 trait not found. Did you forget to import it?`);continue}this.#r.has(i)||this.#l(i,{declarative:!0})}}#h(){if(!this.#r)return;let t=[];for(let e of this.#e)if(e._declarative){e.disconnect(this);for(let i of this.#r)if(i.schema?.name&&e.schema?.name===i.schema.name){this.#r.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[n,r]of Object.entries(this.constructor.properties))if((r.attribute??n.toLowerCase())===t){this[n]=OA(i,r.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[n,r]of Object.entries(t))i[n]=r;return i}signal(t){let e=Ii(t);return this.#i.push(e),e}ensure(t){for(let r of this.children)if(r.getAttribute("slot")===t)return r;let e=this.#u(t);if(e)return e;UO(this.constructor);let i=this.constructor._pp?.[t];if(!i)return null;let n=i.cloneNode(!0);return n._uiPart=!0,this.appendChild(n),n}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,n=!0;for(;i&&i!==this;){if(i.localName.includes("-")){n=!1;break}i=i.parentElement}if(n&&i===this)return e}return null}reconcile(t,e,i,n){let r=t[Ks]||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=r.get(u);d?n(c,h,d):d=n(c,h,null),o.set(u,d),a.push(u)}for(let[h,c]of r)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[Ks]=o}connected(){}render(){}disconnected(){}updated(t){}}});function Sb(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 xa(s,t,e,i){for(var n;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 oe&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:K.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof oe&&o.index<0&&((n=a.enter(t,e,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=a);for(;;){let o=s.enter(t,e,r);if(!o)return s;s=o}}function wb(s,t,e,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(t)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function ud(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 kb(s){if(!s.length)return null;let t=0,e=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>e.from||o.to<e.to)&&(e=o,t=r)}let i=e instanceof oe&&e.index<0?null:e.parent,n=s.slice();return i?n[t]=i:n.splice(t,1),new fd(n,e)}function E$(s,t,e){let i=s.resolveInner(t,e),n=null;for(let r=i instanceof oe?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(t,e)),r=o}else{let o=ci.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new oe(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(xa(a,t,e,!1))}}return n?kb(n):i}function pd(s){return s.children.some(t=>t instanceof ui||!t.type.isAnonymous||pd(t))}function P$(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(e)?new cd(e,e.length):e,l=i.types,h=0,c=0;function u(w,$,A,E,L,P){let{id:X,start:D,end:_,size:W}=a,Y=c,et=h;if(W<0)if(a.next(),W==-1){let $t=r[X];A.push($t),E.push(D-w);return}else if(W==-3){h=X;return}else if(W==-4){c=X;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ot=l[X],gt,ft,xt=D-w;if(_-D<=n&&(ft=O(a.pos-$,L))){let $t=new Uint16Array(ft.size-ft.skip),St=a.pos-ft.size,_t=$t.length;for(;a.pos>St;)_t=g(ft.start,$t,_t);gt=new ui($t,_-ft.start,i),xt=ft.start-w}else{let $t=a.pos-W;a.next();let St=[],_t=[],Wt=X>=o?X:-1,Ri=0,is=_;for(;a.pos>$t;)Wt>=0&&a.id==Wt&&a.size>=0?(a.end<=is-n&&(p(St,_t,D,Ri,a.end,is,Wt,Y,et),Ri=St.length,is=a.end),a.next()):P>2500?d(D,$t,St,_t):u(D,$t,St,_t,Wt,P+1);if(Wt>=0&&Ri>0&&Ri<St.length&&p(St,_t,D,Ri,D,is,Wt,Y,et),St.reverse(),_t.reverse(),Wt>-1&&Ri>0){let AO=f(ot,et);gt=md(ot,St,_t,0,St.length,0,_-D,AO,AO)}else gt=m(ot,St,_t,_-D,Y-_,et)}A.push(gt),E.push(xt)}function d(w,$,A,E){let L=[],P=0,X=-1;for(;a.pos>$;){let{id:D,start:_,end:W,size:Y}=a;if(Y>4)a.next();else{if(X>-1&&_<X)break;X<0&&(X=W-n),L.push(D,_,W),P++,a.next()}}if(P){let D=new Uint16Array(P*4),_=L[L.length-2];for(let W=L.length-3,Y=0;W>=0;W-=3)D[Y++]=L[W],D[Y++]=L[W+1]-_,D[Y++]=L[W+2]-_,D[Y++]=Y;A.push(new ui(D,L[2]-_,i)),E.push(_-w)}}function f(w,$){return(A,E,L)=>{let P=0,X=A.length-1,D,_;if(X>=0&&(D=A[X])instanceof F){if(!X&&D.type==w&&D.length==L)return D;(_=D.prop(B.lookAhead))&&(P=E[X]+D.length+_)}return m(w,A,E,L,P,$)}}function p(w,$,A,E,L,P,X,D,_){let W=[],Y=[];for(;w.length>E;)W.push(w.pop()),Y.push($.pop()+A-L);w.push(m(i.types[X],W,Y,P-L,D-P,_)),$.push(L-A)}function m(w,$,A,E,L,P,X){if(P){let D=[B.contextHash,P];X=X?[D].concat(X):[D]}if(L>25){let D=[B.lookAhead,L];X=X?[D].concat(X):[D]}return new F(w,$,A,E,X)}function O(w,$){let A=a.fork(),E=0,L=0,P=0,X=A.end-n,D={size:0,start:0,skip:0};t:for(let _=A.pos-w;A.pos>_;){let W=A.size;if(A.id==$&&W>=0){D.size=E,D.start=L,D.skip=P,P+=4,E+=4,A.next();continue}let Y=A.pos-W;if(W<0||Y<_||A.start<X)break;let et=A.id>=o?4:0,ot=A.start;for(A.next();A.pos>Y;){if(A.size<0)if(A.size==-3||A.size==-4)et+=4;else break t;else A.id>=o&&(et+=4);A.next()}L=ot,E+=W,P+=et}return($<0||E==w)&&(D.size=E,D.start=L,D.skip=P),D.size>4?D:void 0}function g(w,$,A){let{id:E,start:L,end:P,size:X}=a;if(a.next(),X>=0&&E<o){let D=A;if(X>4){let _=a.pos-(X-4);for(;a.pos>_;)A=g(w,$,A)}$[--A]=D,$[--A]=P-w,$[--A]=L-w,$[--A]=E}else X==-3?h=E:X==-4&&(c=E);return A}let y=[],v=[];for(;a.pos>0;)u(s.start||0,s.bufferStart||0,y,v,-1,0);let S=(t=s.length)!==null&&t!==void 0?t:y.length?v[0]+y[0].length:0;return new F(l[s.topID],y.reverse(),v.reverse(),S)}function Kl(s,t){if(!s.isAnonymous||t instanceof ui||t.type!=s)return 1;let e=Ab.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof F)){e=1;break}e+=Kl(s,i)}Ab.set(t,e)}return e}function md(s,t,e,i,n,r,o,a,l){let h=0;for(let p=i;p<n;p++)h+=Kl(s,t[p]);let c=Math.ceil(h*1.5/8),u=[],d=[];function f(p,m,O,g,y){for(let v=O;v<g;){let S=v,w=m[v],$=Kl(s,p[v]);for(v++;v<g;v++){let A=Kl(s,p[v]);if($+A>=c)break;$+=A}if(v==S+1){if($>c){let A=p[S];f(A.children,A.positions,0,A.children.length,m[S]+y);continue}u.push(p[S])}else{let A=m[v-1]+p[v-1].length-w;u.push(md(s,p,m,S,v,w,A,null,l))}d.push(w+y-r)}}return f(t,e,i,n,0),(a||l)(u,d,o)}function fs(s){return(t,e,i,n)=>new yd(t,s,e,i,n)}function $b(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}function Q$(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 Cb(s,t,e,i,n,r){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),n.push(o-r)}}function T$(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let n=s.tree,r=n.children.indexOf(i),o=n.children[r],a=o.buffer,l=[r];function h(c,u,d,f,p,m){let O=e[m],g=[],y=[];Cb(o,c,O,g,y,f);let v=a[O+1],S=a[O+2];l.push(g.length);let w=m?h(O+4,a[O+3],o.set.types[a[O]],v,S-v,m-1):t.toTree();return g.push(w),y.push(v-f),Cb(o,a[O+3],u,g,y,f),new F(d,g,y,p)}n.children[r]=h(0,a.length,lt.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 oe(u,d+s.from,c,s._tree))}}function Eb(s,t){let e=null,i=t;for(let n=1,r=0;n<s.length;n++){let o=s[n-1].to,a=s[n].from;for(;r<i.length;r++){let l=i[r];if(l.from>=a)break;l.to<=o||(e||(i=e=t.slice()),l.from<o?(e[r]=new re(l.from,o),l.to>a&&e.splice(r+1,0,new re(a,l.to))):l.to>a?e[r--]=new re(a,l.to):e.splice(r--,1))}}return i}function L$(s,t,e,i){let n=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=n==s.length?1e9:o?s[n].to:s[n].from,u=r==t.length?1e9:a?t[r].to:t[r].from;if(o!=a){let d=Math.max(l,e),f=Math.min(c,u,i);d<f&&h.push(new re(d,f))}if(l=Math.min(c,u),l==1e9)break;c==l&&(o?(o=!1,n++):o=!0),u==l&&(a?(a=!1,r++):a=!0)}return h}function Pb(s,t){let e=[];for(let{pos:i,mount:n,frag:r}of s){let o=i+(n.overlay?n.overlay[0].from:0),a=o+n.tree.length,l=Math.max(r.from,o),h=Math.min(r.to,a);if(n.overlay){let c=n.overlay.map(d=>new re(d.from+i,d.to+i)),u=L$(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 We(f,m,n.tree,-o,r.from>=f||r.openStart,r.to<=m||r.openEnd)),p)break;f=u[d].to}}else e.push(new We(l,h,n.tree,-o,r.from>=o||r.openStart,r.to<=a||r.openEnd))}return e}var xd,$$,re,B,ci,C$,lt,Ye,Gl,xb,K,F,cd,ui,Hl,oe,dd,cs,fd,us,Ab,ds,We,Fe,gd,Jl,Od,bd,yd,th,vd,Ze=V(()=>{xd=1024,$$=0,re=class{constructor(t,e){this.from=t,this.to=e}},B=class{constructor(t={}){this.id=$$++,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=lt.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};B.closedBy=new B({deserialize:s=>s.split(" ")}),B.openedBy=new B({deserialize:s=>s.split(" ")}),B.group=new B({deserialize:s=>s.split(" ")}),B.isolate=new B({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),B.contextHash=new B({perNode:!0}),B.lookAhead=new B({perNode:!0}),B.mounted=new B({perNode:!0});ci=class{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[B.mounted.id]}},C$=Object.create(null),lt=class s{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):C$,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new s(t.name||"",e,t.id,i);if(t.props){for(let r of t.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}}return n}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(B.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 n of i.split(" "))e[n]=t[i];return i=>{for(let n=i.prop(B.group),r=-1;r<(n?n.length:0);r++){let o=e[r<0?i.name:n[r]];if(o)return o}}}};lt.none=new lt("",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 n=null;for(let r of t){let o=r(i);if(o){n||(n=Object.assign({},i.props));let a=o[1],l=o[0];l.combine&&l.id in n&&(a=l.combine(n[l.id],a)),n[l.id]=a}}e.push(n?new lt(i.name,n,i.id,i.flags):i)}return new s(e)}},Gl=new WeakMap,xb=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"})(K||(K={}));F=class s{constructor(t,e,i,n,r){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=ci.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let n=i.toString();n&&(e&&(e+=","),e+=n)}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 us(this.topNode,t)}cursorAt(t,e=0,i=0){let n=Gl.get(this)||this.topNode,r=new us(n);return r.moveTo(t,e),Gl.set(this,r._tree),r}get topNode(){return new oe(this,0,0,null)}resolve(t,e=0){let i=xa(Gl.get(this)||this.topNode,t,e,!1);return Gl.set(this,i),i}resolveInner(t,e=0){let i=xa(xb.get(this)||this.topNode,t,e,!0);return xb.set(this,i),i}resolveStack(t,e=0){return E$(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,o=t.mode||0,a=(o&K.IncludeAnonymous)>0;for(let l=this.cursor(o|K.IncludeAnonymous);;){let h=!1;if(l.from<=r&&l.to>=n&&(!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:md(lt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new s(this.type,e,i,n,this.propValues),t.makeTree||((e,i,n)=>new s(lt.none,e,i,n)))}static build(t){return P$(t)}};F.empty=new F(lt.none,[],[],0);cd=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)}},ui=class s{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return lt.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],n=this.set.types[e],r=n.name;if(/\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),t+=4,i==t)return r;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}findChild(t,e,i,n,r){let{buffer:o}=this,a=-1;for(let l=t;l!=e&&!(Sb(r,n,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),o=0;for(let a=t,l=0;a<e;){r[l++]=n[a++],r[l++]=n[a++]-i;let h=r[l++]=n[a++]-i;r[l++]=n[a++]-t,o=Math.max(o,h)}return new s(r,o,this.set)}};Hl=class{cursor(t=0){return new us(this,t)}getChild(t,e=null,i=null){let n=wb(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return wb(this,t,e,i)}resolve(t,e=0){return xa(this,t,e,!1)}resolveInner(t,e=0){return xa(this,t,e,!0)}matchContext(t){return ud(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let n=e.lastChild;if(!n||n.to!=e.to)break;n.type.isError&&n.from==n.to?(i=e,e=n.prevSibling):e=n}return i}get node(){return this}get next(){return this.parent}},oe=class s extends Hl{constructor(t,e,i,n){super(),this._tree=t,this.from=e,this.index=i,this._parent=n}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,n,r=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(!(!(r&K.EnterBracketed&&c instanceof F&&(d=ci.get(c))&&!d.overlay&&d.bracketed&&i>=u&&i<=u+c.length)&&!Sb(n,i,u,u+c.length))){if(c instanceof ui){if(r&K.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,i-u,n);if(f>-1)return new cs(new dd(o,c,t,u),null,f)}else if(r&K.IncludeAnonymous||!c.type.isAnonymous||pd(c)){let f;if(!(r&K.IgnoreMounts)&&(f=ci.get(c))&&!f.overlay)return new s(f.tree,u,t,o);let p=new s(c,u,t,o);return r&K.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?c.children.length-1:0,e,i,n,r)}}}if(r&K.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 n;if(!(i&K.IgnoreOverlays)&&(n=ci.get(this._tree))&&n.overlay){let r=t-this.from,o=i&K.EnterBracketed&&n.bracketed;for(let{from:a,to:l}of n.overlay)if((e>0||o?a<=r:a<r)&&(e<0||o?l>=r:l>r))return new s(n.tree,n.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()}};dd=class{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}},cs=class s extends Hl{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:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new s(this.context,this,r)}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&K.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new s(this.context,this,r)}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,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];t.push(i.slice(n,r,o)),e.push(0)}return new F(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};fd=class{constructor(t,e){this.heads=t,this.node=e}get next(){return kb(this.heads)}};us=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&~K.EnterBracketed,t instanceof oe)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:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return t?t instanceof oe?(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:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}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&K.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&K.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&K.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 n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(n)}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:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let r=e+t,o=t<0?-1:i._tree.children.length;r!=o;r+=t){let a=i._tree.children[r];if(this.mode&K.IncludeAnonymous||a instanceof ui||!a.type.isAnonymous||pd(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 n=this.index,r=this.stack.length;r>=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,i=r+1;break t}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)e=new cs(this.buffer,e,this.stack[n]);return this.bufferNode=new cs(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return ud(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return ud(this._tree,t,n);let o=i[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};Ab=new WeakMap;ds=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof cs?this.setBuffer(t.context.buffer,t.index,e):t instanceof oe&&this.map.set(t.tree,e)}get(t){return t instanceof cs?this.getBuffer(t.context.buffer,t.index):t instanceof oe?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)}},We=class s{constructor(t,e,i,n,r=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?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 n=[new s(0,t.length,t,0,!1,i)];for(let r of e)r.to>t.length&&n.push(r);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=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&&n.push(d),o.to>u)break;o=r<t.length?t[r++]:null}if(!c)break;l=c.toA,h=c.toA-c.toB}return n}},Fe=class{startParse(t,e,i){return typeof t=="string"&&(t=new gd(t)),i=i?i.length?i.map(n=>new re(n.from,n.to)):[new re(0,0)]:[new re(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let r=n.advance();if(r)return r}}},gd=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)}};Jl=class{constructor(t,e,i,n,r,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=n,this.target=r,this.from=o}};Od=class{constructor(t,e,i,n,r,o,a,l){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=r,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}},bd=new B({perNode:!0}),yd=class{constructor(t,e,i,n,r){this.nest=e,this.input=i,this.fragments=n,this.ranges=r,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 n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new F(i.type,i.children,i.positions,i.length,i.propValues.concat([[bd,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[B.mounted.id]=new ci(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 vd(this.fragments),e=null,i=null,n=new us(new oe(this.baseTree,this.ranges[0].from,0,null),K.IncludeAnonymous|K.IgnoreMounts);t:for(let r,o;;){let a=!0,l;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)a=!1;else if(t.hasNode(n)){if(e){let h=e.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.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>=n.from&&d<=n.to&&!e.ranges.some(f=>f.from<d&&f.to>u)&&e.ranges.push({from:u,to:d})}}a=!1}else if(i&&(o=Q$(i.ranges,n.from,n.to)))a=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.from<n.to||!r.overlay)){n.tree||(T$(n),e&&e.depth++,i&&i.depth++);let h=t.findMounts(n.from,r.parser);if(typeof r.overlay=="function")e=new Od(r.parser,r.overlay,h,this.inner.length,n.from,!!r.bracketed,n.tree,e);else{let c=Eb(this.ranges,r.overlay||(n.from<n.to?[new re(n.from,n.to)]:[]));c.length&&$b(c),(c.length||!r.overlay)&&this.inner.push(new Jl(r.parser,c.length?r.parser.startParse(this.input,Pb(h,c),c):r.parser.startParse(""),r.overlay?r.overlay.map(u=>new re(u.from-n.from,u.to-n.from)):null,!!r.bracketed,n.tree,c.length?c[0].from:n.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):a=!1}}else if(e&&(l=e.predicate(n))&&(l===!0&&(l=new re(n.from,n.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&&n.firstChild())e&&e.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break t;if(e&&!--e.depth){let h=Eb(this.ranges,e.ranges);h.length&&($b(h),this.inner.splice(e.index,0,new Jl(e.parser,e.parser.startParse(this.input,Pb(e.mounts,h),h),e.ranges.map(c=>new re(c.from-e.start,c.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}};th=class{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(K.IncludeAnonymous|K.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,K.IgnoreOverlays|K.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 F)e=e.children[0];else break}return!1}},vd=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(bd))!==null&&e!==void 0?e:i.to,this.inner=new th(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(bd))!==null&&t!==void 0?t:e.to,this.inner=new th(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(B.mounted);if(o&&o.parser==e)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=r.to)break;l.tree==this.curFrag.tree&&n.push({frag:l,pos:r.from-l.offset,mount:o})}}}return n}}});function Sa(s,t=Uint16Array){if(typeof s!="string")return s;let e=null;for(let i=0,n=0;i<s.length;){let r=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){r=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}e?e[n++]=r:e=new t(r)}return e}function Tb(s,t,e,i,n,r){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||M$(p,t.token.value,n,r))){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],O=s[p+1]||65536;if(c<m)d=f;else if(c>=O)u=f+1;else{o=s[p+2],t.advance();continue t}}break}}function Lb(s,t,e){for(let i=t,n;(n=s[i])!=65535;i++)if(n==e)return i-t;return-1}function M$(s,t,e,i){let n=Lb(e,i,t);return n<0||Lb(e,i,s)<n}function Mb(s,t,e){let i=s.cursor(K.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 Rb(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 di(s,t){return s[t]|s[t+1]<<16}function R$(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 Ib(s){if(s.external){let t=s.extend?1:0;return(e,i)=>s.external(e,i)<<1|t}return s.get}var eh,ih,Sd,wd,Sr,Qb,sh,Xi,fi,ht,ye,kd,Ad,$d,Cd,Ed,Pd,pi,Ft,ps=V(()=>{Ze();eh=class s{constructor(t,e,i,n,r,o,a,l,h,c=0,u){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=r,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 n=t.parser.context;return new s(t,[],e,i,i,0,[],0,n?new ih(n,n.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,n=t&65535,{parser:r}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),i==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,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;n<r.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[n])===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(n<r.minRepeatTerm||t&131072){let f=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,f,d+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=r.getGoto(f,n,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(n,h)}storeNode(t,e,i,n=4,r=!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(!r||this.pos==i)this.buffer.push(t,e,i,n);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,n>4&&(n-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(t,e,i,n){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let r=t,{parser:o}=this.p;this.pos=n;let a=o.stateFlag(r,1);!a&&(n>i||e<=o.maxNode)&&(this.reducePos=n),this.pushState(r,a?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,n,4)}else this.pos=n,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,n,4)}apply(t,e,i,n){t&65536?this.reduce(t):this.shift(t,e,i,n)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,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),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,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 Sd(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 n=[];for(let r=0,o;r<e.length;r+=2)(o=e[r+1])!=this.state&&this.p.parser.hasAction(o,t)&&n.push(e[r],o);if(this.stack.length<120)for(let r=0;n.length<8&&r<e.length;r+=2){let o=e[r+1];n.some((a,l)=>l&1&&a==o)||n.push(e[r],o)}e=n}let i=[];for(let n=0;n<e.length&&i.length<4;n+=2){let r=e[n+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(e[n],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,n=e&65535,r=this.stack.length-i*3;if(r<0||t.getGoto(this.stack[r],n,!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=(n,r)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;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,r+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 ih(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()}},ih=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Sd=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 n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},wd=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)}};Sr=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Qb=new Sr,sh=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=Qb,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,n=this.rangeIndex,r=this.pos+t;for(;r<i.from;){if(!n)return null;let o=this.ranges[--n];r-=i.from-o.to,i=o}for(;e<0?r>i.to:r>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];r+=o.from-i.to,i=o}return r}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,n;if(e>=0&&e<this.chunk.length)i=this.pos+t,n=this.chunk.charCodeAt(e);else{let r=this.resolveOffset(t,1);if(r==null)return-1;if(i=r,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=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)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}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=Qb,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 n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}},Xi=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;Tb(this.data,t,e,this.id,i.data,i.tokenPrecTable)}};Xi.prototype.contextual=Xi.prototype.fallback=Xi.prototype.extend=!1;fi=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?Sa(t):t}token(t,e){let i=t.pos,n=0;for(;;){let r=t.next<0,o=t.resolveOffset(1,1);if(Tb(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(r||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}};fi.prototype.contextual=Xi.prototype.fallback=Xi.prototype.extend=!1;ht=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};ye=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),kd=null;Ad=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?Mb(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Mb(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],n=this.index[e];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[n],o=this.start[e]+i.positions[n];if(o>t)return this.nextStart=o,null;if(r instanceof F){if(o==t){if(o<this.safeFrom)return null;let a=o+r.length;if(a<=this.safeTo){let l=r.prop(B.lookAhead);if(!l||a+l<this.fragment.to)return r}}this.index[e]++,o+r.length>=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}},$d=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new Sr)}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:r}=n,o=n.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let h=0;h<r.length;h++){if((1<<h&o)==0)continue;let c=r[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 Sr,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 Sr,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:r}=i.p;for(let o=0;o<r.specialized.length;o++)if(r.specialized[o]==t.value){let a=r.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(n+1)}putAction(t,e,i,n){for(let r=0;r<n;r+=3)if(this.actions[r]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=i,n}addActions(t,e,i,n){let{state:r}=t,{parser:o}=t.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(r,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=di(a,h+2);else{n==0&&a[h+1]==2&&(n=this.putAction(di(a,h+2),e,i,n));break}a[h]==e&&(n=this.putAction(di(a,h+1),e,i,n))}return n}},Cd=class{constructor(t,e,i,n){this.parser=t,this.input=e,this.ranges=n,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 sh(e,n),this.tokens=new $d(t,this.stream),this.topTerm=t.top[1];let{from:r}=n[0];this.stacks=[eh.start(this,t.top[0],r)],this.fragments=i.length&&this.stream.end-r>t.bufferLength*4?new Ad(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],n,r;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;{n||(n=[],r=[]),n.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=n&&R$(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&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&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,r,i);if(o)return ye&&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 n=t.pos,{parser:r}=this,o=ye?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&n>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(n);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?r.getGoto(t.state,u.type.id):-1;if(d>-1&&u.length&&(!h||(u.prop(B.contextHash)||0)==c))return t.useNode(u,d),ye&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(u.type.id)})`),!0;if(!(u instanceof F)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof F&&u.positions[0]==0)u=f;else break}}let a=r.stateSlot(t.state,4);if(a>0)return t.reduce(a),ye&&console.log(o+this.stackID(t)+` (via always-reduce ${r.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),ye&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${r.getName(c&65535)}`} for ${r.getName(u)} @ ${n}${p==t?"":", split"})`),f)return!0;p.pos>n?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 Rb(t,e),!0}}runRecovery(t,e,i){let n=null,r=!1;for(let o=0;o<t.length;o++){let a=t[o],l=e[o<<1],h=e[(o<<1)+1],c=ye?this.stackID(a)+" -> ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),ye&&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()&&(ye&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));f++)ye&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))ye&&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),ye&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Rb(a,i)):(!n||n.score<u.score)&&(n=u)}return n}stackToTree(t){return t.close(),F.build({buffer:wd.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=(kd||(kd=new WeakMap)).get(t);return e||kd.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};Ed=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||this.disabled[t]==0}},Pd=s=>s,pi=class{constructor(t){this.start=t.start,this.shift=t.shift||Pd,this.reduce=t.reduce||Pd,this.reuse=t.reuse||Pd,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},Ft=class s extends Fe{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]),n=[];for(let a=0;a<e.length;a++)n.push([]);function r(a,l,h){n[a].push([l,l.deserialize(String(h))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=B[l]);for(let h=1;h<a.length;){let c=a[h++];if(c>=0)r(c,l,a[h++]);else{let u=a[h+-c];for(let d=-c;d>0;d--)r(a[h++],l,u);h++}}}this.nodeSet=new Ye(e.map((a,l)=>lt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[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=Sa(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(Ib),this.states=Sa(t.states,Uint32Array),this.data=Sa(t.stateData),this.goto=Sa(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new Xi(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 n=new Cd(this,t,e,i);for(let r of this.wrappers)n=r(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let r=n[e+1];;){let o=n[r++],a=o&1,l=n[r++];if(a&&i)return l;for(let h=r+(o>>1);r<h;r++)if(n[r]==t)return l;if(a)return-1}}hasAction(t,e){let i=this.data;for(let n=0;n<2;n++)for(let r=this.stateSlot(t,n?2:1),o;;r+=3){if((o=i[r])==65535)if(i[r+1]==1)o=i[r=di(i,r+2)];else{if(i[r+1]==2)return di(i,r+2);break}if(o==e||o==0)return di(i,r+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),n=i?e(i):void 0;for(let r=this.stateSlot(t,1);n==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=di(this.data,r+2);else break;n=e(di(this.data,r+1))}return n}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=di(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];e.some((r,o)=>o&1&&r==n)||e.push(this.data[i],n)}}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 n=t.tokenizers.find(r=>r.from==i);return n?n.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,n)=>{let r=t.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return e.specializers[n]=Ib(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 r of t.split(" ")){let o=e.indexOf(r);o>=0&&(i[o]=!0)}let n=null;for(let r=0;r<e.length;r++)if(!i[r])for(let o=this.dialects[e[r]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new Ed(t,i,n)}static deserialize(t){return new s(t)}}});function X$(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function Z$(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,n=t.length;i<n;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function Ct(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let n of e.split(" "))if(n){let r=[],o=2,a=n;for(let u=0;;){if(a=="..."&&u>0&&u+3==n.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+n);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==n.length)break;let f=n[u++];if(u==n.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+n);a=n.slice(u)}let l=r.length-1,h=r[l];if(!h)throw new RangeError("Invalid path: "+n);let c=new ms(i,o,l>0?r.slice(0,l):null);t[h]=c.sort(t[h])}}return Db.add(t)}function lh(s,t){let e=Object.create(null);for(let r of s)if(!Array.isArray(r.tag))e[r.tag.id]=r.class;else for(let o of r.tag)e[o.id]=r.class;let{scope:i,all:n=null}=t||{};return{style:r=>{let o=n;for(let a of r)for(let l of a.set){let h=e[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function q$(s,t){let e=null;for(let i of s){let n=i.style(t);n&&(e=e?e+" "+n:n)}return e}function hh(s,t,e,i=0,n=s.length){let r=new Qd(i,Array.isArray(t)?t:[t],e);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}function N$(s,t,e,i,n,r=0,o=s.length){let a=r;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,name:l,c:void 0,_fx:null}}return e}function zl(s){for(let t of s)t&&t._fx&&(t._fx(),t._fx=null)}function zu(s){if(s.n.nodeType===1&&s.n[Bu])return s.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[Bu]=!0,s.n.replaceWith(t),s.n=t,t}function Vu(s,t){if(t!==s.c){if(s.t==="n")if(t!=null&&t._directive)t._commit(zu(s));else if(jO(t))Hs(t,zu(s));else if(Array.isArray(t)){let e=zu(s);e.replaceChildren();for(let i of t)if(jO(i)){let n=document.createElement("span");n.style.display="contents",n.setAttribute("role","presentation"),e.appendChild(n),Hs(i,n)}else e.appendChild(document.createTextNode(i??""))}else if(t instanceof Node)s.n.replaceWith(t),s.n=t;else if(s.n[Bu]){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=BO(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 fA(s,t){for(let e=0;e<s.length;e++){let i=s[e];if(!i)continue;let n=t[e],r=i.t!=="e"&&typeof n=="function",o=!r&&i.t!=="e"&&Nu(n);if(i._fx&&!r&&!o&&(i._fx(),i._fx=null),r){i._fx||(i._fx=rs(()=>Vu(i,n())));continue}if(o){i._fx||(i._fx=rs(()=>Vu(i,n.value)));continue}Vu(i,n)}}function pA(s,t,e){return{_directive:!0,_commit(i){let n=i[Ks]||new Map,r=new Map,o=[];for(let l=0;l<s.length;l++){let h=t(s[l],l);if(r.has(h))continue;o.push(h);let c=e(s[l],l);if(n.has(h)){let u=n.get(h);Hs(c,u),r.set(h,u)}else{let u=document.createElement("span");u.style.display="contents",u.setAttribute("role","presentation"),Hs(c,u),r.set(h,u)}}for(let[l,h]of n)r.has(l)||(h._i&&zl(h._i.p),h.remove());let a=null;for(let l=o.length-1;l>=0;l--){let h=r.get(o[l]);(h.nextSibling!==a||h.parentNode!==i)&&i.insertBefore(h,a),a=h}i[Ks]=r}}}var Bu,Ks,qO,NO,Bl,da,zO,jO,_O,ju=V(()=>{"use strict";je();[Bu,Ks]=[Symbol(),Symbol()];qO=new WeakMap;NO={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"};Bl="http://www.w3.org/2000/svg",da="http://www.w3.org/1998/Math/MathML",zO="http://www.w3.org/1999/xhtml";jO=s=>s!=null&&typeof s=="object"&&s.strings,_O=s=>typeof s=="function"||s!=null&&typeof s.handleEvent=="function"});function YO(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(!WO.has(s.category))throw new Error(`Trait "${s.name}" has unknown category "${s.category}". Known: ${[...WO].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(n,r){i=s.setup({host:n,...r||{}})},disconnect(n){i&&(i(),i=null);for(let r of t.attributes)n.hasAttribute(r)&&(console.warn(`Trait "${t.name}": attribute "${r}" still present after disconnect`),n.removeAttribute(r))}}}return e.schema=t,Vl.set(s.name,e),e}function FO(s){return Vl.get(s)||null}function SI(s){return Vl.get(s)?.schema||null}function wI(){return[...Vl.keys()]}var Vl,WO,_u=V(()=>{"use strict";Vl=new Map,WO=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"])});function mA(s,t){s[fa]=new Map,s[Wu]=new Map;for(let[e,i]of Object.entries(t)){let n=i.attribute??e.toLowerCase(),r=i.type??String,o=Ii(i.default??void 0);s[Wu].set(e,o),Object.defineProperty(s,e,{get(){return o.value},set(a){let l=o.peek();Object.is(l,a)||(s[fa].set(e,l),o.value=a,i.reflect&&gA(s,n,a,r))},configurable:!0})}}function gA(s,t,e,i){i===Boolean?e?s.setAttribute(t,""):s.removeAttribute(t):e==null?s.removeAttribute(t):s.setAttribute(t,String(e))}function bA(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 n=document.createElement("template");n.innerHTML=i,s._pp[e]=n.content.firstElementChild}}var Wu,fa,OA,k,Q=V(()=>{"use strict";je();ju();je();ju();_u();Wu=Symbol(),fa=Symbol();OA=(s,t)=>t===Boolean?s!==null:t===Number?s===null?null:+s:s;k=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;#n=null;#r=null;#a=Ii(0);constructor(){super(),this.internals=this.attachInternals(),mA(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),bA(t),UO(t),Tt(()=>this.connected()),this.#t.push(rs(()=>{for(let i of this[Wu].values())i.value;this.#a.value;let e=t.template(this);if(e&&Hs(e,this),this.render(),this[fa].size){let i=new Map(this[fa]);this[fa].clear(),this.updated(i)}},{host:this.localName,onError:this.onError?e=>this.onError(e):null})),this.#r||(this.#r=new Set);for(let e of t.traits)this.#l(e);this.#c(),this.#s&&this.#o()}disconnectedCallback(){this._i&&zl(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.#r?.clear(),this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.disconnected()}#o(){let t=this.#s;t.connect?.(this),this.#n=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#s}set controller(t){this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.#s=t,t&&this.isConnected&&this.#o()}#l(t,{declarative:e=!1}={}){this.#r.add(t);let i=t();i.connect(this,{host:this,signal:Ii,computed:qu,effect:rs}),e&&(i._declarative=!0),this.#e.push(i)}addTrait(t){return this.#r||(this.#r=new Set),this.#r.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=FO(e);if(!i){console.warn(`<${this.localName}> traits="${e}" \u2014 trait not found. Did you forget to import it?`);continue}this.#r.has(i)||this.#l(i,{declarative:!0})}}#h(){if(!this.#r)return;let t=[];for(let e of this.#e)if(e._declarative){e.disconnect(this);for(let i of this.#r)if(i.schema?.name&&e.schema?.name===i.schema.name){this.#r.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[n,r]of Object.entries(this.constructor.properties))if((r.attribute??n.toLowerCase())===t){this[n]=OA(i,r.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[n,r]of Object.entries(t))i[n]=r;return i}signal(t){let e=Ii(t);return this.#i.push(e),e}ensure(t){for(let r of this.children)if(r.getAttribute("slot")===t)return r;let e=this.#u(t);if(e)return e;UO(this.constructor);let i=this.constructor._pp?.[t];if(!i)return null;let n=i.cloneNode(!0);return n._uiPart=!0,this.appendChild(n),n}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,n=!0;for(;i&&i!==this;){if(i.localName.includes("-")){n=!1;break}i=i.parentElement}if(n&&i===this)return e}return null}reconcile(t,e,i,n){let r=t[Ks]||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=r.get(u);d?n(c,h,d):d=n(c,h,null),o.set(u,d),a.push(u)}for(let[h,c]of r)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[Ks]=o}connected(){}render(){}disconnected(){}updated(t){}}});function Sb(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 xa(s,t,e,i){for(var n;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 oe&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:K.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof oe&&o.index<0&&((n=a.enter(t,e,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=a);for(;;){let o=s.enter(t,e,r);if(!o)return s;s=o}}function wb(s,t,e,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(t)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function ud(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 kb(s){if(!s.length)return null;let t=0,e=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>e.from||o.to<e.to)&&(e=o,t=r)}let i=e instanceof oe&&e.index<0?null:e.parent,n=s.slice();return i?n[t]=i:n.splice(t,1),new fd(n,e)}function E$(s,t,e){let i=s.resolveInner(t,e),n=null;for(let r=i instanceof oe?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(t,e)),r=o}else{let o=ci.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new oe(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(xa(a,t,e,!1))}}return n?kb(n):i}function pd(s){return s.children.some(t=>t instanceof ui||!t.type.isAnonymous||pd(t))}function P$(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(e)?new cd(e,e.length):e,l=i.types,h=0,c=0;function u(w,$,A,E,L,P){let{id:X,start:D,end:_,size:W}=a,Y=c,et=h;if(W<0)if(a.next(),W==-1){let $t=r[X];A.push($t),E.push(D-w);return}else if(W==-3){h=X;return}else if(W==-4){c=X;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ot=l[X],gt,ft,xt=D-w;if(_-D<=n&&(ft=O(a.pos-$,L))){let $t=new Uint16Array(ft.size-ft.skip),St=a.pos-ft.size,_t=$t.length;for(;a.pos>St;)_t=g(ft.start,$t,_t);gt=new ui($t,_-ft.start,i),xt=ft.start-w}else{let $t=a.pos-W;a.next();let St=[],_t=[],Wt=X>=o?X:-1,Ri=0,is=_;for(;a.pos>$t;)Wt>=0&&a.id==Wt&&a.size>=0?(a.end<=is-n&&(p(St,_t,D,Ri,a.end,is,Wt,Y,et),Ri=St.length,is=a.end),a.next()):P>2500?d(D,$t,St,_t):u(D,$t,St,_t,Wt,P+1);if(Wt>=0&&Ri>0&&Ri<St.length&&p(St,_t,D,Ri,D,is,Wt,Y,et),St.reverse(),_t.reverse(),Wt>-1&&Ri>0){let AO=f(ot,et);gt=md(ot,St,_t,0,St.length,0,_-D,AO,AO)}else gt=m(ot,St,_t,_-D,Y-_,et)}A.push(gt),E.push(xt)}function d(w,$,A,E){let L=[],P=0,X=-1;for(;a.pos>$;){let{id:D,start:_,end:W,size:Y}=a;if(Y>4)a.next();else{if(X>-1&&_<X)break;X<0&&(X=W-n),L.push(D,_,W),P++,a.next()}}if(P){let D=new Uint16Array(P*4),_=L[L.length-2];for(let W=L.length-3,Y=0;W>=0;W-=3)D[Y++]=L[W],D[Y++]=L[W+1]-_,D[Y++]=L[W+2]-_,D[Y++]=Y;A.push(new ui(D,L[2]-_,i)),E.push(_-w)}}function f(w,$){return(A,E,L)=>{let P=0,X=A.length-1,D,_;if(X>=0&&(D=A[X])instanceof F){if(!X&&D.type==w&&D.length==L)return D;(_=D.prop(B.lookAhead))&&(P=E[X]+D.length+_)}return m(w,A,E,L,P,$)}}function p(w,$,A,E,L,P,X,D,_){let W=[],Y=[];for(;w.length>E;)W.push(w.pop()),Y.push($.pop()+A-L);w.push(m(i.types[X],W,Y,P-L,D-P,_)),$.push(L-A)}function m(w,$,A,E,L,P,X){if(P){let D=[B.contextHash,P];X=X?[D].concat(X):[D]}if(L>25){let D=[B.lookAhead,L];X=X?[D].concat(X):[D]}return new F(w,$,A,E,X)}function O(w,$){let A=a.fork(),E=0,L=0,P=0,X=A.end-n,D={size:0,start:0,skip:0};t:for(let _=A.pos-w;A.pos>_;){let W=A.size;if(A.id==$&&W>=0){D.size=E,D.start=L,D.skip=P,P+=4,E+=4,A.next();continue}let Y=A.pos-W;if(W<0||Y<_||A.start<X)break;let et=A.id>=o?4:0,ot=A.start;for(A.next();A.pos>Y;){if(A.size<0)if(A.size==-3||A.size==-4)et+=4;else break t;else A.id>=o&&(et+=4);A.next()}L=ot,E+=W,P+=et}return($<0||E==w)&&(D.size=E,D.start=L,D.skip=P),D.size>4?D:void 0}function g(w,$,A){let{id:E,start:L,end:P,size:X}=a;if(a.next(),X>=0&&E<o){let D=A;if(X>4){let _=a.pos-(X-4);for(;a.pos>_;)A=g(w,$,A)}$[--A]=D,$[--A]=P-w,$[--A]=L-w,$[--A]=E}else X==-3?h=E:X==-4&&(c=E);return A}let y=[],v=[];for(;a.pos>0;)u(s.start||0,s.bufferStart||0,y,v,-1,0);let S=(t=s.length)!==null&&t!==void 0?t:y.length?v[0]+y[0].length:0;return new F(l[s.topID],y.reverse(),v.reverse(),S)}function Kl(s,t){if(!s.isAnonymous||t instanceof ui||t.type!=s)return 1;let e=Ab.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof F)){e=1;break}e+=Kl(s,i)}Ab.set(t,e)}return e}function md(s,t,e,i,n,r,o,a,l){let h=0;for(let p=i;p<n;p++)h+=Kl(s,t[p]);let c=Math.ceil(h*1.5/8),u=[],d=[];function f(p,m,O,g,y){for(let v=O;v<g;){let S=v,w=m[v],$=Kl(s,p[v]);for(v++;v<g;v++){let A=Kl(s,p[v]);if($+A>=c)break;$+=A}if(v==S+1){if($>c){let A=p[S];f(A.children,A.positions,0,A.children.length,m[S]+y);continue}u.push(p[S])}else{let A=m[v-1]+p[v-1].length-w;u.push(md(s,p,m,S,v,w,A,null,l))}d.push(w+y-r)}}return f(t,e,i,n,0),(a||l)(u,d,o)}function fs(s){return(t,e,i,n)=>new yd(t,s,e,i,n)}function $b(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}function Q$(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 Cb(s,t,e,i,n,r){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),n.push(o-r)}}function T$(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let n=s.tree,r=n.children.indexOf(i),o=n.children[r],a=o.buffer,l=[r];function h(c,u,d,f,p,m){let O=e[m],g=[],y=[];Cb(o,c,O,g,y,f);let v=a[O+1],S=a[O+2];l.push(g.length);let w=m?h(O+4,a[O+3],o.set.types[a[O]],v,S-v,m-1):t.toTree();return g.push(w),y.push(v-f),Cb(o,a[O+3],u,g,y,f),new F(d,g,y,p)}n.children[r]=h(0,a.length,lt.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 oe(u,d+s.from,c,s._tree))}}function Eb(s,t){let e=null,i=t;for(let n=1,r=0;n<s.length;n++){let o=s[n-1].to,a=s[n].from;for(;r<i.length;r++){let l=i[r];if(l.from>=a)break;l.to<=o||(e||(i=e=t.slice()),l.from<o?(e[r]=new re(l.from,o),l.to>a&&e.splice(r+1,0,new re(a,l.to))):l.to>a?e[r--]=new re(a,l.to):e.splice(r--,1))}}return i}function L$(s,t,e,i){let n=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=n==s.length?1e9:o?s[n].to:s[n].from,u=r==t.length?1e9:a?t[r].to:t[r].from;if(o!=a){let d=Math.max(l,e),f=Math.min(c,u,i);d<f&&h.push(new re(d,f))}if(l=Math.min(c,u),l==1e9)break;c==l&&(o?(o=!1,n++):o=!0),u==l&&(a?(a=!1,r++):a=!0)}return h}function Pb(s,t){let e=[];for(let{pos:i,mount:n,frag:r}of s){let o=i+(n.overlay?n.overlay[0].from:0),a=o+n.tree.length,l=Math.max(r.from,o),h=Math.min(r.to,a);if(n.overlay){let c=n.overlay.map(d=>new re(d.from+i,d.to+i)),u=L$(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 We(f,m,n.tree,-o,r.from>=f||r.openStart,r.to<=m||r.openEnd)),p)break;f=u[d].to}}else e.push(new We(l,h,n.tree,-o,r.from>=o||r.openStart,r.to<=a||r.openEnd))}return e}var xd,$$,re,B,ci,C$,lt,Ye,Gl,xb,K,F,cd,ui,Hl,oe,dd,cs,fd,us,Ab,ds,We,Fe,gd,Jl,Od,bd,yd,th,vd,Ze=V(()=>{xd=1024,$$=0,re=class{constructor(t,e){this.from=t,this.to=e}},B=class{constructor(t={}){this.id=$$++,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=lt.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};B.closedBy=new B({deserialize:s=>s.split(" ")}),B.openedBy=new B({deserialize:s=>s.split(" ")}),B.group=new B({deserialize:s=>s.split(" ")}),B.isolate=new B({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),B.contextHash=new B({perNode:!0}),B.lookAhead=new B({perNode:!0}),B.mounted=new B({perNode:!0});ci=class{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[B.mounted.id]}},C$=Object.create(null),lt=class s{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):C$,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new s(t.name||"",e,t.id,i);if(t.props){for(let r of t.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}}return n}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(B.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 n of i.split(" "))e[n]=t[i];return i=>{for(let n=i.prop(B.group),r=-1;r<(n?n.length:0);r++){let o=e[r<0?i.name:n[r]];if(o)return o}}}};lt.none=new lt("",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 n=null;for(let r of t){let o=r(i);if(o){n||(n=Object.assign({},i.props));let a=o[1],l=o[0];l.combine&&l.id in n&&(a=l.combine(n[l.id],a)),n[l.id]=a}}e.push(n?new lt(i.name,n,i.id,i.flags):i)}return new s(e)}},Gl=new WeakMap,xb=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"})(K||(K={}));F=class s{constructor(t,e,i,n,r){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=ci.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let n=i.toString();n&&(e&&(e+=","),e+=n)}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 us(this.topNode,t)}cursorAt(t,e=0,i=0){let n=Gl.get(this)||this.topNode,r=new us(n);return r.moveTo(t,e),Gl.set(this,r._tree),r}get topNode(){return new oe(this,0,0,null)}resolve(t,e=0){let i=xa(Gl.get(this)||this.topNode,t,e,!1);return Gl.set(this,i),i}resolveInner(t,e=0){let i=xa(xb.get(this)||this.topNode,t,e,!0);return xb.set(this,i),i}resolveStack(t,e=0){return E$(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,o=t.mode||0,a=(o&K.IncludeAnonymous)>0;for(let l=this.cursor(o|K.IncludeAnonymous);;){let h=!1;if(l.from<=r&&l.to>=n&&(!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:md(lt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new s(this.type,e,i,n,this.propValues),t.makeTree||((e,i,n)=>new s(lt.none,e,i,n)))}static build(t){return P$(t)}};F.empty=new F(lt.none,[],[],0);cd=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)}},ui=class s{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return lt.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],n=this.set.types[e],r=n.name;if(/\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),t+=4,i==t)return r;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}findChild(t,e,i,n,r){let{buffer:o}=this,a=-1;for(let l=t;l!=e&&!(Sb(r,n,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),o=0;for(let a=t,l=0;a<e;){r[l++]=n[a++],r[l++]=n[a++]-i;let h=r[l++]=n[a++]-i;r[l++]=n[a++]-t,o=Math.max(o,h)}return new s(r,o,this.set)}};Hl=class{cursor(t=0){return new us(this,t)}getChild(t,e=null,i=null){let n=wb(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return wb(this,t,e,i)}resolve(t,e=0){return xa(this,t,e,!1)}resolveInner(t,e=0){return xa(this,t,e,!0)}matchContext(t){return ud(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let n=e.lastChild;if(!n||n.to!=e.to)break;n.type.isError&&n.from==n.to?(i=e,e=n.prevSibling):e=n}return i}get node(){return this}get next(){return this.parent}},oe=class s extends Hl{constructor(t,e,i,n){super(),this._tree=t,this.from=e,this.index=i,this._parent=n}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,n,r=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(!(!(r&K.EnterBracketed&&c instanceof F&&(d=ci.get(c))&&!d.overlay&&d.bracketed&&i>=u&&i<=u+c.length)&&!Sb(n,i,u,u+c.length))){if(c instanceof ui){if(r&K.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,i-u,n);if(f>-1)return new cs(new dd(o,c,t,u),null,f)}else if(r&K.IncludeAnonymous||!c.type.isAnonymous||pd(c)){let f;if(!(r&K.IgnoreMounts)&&(f=ci.get(c))&&!f.overlay)return new s(f.tree,u,t,o);let p=new s(c,u,t,o);return r&K.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?c.children.length-1:0,e,i,n,r)}}}if(r&K.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 n;if(!(i&K.IgnoreOverlays)&&(n=ci.get(this._tree))&&n.overlay){let r=t-this.from,o=i&K.EnterBracketed&&n.bracketed;for(let{from:a,to:l}of n.overlay)if((e>0||o?a<=r:a<r)&&(e<0||o?l>=r:l>r))return new s(n.tree,n.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()}};dd=class{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}},cs=class s extends Hl{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:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new s(this.context,this,r)}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&K.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new s(this.context,this,r)}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,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];t.push(i.slice(n,r,o)),e.push(0)}return new F(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};fd=class{constructor(t,e){this.heads=t,this.node=e}get next(){return kb(this.heads)}};us=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&~K.EnterBracketed,t instanceof oe)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:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return t?t instanceof oe?(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:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}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&K.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&K.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&K.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 n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(n)}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:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let r=e+t,o=t<0?-1:i._tree.children.length;r!=o;r+=t){let a=i._tree.children[r];if(this.mode&K.IncludeAnonymous||a instanceof ui||!a.type.isAnonymous||pd(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 n=this.index,r=this.stack.length;r>=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,i=r+1;break t}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)e=new cs(this.buffer,e,this.stack[n]);return this.bufferNode=new cs(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return ud(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return ud(this._tree,t,n);let o=i[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};Ab=new WeakMap;ds=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof cs?this.setBuffer(t.context.buffer,t.index,e):t instanceof oe&&this.map.set(t.tree,e)}get(t){return t instanceof cs?this.getBuffer(t.context.buffer,t.index):t instanceof oe?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)}},We=class s{constructor(t,e,i,n,r=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?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 n=[new s(0,t.length,t,0,!1,i)];for(let r of e)r.to>t.length&&n.push(r);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=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&&n.push(d),o.to>u)break;o=r<t.length?t[r++]:null}if(!c)break;l=c.toA,h=c.toA-c.toB}return n}},Fe=class{startParse(t,e,i){return typeof t=="string"&&(t=new gd(t)),i=i?i.length?i.map(n=>new re(n.from,n.to)):[new re(0,0)]:[new re(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let r=n.advance();if(r)return r}}},gd=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)}};Jl=class{constructor(t,e,i,n,r,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=n,this.target=r,this.from=o}};Od=class{constructor(t,e,i,n,r,o,a,l){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=r,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}},bd=new B({perNode:!0}),yd=class{constructor(t,e,i,n,r){this.nest=e,this.input=i,this.fragments=n,this.ranges=r,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 n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new F(i.type,i.children,i.positions,i.length,i.propValues.concat([[bd,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[B.mounted.id]=new ci(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 vd(this.fragments),e=null,i=null,n=new us(new oe(this.baseTree,this.ranges[0].from,0,null),K.IncludeAnonymous|K.IgnoreMounts);t:for(let r,o;;){let a=!0,l;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)a=!1;else if(t.hasNode(n)){if(e){let h=e.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.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>=n.from&&d<=n.to&&!e.ranges.some(f=>f.from<d&&f.to>u)&&e.ranges.push({from:u,to:d})}}a=!1}else if(i&&(o=Q$(i.ranges,n.from,n.to)))a=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.from<n.to||!r.overlay)){n.tree||(T$(n),e&&e.depth++,i&&i.depth++);let h=t.findMounts(n.from,r.parser);if(typeof r.overlay=="function")e=new Od(r.parser,r.overlay,h,this.inner.length,n.from,!!r.bracketed,n.tree,e);else{let c=Eb(this.ranges,r.overlay||(n.from<n.to?[new re(n.from,n.to)]:[]));c.length&&$b(c),(c.length||!r.overlay)&&this.inner.push(new Jl(r.parser,c.length?r.parser.startParse(this.input,Pb(h,c),c):r.parser.startParse(""),r.overlay?r.overlay.map(u=>new re(u.from-n.from,u.to-n.from)):null,!!r.bracketed,n.tree,c.length?c[0].from:n.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):a=!1}}else if(e&&(l=e.predicate(n))&&(l===!0&&(l=new re(n.from,n.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&&n.firstChild())e&&e.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break t;if(e&&!--e.depth){let h=Eb(this.ranges,e.ranges);h.length&&($b(h),this.inner.splice(e.index,0,new Jl(e.parser,e.parser.startParse(this.input,Pb(e.mounts,h),h),e.ranges.map(c=>new re(c.from-e.start,c.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}};th=class{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(K.IncludeAnonymous|K.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,K.IgnoreOverlays|K.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 F)e=e.children[0];else break}return!1}},vd=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(bd))!==null&&e!==void 0?e:i.to,this.inner=new th(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(bd))!==null&&t!==void 0?t:e.to,this.inner=new th(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(B.mounted);if(o&&o.parser==e)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=r.to)break;l.tree==this.curFrag.tree&&n.push({frag:l,pos:r.from-l.offset,mount:o})}}}return n}}});function Sa(s,t=Uint16Array){if(typeof s!="string")return s;let e=null;for(let i=0,n=0;i<s.length;){let r=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){r=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}e?e[n++]=r:e=new t(r)}return e}function Tb(s,t,e,i,n,r){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||M$(p,t.token.value,n,r))){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],O=s[p+1]||65536;if(c<m)d=f;else if(c>=O)u=f+1;else{o=s[p+2],t.advance();continue t}}break}}function Lb(s,t,e){for(let i=t,n;(n=s[i])!=65535;i++)if(n==e)return i-t;return-1}function M$(s,t,e,i){let n=Lb(e,i,t);return n<0||Lb(e,i,s)<n}function Mb(s,t,e){let i=s.cursor(K.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 Rb(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 di(s,t){return s[t]|s[t+1]<<16}function R$(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 Ib(s){if(s.external){let t=s.extend?1:0;return(e,i)=>s.external(e,i)<<1|t}return s.get}var eh,ih,Sd,wd,Sr,Qb,sh,Xi,fi,ht,ye,kd,Ad,$d,Cd,Ed,Pd,pi,Ft,ps=V(()=>{Ze();eh=class s{constructor(t,e,i,n,r,o,a,l,h,c=0,u){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=r,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 n=t.parser.context;return new s(t,[],e,i,i,0,[],0,n?new ih(n,n.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,n=t&65535,{parser:r}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),i==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,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;n<r.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[n])===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(n<r.minRepeatTerm||t&131072){let f=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,f,d+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=r.getGoto(f,n,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(n,h)}storeNode(t,e,i,n=4,r=!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(!r||this.pos==i)this.buffer.push(t,e,i,n);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,n>4&&(n-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(t,e,i,n){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let r=t,{parser:o}=this.p;this.pos=n;let a=o.stateFlag(r,1);!a&&(n>i||e<=o.maxNode)&&(this.reducePos=n),this.pushState(r,a?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,n,4)}else this.pos=n,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,n,4)}apply(t,e,i,n){t&65536?this.reduce(t):this.shift(t,e,i,n)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,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),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,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 Sd(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 n=[];for(let r=0,o;r<e.length;r+=2)(o=e[r+1])!=this.state&&this.p.parser.hasAction(o,t)&&n.push(e[r],o);if(this.stack.length<120)for(let r=0;n.length<8&&r<e.length;r+=2){let o=e[r+1];n.some((a,l)=>l&1&&a==o)||n.push(e[r],o)}e=n}let i=[];for(let n=0;n<e.length&&i.length<4;n+=2){let r=e[n+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(e[n],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,n=e&65535,r=this.stack.length-i*3;if(r<0||t.getGoto(this.stack[r],n,!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=(n,r)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;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,r+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 ih(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()}},ih=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Sd=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 n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},wd=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)}};Sr=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Qb=new Sr,sh=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=Qb,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,n=this.rangeIndex,r=this.pos+t;for(;r<i.from;){if(!n)return null;let o=this.ranges[--n];r-=i.from-o.to,i=o}for(;e<0?r>i.to:r>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];r+=o.from-i.to,i=o}return r}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,n;if(e>=0&&e<this.chunk.length)i=this.pos+t,n=this.chunk.charCodeAt(e);else{let r=this.resolveOffset(t,1);if(r==null)return-1;if(i=r,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=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)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}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=Qb,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 n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}},Xi=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;Tb(this.data,t,e,this.id,i.data,i.tokenPrecTable)}};Xi.prototype.contextual=Xi.prototype.fallback=Xi.prototype.extend=!1;fi=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?Sa(t):t}token(t,e){let i=t.pos,n=0;for(;;){let r=t.next<0,o=t.resolveOffset(1,1);if(Tb(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(r||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}};fi.prototype.contextual=Xi.prototype.fallback=Xi.prototype.extend=!1;ht=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};ye=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),kd=null;Ad=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?Mb(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Mb(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],n=this.index[e];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[n],o=this.start[e]+i.positions[n];if(o>t)return this.nextStart=o,null;if(r instanceof F){if(o==t){if(o<this.safeFrom)return null;let a=o+r.length;if(a<=this.safeTo){let l=r.prop(B.lookAhead);if(!l||a+l<this.fragment.to)return r}}this.index[e]++,o+r.length>=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}},$d=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new Sr)}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:r}=n,o=n.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let h=0;h<r.length;h++){if((1<<h&o)==0)continue;let c=r[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 Sr,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 Sr,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:r}=i.p;for(let o=0;o<r.specialized.length;o++)if(r.specialized[o]==t.value){let a=r.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(n+1)}putAction(t,e,i,n){for(let r=0;r<n;r+=3)if(this.actions[r]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=i,n}addActions(t,e,i,n){let{state:r}=t,{parser:o}=t.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(r,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=di(a,h+2);else{n==0&&a[h+1]==2&&(n=this.putAction(di(a,h+2),e,i,n));break}a[h]==e&&(n=this.putAction(di(a,h+1),e,i,n))}return n}},Cd=class{constructor(t,e,i,n){this.parser=t,this.input=e,this.ranges=n,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 sh(e,n),this.tokens=new $d(t,this.stream),this.topTerm=t.top[1];let{from:r}=n[0];this.stacks=[eh.start(this,t.top[0],r)],this.fragments=i.length&&this.stream.end-r>t.bufferLength*4?new Ad(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],n,r;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;{n||(n=[],r=[]),n.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=n&&R$(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&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&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,r,i);if(o)return ye&&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 n=t.pos,{parser:r}=this,o=ye?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&n>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(n);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?r.getGoto(t.state,u.type.id):-1;if(d>-1&&u.length&&(!h||(u.prop(B.contextHash)||0)==c))return t.useNode(u,d),ye&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(u.type.id)})`),!0;if(!(u instanceof F)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof F&&u.positions[0]==0)u=f;else break}}let a=r.stateSlot(t.state,4);if(a>0)return t.reduce(a),ye&&console.log(o+this.stackID(t)+` (via always-reduce ${r.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),ye&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${r.getName(c&65535)}`} for ${r.getName(u)} @ ${n}${p==t?"":", split"})`),f)return!0;p.pos>n?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 Rb(t,e),!0}}runRecovery(t,e,i){let n=null,r=!1;for(let o=0;o<t.length;o++){let a=t[o],l=e[o<<1],h=e[(o<<1)+1],c=ye?this.stackID(a)+" -> ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),ye&&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()&&(ye&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));f++)ye&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))ye&&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),ye&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Rb(a,i)):(!n||n.score<u.score)&&(n=u)}return n}stackToTree(t){return t.close(),F.build({buffer:wd.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=(kd||(kd=new WeakMap)).get(t);return e||kd.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};Ed=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||this.disabled[t]==0}},Pd=s=>s,pi=class{constructor(t){this.start=t.start,this.shift=t.shift||Pd,this.reduce=t.reduce||Pd,this.reuse=t.reuse||Pd,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},Ft=class s extends Fe{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]),n=[];for(let a=0;a<e.length;a++)n.push([]);function r(a,l,h){n[a].push([l,l.deserialize(String(h))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=B[l]);for(let h=1;h<a.length;){let c=a[h++];if(c>=0)r(c,l,a[h++]);else{let u=a[h+-c];for(let d=-c;d>0;d--)r(a[h++],l,u);h++}}}this.nodeSet=new Ye(e.map((a,l)=>lt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[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=Sa(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(Ib),this.states=Sa(t.states,Uint32Array),this.data=Sa(t.stateData),this.goto=Sa(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new Xi(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 n=new Cd(this,t,e,i);for(let r of this.wrappers)n=r(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let r=n[e+1];;){let o=n[r++],a=o&1,l=n[r++];if(a&&i)return l;for(let h=r+(o>>1);r<h;r++)if(n[r]==t)return l;if(a)return-1}}hasAction(t,e){let i=this.data;for(let n=0;n<2;n++)for(let r=this.stateSlot(t,n?2:1),o;;r+=3){if((o=i[r])==65535)if(i[r+1]==1)o=i[r=di(i,r+2)];else{if(i[r+1]==2)return di(i,r+2);break}if(o==e||o==0)return di(i,r+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),n=i?e(i):void 0;for(let r=this.stateSlot(t,1);n==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=di(this.data,r+2);else break;n=e(di(this.data,r+1))}return n}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=di(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];e.some((r,o)=>o&1&&r==n)||e.push(this.data[i],n)}}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 n=t.tokenizers.find(r=>r.from==i);return n?n.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,n)=>{let r=t.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return e.specializers[n]=Ib(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 r of t.split(" ")){let o=e.indexOf(r);o>=0&&(i[o]=!0)}let n=null;for(let r=0;r<e.length;r++)if(!i[r])for(let o=this.dialects[e[r]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new Ed(t,i,n)}static deserialize(t){return new s(t)}}});function X$(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function Z$(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,n=t.length;i<n;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function Ct(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let n of e.split(" "))if(n){let r=[],o=2,a=n;for(let u=0;;){if(a=="..."&&u>0&&u+3==n.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+n);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==n.length)break;let f=n[u++];if(u==n.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+n);a=n.slice(u)}let l=r.length-1,h=r[l];if(!h)throw new RangeError("Invalid path: "+n);let c=new ms(i,o,l>0?r.slice(0,l):null);t[h]=c.sort(t[h])}}return Db.add(t)}function lh(s,t){let e=Object.create(null);for(let r of s)if(!Array.isArray(r.tag))e[r.tag.id]=r.class;else for(let o of r.tag)e[o.id]=r.class;let{scope:i,all:n=null}=t||{};return{style:r=>{let o=n;for(let a of r)for(let l of a.set){let h=e[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function q$(s,t){let e=null;for(let i of s){let n=i.style(t);n&&(e=e?e+" "+n:n)}return e}function hh(s,t,e,i=0,n=s.length){let r=new Qd(i,Array.isArray(t)?t:[t],e);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}function N$(s,t,e,i,n,r=0,o=s.length){let a=r;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;n(),d=f+1}a=h}}hh(t,e,(h,c,u)=>{l(h,""),l(c,u)},r,o),l(o,"")}function Xb(s){let t=s.type.prop(Db);for(;t&&t.context&&!s.matchContext(t.context);)t=t.next;return t||null}var I$,ae,D$,nh,Db,ms,Qd,R,rh,Zi,Zb,qb,qi,oh,Td,Ue,gs,Ge,He,Ld,wa,ah,b,B$,Ke=V(()=>{Ze();I$=0,ae=class s{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=I$++}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 n=new s(i,[],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(t){let e=new nh(t);return i=>i.modified.indexOf(e)>-1?i:nh.get(i.base||i,i.modified.concat(e).sort((n,r)=>n.id-r.id))}},D$=0,nh=class s{constructor(t){this.name=t,this.instances=[],this.id=D$++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(a=>a.base==t&&X$(e,a.modified));if(i)return i;let n=[],r=new ae(t.name,n,t,e);for(let a of e)a.instances.push(r);let o=Z$(e);for(let a of t.set)if(!a.modified.length)for(let l of o)n.push(s.get(a,l));return r}};Db=new B({combine(s,t){let e,i,n;for(;s||t;){if(!s||t&&s.depth>=t.depth?(n=t,t=t.next):(n=s,s=s.next),e&&e.mode==n.mode&&!n.context&&!e.context)continue;let r=new ms(n.tags,n.mode,n.context);e?e.next=r:i=r,e=r}return i}}),ms=class{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}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}};ms.empty=new ms([],2,null);Qd=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,n,r){let{type:o,from:a,to:l}=t;if(a>=i||l<=e)return;o.isTop&&(r=this.highlighters.filter(f=>!f.scope||f.scope(o)));let h=n,c=Xb(t)||ms.empty,u=q$(r,c.tags);if(u&&(h&&(h+=" "),h+=u,c.mode==1&&(n+=(n?" ":"")+u)),this.startSpan(Math.max(e,a),h),c.opaque)return;let d=t.tree&&t.tree.prop(B.mounted);if(d&&d.overlay){let f=t.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(O=>!O.scope||O.scope(d.tree.type)),m=t.firstChild();for(let O=0,g=a;;O++){let y=O<d.overlay.length?d.overlay[O]:null,v=y?y.from+a:l,S=Math.max(e,g),w=Math.min(i,v);if(S<w&&m)for(;t.from<w&&(this.highlightRange(t,S,w,n,r),this.startSpan(Math.min(w,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&&(n="");do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}};R=ae.define,rh=R(),Zi=R(),Zb=R(Zi),qb=R(Zi),qi=R(),oh=R(qi),Td=R(qi),Ue=R(),gs=R(Ue),Ge=R(),He=R(),Ld=R(),wa=R(Ld),ah=R(),b={comment:rh,lineComment:R(rh),blockComment:R(rh),docComment:R(rh),name:Zi,variableName:R(Zi),typeName:Zb,tagName:R(Zb),propertyName:qb,attributeName:R(qb),className:R(Zi),labelName:R(Zi),namespace:R(Zi),macroName:R(Zi),literal:qi,string:oh,docString:R(oh),character:R(oh),attributeValue:R(oh),number:Td,integer:R(Td),float:R(Td),bool:R(qi),regexp:R(qi),escape:R(qi),color:R(qi),url:R(qi),keyword:Ge,self:R(Ge),null:R(Ge),atom:R(Ge),unit:R(Ge),modifier:R(Ge),operatorKeyword:R(Ge),controlKeyword:R(Ge),definitionKeyword:R(Ge),moduleKeyword:R(Ge),operator:He,derefOperator:R(He),arithmeticOperator:R(He),logicOperator:R(He),bitwiseOperator:R(He),compareOperator:R(He),updateOperator:R(He),definitionOperator:R(He),typeOperator:R(He),controlOperator:R(He),punctuation:Ld,separator:R(Ld),bracket:wa,angleBracket:R(wa),squareBracket:R(wa),paren:R(wa),brace:R(wa),content:Ue,heading:gs,heading1:R(gs),heading2:R(gs),heading3:R(gs),heading4:R(gs),heading5:R(gs),heading6:R(gs),contentSeparator:R(Ue),list:R(Ue),quote:R(Ue),emphasis:R(Ue),strong:R(Ue),link:R(Ue),monospace:R(Ue),strikethrough:R(Ue),inserted:R(),deleted:R(),changed:R(),invalid:R(),meta:ah,documentMeta:R(ah),annotation:R(ah),processingInstruction:R(ah),definition:ae.defineModifier("definition"),constant:ae.defineModifier("constant"),function:ae.defineModifier("function"),standard:ae.defineModifier("standard"),local:ae.defineModifier("local"),special:ae.defineModifier("special")};for(let s in b){let t=b[s];t instanceof ae&&(t.name=s)}B$=lh([{tag:b.link,class:"tok-link"},{tag:b.heading,class:"tok-heading"},{tag:b.emphasis,class:"tok-emphasis"},{tag:b.strong,class:"tok-strong"},{tag:b.keyword,class:"tok-keyword"},{tag:b.atom,class:"tok-atom"},{tag:b.bool,class:"tok-bool"},{tag:b.url,class:"tok-url"},{tag:b.labelName,class:"tok-labelName"},{tag:b.inserted,class:"tok-inserted"},{tag:b.deleted,class:"tok-deleted"},{tag:b.literal,class:"tok-literal"},{tag:b.string,class:"tok-string"},{tag:b.number,class:"tok-number"},{tag:[b.regexp,b.escape,b.special(b.string)],class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.local(b.variableName),class:"tok-variableName tok-local"},{tag:b.definition(b.variableName),class:"tok-variableName tok-definition"},{tag:b.special(b.variableName),class:"tok-variableName2"},{tag:b.definition(b.propertyName),class:"tok-propertyName tok-definition"},{tag:b.typeName,class:"tok-typeName"},{tag:b.namespace,class:"tok-namespace"},{tag:b.className,class:"tok-className"},{tag:b.macroName,class:"tok-macroName"},{tag:b.propertyName,class:"tok-propertyName"},{tag:b.operator,class:"tok-operator"},{tag:b.comment,class:"tok-comment"},{tag:b.meta,class:"tok-meta"},{tag:b.invalid,class:"tok-invalid"},{tag:b.punctuation,class:"tok-punctuation"}])});var z$,Md,Nb=V(()=>{ps();Ke();z$=Ct({String:b.string,Number:b.number,"True False":b.bool,PropertyName:b.propertyName,Null:b.null,", :":b.separator,"[ ]":b.squareBracket,"{ }":b.brace}),Md=Ft.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:[z$],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 V$(s){if(s<768)return!1;for(let t=0,e=ka.length;;){let i=t+e>>1;if(s<ka[i])e=i;else if(s>=Rd[i])t=i+1;else return!0;if(t==e)return!1}}function Bb(s){return s>=127462&&s<=127487}function WB(s){for(let t=0;t<ka.length;t++)if(Rd[t]>s)return ka[t]<=s;return!1}function Yb(s,t,e=!0,i=!0){return(e?Vb:j$)(s,t,i)}function Vb(s,t,e){if(t==s.length)return t;t&&jb(s.charCodeAt(t))&&_b(s.charCodeAt(t-1))&&t--;let i=Id(s,t);for(t+=Wb(i);t<s.length;){let n=Id(s,t);if(i==zb||n==zb||e&&V$(n))t+=Wb(n),i=n;else if(Bb(n)){let r=0,o=t-2;for(;o>=0&&Bb(Id(s,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function j$(s,t,e){for(;t>0;){let i=Vb(s,t-2,e);if(i<t)return i;t--}return 0}function Id(s,t){let e=s.charCodeAt(t);if(!_b(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return jb(i)?(e-55296<<10)+(i-56320)+65536:e}function jb(s){return s>=56320&&s<57344}function _b(s){return s>=55296&&s<56320}function Wb(s){return s<65536?1:2}var ka,Rd,zb,Fb=V(()=>{ka=[],Rd=[];(()=>{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?Rd:ka).push(e=e+s[t])})();zb=8205});function _$(s){let t=-1;for(let e of s)t+=e.length+1;return t}function ch(s,t,e=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let a=s[r],l=n+a.length;l>=e&&(l>i&&(a=a.slice(0,i-n)),n<e&&(a=a.slice(e-n)),o?(t[t.length-1]+=a,o=!1):t.push(a)),n=l+1}return t}function Ub(s,t,e){return ch(s,[""],t,e)}function kr(s,t,e){return t=Math.max(0,Math.min(s.length,t)),[t,Math.max(t,Math.min(s.length,e))]}function yt(s,t,e=!0,i=!0){return Yb(s,t,e,i)}function W$(s){return s>=56320&&s<57344}function Y$(s){return s>=55296&&s<56320}function qt(s,t){let e=s.charCodeAt(t);if(!Y$(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return W$(i)?(e-55296<<10)+(i-56320)+65536:e}function wh(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 Xt(s,t,e,i=!1){if(t==0&&e<=0)return;let n=s.length-2;n>=0&&e<=0&&e==s[n+1]?s[n]+=t:n>=0&&t==0&&s[n]==0?s[n+1]+=e:i?(s[n]+=t,s[n+1]+=e):s.push(t,e)}function Ni(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(H.empty);s.push(e)}}function Xd(s,t,e){let i=s.inserted;for(let n=0,r=0,o=0;o<s.sections.length;){let a=s.sections[o++],l=s.sections[o++];if(l<0)n+=a,r+=a;else{let h=n,c=r,u=H.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(n,h,r,c,u),n=h,r=c}}}function Zd(s,t,e,i=!1){let n=[],r=i?[]:null,o=new bs(s),a=new bs(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);Xt(n,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(Xt(n,a.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&l<o.i&&o.len<=c&&(Xt(n,0,o.ins),r&&Ni(r,n,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;Xt(n,h,l<o.i?o.ins:0),r&&l<o.i&&Ni(r,n,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&a.done)return r?Zt.createSet(n,r):Je.create(n);throw new Error("Mismatched change set lengths")}}}function Gb(s,t,e=!1){let i=[],n=e?[]:null,r=new bs(s),o=new bs(t);for(let a=!1;;){if(r.done&&o.done)return n?Zt.createSet(i,n):Je.create(i);if(r.ins==0)Xt(i,r.len,0,a),r.next();else if(o.len==0&&!o.done)Xt(i,0,o.ins,a),n&&Ni(n,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Xt(i,l,c,a),n&&c&&Ni(n,i,o.text)}else o.ins==-1?(Xt(i,r.off?0:r.len,l,a),n&&Ni(n,i,r.textBit(l))):(Xt(i,r.off?0:r.len,o.off?0:o.ins,a),n&&!o.off&&Ni(n,i,o.text));a=(r.ins>l||o.ins>=0&&o.len>l)&&(a||i.length>h),r.forward2(l),o.forward(l)}}}}function Hb(s,t){for(let e of s.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}function Nd(s,t){return s==t||s.length==t.length&&s.every((e,i)=>e===t[i])}function Kb(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 Bd(s,t){let e=!1;for(let i of t)Ca(s,i)&1&&(e=!0);return e}function F$(s,t,e){let i=e.map(l=>s[l.id]),n=e.map(l=>l.type),r=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=Oh(l,i[c]);if(n[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)Ca(l,h);return l.values[o]=a(l),1},update(l,h){if(!Bd(l,r))return 0;let c=a(l);return t.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,h){let c=Bd(l,i),u=h.config.facets[t.id],d=h.facet(t);if(u&&!c&&Nd(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 Aa(s){return t=>new mh(t,s)}function U$(s,t,e){let i=[[],[],[],[],[]],n=new Map;function r(o,a){let l=n.get(o);if(l!=null){if(l<=a)return;let h=i[l].indexOf(o);h>-1&&i[l].splice(h,1),o instanceof $a&&e.delete(o.compartment)}if(n.set(o,a),Array.isArray(o))for(let h of o)r(h,a);else if(o instanceof $a){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),r(h,a)}else if(o instanceof mh)r(o.inner,o.prec);else if(o instanceof ut)i[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof Ar)i[a].push(o),o.facet.extensions&&r(o.facet.extensions,vs.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.`);r(h,a)}}return r(s,vs.default),i.reduce((o,a)=>o.concat(a))}function Ca(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 n=s.computeSlot(s,s.config.dynamicSlots[e]);return s.status[e]=2|n}function Oh(s,t){return t&1?s.config.staticValues[t>>1]:s.values[t>>1]}function G$(s,t){let e=[];for(let i=0,n=0;;){let r,o;if(i<s.length&&(n==t.length||t[n]>=s[i]))r=s[i++],o=s[i++];else if(n<t.length)r=t[n++],o=t[n++];else return e;!e.length||e[e.length-1]<r?e.push(r,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function ry(s,t,e){var i;let n,r,o;return e?(n=t.changes,r=Zt.empty(t.changes.length),o=s.changes.compose(t.changes)):(n=t.changes.map(s.changes),r=s.changes.mapDesc(t.changes,!0),o=s.changes.compose(n)),{changes:o,selection:t.selection?t.selection.map(r):(i=s.selection)===null||i===void 0?void 0:i.map(n),effects:j.mapEffects(s.effects,n).concat(j.mapEffects(t.effects,r)),annotations:s.annotations.length?s.annotations.concat(t.annotations):t.annotations,scrollIntoView:s.scrollIntoView||t.scrollIntoView}}function Vd(s,t,e){let i=t.selection,n=$r(t.annotations);return t.userEvent&&(n=n.concat(pt.userEvent.of(t.userEvent))),{changes:t.changes instanceof Zt?t.changes:Zt.of(t.changes||[],e,s.facet(ty)),selection:i&&(i instanceof C?i:C.single(i.anchor,i.head)),effects:$r(t.effects),annotations:n,scrollIntoView:!!t.scrollIntoView}}function oy(s,t,e){let i=Vd(s,t.length?t[0]:{},s.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let r=1;r<t.length;r++){t[r].filter===!1&&(e=!1);let o=!!t[r].sequential;i=ry(i,Vd(s,t[r],o?i.changes.newLength:s.doc.length),o)}let n=pt.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return K$(e?H$(n):n)}function H$(s){let t=s.startState,e=!0;for(let n of t.facet(ey)){let r=n(s);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:G$(e,r))}if(e!==!0){let n,r;if(e===!1)r=s.changes.invertedDesc,n=Zt.empty(t.doc.length);else{let o=s.changes.filter(e);n=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}s=pt.create(t,n,s.selection&&s.selection.map(r),j.mapEffects(s.effects,r),s.annotations,s.scrollIntoView)}let i=t.facet(iy);for(let n=i.length-1;n>=0;n--){let r=i[n](s);r instanceof pt?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof pt?s=r[0]:s=oy(t,$r(r),!1)}return s}function K$(s){let t=s.startState,e=t.facet(sy),i=s;for(let n=e.length-1;n>=0;n--){let r=e[n](s);r&&Object.keys(r).length&&(i=ry(i,Vd(t,r,s.changes.newLength),!0))}return i==s?s:pt.create(t,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}function $r(s){return s==null?J$:Array.isArray(s)?s:[s]}function eC(s){if(jd)return jd.test(s);for(let t=0;t<s.length;t++){let e=s[t];if(/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||tC.test(e)))return!0}return!1}function iC(s){return t=>{if(!/\S/.test(t))return ct.Space;if(eC(t))return ct.Word;for(let e=0;e<s.length;e++)if(t.indexOf(s[e])>-1)return ct.Word;return ct.Other}}function Gt(s,t,e={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[r],a=i[r];if(a===void 0)i[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let n in t)i[n]===void 0&&(i[n]=t[n]);return i}function _d(s,t){return s==t||s.constructor==t.constructor&&s.eq(t)}function Wd(s,t){return s.from-t.from||s.value.startSide-t.value.startSide}function sC(s){if(s.length>1)for(let t=s[0],e=1;e<s.length;e++){let i=s[e];if(Wd(t,i)>0)return s.slice().sort(Wd);t=i}return s}function ay(s,t,e){let i=new Map;for(let r of s)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let n=new Set;for(let r of t)for(let o=0;o<r.chunk.length;o++){let a=i.get(r.chunk[o]);a!=null&&(e?e.mapPos(a):a)==r.chunkPos[o]&&!e?.touchesRange(a,a+r.chunk[o].length)&&n.add(r.chunk[o])}return n}function Fd(s,t){for(let e=s[t];;){let i=(t<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1<s.length&&n.compare(s[i+1])>=0&&(n=s[i+1],i++),e.compare(n)<0)break;s[i]=e,s[t]=n,t=i}}function ly(s,t,e,i,n,r){s.goto(t),e.goto(i);let o=i+n,a=i,l=i-t,h=!!r.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&&_d(s.point,e.point)&&Ud(s.activeForPoint(s.to),e.activeForPoint(e.to))||r.comparePoint(a,p,s.point,e.point),c=!1):(c&&r.boundChange(a),p>a&&!Ud(s.active,e.active)&&r.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 Ud(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!=t[e]&&!_d(s[e],t[e]))return!1;return!0}function xh(s,t){for(let e=t,i=s.length-1;e<i;e++)s[e]=s[e+1];s.pop()}function Sh(s,t,e){for(let i=s.length-1;i>=t;i--)s[i+1]=s[i];s[t]=e}function hy(s,t){let e=-1,i=1e9;for(let n=0;n<t.length;n++)(t[n]-i||s[n].endSide-s[e].endSide)<0&&(e=n,i=t[n]);return e}function Nt(s,t,e=s.length){let i=0;for(let n=0;n<e&&n<s.length;)s.charCodeAt(n)==9?(i+=t-i%t,n++):(i++,n=yt(s,n));return i}function Pa(s,t,e,i){for(let n=0,r=0;;){if(r>=t)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?e-r%e:1,n=yt(s,n)}return i===!0?-1:s.length}var H,ve,wr,Os,uh,dh,fh,Dd,bt,Je,Zt,bs,ys,C,qd,I,Ar,ph,ut,vs,le,mh,Bi,$a,gh,Jb,zd,ty,ey,iy,sy,ny,Ut,bh,yh,j,pt,J$,ct,tC,jd,it,xe,Cr,Yd,U,Se,vh,Ea,xs,ti=V(()=>{Fb();H=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]=kr(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),wr.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=kr(this,t,e);let i=[];return this.decompose(t,e,i,0),wr.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),n=new Os(this),r=new Os(t);for(let o=e,a=e;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(a+=n.value.length,n.done||a>=i)return!0}}iter(t=1){return new Os(this,t)}iterRange(t,e=this.length){return new uh(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new dh(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 ve(t):wr.from(ve.split(t,[]))}},ve=class s extends H{constructor(t,e=_$(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.text[r],a=n+o.length;if((e?i:a)>=t)return new fh(n,a,i,o);n=a+1,i++}}decompose(t,e,i,n){let r=t<=0&&e>=this.length?this:new s(Ub(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=i.pop(),a=ch(r.text,o.text.slice(),0,r.length);if(a.length<=32)i.push(new s(a,o.length+r.length));else{let l=a.length>>1;i.push(new s(a.slice(0,l)),new s(a.slice(l)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof s))return super.replace(t,e,i);[t,e]=kr(this,t,e);let n=ch(this.text,ch(i.text,Ub(this.text,0,t)),e),r=this.length+i.length-(e-t);return n.length<=32?new s(n,r):wr.from(s.split(n,[]),r)}sliceString(t,e=this.length,i=`
|
|
12
12
|
`){[t,e]=kr(this,t,e);let n="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let a=this.text[o],l=r+a.length;r>t&&o&&(n+=i),t<l&&e>r&&(n+=a.slice(Math.max(0,t-r),e-r)),r=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let r of t)i.push(r),n+=r.length+1,i.length==32&&(e.push(new s(i,n)),i=[],n=-1);return n>-1&&e.push(new s(i,n)),e}},wr=class s extends H{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,n){for(let r=0;;r++){let o=this.children[r],a=n+o.length,l=i+o.lines-1;if((e?l:a)>=t)return o.lineInner(t,e,i,n);n=a+1,i=l+1}}decompose(t,e,i,n){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let a=this.children[r],l=o+a.length;if(t<=l&&e>=o){let h=n&((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]=kr(this,t,e),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],a=r+o.length;if(t>=r&&e<=a){let l=o.replace(t-r,e-r,i),h=this.lines-o.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let c=this.children.slice();return c[n]=l,new s(c,this.length-(e-t)+i.length)}return super.replace(r,a,l)}r=a+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
|
|
13
13
|
`){[t,e]=kr(this,t,e);let n="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let a=this.children[r],l=o+a.length;o>t&&r&&(n+=i),t<l&&e>o&&(n+=a.sliceString(t-o,e-o,i)),o=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof s))return 0;let i=0,[n,r,o,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,r+=e){if(n==o||r==a)return i;let l=this.children[n],h=t.children[r];if(l!=h)return i+l.scanIdentical(h,e);i+=l.length+1}}static from(t,e=t.reduce((i,n)=>i+n.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 ve(f,e)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,a=[],l=0,h=-1,c=[];function u(f){let p;if(f.lines>r&&f instanceof s)for(let m of f.children)u(m);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof ve&&l&&(p=c[c.length-1])instanceof ve&&f.lines+p.lines<=32?(l+=f.lines,h+=f.length+1,c[c.length-1]=new ve(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>n&&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)}};H.empty=new ve([""],0);Os=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 ve?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,a=n instanceof ve?n.text.length:n.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((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
|
|
@@ -133,7 +133,7 @@ parent-template-re-read pattern that works across frameworks.`);return}if(this.d
|
|
|
133
133
|
<div slot="layer" data-layer="base">${t}</div>
|
|
134
134
|
<div slot="layer" data-layer="fill" aria-hidden="true">${t}</div>
|
|
135
135
|
</div>
|
|
136
|
-
`}this.#t=this.querySelector('[slot="field"]'),this.#e=this.querySelector('[data-layer="base"] [slot="value"]'),this.#t&&this.#t.addEventListener("pointerdown",this.#c),this.addEventListener("keydown",this.#d)}render(){if(!this.#t)return;let t=this.#r(this.value);this.#e&&(this.#e.textContent=t);let e=this.querySelector('[data-layer="fill"] [slot="value"]');e&&(e.textContent=t);let i=this.max-this.min,n=i>0?(this.value-this.min)/i*100:0;this.style.setProperty("--range-fill-pct",`${n}%`),this.setAttribute("aria-valuemin",this.min),this.setAttribute("aria-valuemax",this.max),this.setAttribute("aria-valuenow",this.value),this.setAttribute("aria-valuetext",`${this.value}${this.suffix?" "+this.suffix:""}`),this.setAttribute("aria-label",this.label||""),this.syncValue(String(this.value))}#r(t){let e=(String(this.step).split(".")[1]||"").length;return e>0?t.toFixed(e):String(t)}#a(t){let e=Math.round((t-this.min)/this.step)*this.step+this.min;return Math.max(this.min,Math.min(this.max,parseFloat(e.toFixed(10))))}#o(t){let e=this.#a(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})))}#l(t){let e=this.#t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-e.left)/e.width));return this.#a(this.min+i*(this.max-this.min))}#c=t=>{this.disabled||(t.preventDefault(),this.#o(this.#l(t.clientX)),this.#i=!0,this.#s=t.clientX,this.#n=this.value,this.setAttribute("data-dragging",""),this.#t.setPointerCapture(t.pointerId),this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#u))};#h=t=>{if(!this.#i)return;let e=t.clientX-this.#s,i=this.#t.getBoundingClientRect().width,n=this.max-this.min,r=e/i*n;this.#o(this.#n+r)};#u=t=>{this.#i=!1,this.removeAttribute("data-dragging"),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#h),this.#t.removeEventListener("pointerup",this.#u),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#d=t=>{if(this.disabled)return;let e=this.value;switch(t.key){case"ArrowRight":case"ArrowUp":e+=this.step;break;case"ArrowLeft":case"ArrowDown":e-=this.step;break;case"Home":e=this.min;break;case"End":e=this.max;break;case"PageUp":e+=this.step*10;break;case"PageDown":e-=this.step*10;break;default:return}t.preventDefault(),this.#o(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};disconnected(){super.disconnected(),this.#t?.removeEventListener("pointerdown",this.#c),this.#t?.removeEventListener("pointermove",this.#h),this.#t?.removeEventListener("pointerup",this.#u),this.removeEventListener("keydown",this.#d),this.#t=null,this.#e=null}};x("range-ui",pn);Q();var mn=class extends k{static requiredIcons=["caret-right"];static template=()=>null;connected(){this.setAttribute("role","tree"),this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i)}get selectedItem(){return this.querySelector("tree-item-ui[selected]")}select(t,e=null){let i=this.selectedItem;i&&i!==t&&i.removeAttribute("selected"),t.setAttribute("selected",""),this.dispatchEvent(new CustomEvent("tree-select",{bubbles:!0,detail:{item:t,text:t.text,value:t.value,ctrlKey:!!e?.ctrlKey,metaKey:!!e?.metaKey,shiftKey:!!e?.shiftKey}}))}#t(t){if(!t)return null;if(t instanceof Element)return t.matches?.("tree-item-ui")?t:null;if(typeof t=="string"){let e=t.replace(/"/g,'\\"');return this.querySelector(`tree-item-ui[value="${e}"]`)||this.querySelector(`tree-item-ui[text="${e}"]`)||null}return null}expand(t){let e=this.#t(t);e&&e.hasChildren&&!e.open&&(e.open=!0)}collapse(t){let e=this.#t(t);e&&e.open&&(e.open=!1)}expandAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.hasChildren&&!t.open&&(t.open=!0)}collapseAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.open&&(t.open=!1)}expandTo(t){let e=this.#t(t);if(!e)return;let i=e.parentElement?.closest("tree-item-ui");for(;i;)i.hasChildren&&!i.open&&(i.open=!0),i=i.parentElement?.closest("tree-item-ui");e.querySelector(':scope > [slot="row"]')?.scrollIntoView?.({block:"nearest",inline:"nearest"})}#e=t=>{let e=t.target.closest("tree-item-ui");if(!e||!this.contains(e)||t.target.closest('[slot="actions"] *'))return;let i=e.querySelector(':scope > [slot="row"]');!i||!(t.target===i||i.contains(t.target))||(this.select(e,t),e.hasChildren&&(e.open=!e.open))};#i=t=>{let e=t.target.closest("tree-item-ui");if(e)switch(t.key){case"ArrowRight":if(t.preventDefault(),e.hasChildren&&!e.open)e.open=!0;else{let i=e.querySelector(":scope > tree-item-ui");i&&i.querySelector('[slot="row"]')?.focus()}break;case"ArrowLeft":if(t.preventDefault(),e.hasChildren&&e.open)e.open=!1;else{let i=e.parentElement?.closest("tree-item-ui");i&&i.querySelector(':scope > [slot="row"]')?.focus()}break;case"ArrowDown":{t.preventDefault();let i=this.#s(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"ArrowUp":{t.preventDefault();let i=this.#n(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"Enter":case" ":t.preventDefault(),this.select(e,t);break}};#s(t){if(t.open&&t.hasChildren)return t.querySelector(":scope > tree-item-ui");let e=t;for(;e;){let i=e.nextElementSibling;if(i&&i.matches("tree-item-ui"))return i;e=e.parentElement?.closest("tree-item-ui")}return null}#n(t){let e=t.previousElementSibling;if(e&&e.matches("tree-item-ui")){let n=e;for(;n.open&&n.hasChildren;){let r=n.querySelectorAll(":scope > tree-item-ui");n=r[r.length-1]}return n}return t.parentElement?.closest("tree-item-ui")||null}disconnected(){this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i)}},gn=class extends k{static properties={text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},badge:{type:String,default:"",reflect:!0}};static template=()=>null;get hasChildren(){return this.querySelector(":scope > tree-item-ui")!==null}get depth(){let t=0,e=this.parentElement;for(;e;)e.matches("tree-item-ui")&&t++,e=e.parentElement;return t}connected(){this.setAttribute("role","group"),this.querySelector(':scope > [slot="row"]')||this.#t();let t=this.querySelector(':scope > [slot="row"]');t&&(t.setAttribute("role","treeitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"))}#t(){let t=document.createElement("div");t.setAttribute("slot","row"),t.setAttribute("tabindex","0");let e=this.querySelector(':scope > [slot="caret"]');if(e)t.appendChild(e);else{let o=document.createElement("icon-ui");o.setAttribute("slot","caret"),o.setAttribute("name","caret-right"),t.appendChild(o)}if(this.icon){let o=document.createElement("icon-ui");o.setAttribute("name",this.icon),o.setAttribute("slot","icon"),t.appendChild(o)}let i=document.createElement("span");i.setAttribute("slot","text"),i.textContent=this.text,t.appendChild(i);let n=document.createElement("span");n.setAttribute("slot","badge"),this.badge&&(n.textContent=this.badge),t.appendChild(n);let r=this.querySelectorAll(':scope > [slot="actions"]');if(r.length)for(let o of r)t.appendChild(o);else{let o=document.createElement("span");o.setAttribute("slot","actions"),t.appendChild(o)}this.prepend(t)}render(){let t=this.querySelector(':scope > [slot="row"]');if(!t)return;t.style.paddingInlineStart=`${this.depth*16+4}px`,this.hasChildren?t.setAttribute("aria-expanded",String(this.open)):t.removeAttribute("aria-expanded"),this.selected?t.setAttribute("aria-selected","true"):t.removeAttribute("aria-selected");let e=t.querySelector('[slot="text"]');e&&this.text&&(e.textContent=this.text);let i=t.querySelector('[slot="badge"]');i&&(i.textContent=this.badge||"")}};x("tree-ui",mn),x("tree-item-ui",gn);Q();var On=class extends k{static requiredIcons=["caret-right"];static properties={collapsed:{type:Boolean,default:!1,reflect:!0},resizable:{type:Boolean,default:!1,reflect:!0},minWidth:{type:Number,default:200,attribute:"min-width",reflect:!0},maxWidth:{type:Number,default:9999,attribute:"max-width",reflect:!0},side:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=!1;#i=0;#s=0;#n=null;#r="";#a=!1;connected(){this.#a||(this.#a=!0,this.addEventListener("click",this.#o),this.addEventListener("keydown",this.#l)),this.resizable&&!this.querySelector('[slot="resize"]')&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","resize"),this.appendChild(this.#t)),(this.#t||this.resizable)&&(this.#t=this.#t||this.querySelector('[slot="resize"]'),this.#t?.addEventListener("pointerdown",this.#c))}render(){let t=this.querySelector(":scope > header");if(t&&(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-expanded",String(!this.collapsed)),!t.querySelector('[slot="caret"]'))){let e=document.createElement("icon-ui");e.setAttribute("slot","caret"),e.setAttribute("name","caret-right"),t.append(e)}}toggle(){this.collapsed=!this.collapsed,this.dispatchEvent(new Event("toggle",{bubbles:!0}))}#o=t=>{let e=this.querySelector(":scope > header");e&&(t.target===e||e.contains(t.target))&&this.toggle()};#l=t=>{t.target===this.querySelector(":scope > header")&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.toggle())};#c=t=>{if(t.isPrimary){t.preventDefault(),this.#e=!0,this.#i=t.clientX,this.#s=this.getBoundingClientRect().width,this.#n=t.pointerId,this.setAttribute("data-resizing","");try{this.#t.setPointerCapture(t.pointerId)}catch{}this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#u,{once:!0}),this.#t.addEventListener("pointercancel",this.#u,{once:!0}),this.#r=document.documentElement.style.cursor,document.documentElement.style.cursor="col-resize"}};#h=t=>{if(!this.#e)return;let e=this.side==="trailing"?-1:1,i=(t.clientX-this.#i)*e,n=Math.max(this.minWidth,Math.min(this.maxWidth,this.#s+i));this.style.width=`${n}px`};#u=()=>{if(this.#e){this.#e=!1,this.removeAttribute("data-resizing");try{this.#t?.releasePointerCapture(this.#n)}catch{}this.#n=null,this.#t?.removeEventListener("pointermove",this.#h),document.documentElement.style.cursor=this.#r}};disconnected(){this.removeEventListener("click",this.#o),this.removeEventListener("keydown",this.#l),this.#t?.removeEventListener("pointerdown",this.#c),this.#t?.removeEventListener("pointermove",this.#h),this.#e&&(document.documentElement.style.cursor=this.#r),this.#a=!1}};x("pane-ui",On);Q();var bn=class extends k{static properties={scroll:{type:Boolean,default:!1,reflect:!0},maxWidth:{type:String,default:"",attribute:"max-width",reflect:!0},padding:{type:String,default:"",reflect:!0},stickyHeader:{type:Boolean,default:!1,attribute:"sticky-header",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.stickyHeader&&this.#i()}disconnected(){this.#s()}render(){this.stickyHeader&&!this.#t&&this.#i(),!this.stickyHeader&&this.#t&&this.#s()}#i(){let t=this.querySelector(":scope > :is(header, header-ui)");t&&(this.#t||(this.#t=document.createElement("div"),this.#t.setAttribute("data-page-sentinel",""),this.#t.style.cssText="height: 0; width: 0; pointer-events: none;",t.insertAdjacentElement("beforebegin",this.#t)),this.#e||(this.#e=new IntersectionObserver(e=>{this.toggleAttribute("data-header-stuck",!e[0].isIntersecting)},{threshold:0})),this.#e.observe(this.#t))}#s(){this.#e?.disconnect(),this.#e=null,this.#t?.remove(),this.#t=null,this.removeAttribute("data-header-stuck")}};x("page-ui",bn);Q();var ma=class extends k{static properties={disabled:{type:Boolean,default:!1,reflect:!0},loading:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"Type a message...",reflect:!0},model:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=[];#r=[];#a=null;#o=null;#l=null;#c=()=>this.#o?.click();#h=()=>{this.#o?.files?.length&&this.#m(this.#o.files),this.#o&&(this.#o.value="")};get value(){return this.#t?.value?.trim()??""}get attachments(){return[...this.#r]}set models(t){this.#n=t||[],this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model))}get models(){return this.#n}connected(){this.querySelector('[slot="toolbar"]')||(this.innerHTML=`
|
|
136
|
+
`}this.#t=this.querySelector('[slot="field"]'),this.#e=this.querySelector('[data-layer="base"] [slot="value"]'),this.#t&&this.#t.addEventListener("pointerdown",this.#c),this.addEventListener("keydown",this.#d)}render(){if(!this.#t)return;let t=this.#r(this.value);this.#e&&(this.#e.textContent=t);let e=this.querySelector('[data-layer="fill"] [slot="value"]');e&&(e.textContent=t);let i=this.max-this.min,n=i>0?(this.value-this.min)/i*100:0;this.style.setProperty("--range-fill-pct",`${n}%`),this.setAttribute("aria-valuemin",this.min),this.setAttribute("aria-valuemax",this.max),this.setAttribute("aria-valuenow",this.value),this.setAttribute("aria-valuetext",`${this.value}${this.suffix?" "+this.suffix:""}`),this.setAttribute("aria-label",this.label||""),this.syncValue(String(this.value))}#r(t){let e=(String(this.step).split(".")[1]||"").length;return e>0?t.toFixed(e):String(t)}#a(t){let e=Math.round((t-this.min)/this.step)*this.step+this.min;return Math.max(this.min,Math.min(this.max,parseFloat(e.toFixed(10))))}#o(t){let e=this.#a(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})))}#l(t){let e=this.#t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-e.left)/e.width));return this.#a(this.min+i*(this.max-this.min))}#c=t=>{this.disabled||(t.preventDefault(),this.#o(this.#l(t.clientX)),this.#i=!0,this.#s=t.clientX,this.#n=this.value,this.setAttribute("data-dragging",""),this.#t.setPointerCapture(t.pointerId),this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#u))};#h=t=>{if(!this.#i)return;let e=t.clientX-this.#s,i=this.#t.getBoundingClientRect().width,n=this.max-this.min,r=e/i*n;this.#o(this.#n+r)};#u=t=>{this.#i=!1,this.removeAttribute("data-dragging"),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#h),this.#t.removeEventListener("pointerup",this.#u),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#d=t=>{if(this.disabled)return;let e=this.value;switch(t.key){case"ArrowRight":case"ArrowUp":e+=this.step;break;case"ArrowLeft":case"ArrowDown":e-=this.step;break;case"Home":e=this.min;break;case"End":e=this.max;break;case"PageUp":e+=this.step*10;break;case"PageDown":e-=this.step*10;break;default:return}t.preventDefault(),this.#o(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};disconnected(){super.disconnected(),this.#t?.removeEventListener("pointerdown",this.#c),this.#t?.removeEventListener("pointermove",this.#h),this.#t?.removeEventListener("pointerup",this.#u),this.removeEventListener("keydown",this.#d),this.#t=null,this.#e=null}};x("range-ui",pn);Q();var mn=class extends k{static requiredIcons=["caret-right"];static template=()=>null;connected(){this.setAttribute("role","tree"),this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i)}get selectedItem(){return this.querySelector("tree-item-ui[selected]")}select(t,e=null){let i=this.selectedItem;i&&i!==t&&i.removeAttribute("selected"),t.setAttribute("selected",""),this.dispatchEvent(new CustomEvent("tree-select",{bubbles:!0,detail:{item:t,text:t.text,value:t.value,ctrlKey:!!e?.ctrlKey,metaKey:!!e?.metaKey,shiftKey:!!e?.shiftKey}}))}#t(t){if(!t)return null;if(t instanceof Element)return t.matches?.("tree-item-ui")?t:null;if(typeof t=="string"){let e=t.replace(/"/g,'\\"');return this.querySelector(`tree-item-ui[value="${e}"]`)||this.querySelector(`tree-item-ui[text="${e}"]`)||null}return null}expand(t){let e=this.#t(t);e&&e.hasChildren&&!e.open&&(e.open=!0)}collapse(t){let e=this.#t(t);e&&e.open&&(e.open=!1)}expandAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.hasChildren&&!t.open&&(t.open=!0)}collapseAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.open&&(t.open=!1)}expandTo(t){let e=this.#t(t);if(!e)return;let i=e.parentElement?.closest("tree-item-ui");for(;i;)i.hasChildren&&!i.open&&(i.open=!0),i=i.parentElement?.closest("tree-item-ui");e.querySelector(':scope > [slot="row"]')?.scrollIntoView?.({block:"nearest",inline:"nearest"})}#e=t=>{let e=t.target.closest("tree-item-ui");if(!e||!this.contains(e)||t.target.closest('[slot="actions"] *'))return;let i=e.querySelector(':scope > [slot="row"]');!i||!(t.target===i||i.contains(t.target))||(this.select(e,t),e.hasChildren&&(e.open=!e.open))};#i=t=>{let e=t.target.closest("tree-item-ui");if(e)switch(t.key){case"ArrowRight":if(t.preventDefault(),e.hasChildren&&!e.open)e.open=!0;else{let i=e.querySelector(":scope > tree-item-ui");i&&i.querySelector('[slot="row"]')?.focus()}break;case"ArrowLeft":if(t.preventDefault(),e.hasChildren&&e.open)e.open=!1;else{let i=e.parentElement?.closest("tree-item-ui");i&&i.querySelector(':scope > [slot="row"]')?.focus()}break;case"ArrowDown":{t.preventDefault();let i=this.#s(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"ArrowUp":{t.preventDefault();let i=this.#n(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"Enter":case" ":t.preventDefault(),this.select(e,t);break}};#s(t){if(t.open&&t.hasChildren)return t.querySelector(":scope > tree-item-ui");let e=t;for(;e;){let i=e.nextElementSibling;if(i&&i.matches("tree-item-ui"))return i;e=e.parentElement?.closest("tree-item-ui")}return null}#n(t){let e=t.previousElementSibling;if(e&&e.matches("tree-item-ui")){let n=e;for(;n.open&&n.hasChildren;){let r=n.querySelectorAll(":scope > tree-item-ui");n=r[r.length-1]}return n}return t.parentElement?.closest("tree-item-ui")||null}disconnected(){this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i)}},gn=class extends k{static properties={text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},badge:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=!1;get hasChildren(){return this.querySelector(":scope > tree-item-ui")!==null}get depth(){let t=0,e=this.parentElement;for(;e;)e.matches("tree-item-ui")&&t++,e=e.parentElement;return t}connected(){this.setAttribute("role","group"),this.querySelector(':scope > [slot="row"]')||this.#i();let t=this.querySelector(':scope > [slot="row"]');t&&(t.setAttribute("role","treeitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")),this.#n(),this.#t=new MutationObserver(()=>this.#n()),this.#t.observe(this,{childList:!0,subtree:!0})}#i(){let t=document.createElement("div");t.setAttribute("slot","row"),t.setAttribute("tabindex","0");let e=this.#s("caret")[0];if(e)t.appendChild(e);else{let o=document.createElement("icon-ui");o.setAttribute("slot","caret"),o.setAttribute("name","caret-right"),o.dataset.treeCaretDefault="1",t.appendChild(o)}if(this.icon){let o=document.createElement("icon-ui");o.setAttribute("name",this.icon),o.setAttribute("slot","icon"),t.appendChild(o)}let i=document.createElement("span");i.setAttribute("slot","text"),i.textContent=this.text,t.appendChild(i);let n=document.createElement("span");n.setAttribute("slot","badge"),this.badge&&(n.textContent=this.badge),t.appendChild(n);let r=document.createElement("span");r.setAttribute("slot","actions"),r.dataset.treeActionsPlaceholder="1",t.appendChild(r),this.prepend(t)}render(){let t=this.querySelector(':scope > [slot="row"]');if(!t)return;t.style.paddingInlineStart=`${this.depth*16+4}px`,this.hasChildren?t.setAttribute("aria-expanded",String(this.open)):t.removeAttribute("aria-expanded"),this.selected?t.setAttribute("aria-selected","true"):t.removeAttribute("aria-selected");let e=t.querySelector('[slot="text"]');e&&this.text&&(e.textContent=this.text);let i=t.querySelector('[slot="badge"]');i&&(i.textContent=this.badge||"")}#s(t){let e=[],i=n=>{for(let r of n.children)if(!r.matches("tree-item-ui")){if(r.getAttribute("slot")===t){e.push(r);continue}(r.matches('[role="presentation"]')||r.style?.display==="contents")&&i(r)}};return i(this),e}#n(){if(this.#e)return;let t=this.querySelector(':scope > [slot="row"]');if(t){this.#e=!0;try{let e=this.#s("actions").filter(n=>!n.dataset.treeActionsPlaceholder&&n.parentElement!==t);if(e.length){t.querySelector(':scope > [slot="actions"][data-tree-actions-placeholder]')?.remove();for(let n of e)t.appendChild(n)}let i=this.#s("caret").find(n=>!n.dataset.treeCaretDefault&&n.parentElement!==t);i&&(t.querySelector(':scope > [slot="caret"][data-tree-caret-default]')?.remove(),t.prepend(i))}finally{this.#t?.takeRecords(),this.#e=!1}}}disconnected(){this.#t?.disconnect(),this.#t=null}};x("tree-ui",mn),x("tree-item-ui",gn);Q();var On=class extends k{static requiredIcons=["caret-right"];static properties={collapsed:{type:Boolean,default:!1,reflect:!0},resizable:{type:Boolean,default:!1,reflect:!0},minWidth:{type:Number,default:200,attribute:"min-width",reflect:!0},maxWidth:{type:Number,default:9999,attribute:"max-width",reflect:!0},side:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=!1;#i=0;#s=0;#n=null;#r="";#a=!1;connected(){this.#a||(this.#a=!0,this.addEventListener("click",this.#o),this.addEventListener("keydown",this.#l)),this.resizable&&!this.querySelector('[slot="resize"]')&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","resize"),this.appendChild(this.#t)),(this.#t||this.resizable)&&(this.#t=this.#t||this.querySelector('[slot="resize"]'),this.#t?.addEventListener("pointerdown",this.#c))}render(){let t=this.querySelector(":scope > header");if(t&&(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-expanded",String(!this.collapsed)),!t.querySelector('[slot="caret"]'))){let e=document.createElement("icon-ui");e.setAttribute("slot","caret"),e.setAttribute("name","caret-right"),t.append(e)}}toggle(){this.collapsed=!this.collapsed,this.dispatchEvent(new Event("toggle",{bubbles:!0}))}#o=t=>{let e=this.querySelector(":scope > header");e&&(t.target===e||e.contains(t.target))&&this.toggle()};#l=t=>{t.target===this.querySelector(":scope > header")&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.toggle())};#c=t=>{if(t.isPrimary){t.preventDefault(),this.#e=!0,this.#i=t.clientX,this.#s=this.getBoundingClientRect().width,this.#n=t.pointerId,this.setAttribute("data-resizing","");try{this.#t.setPointerCapture(t.pointerId)}catch{}this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#u,{once:!0}),this.#t.addEventListener("pointercancel",this.#u,{once:!0}),this.#r=document.documentElement.style.cursor,document.documentElement.style.cursor="col-resize"}};#h=t=>{if(!this.#e)return;let e=this.side==="trailing"?-1:1,i=(t.clientX-this.#i)*e,n=Math.max(this.minWidth,Math.min(this.maxWidth,this.#s+i));this.style.width=`${n}px`};#u=()=>{if(this.#e){this.#e=!1,this.removeAttribute("data-resizing");try{this.#t?.releasePointerCapture(this.#n)}catch{}this.#n=null,this.#t?.removeEventListener("pointermove",this.#h),document.documentElement.style.cursor=this.#r}};disconnected(){this.removeEventListener("click",this.#o),this.removeEventListener("keydown",this.#l),this.#t?.removeEventListener("pointerdown",this.#c),this.#t?.removeEventListener("pointermove",this.#h),this.#e&&(document.documentElement.style.cursor=this.#r),this.#a=!1}};x("pane-ui",On);Q();var bn=class extends k{static properties={scroll:{type:Boolean,default:!1,reflect:!0},maxWidth:{type:String,default:"",attribute:"max-width",reflect:!0},padding:{type:String,default:"",reflect:!0},stickyHeader:{type:Boolean,default:!1,attribute:"sticky-header",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.stickyHeader&&this.#i()}disconnected(){this.#s()}render(){this.stickyHeader&&!this.#t&&this.#i(),!this.stickyHeader&&this.#t&&this.#s()}#i(){let t=this.querySelector(":scope > :is(header, header-ui)");t&&(this.#t||(this.#t=document.createElement("div"),this.#t.setAttribute("data-page-sentinel",""),this.#t.style.cssText="height: 0; width: 0; pointer-events: none;",t.insertAdjacentElement("beforebegin",this.#t)),this.#e||(this.#e=new IntersectionObserver(e=>{this.toggleAttribute("data-header-stuck",!e[0].isIntersecting)},{threshold:0})),this.#e.observe(this.#t))}#s(){this.#e?.disconnect(),this.#e=null,this.#t?.remove(),this.#t=null,this.removeAttribute("data-header-stuck")}};x("page-ui",bn);Q();var ma=class extends k{static properties={disabled:{type:Boolean,default:!1,reflect:!0},loading:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"Type a message...",reflect:!0},model:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=[];#r=[];#a=null;#o=null;#l=null;#c=()=>this.#o?.click();#h=()=>{this.#o?.files?.length&&this.#m(this.#o.files),this.#o&&(this.#o.value="")};get value(){return this.#t?.value?.trim()??""}get attachments(){return[...this.#r]}set models(t){this.#n=t||[],this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model))}get models(){return this.#n}connected(){this.querySelector('[slot="toolbar"]')||(this.innerHTML=`
|
|
137
137
|
<textarea-ui placeholder="${this.placeholder}" rows="1"></textarea-ui>
|
|
138
138
|
<div slot="toolbar">
|
|
139
139
|
<select-ui slot="model" placeholder="Model" aria-label="Select model" divider></select-ui>
|
|
@@ -200,7 +200,7 @@ Correct shape for <chart-ui x="label" y="value">:
|
|
|
200
200
|
`),n=i.filter(o=>o.trim().length>0).map(o=>o.match(/^[ \t]*/)[0].length),r=n.length?Math.min(...n):0;return r>0?i.map(o=>o.slice(r)).join(`
|
|
201
201
|
`):e}async#u(){if(this.#n||this.#i)return;let t=this.#s,e=Gg(this.language);this.#n=!0;try{let i=await Promise.resolve().then(()=>(Ug(),Fg)),n=null;try{n=(await i.importWithTimeout(i.languages[e],`lang-${e}`))?.extension??null}catch(r){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"language",language:e,error:r}}))}if(t!==this.#s||!this.isConnected)return;this.#d(i,n,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.#n=!1}}#d(t,e,i){let{EditorState:n,EditorView:r,Compartment:o,lineNumbers:a,placeholder:l,syntaxHighlighting:h,history:c,historyKeymap:u,defaultKeymap:d,indentWithTab:f,keymap:p,adiaBaseTheme:m,adiaHighlightStyle:O,lintGutter:g,jsonLinter:y}=t,v=this.querySelector(":scope > pre"),S=v?v.querySelector("code")?.textContent??"":"",w=this.text||S||"";this.#a=w;let $=document.createElement("div");$.setAttribute("data-cm-mount",""),v?v.replaceWith($):this.appendChild($);let A=[m,h(O)];this.editable&&A.push(c(),p.of([{key:"Mod-s",run:E=>(this.#g(E),!0)},...d,...u,f]),r.updateListener.of(E=>{if(!E.docChanged)return;let L=E.state.doc.toString();this.#m(L),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:L}}))}),r.domEventHandlers({focus:(E,L)=>(this.#r=L.state.doc.toString(),!1),blur:(E,L)=>{let P=L.state.doc.toString();return this.#r!==null&&P!==this.#r&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:P}})),this.#r=null,!1}})),this.#o=new o,A.push(this.#o.of(this.#f(r,n))),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 r({parent:$,state:n.create({doc:w,extensions:A})}),this.editable&&this.#m(w)}#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(()=>(Ug(),Fg));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.#O(t))}#O(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)}#g(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??"")}#y(){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)}}};x("code-ui",no);Q();function r1(s){let t=s.replace(/=""(?=[\s/>])/g,"").replace(/\t/g," ").split(`
|
|
202
202
|
`);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()),n=(i.length?i:t.filter(o=>o.trim())).map(e),r=n.length?Math.min(...n):0;return t.map(o=>o.slice(Math.min(r,e(o)))).join(`
|
|
203
|
-
`)}var ro=class extends k{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 n=document.createElement("div");n.setAttribute("data-preview-render",""),n.innerHTML=t;let r=document.createElement("div");r.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,""),r.appendChild(o),i?[r,n]:[n,r]}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 n=[...this.children],r=[];for(let o of n){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=r1(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),r.push(c)}if(r.length){this.replaceChildren(...r),this.#n();return}}let i=r1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#n()}#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);#n(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};x("preview-ui",ro);Q();var oo=class extends k{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.#n),this.addEventListener("keydown",this.#r))}disconnected(){this.removeEventListener("click",this.#n),this.removeEventListener("keydown",this.#r),this.#t=!1}render(){if(!this.selectable){for(let n of this.#e())n.removeAttribute("aria-selected"),n.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let n of e){let r=this.#i(n),o=r&&r===t;n.setAttribute("aria-selected",o?"true":"false"),n.setAttribute("tabindex",o?"0":"-1"),o&&(i=n)}!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(r=>this.#i(r)===t)?.focus?.())}#n=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)};#r=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,n=e.indexOf(i);if(n<0)return;let r=n;switch(t.key){case"ArrowDown":r=Math.min(e.length-1,n+1);break;case"ArrowUp":r=Math.max(0,n-1);break;case"Home":r=0;break;case"End":r=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[n]);o&&this.#s(o);return}default:return}r!==n&&(t.preventDefault(),e[r]?.focus?.())}},ao=class extends k{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 n=this.#e(document.createElement("icon-ui"));n.setAttribute("slot","icon"),n.setAttribute("name",this.icon),this.prepend(n)}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 n=this.#e(document.createElement("span"));n.setAttribute("slot","text"),n.textContent=this.text,this.appendChild(n)}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 n=this.#e(document.createElement("span"));n.setAttribute("slot","description"),n.textContent=this.description,this.appendChild(n)}else this.#i(i)&&i.remove()}};x("list-ui",oo),x("list-item-ui",ao);Q();var lo=class extends k{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;#n=null;#r=(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.#E();let t=this.#A();this.#u=t,this.#d=this.#$()};#O=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 n=this.items?.[i];n!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:n,index:i},bubbles:!0}))};#g=t=>{if(t.target!==this)return;let e=this.#k()||this.estimatedSize||48,i=this.#w(),n=0;switch(t.key){case"ArrowDown":n=+e;break;case"ArrowUp":n=-e;break;case"PageDown":n=+i;break;case"PageUp":n=-i;break;case" ":n=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let r=this.#A();this.#P(r+n)};#y=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let n=this.#c>=0?this.#c:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:n},bubbles:!0}))}else if(i==="bottom"){let n=this.items||[],r=this.#h>=0?this.#h:n.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:r},bubbles:!0}))}}};#b=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let n=i.target;if(!n||n.parentElement!==this.#e)continue;let r=Number(n.dataset.index);if(!Number.isInteger(r))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(r)!==a&&(this.#o.set(r,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:r,height:a},bubbles:!0})),e=!0)}e&&(this.#Z(),this.#M(),this.#E())};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.#y,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#b)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#O),this.addEventListener("keydown",this.#g),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#O),this.removeEventListener("keydown",this.#g),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.#$());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.#M(),this.#E(),e&&this.scrollToBottom(),this.#d=this.#$()}set renderRow(t){this.#n=typeof t=="function"?t:null,this.#a.clear(),this.#E()}get renderRow(){return this.#n}set keyFn(t){this.#r=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#E()}get keyFn(){return this.#r}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let n=this.items||[];if(!n.length)return;let r=Math.max(0,Math.min(n.length-1,t|0)),o=this.#x(r),a=this.#w(),l=this.#v(r),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#P(Math.max(0,h),e)}scrollToTop(){this.#P(0)}scrollToBottom(){let t=this.#S();this.#P(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.#M(),this.#E()}#k(){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.#k();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#x(t){let e=this.#k();if(e>0)return t*e;let i=0;for(let n=0;n<t;n++)i+=this.#v(n);return i}#S(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#k();if(i>0)return e*i;let n=0,r=this.estimatedSize||48;for(let o=0;o<e;o++)n+=this.#o.get(o)??r;return n}#w(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#P(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#$(){let t=this.#A(),e=this.#w(),i=this.#S();return t+e>=i-1}#M(){if(!this.#t)return;let t=this.#S();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.#w(),n=this.#A(),r=this.#k(),o,a;if(r>0)o=Math.floor(n/r),a=Math.ceil((n+i)/r);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>n){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}}#E(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:n}=this.#Q(),r=this.#x(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${r}px)`:this.#e.style.transform=`translateY(${r}px)`,this.loading?this.#C(n-i):this.#R(t,i,n),(i!==this.#c||n!==this.#h)&&(this.#c=i,this.#h=n,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:n,items:t.slice(i,n)},bubbles:!0})))}#R(t,e,i){if(!this.#e)return;let n=new Set,r=this.#n??this.#T();for(let l=e;l<i;l++){let h=t[l],c=this.#r(h,l);n.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#L(h,l,r),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#r(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)n.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)}#C(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 n=0;n<e;n++){let r=document.createElement("div");if(r.setAttribute("data-row",""),r.setAttribute("data-skeleton-row",""),r.dataset.index=String(n),i?.content)r.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");r.appendChild(o)}this.#e.appendChild(r)}}#L(t,e,i){let n=document.createElement("div");n.setAttribute("data-row",""),n.setAttribute("role","listitem"),n.dataset.index=String(e),n.setAttribute("aria-rowindex",String(e+1));let r=null;if(typeof i=="function")try{r=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(r instanceof Node)n.appendChild(r);else if(r!=null)n.textContent=String(r);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)),n.appendChild(o)}else t!=null&&(n.textContent=String(t));return n}#T(){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,n)=>{let r=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":gR(String(h))}),o=document.createElement("template");return o.innerHTML=r,o.content.cloneNode(!0)}}#D=null;#Z(){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 gR(s){return s.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}x("list-window-ui",lo);Q();var ho=class extends k{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;#n=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}#r(){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.#y),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.#r(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui");for(let n of i)e.contains(n)||e.appendChild(n);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=at(t,e,{placement:this.placement,gap:this.gap}),this.#u&&(this.#u=!1,this.#n=requestAnimationFrame(()=>{this.#n=null,this.#c(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#O),document.addEventListener("keydown",this.#g,!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.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null),document.removeEventListener("pointerdown",this.#O),document.removeEventListener("keydown",this.#g,!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,n=e[i];n.setAttribute("tabindex","-1"),n.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}}};#O=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#g=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)};#y=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#y),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},co=class extends k{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.#n()}#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)}}}#n(){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.#n()}},uo=class extends k{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}};x("menu-ui",ho),x("menu-item-ui",co),x("menu-divider-ui",uo);Q();var o1=500,fo=class extends k{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:o1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#n=null;#r=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#c(),this.#k(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#r=i,t==null||e==null){let n=i.getBoundingClientRect();t=n.left+n.width/2,e=n.top+n.height/2}this.#y(t,e)}}close(t="manual"){this.#b(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.#r=t.currentTarget,this.#y(t.clientX,t.clientY))};#d=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#n=setTimeout(()=>{this.#r=t.currentTarget,this.#y(e.clientX,e.clientY)},this.longPressMs??o1))};#f=()=>{this.#n&&clearTimeout(this.#n),this.#n=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#r=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#O(){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.#S),document.body.appendChild(t),this.#t=t,t}#g(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}#y(t,e){let i=this.#O();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 n=this.#g(t,e);this.#i?.(),this.#i=at(n,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let r=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>r?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#r,x:t,y:e}}))}#b(t="manual"){if(this.open){this.open=!1,this.#k(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#r?.focus?.()}catch{}}}#k(){this.#x(),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.#b("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#b("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#x(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#S=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",n=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:n}})),this.#b("select")}};x("context-menu-ui",fo);Q();var po=class extends k{static properties={};static template=()=>null};x("visually-hidden-ui",po);Q();var mo=class extends k{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(/^#/,""),n=document.getElementById(i);n&&queueMicrotask(()=>{n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!1})})}};x("skip-nav-ui",mo);Q();var go=class extends k{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};x("mark-ui",go);var Oo=class extends Z{static properties={...Z.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.#n),this.addEventListener("focus",this.#r),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#n),this.removeEventListener("focus",this.#r),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())};#n=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()}};#r=()=>{};#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))}};x("inline-edit-ui",Oo);Q();var bo=class extends k{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;#n=null;#r=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.#n=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#n,!0),this.#r=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.#r)}#h(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#n&&window.removeEventListener("scroll",this.#n,!0),this.#r&&document.removeEventListener("keydown",this.#r),this.#s=this.#n=this.#r=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,n=this.step===0,r=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=`
|
|
203
|
+
`)}var ro=class extends k{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 n=document.createElement("div");n.setAttribute("data-preview-render",""),n.innerHTML=t;let r=document.createElement("div");r.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,""),r.appendChild(o),i?[r,n]:[n,r]}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 n=[...this.children],r=[];for(let o of n){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=r1(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),r.push(c)}if(r.length){this.replaceChildren(...r),this.#n();return}}let i=r1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#n()}#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);#n(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};x("preview-ui",ro);Q();var oo=class extends k{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.#n),this.addEventListener("keydown",this.#r))}disconnected(){this.removeEventListener("click",this.#n),this.removeEventListener("keydown",this.#r),this.#t=!1}render(){if(!this.selectable){for(let n of this.#e())n.removeAttribute("aria-selected"),n.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let n of e){let r=this.#i(n),o=r&&r===t;n.setAttribute("aria-selected",o?"true":"false"),n.setAttribute("tabindex",o?"0":"-1"),o&&(i=n)}!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(r=>this.#i(r)===t)?.focus?.())}#n=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)};#r=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,n=e.indexOf(i);if(n<0)return;let r=n;switch(t.key){case"ArrowDown":r=Math.min(e.length-1,n+1);break;case"ArrowUp":r=Math.max(0,n-1);break;case"Home":r=0;break;case"End":r=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[n]);o&&this.#s(o);return}default:return}r!==n&&(t.preventDefault(),e[r]?.focus?.())}},ao=class extends k{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 n=this.#e(document.createElement("icon-ui"));n.setAttribute("slot","icon"),n.setAttribute("name",this.icon),this.prepend(n)}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 n=this.#e(document.createElement("span"));n.setAttribute("slot","text"),n.textContent=this.text,this.appendChild(n)}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 n=this.#e(document.createElement("span"));n.setAttribute("slot","description"),n.textContent=this.description,this.appendChild(n)}else this.#i(i)&&i.remove()}};x("list-ui",oo),x("list-item-ui",ao);Q();var lo=class extends k{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;#n=null;#r=(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.#E();let t=this.#A();this.#u=t,this.#d=this.#$()};#O=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 n=this.items?.[i];n!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:n,index:i},bubbles:!0}))};#g=t=>{if(t.target!==this)return;let e=this.#k()||this.estimatedSize||48,i=this.#w(),n=0;switch(t.key){case"ArrowDown":n=+e;break;case"ArrowUp":n=-e;break;case"PageDown":n=+i;break;case"PageUp":n=-i;break;case" ":n=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let r=this.#A();this.#P(r+n)};#y=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let n=this.#c>=0?this.#c:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:n},bubbles:!0}))}else if(i==="bottom"){let n=this.items||[],r=this.#h>=0?this.#h:n.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:r},bubbles:!0}))}}};#b=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let n=i.target;if(!n||n.parentElement!==this.#e)continue;let r=Number(n.dataset.index);if(!Number.isInteger(r))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(r)!==a&&(this.#o.set(r,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:r,height:a},bubbles:!0})),e=!0)}e&&(this.#Z(),this.#M(),this.#E())};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.#y,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#b)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#O),this.addEventListener("keydown",this.#g),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#O),this.removeEventListener("keydown",this.#g),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.#$());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.#M(),this.#E(),e&&this.scrollToBottom(),this.#d=this.#$()}set renderRow(t){this.#n=typeof t=="function"?t:null,this.#a.clear(),this.#E()}get renderRow(){return this.#n}set keyFn(t){this.#r=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#E()}get keyFn(){return this.#r}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let n=this.items||[];if(!n.length)return;let r=Math.max(0,Math.min(n.length-1,t|0)),o=this.#x(r),a=this.#w(),l=this.#v(r),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#P(Math.max(0,h),e)}scrollToTop(){this.#P(0)}scrollToBottom(){let t=this.#S();this.#P(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.#M(),this.#E()}#k(){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.#k();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#x(t){let e=this.#k();if(e>0)return t*e;let i=0;for(let n=0;n<t;n++)i+=this.#v(n);return i}#S(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#k();if(i>0)return e*i;let n=0,r=this.estimatedSize||48;for(let o=0;o<e;o++)n+=this.#o.get(o)??r;return n}#w(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#P(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#$(){let t=this.#A(),e=this.#w(),i=this.#S();return t+e>=i-1}#M(){if(!this.#t)return;let t=this.#S();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.#w(),n=this.#A(),r=this.#k(),o,a;if(r>0)o=Math.floor(n/r),a=Math.ceil((n+i)/r);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>n){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}}#E(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:n}=this.#Q(),r=this.#x(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${r}px)`:this.#e.style.transform=`translateY(${r}px)`,this.loading?this.#C(n-i):this.#R(t,i,n),(i!==this.#c||n!==this.#h)&&(this.#c=i,this.#h=n,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:n,items:t.slice(i,n)},bubbles:!0})))}#R(t,e,i){if(!this.#e)return;let n=new Set,r=this.#n??this.#T();for(let l=e;l<i;l++){let h=t[l],c=this.#r(h,l);n.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#L(h,l,r),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#r(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)n.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)}#C(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 n=0;n<e;n++){let r=document.createElement("div");if(r.setAttribute("data-row",""),r.setAttribute("data-skeleton-row",""),r.dataset.index=String(n),i?.content)r.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");r.appendChild(o)}this.#e.appendChild(r)}}#L(t,e,i){let n=document.createElement("div");n.setAttribute("data-row",""),n.setAttribute("role","listitem"),n.dataset.index=String(e),n.setAttribute("aria-rowindex",String(e+1));let r=null;if(typeof i=="function")try{r=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(r instanceof Node)n.appendChild(r);else if(r!=null)n.textContent=String(r);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)),n.appendChild(o)}else t!=null&&(n.textContent=String(t));return n}#T(){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,n)=>{let r=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":gR(String(h))}),o=document.createElement("template");return o.innerHTML=r,o.content.cloneNode(!0)}}#D=null;#Z(){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 gR(s){return s.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}x("list-window-ui",lo);Q();var ho=class extends k{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;#n=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}#r(){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.#y),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.#r(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui");for(let n of i)e.contains(n)||e.appendChild(n);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=at(t,e,{placement:this.placement,gap:this.gap}),this.#u&&(this.#u=!1,this.#n=requestAnimationFrame(()=>{this.#n=null,this.#c(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#O),document.addEventListener("keydown",this.#g,!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.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null),document.removeEventListener("pointerdown",this.#O),document.removeEventListener("keydown",this.#g,!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,n=e[i];n.setAttribute("tabindex","-1"),n.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}}};#O=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#g=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)};#y=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#y),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},co=class extends k{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.#n()}#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)}}}#n(){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.#n()}},uo=class extends k{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}};x("menu-ui",ho),x("menu-item-ui",co),x("menu-divider-ui",uo);Q();var o1=500,fo=class extends k{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:o1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#n=null;#r=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#c(),this.#k(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#r=i,t==null||e==null){let n=i.getBoundingClientRect();t=n.left+n.width/2,e=n.top+n.height/2}this.#y(t,e)}}close(t="manual"){this.#b(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.#r=t.currentTarget,this.#y(t.clientX,t.clientY))};#d=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#n=setTimeout(()=>{this.#r=t.currentTarget,this.#y(e.clientX,e.clientY)},this.longPressMs??o1))};#f=()=>{this.#n&&clearTimeout(this.#n),this.#n=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#r=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#O(){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.#S),document.body.appendChild(t),this.#t=t,t}#g(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}#y(t,e){let i=this.#O();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 n=this.#g(t,e);this.#i?.(),this.#i=at(n,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let r=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>r?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#r,x:t,y:e}}))}#b(t="manual"){if(this.open){this.open=!1,this.#k(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#r?.focus?.()}catch{}}}#k(){this.#x(),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.#b("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#b("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#x(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#S=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",n=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:n}})),this.#b("select")}};x("context-menu-ui",fo);Q();var po=class extends k{static properties={};static template=()=>null};x("visually-hidden-ui",po);Q();var mo=class extends k{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(/^#/,""),n=document.getElementById(i);n&&queueMicrotask(()=>{n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!1})})}};x("skip-nav-ui",mo);Q();var go=class extends k{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};x("mark-ui",go);var Oo=class extends Z{static properties={...Z.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.#n),this.addEventListener("focus",this.#r),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#n),this.removeEventListener("focus",this.#r),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())};#n=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()}};#r=()=>{};#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))}};x("inline-edit-ui",Oo);Q();var bo=class extends k{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;#n=null;#r=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.#n=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#n,!0),this.#r=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.#r)}#h(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#n&&window.removeEventListener("scroll",this.#n,!0),this.#r&&document.removeEventListener("keydown",this.#r),this.#s=this.#n=this.#r=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,n=this.step===0,r=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=`
|
|
204
204
|
<div data-tour-header>
|
|
205
205
|
<span data-tour-indicator>${h}</span>
|
|
206
206
|
<span></span>
|