@adia-ai/web-modules 0.7.15 → 0.7.16

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog — @adia-ai/web-modules
2
2
 
3
+ ## [0.7.16] — 2026-06-08
4
+
5
+ ### Changed
6
+ - **Dist shell bundles rebuilt.** `dist/everything.min.js` + the admin / chat / editor / simple shell `.min.js` were regenerated to clear accumulated source drift that rode through to 0.7.15 unbundled. The CDN kitchen-sink (`@adia-ai/web-modules/everything`) now matches source. Gated going forward by `check:js-bundles-fresh` in CI.
7
+
3
8
  ## [0.7.15] — 2026-06-08
4
9
 
5
10
  ### Maintenance
@@ -41,7 +41,7 @@ var FS=Object.defineProperty;var N=(i,e)=>()=>(i&&(e=i(i=0)),e);var Si=(i,e)=>{f
41
41
  `+c+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let l=+o[1],a=s.name;a[0]==="@"?(r.removeAttribute(a),t[l]={t:"e",n:r,name:a.slice(1),c:void 0,_fx:null}):a[0]==="."?(r.removeAttribute(a),t[l]={t:"p",n:r,name:Bu(r,a.slice(1)),c:void 0,_fx:null,_resolved:!1}):a[0]==="?"?(r.removeAttribute(a),console.warn(`[template] Lit-style boolean attribute "${a}=" is not supported.
42
42
  Element: <${r.tagName.toLowerCase()}>
43
43
  Use .${a.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
44
- See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function os(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function ql(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Gu=i=>i!=null&&typeof i=="object"&&i.strings,Uu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function Bl(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(ql(i));else if(Gu(e))on(e,ql(i));else if(Array.isArray(e)){let t=ql(i);t.replaceChildren();for(let n of e)if(Gu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),on(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(e instanceof Node)i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Bu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Uu(i.c)&&i.n.removeEventListener(i.name,i.c),Uu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function oy(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Dl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=Qi(()=>Bl(n,r())));continue}if(o){n._fx||(n._fx=Qi(()=>Bl(n,r.value)));continue}Bl(n,r)}}function ly(i,e,t){return{_directive:!0,_commit(n){let r=n[ln]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);on(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),on(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&os(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[ln]=s}}}var ls=new Map,Fu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function mT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Fu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Fu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,ls.set(i.name,t),t}function Hu(i){return ls.get(i)||null}function gT(i){return ls.get(i)?.schema||null}function bT(){return[...ls.keys()]}var Il=Symbol(),Nn=Symbol();function ay(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=sn(n.default??void 0);i[Il].set(t,o),Object.defineProperty(i,t,{get(){return o.value},set(l){let a=o.peek();Object.is(a,l)||(i[Nn].set(t,a),o.value=l,n.reflect&&hy(i,r,l,s))},configurable:!0})}}function hy(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var cy=(i,e)=>e===Boolean?i!==null:e===Number?i===null?null:+i:i;function fy(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e)return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var an=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=sn(0);constructor(){super(),this.internals=this.attachInternals(),ay(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),fy(e),Ku(e),Vl(()=>this.connected()),this.#t.push(Qi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&on(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&os(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:sn,computed:Yl,effect:Qi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Hu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=cy(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=sn(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[ln]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[ln]=o}connected(){}render(){}disconnected(){}updated(e){}};var uy={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},Ju=i=>i.replace(/[&<>"]/g,e=>uy[e]);function Nl(i){let e=i.split(`
44
+ See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function os(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function ql(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Gu=i=>i!=null&&typeof i=="object"&&i.strings,Uu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function Bl(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(ql(i));else if(Gu(e))on(e,ql(i));else if(Array.isArray(e)){let t=ql(i);t.replaceChildren();for(let n of e)if(Gu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),on(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(e instanceof Node)i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Bu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Uu(i.c)&&i.n.removeEventListener(i.name,i.c),Uu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function oy(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Dl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=Qi(()=>Bl(n,r())));continue}if(o){n._fx||(n._fx=Qi(()=>Bl(n,r.value)));continue}Bl(n,r)}}function ly(i,e,t){return{_directive:!0,_commit(n){let r=n[ln]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);on(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),on(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&os(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[ln]=s}}}var ls=new Map,Fu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function mT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Fu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Fu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,ls.set(i.name,t),t}function Hu(i){return ls.get(i)||null}function gT(i){return ls.get(i)?.schema||null}function bT(){return[...ls.keys()]}var Il=Symbol(),Nn=Symbol();function ay(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=Object.prototype.hasOwnProperty.call(i,t),l=o?i[t]:void 0;o&&delete i[t];let a=sn(n.default??void 0);i[Il].set(t,a),Object.defineProperty(i,t,{get(){return a.value},set(h){let c=a.peek();Object.is(c,h)||(i[Nn].set(t,c),a.value=h,n.reflect&&hy(i,r,h,s))},configurable:!0}),o&&(a.value=l)}}function hy(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var cy=(i,e)=>e===Boolean?i!==null:e===Number?i===null?null:+i:i;function fy(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e)return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var an=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=sn(0);constructor(){super(),this.internals=this.attachInternals(),ay(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),fy(e),Ku(e),Vl(()=>this.connected()),this.#t.push(Qi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&on(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&os(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:sn,computed:Yl,effect:Qi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Hu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=cy(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=sn(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[ln]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[ln]=o}connected(){}render(){}disconnected(){}updated(e){}};var uy={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},Ju=i=>i.replace(/[&<>"]/g,e=>uy[e]);function Nl(i){let e=i.split(`
45
45
  `),t=[],n=0;for(;n<e.length;){let r=e[n],s=r.match(/^```(\w*)/);if(s){let a=s[1],h=[];for(n++;n<e.length&&!e[n].startsWith("```");)h.push(Ju(e[n])),n++;n++;let c=h.join(`
46
46
  `);t.push(a?`<code-ui language="${a}">${c}</code-ui>`:`<pre><code>${c}</code></pre>`);continue}if(!r.trim()){n++;continue}let o=r.match(/^(#{1,6})\s+(.+)/);if(o){let a=o[1].length;t.push(`<h${a}>${as(o[2])}</h${a}>`),n++;continue}if(/^[-*]\s/.test(r)){let a=[];for(;n<e.length&&/^[-*]\s/.test(e[n]);)a.push(`<li>${as(e[n].replace(/^[-*]\s/,""))}</li>`),n++;t.push(`<ul>${a.join("")}</ul>`);continue}if(/^\d+\.\s/.test(r)){let a=[];for(;n<e.length&&/^\d+\.\s/.test(e[n]);)a.push(`<li>${as(e[n].replace(/^\d+\.\s/,""))}</li>`),n++;t.push(`<ol>${a.join("")}</ol>`);continue}let l=[];for(;n<e.length&&e[n].trim()&&!/^```|^#{1,6}\s|^[-*]\s|^\d+\.\s/.test(e[n]);)l.push(e[n]),n++;t.push(`<p>${as(l.join(" "))}</p>`)}return t.join(`
47
47
  `)}function as(i){return Ju(i).replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/_(.+?)_/g,"<em>$1</em>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>')}cd();function NT(i,e){customElements.define(i,e)}function fd(i,e){return customElements.get(i)?!1:(customElements.define(i,e),!0)}function GT(i){return!!customElements.get(i)}var hT=new Set(["json","html","javascript","js","css","markdown","md","yaml","yml"]),cT={js:"javascript",md:"markdown",yml:"yaml"};function ju(i){if(!i)return"";let e=String(i).toLowerCase();return cT[e]??e}var ts=class i extends an{static formAssociated=!0;static properties={language:{type:String,default:"",reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},text:{type:String,default:"",reflect:!0},lineNumbers:{type:Boolean,default:!1,reflect:!0,attribute:"line-numbers"},editable:{type:Boolean,default:!1,reflect:!0},bare:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"",reflect:!0},name:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#r=null;#e=null;#i=0;#o=!1;#n=null;#l="";#s=null;#a=()=>this.#b();connected(){this.#i+=1,!this.inline&&!this.querySelector(":scope > pre")&&this.#h(),this.#t=this.querySelector(':scope > header [slot="copy"]'),this.#t&&this.#t.addEventListener("click",this.#a);let e=ju(this.language),t=this.hasAttribute("data-line-states")||e==="diff";!this.inline&&!t&&(hT.has(e)||this.editable)&&this.#f()}disconnected(){this.#i+=1,this.#r!=null&&(clearTimeout(this.#r),this.#r=null),this.#t&&(this.#t.removeEventListener("click",this.#a),this.#t=null),this.#e&&(this.#e.destroy(),this.#e=null)}#h(){let e=this.querySelector(":scope > template"),t=this.text?this.text.trim():e?i.#c(e.innerHTML):(this.textContent||"").trim();if(this.textContent="",!this.bare){let a=document.createElement("header"),h=document.createElement("span");h.setAttribute("slot","label"),h.textContent=this.language||"code",a.appendChild(h);let c=document.createElement("div");c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("slot","copy"),c.textContent="Copy",a.appendChild(c),this.appendChild(a)}let n=document.createElement("pre"),r=document.createElement("code"),s=ju(this.language),o=this.getAttribute("data-line-states");if(o!=null||s==="diff"){r.setAttribute("data-line-state-mode",""),this.lineNumbers&&r.setAttribute("data-line-numbers","");let a=o?.split(",").map(c=>c.trim())??null;t.split(`
@@ -1,10 +1,10 @@
1
- var S=Symbol("signal"),f=null,h=null,_=!1;function P(t){for(let e of t){if(e.disposed){t.delete(e);continue}e.dirty=!0,h||(h=new Set,_||queueMicrotask(q)),h.add(e)}}function q(){let t,e=0;for(;t=h;){if(++e>100){h=null,console.error("signals: drain loop exceeded 100 iterations");break}h=null;for(let n of t)if(!n.disposed&&n.dirty){n.dirty=!1;try{n.run()}catch(o){n.onError?n.onError(o):(n.disposed=!0,queueMicrotask(()=>{throw o}))}}}}function K(t){if(_){t();return}_=!0;try{t()}finally{_=!1,h&&q()}}function M(t){let e=f;f=null;try{return t()}finally{f=e}}function m(t){let e=new Set;return{[S]:!0,get value(){return f&&e.add(f),t},set value(n){Object.is(t,n)||(t=n,P(e))},peek(){return t}}}function k(t){let e=new Set,n,o=!0,r={dirty:!1,disposed:!1,run(){o=!0,P(e)}};return{[S]:!0,get value(){if(f&&e.add(f),o){let s=f;f=r;try{n=t(),o=!1}finally{f=s}}return n},peek(){return n}}}function p(t,e){let n={dirty:!1,disposed:!1,host:e?.host??null,onError:e?.onError??null,run(){let o=f;f=n;try{t()}finally{f=o}}};return n.run(),()=>{n.disposed=!0}}function O(t){return t!=null&&typeof t=="object"&&t[S]===!0}var[v,b]=[Symbol(),Symbol()];function V(t,...e){return{strings:t,values:e}}function X(t,...e){let n="";for(let r=0;r<t.length;r++)n+=t[r],r<e.length&&(n+=e[r]);let o=new CSSStyleSheet;return o.replaceSync(n),o}var I=new WeakMap;function Y(t){let e=0,n=0,o=0;for(;o<t.length;){if(e===0&&t.charCodeAt(o)===60&&t.charCodeAt(o+1)===33&&t.charCodeAt(o+2)===45&&t.charCodeAt(o+3)===45){let s=t.indexOf("-->",o+4);if(s===-1){n=0;break}o=s+3,n=0;continue}let r=t.charCodeAt(o);e?r===(e===1?39:34)&&(e=0):r===39?e=1:r===34?e=2:r===60?n=1:r===62&&(n=0),o++}return n===1}function J(t){let e=I.get(t);if(e)return e;let n="";for(let o=0;o<t.length;o++)n+=t[o],o<t.length-1&&(n+=Y(n)?`{{p:${o}}}`:`<!--p:${o}-->`);return e=document.createElement("template"),e.innerHTML=n,I.set(t,e),e}var B={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"};function H(t,e){if(B[e])return B[e];let n=Object.getOwnPropertyNames(t);for(let r=0;r<n.length;r++){let s=n[r];if(s!==e&&s.toLowerCase()===e)return s}let o=Object.getPrototypeOf(t);for(;o&&o!==Object.prototype;){let r=Object.getOwnPropertyNames(o);for(let s=0;s<r.length;s++){let l=r[s];if(l!==e&&l.toLowerCase()===e)return l}o=Object.getPrototypeOf(o)}return e}function g(t,e){let n=e._i;(!n||n.s!==t.strings)&&(n&&C(n.p),n=Q(t,e),e._i=n),ne(n.p,t.values)}function Q(t,e){let{strings:n}=t,r=J(n).content.cloneNode(!0),s=Z(e);s&&(r=ee(r,s));let l=te(r,t.values.length);return e.replaceChildren(r),{s:n,p:l}}var A="http://www.w3.org/2000/svg",y="http://www.w3.org/1998/Math/MathML",R="http://www.w3.org/1999/xhtml";function Z(t){if(!t||t.nodeType!==1)return null;if(t.namespaceURI===A)return A;if(t.namespaceURI===y)return y;if(typeof t.closest!="function")return null;let e=t.closest("svg, math, foreignObject, annotation-xml");if(!e)return null;let n=e.localName;if(n==="foreignobject"||n==="foreignObject")return null;if(n==="annotation-xml"){let o=(e.getAttribute("encoding")||"").toLowerCase();return o==="text/html"||o==="application/xhtml+xml"?null:y}return n==="svg"?A:n==="math"?y:null}function ee(t,e){let n=document.createDocumentFragment();return U(t,n,e),n}function U(t,e,n){for(let o of[...t.childNodes])if(o.nodeType===1){let s=document.createElementNS(n,o.localName);for(let i of o.attributes)i.namespaceURI?s.setAttributeNS(i.namespaceURI,i.name,i.value):s.setAttribute(i.name,i.value);e.appendChild(s);let l=o.localName,c=n;if(n===A&&(l==="foreignObject"||l==="foreignobject"))c=R;else if(n===y&&l==="annotation-xml"){let i=(o.getAttribute("encoding")||"").toLowerCase();(i==="text/html"||i==="application/xhtml+xml")&&(c=R)}U(o,s,c)}else e.appendChild(o.cloneNode(!0))}function te(t,e){let n=new Array(e),o=document.createTreeWalker(t,129),r;for(;r=o.nextNode();)if(r.nodeType===8){let s=r.data.match(/^p:(\d+)$/);if(s){let l=document.createTextNode("");r.replaceWith(l),o.currentNode=l,n[+s[1]]={t:"n",n:l,c:void 0,_fx:null}}}else if(r.nodeType===1)for(let s of[...r.attributes]){let l=s.value.match(/^\{\{p:(\d+)\}\}$/);if(!l){if(s.value.includes("{{p:")){let a=s.name,u=a==="class"?' class="${expression}" \u2190 full replacement (whole class string is the expression)\n .className=${expression} \u2190 writes to the className property (resolved camelCase since FB-55 fix)\n':a==="style"?' style="${expression}" \u2190 full replacement of the style string\n .style.cssText=${expression} \u2190 write CSS text via the style.cssText accessor\n':` ${a}="\${expression}" \u2190 full replacement (whole attr is the placeholder)
2
- .${a}=\${expression} \u2190 property assignment (preferred for objects/functions)
1
+ var S=Symbol("signal"),f=null,h=null,_=!1;function P(t){for(let e of t){if(e.disposed){t.delete(e);continue}e.dirty=!0,h||(h=new Set,_||queueMicrotask(q)),h.add(e)}}function q(){let t,e=0;for(;t=h;){if(++e>100){h=null,console.error("signals: drain loop exceeded 100 iterations");break}h=null;for(let n of t)if(!n.disposed&&n.dirty){n.dirty=!1;try{n.run()}catch(o){n.onError?n.onError(o):(n.disposed=!0,queueMicrotask(()=>{throw o}))}}}}function K(t){if(_){t();return}_=!0;try{t()}finally{_=!1,h&&q()}}function M(t){let e=f;f=null;try{return t()}finally{f=e}}function m(t){let e=new Set;return{[S]:!0,get value(){return f&&e.add(f),t},set value(n){Object.is(t,n)||(t=n,P(e))},peek(){return t}}}function O(t){let e=new Set,n,o=!0,r={dirty:!1,disposed:!1,run(){o=!0,P(e)}};return{[S]:!0,get value(){if(f&&e.add(f),o){let s=f;f=r;try{n=t(),o=!1}finally{f=s}}return n},peek(){return n}}}function p(t,e){let n={dirty:!1,disposed:!1,host:e?.host??null,onError:e?.onError??null,run(){let o=f;f=n;try{t()}finally{f=o}}};return n.run(),()=>{n.disposed=!0}}function k(t){return t!=null&&typeof t=="object"&&t[S]===!0}var[v,b]=[Symbol(),Symbol()];function V(t,...e){return{strings:t,values:e}}function X(t,...e){let n="";for(let r=0;r<t.length;r++)n+=t[r],r<e.length&&(n+=e[r]);let o=new CSSStyleSheet;return o.replaceSync(n),o}var I=new WeakMap;function Y(t){let e=0,n=0,o=0;for(;o<t.length;){if(e===0&&t.charCodeAt(o)===60&&t.charCodeAt(o+1)===33&&t.charCodeAt(o+2)===45&&t.charCodeAt(o+3)===45){let s=t.indexOf("-->",o+4);if(s===-1){n=0;break}o=s+3,n=0;continue}let r=t.charCodeAt(o);e?r===(e===1?39:34)&&(e=0):r===39?e=1:r===34?e=2:r===60?n=1:r===62&&(n=0),o++}return n===1}function J(t){let e=I.get(t);if(e)return e;let n="";for(let o=0;o<t.length;o++)n+=t[o],o<t.length-1&&(n+=Y(n)?`{{p:${o}}}`:`<!--p:${o}-->`);return e=document.createElement("template"),e.innerHTML=n,I.set(t,e),e}var B={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"};function H(t,e){if(B[e])return B[e];let n=Object.getOwnPropertyNames(t);for(let r=0;r<n.length;r++){let s=n[r];if(s!==e&&s.toLowerCase()===e)return s}let o=Object.getPrototypeOf(t);for(;o&&o!==Object.prototype;){let r=Object.getOwnPropertyNames(o);for(let s=0;s<r.length;s++){let a=r[s];if(a!==e&&a.toLowerCase()===e)return a}o=Object.getPrototypeOf(o)}return e}function g(t,e){let n=e._i;(!n||n.s!==t.strings)&&(n&&C(n.p),n=Q(t,e),e._i=n),ne(n.p,t.values)}function Q(t,e){let{strings:n}=t,r=J(n).content.cloneNode(!0),s=Z(e);s&&(r=ee(r,s));let a=te(r,t.values.length);return e.replaceChildren(r),{s:n,p:a}}var A="http://www.w3.org/2000/svg",y="http://www.w3.org/1998/Math/MathML",R="http://www.w3.org/1999/xhtml";function Z(t){if(!t||t.nodeType!==1)return null;if(t.namespaceURI===A)return A;if(t.namespaceURI===y)return y;if(typeof t.closest!="function")return null;let e=t.closest("svg, math, foreignObject, annotation-xml");if(!e)return null;let n=e.localName;if(n==="foreignobject"||n==="foreignObject")return null;if(n==="annotation-xml"){let o=(e.getAttribute("encoding")||"").toLowerCase();return o==="text/html"||o==="application/xhtml+xml"?null:y}return n==="svg"?A:n==="math"?y:null}function ee(t,e){let n=document.createDocumentFragment();return U(t,n,e),n}function U(t,e,n){for(let o of[...t.childNodes])if(o.nodeType===1){let s=document.createElementNS(n,o.localName);for(let i of o.attributes)i.namespaceURI?s.setAttributeNS(i.namespaceURI,i.name,i.value):s.setAttribute(i.name,i.value);e.appendChild(s);let a=o.localName,c=n;if(n===A&&(a==="foreignObject"||a==="foreignobject"))c=R;else if(n===y&&a==="annotation-xml"){let i=(o.getAttribute("encoding")||"").toLowerCase();(i==="text/html"||i==="application/xhtml+xml")&&(c=R)}U(o,s,c)}else e.appendChild(o.cloneNode(!0))}function te(t,e){let n=new Array(e),o=document.createTreeWalker(t,129),r;for(;r=o.nextNode();)if(r.nodeType===8){let s=r.data.match(/^p:(\d+)$/);if(s){let a=document.createTextNode("");r.replaceWith(a),o.currentNode=a,n[+s[1]]={t:"n",n:a,c:void 0,_fx:null}}}else if(r.nodeType===1)for(let s of[...r.attributes]){let a=s.value.match(/^\{\{p:(\d+)\}\}$/);if(!a){if(s.value.includes("{{p:")){let l=s.name,u=l==="class"?' class="${expression}" \u2190 full replacement (whole class string is the expression)\n .className=${expression} \u2190 writes to the className property (resolved camelCase since FB-55 fix)\n':l==="style"?' style="${expression}" \u2190 full replacement of the style string\n .style.cssText=${expression} \u2190 write CSS text via the style.cssText accessor\n':` ${l}="\${expression}" \u2190 full replacement (whole attr is the placeholder)
2
+ .${l}=\${expression} \u2190 property assignment (preferred for objects/functions)
3
3
  `;console.warn(`[template] Partial attribute interpolation is not supported.
4
4
  Element: <${r.tagName.toLowerCase()}>
5
- Attribute: ${a}="${s.value.slice(0,80)}${s.value.length>80?"\u2026":""}"
5
+ Attribute: ${l}="${s.value.slice(0,80)}${s.value.length>80?"\u2026":""}"
6
6
  Use one of:
7
- `+u+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let c=+l[1],i=s.name;i[0]==="@"?(r.removeAttribute(i),n[c]={t:"e",n:r,name:i.slice(1),c:void 0,_fx:null}):i[0]==="."?(r.removeAttribute(i),n[c]={t:"p",n:r,name:H(r,i.slice(1)),c:void 0,_fx:null,_resolved:!1}):i[0]==="?"?(r.removeAttribute(i),console.warn(`[template] Lit-style boolean attribute "${i}=" is not supported.
7
+ `+u+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let c=+a[1],i=s.name;i[0]==="@"?(r.removeAttribute(i),n[c]={t:"e",n:r,name:i.slice(1),c:void 0,_fx:null}):i[0]==="."?(r.removeAttribute(i),n[c]={t:"p",n:r,name:H(r,i.slice(1)),c:void 0,_fx:null,_resolved:!1}):i[0]==="?"?(r.removeAttribute(i),console.warn(`[template] Lit-style boolean attribute "${i}=" is not supported.
8
8
  Element: <${r.tagName.toLowerCase()}>
9
9
  Use .${i.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.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:r,name:i,c:void 0,_fx:null}}return n}function C(t){for(let e of t)e&&e._fx&&(e._fx(),e._fx=null)}function $(t){if(t.n.nodeType===1&&t.n[v])return t.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[v]=!0,t.n.replaceWith(e),t.n=e,e}var W=t=>t!=null&&typeof t=="object"&&t.strings,D=t=>typeof t=="function"||t!=null&&typeof t.handleEvent=="function";function L(t,e){if(e!==t.c){if(t.t==="n")if(e!=null&&e._directive)e._commit($(t));else if(W(e))g(e,$(t));else if(Array.isArray(e)){let n=$(t);n.replaceChildren();for(let o of e)if(W(o)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),n.appendChild(r),g(o,r)}else n.appendChild(document.createTextNode(o??""))}else if(e instanceof Node)t.n.replaceWith(e),t.n=e;else if(t.n[v]){let n=document.createTextNode(e??"");t.n.replaceWith(n),t.n=n}else t.n.textContent=e??"";else if(t.t==="a")e==null||e===!1?t.n.removeAttribute(t.name):t.n.setAttribute(t.name,e===!0?"":e);else if(t.t==="p"){if(!t._resolved){let n=H(t.n,t.name);n!==t.name&&(t.name=n),t._resolved=!0}t.n[t.name]=e}else t.t==="e"&&(D(t.c)&&t.n.removeEventListener(t.name,t.c),D(e)&&t.n.addEventListener(t.name,e));t.c=e}}function ne(t,e){for(let n=0;n<t.length;n++){let o=t[n];if(!o)continue;let r=e[n],s=o.t!=="e"&&typeof r=="function",l=!s&&o.t!=="e"&&O(r);if(o._fx&&!s&&!l&&(o._fx(),o._fx=null),s){o._fx||(o._fx=p(()=>L(o,r())));continue}if(l){o._fx||(o._fx=p(()=>L(o,r.value)));continue}L(o,r)}}function oe(t,e,n){return{_directive:!0,_commit(o){let r=o[b]||new Map,s=new Map,l=[];for(let i=0;i<t.length;i++){let a=e(t[i],i);if(s.has(a))continue;l.push(a);let u=n(t[i],i);if(r.has(a)){let d=r.get(a);g(u,d),s.set(a,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),s.set(a,d)}}for(let[i,a]of r)s.has(i)||(a._i&&C(a._i.p),a.remove());let c=null;for(let i=l.length-1;i>=0;i--){let a=s.get(l[i]);(a.nextSibling!==c||a.parentNode!==o)&&o.insertBefore(a,c),c=a}o[b]=s}}}var N=new Map,F=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function fe(t){if(!t.name)throw new Error("Trait requires a name");if(!t.setup)throw new Error(`Trait "${t.name}" requires a setup function`);if(!t.category)throw new Error(`Trait "${t.name}" requires a category`);if(!F.has(t.category))throw new Error(`Trait "${t.name}" has unknown category "${t.category}". Known: ${[...F].join(", ")}`);if(!t.description)throw new Error(`Trait "${t.name}" requires a description`);let e=Object.freeze({name:t.name,category:t.category,description:t.description,attributes:Object.freeze(t.attributes||[]),events:Object.freeze(t.events||[]),config:Object.freeze(t.config||[])});function n(){let o=null;return{schema:e,connect(r,s){o=t.setup({host:r,...s||{}})},disconnect(r){o&&(o(),o=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return n.schema=e,N.set(t.name,n),n}function z(t){return N.get(t)||null}function de(t){return N.get(t)?.schema||null}function he(){return[...N.keys()]}var j=Symbol(),x=Symbol();function re(t,e){t[x]=new Map,t[j]=new Map;for(let[n,o]of Object.entries(e)){let r=o.attribute??n.toLowerCase(),s=o.type??String,l=m(o.default??void 0);t[j].set(n,l),Object.defineProperty(t,n,{get(){return l.value},set(c){let i=l.peek();Object.is(i,c)||(t[x].set(n,i),l.value=c,o.reflect&&se(t,r,c,s))},configurable:!0})}}function se(t,e,n,o){o===Boolean?n?t.setAttribute(e,""):t.removeAttribute(e):n==null?t.removeAttribute(e):t.setAttribute(e,String(n))}var ie=(t,e)=>e===Boolean?t!==null:e===Number?t===null?null:+t:t;function le(t){if(Object.hasOwn(t,"_sa"))return;t._sa=!0;let e=t.styles;if(!e)return;let n=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(o=>!document.adoptedStyleSheets.includes(o))]}function G(t){if(Object.hasOwn(t,"_pp"))return;t._pp={};let e=t.parts;if(e)for(let[n,o]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=o,t._pp[n]=r.content.firstElementChild}}var E=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([n,o])=>o.attribute??n.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#r=[];#e=[];#n=[];#o=null;#s=null;#t=null;#l=m(0);constructor(){super(),this.internals=this.attachInternals(),re(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),le(e),G(e),M(()=>this.connected()),this.#r.push(p(()=>{for(let o of this[j].values())o.value;this.#l.value;let n=e.template(this);if(n&&g(n,this),this.render(),this[x].size){let o=new Map(this[x]);this[x].clear(),this.updated(o)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of e.traits)this.#i(n);this.#c(),this.#o&&this.#a()}disconnectedCallback(){this._i&&C(this._i.p);for(let e of this.#r)e();this.#r.length=0;for(let e of this.#n)e.value=void 0;this.#n.length=0;for(let e of this.#e)e.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.disconnected()}#a(){let e=this.#o;e.connect?.(this),this.#s=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#o}set controller(e){this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.#o=e,e&&this.isConnected&&this.#a()}#i(e,{declarative:n=!1}={}){this.#t.add(e);let o=e();o.connect(this,{host:this,signal:m,computed:k,effect:p}),n&&(o._declarative=!0),this.#e.push(o)}addTrait(e){return this.#t||(this.#t=new Set),this.#t.has(e)?this:(this.#i(e),this)}#c(){let e=this.getAttribute("traits");if(e)for(let n of e.split(/\s+/).filter(Boolean)){let o=z(n);if(!o){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(o)||this.#i(o,{declarative:!0})}}#f(){if(!this.#t)return;let e=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let o of this.#t)if(o.schema?.name&&n.schema?.name===o.schema.name){this.#t.delete(o);break}}else e.push(n);this.#e.length=0,this.#e.push(...e),this.#c()}attributeChangedCallback(e,n,o){if(e==="traits"){this.isConnected&&this.#f();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=ie(o,s.type??String);break}}static template=()=>null;static create(e={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let o=document.createElement(n);for(let[r,s]of Object.entries(e))o[r]=s;return o}signal(e){let n=m(e);return this.#n.push(n),n}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let n=this.#u(e);if(n)return n;G(this.constructor);let o=this.constructor._pp?.[e];if(!o)return null;let r=o.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let o of this.children)if(o.getAttribute("slot")===e){o.remove();return}let n=this.#u(e);n&&n.remove()}#u(e){for(let n of this.querySelectorAll(`[slot="${e}"]`)){let o=n.parentElement,r=!0;for(;o&&o!==this;){if(o.localName.includes("-")){r=!1;break}o=o.parentElement}if(r&&o===this)return n}return null}reconcile(e,n,o,r){let s=e[b]||new Map,l=new Map,c=[];for(let a=0;a<n.length;a++){let u=n[a],d=o(u,a);if(l.has(d))continue;let w=s.get(d);w?r(u,a,w):w=r(u,a,null),l.set(d,w),c.push(d)}for(let[a,u]of s)l.has(a)||u.remove();let i=null;for(let a=c.length-1;a>=0;a--){let u=l.get(c[a]);(u.nextSibling!==i||u.parentNode!==e)&&e.insertBefore(u,i),i=u}e[b]=l}connected(){}render(){}disconnected(){}updated(e){}};var T=class extends E{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#r=null;#e=null;#n=null;connected(){this.#r=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#o(),this.#n=e=>{let n=e?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#r?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#r.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#o(){for(let e of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(e.getAttribute("data-options"));e.options=n}catch{}}};customElements.define("editor-shell",T);export{T as EditorShell};
10
+ See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:r,name:i,c:void 0,_fx:null}}return n}function C(t){for(let e of t)e&&e._fx&&(e._fx(),e._fx=null)}function $(t){if(t.n.nodeType===1&&t.n[v])return t.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[v]=!0,t.n.replaceWith(e),t.n=e,e}var W=t=>t!=null&&typeof t=="object"&&t.strings,D=t=>typeof t=="function"||t!=null&&typeof t.handleEvent=="function";function j(t,e){if(e!==t.c){if(t.t==="n")if(e!=null&&e._directive)e._commit($(t));else if(W(e))g(e,$(t));else if(Array.isArray(e)){let n=$(t);n.replaceChildren();for(let o of e)if(W(o)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),n.appendChild(r),g(o,r)}else n.appendChild(document.createTextNode(o??""))}else if(e instanceof Node)t.n.replaceWith(e),t.n=e;else if(t.n[v]){let n=document.createTextNode(e??"");t.n.replaceWith(n),t.n=n}else t.n.textContent=e??"";else if(t.t==="a")e==null||e===!1?t.n.removeAttribute(t.name):t.n.setAttribute(t.name,e===!0?"":e);else if(t.t==="p"){if(!t._resolved){let n=H(t.n,t.name);n!==t.name&&(t.name=n),t._resolved=!0}t.n[t.name]=e}else t.t==="e"&&(D(t.c)&&t.n.removeEventListener(t.name,t.c),D(e)&&t.n.addEventListener(t.name,e));t.c=e}}function ne(t,e){for(let n=0;n<t.length;n++){let o=t[n];if(!o)continue;let r=e[n],s=o.t!=="e"&&typeof r=="function",a=!s&&o.t!=="e"&&k(r);if(o._fx&&!s&&!a&&(o._fx(),o._fx=null),s){o._fx||(o._fx=p(()=>j(o,r())));continue}if(a){o._fx||(o._fx=p(()=>j(o,r.value)));continue}j(o,r)}}function oe(t,e,n){return{_directive:!0,_commit(o){let r=o[b]||new Map,s=new Map,a=[];for(let i=0;i<t.length;i++){let l=e(t[i],i);if(s.has(l))continue;a.push(l);let u=n(t[i],i);if(r.has(l)){let d=r.get(l);g(u,d),s.set(l,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),s.set(l,d)}}for(let[i,l]of r)s.has(i)||(l._i&&C(l._i.p),l.remove());let c=null;for(let i=a.length-1;i>=0;i--){let l=s.get(a[i]);(l.nextSibling!==c||l.parentNode!==o)&&o.insertBefore(l,c),c=l}o[b]=s}}}var N=new Map,F=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function fe(t){if(!t.name)throw new Error("Trait requires a name");if(!t.setup)throw new Error(`Trait "${t.name}" requires a setup function`);if(!t.category)throw new Error(`Trait "${t.name}" requires a category`);if(!F.has(t.category))throw new Error(`Trait "${t.name}" has unknown category "${t.category}". Known: ${[...F].join(", ")}`);if(!t.description)throw new Error(`Trait "${t.name}" requires a description`);let e=Object.freeze({name:t.name,category:t.category,description:t.description,attributes:Object.freeze(t.attributes||[]),events:Object.freeze(t.events||[]),config:Object.freeze(t.config||[])});function n(){let o=null;return{schema:e,connect(r,s){o=t.setup({host:r,...s||{}})},disconnect(r){o&&(o(),o=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return n.schema=e,N.set(t.name,n),n}function z(t){return N.get(t)||null}function de(t){return N.get(t)?.schema||null}function he(){return[...N.keys()]}var L=Symbol(),x=Symbol();function re(t,e){t[x]=new Map,t[L]=new Map;for(let[n,o]of Object.entries(e)){let r=o.attribute??n.toLowerCase(),s=o.type??String,a=Object.prototype.hasOwnProperty.call(t,n),c=a?t[n]:void 0;a&&delete t[n];let i=m(o.default??void 0);t[L].set(n,i),Object.defineProperty(t,n,{get(){return i.value},set(l){let u=i.peek();Object.is(u,l)||(t[x].set(n,u),i.value=l,o.reflect&&se(t,r,l,s))},configurable:!0}),a&&(i.value=c)}}function se(t,e,n,o){o===Boolean?n?t.setAttribute(e,""):t.removeAttribute(e):n==null?t.removeAttribute(e):t.setAttribute(e,String(n))}var ie=(t,e)=>e===Boolean?t!==null:e===Number?t===null?null:+t:t;function le(t){if(Object.hasOwn(t,"_sa"))return;t._sa=!0;let e=t.styles;if(!e)return;let n=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(o=>!document.adoptedStyleSheets.includes(o))]}function G(t){if(Object.hasOwn(t,"_pp"))return;t._pp={};let e=t.parts;if(e)for(let[n,o]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=o,t._pp[n]=r.content.firstElementChild}}var E=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([n,o])=>o.attribute??n.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#r=[];#e=[];#n=[];#o=null;#s=null;#t=null;#l=m(0);constructor(){super(),this.internals=this.attachInternals(),re(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),le(e),G(e),M(()=>this.connected()),this.#r.push(p(()=>{for(let o of this[L].values())o.value;this.#l.value;let n=e.template(this);if(n&&g(n,this),this.render(),this[x].size){let o=new Map(this[x]);this[x].clear(),this.updated(o)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of e.traits)this.#i(n);this.#c(),this.#o&&this.#a()}disconnectedCallback(){this._i&&C(this._i.p);for(let e of this.#r)e();this.#r.length=0;for(let e of this.#n)e.value=void 0;this.#n.length=0;for(let e of this.#e)e.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.disconnected()}#a(){let e=this.#o;e.connect?.(this),this.#s=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#o}set controller(e){this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.#o=e,e&&this.isConnected&&this.#a()}#i(e,{declarative:n=!1}={}){this.#t.add(e);let o=e();o.connect(this,{host:this,signal:m,computed:O,effect:p}),n&&(o._declarative=!0),this.#e.push(o)}addTrait(e){return this.#t||(this.#t=new Set),this.#t.has(e)?this:(this.#i(e),this)}#c(){let e=this.getAttribute("traits");if(e)for(let n of e.split(/\s+/).filter(Boolean)){let o=z(n);if(!o){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(o)||this.#i(o,{declarative:!0})}}#f(){if(!this.#t)return;let e=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let o of this.#t)if(o.schema?.name&&n.schema?.name===o.schema.name){this.#t.delete(o);break}}else e.push(n);this.#e.length=0,this.#e.push(...e),this.#c()}attributeChangedCallback(e,n,o){if(e==="traits"){this.isConnected&&this.#f();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=ie(o,s.type??String);break}}static template=()=>null;static create(e={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let o=document.createElement(n);for(let[r,s]of Object.entries(e))o[r]=s;return o}signal(e){let n=m(e);return this.#n.push(n),n}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let n=this.#u(e);if(n)return n;G(this.constructor);let o=this.constructor._pp?.[e];if(!o)return null;let r=o.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let o of this.children)if(o.getAttribute("slot")===e){o.remove();return}let n=this.#u(e);n&&n.remove()}#u(e){for(let n of this.querySelectorAll(`[slot="${e}"]`)){let o=n.parentElement,r=!0;for(;o&&o!==this;){if(o.localName.includes("-")){r=!1;break}o=o.parentElement}if(r&&o===this)return n}return null}reconcile(e,n,o,r){let s=e[b]||new Map,a=new Map,c=[];for(let l=0;l<n.length;l++){let u=n[l],d=o(u,l);if(a.has(d))continue;let w=s.get(d);w?r(u,l,w):w=r(u,l,null),a.set(d,w),c.push(d)}for(let[l,u]of s)a.has(l)||u.remove();let i=null;for(let l=c.length-1;l>=0;l--){let u=a.get(c[l]);(u.nextSibling!==i||u.parentNode!==e)&&e.insertBefore(u,i),i=u}e[b]=a}connected(){}render(){}disconnected(){}updated(e){}};var T=class extends E{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#r=null;#e=null;#n=null;connected(){this.#r=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#o(),this.#n=e=>{let n=e?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#r?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#r.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#o(){for(let e of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(e.getAttribute("data-options"));e.options=n}catch{}}};customElements.define("editor-shell",T);export{T as EditorShell};