@symbo.ls/element 3.14.446 → 3.14.577

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,17 @@
1
1
  # @symbo.ls/element
2
2
 
3
+ ## 3.14.577
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.503
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated cross-repo patch release.
14
+
3
15
  ## 3.14.446
4
16
 
5
17
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- "use strict";var Y=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var lt=(t,s)=>{for(var n in s)Y(t,n,{get:s[n],enumerable:!0})},ht=(t,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of pt(s))!yt.call(t,c)&&c!==n&&Y(t,c,{get:()=>s[c],enumerable:!(i=dt(s,c))||i.enumerable});return t};var _t=t=>ht(Y({},"__esModule",{value:!0}),t);var $t={};lt($t,{create:()=>T,default:()=>Lt});module.exports=_t($t);var k=require("@symbo.ls/signal"),j=require("@symbo.ls/signal"),N=require("./cache.js"),P=require("./registry.js"),et=require("./delegate.js"),ft=require("./extends.js"),at=require("./methods.js"),Dt=require("./dispose.js"),V=require("@symbo.ls/utils"),W=require("@symbo.ls/utils/function.js"),F=require("@symbo.ls/state"),x=require("css-in-props"),ut=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),I=require("attrs-in-props");let gt=1;function M(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function bt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function xt(t){return t.toLowerCase()}function G(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=G(c,o):n[i]=o}return n}function T(t,s,n,i={},c){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${gt++}`,o.parent=s||null,o.context=t.context||s?.context||i.context||{},o.context.__create||(o.context.__create=T);const e=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const h=n.indexOf("_");if(h>0){const _=n.substring(0,h),g=o.context?.components;g&&(g[_]||g["smbls."+_])&&(t={extends:_,...t})}}(0,ft.applyExtends)(o,t,i);const f=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const _=t[h],g=o[h],b=g&&_&&typeof g=="object"&&typeof _=="object"&&!Array.isArray(g)&&!Array.isArray(_)&&typeof g!="function"&&typeof _!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=G(g,_):b&&f.has(h)?o[h]={...g,..._}:o[h]=_}function a(h){for(const _ in h){const g=h[_],b=o[_],C=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";C&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=G(b,g):C&&f.has(_)?o[_]={...b,...g}:o[_]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,d=s?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,p=d||l||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=(0,k.createScopeStore)(h,p)}else p&&(o.scope=p);if(t.if!==void 0&&(o.if=t.if),(0,at.addMethods)(o),At(o,s,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(_){if(h=!1,e.__ifError=_,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,_?.message||_)}}else h=o.if;e.__if=!!h}if(e.__if)typeof t.if=="function"&&(e.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof t.if=="function"&&Z(o,{if:t.if}),o;o.tag||(o.tag=(0,N.detectTag)(o)),R("Init",o,i);const y=o.node=(0,N.cacheNode)(o);if(!y)return o;R("AttachNode",o,i),y.setAttribute&&o.key&&y.setAttribute("data-key",o.key),y.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&y.setAttribute("data-smbls-app",o.context.key),o.id&&y.setAttribute&&(y.id=o.id),rt(o,i),Z(o,t),z(o),ct(o),Pt(o);try{it(o,i)}catch(h){if(typeof console<"u"&&console.error){const _=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
1
+ "use strict";var G=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var _t=Object.prototype.hasOwnProperty;var gt=(t,s)=>{for(var n in s)G(t,n,{get:s[n],enumerable:!0})},bt=(t,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of ht(s))!_t.call(t,c)&&c!==n&&G(t,c,{get:()=>s[c],enumerable:!(i=lt(s,c))||i.enumerable});return t};var xt=t=>bt(G({},"__esModule",{value:!0}),t);var $t={};gt($t,{create:()=>N,default:()=>Nt});module.exports=xt($t);var k=require("@symbo.ls/signal"),S=require("@symbo.ls/signal"),$=require("./cache.js"),E=require("./registry.js"),dt=require("./delegate.js"),pt=require("./extends.js"),yt=require("./methods.js"),Kt=require("./dispose.js"),H=require("@symbo.ls/utils"),U=require("@symbo.ls/utils/function.js"),I=require("@symbo.ls/state"),x=require("css-in-props"),tt=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),V=require("attrs-in-props");let At=1;function F(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function vt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function St(t){return t.toLowerCase()}function ct(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function W(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=W(c,o):n[i]=o}return n}function N(t,s,n,i={},c){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${At++}`,o.parent=s||null,o.context=t.context||s?.context||i.context||{},o.context.__create||(o.context.__create=N);const r=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const h=n.indexOf("_");if(h>0){const _=n.substring(0,h),g=o.context?.components;g&&(g[_]||g["smbls."+_])&&(t={...t,extends:_})}}(0,pt.applyExtends)(o,t,i);const e=new Set(["childProps","attr","style","scope","data"]),f=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const _=t[h],g=o[h],b=g&&_&&typeof g=="object"&&typeof _=="object"&&!Array.isArray(g)&&!Array.isArray(_)&&typeof g!="function"&&typeof _!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=W(g,_):b&&e.has(h)?o[h]={...g,..._}:b&&ct(h)?o[h]=W(g,_):o[h]=_}function a(h){for(const _ in h){const g=h[_],b=o[_],C=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";C&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=W(b,g):C&&e.has(_)?o[_]={...b,...g}:C&&ct(_)?o[_]=W(b,g):o[_]=g}}f&&a(f),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,d=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=d||p||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=(0,k.createScopeStore)(h,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),(0,yt.addMethods)(o),Ct(o,s,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(_){if(h=!1,r.__ifError=_,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,_?.message||_)}}else h=o.if;r.__if=!!h}if(r.__if)typeof t.if=="function"&&(r.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof t.if=="function"&&z(o,{if:t.if}),o;o.tag||(o.tag=(0,$.detectTag)(o)),R("Init",o,i);const l=o.node=(0,$.cacheNode)(o);if(!l)return o;if(o.tag==="fragment"){const _=(o.context?.document||globalThis.document).createComment("");l.appendChild(_),r.__fragmentAnchor=_}R("AttachNode",o,i),l.setAttribute&&o.key&&l.setAttribute("data-key",o.key),l.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&l.setAttribute("data-smbls-app",o.context.key),o.id&&l.setAttribute&&(l.id=o.id),at(o,i),z(o,t),q(o),et(o),Tt(o);try{ut(o,i)}catch(h){if(typeof console<"u"&&console.error){const _=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
2
2
  `+h.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(J(o,s,c),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&(0,A.pushConfig)(h);try{const _=o.html(o,o.state,o.context);_!=null&&typeof _!="function"&&(o.node.innerHTML=_)}catch{}finally{h&&(0,A.popConfig)()}}if(R("Create",o,i),R("Complete",o,i),R("Render",o,i),R("RenderRouter",o,i),typeof o.onFrame=="function"){const h=o.onFrame,_=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){_&&(0,A.pushConfig)(_);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{_&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,s,n){const i=!s,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&c&&t.context?.state,e=n.state!==void 0&&!o?n.state:t.state&&!(0,k.isStore)(t.state)?t.state:void 0;if(e==null){if(s?.state)t.state=s.state,(0,F.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const p in d)r[p]===void 0&&(r[p]=d[p]);const l=new Set(a.languages||[]);for(const p in a.translations)!l.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=(0,k.isStore)(r)?r:(0,k.createStore)(r),t.state.__element=t,t.state.root=t.state,(0,F.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="string"){if(t.state=ot(e,s),t.state&&typeof t.state=="object"&&!(0,k.isStore)(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="function"){const f=e(t,s?.state);t.state=(0,k.isStore)(f)?f:(0,k.createStore)(f||{})}else(0,k.isStore)(e)?t.state=e:t.state=(0,k.createStore)({...e});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,F.applyStateMethods)(t,t.state)}function U(t,s){if(!s)return t;const n=s.split("/");let i=t;for(const c of n){if(i==null)return{};i=i[c]}return i??{}}function ot(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const c=t.slice(3);return c?U(s.state,c):s.state??{}}if(t.startsWith("~/")){const c=s.state?.root||s.state,o=t.slice(2);return o?U(c,o):c??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=U(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const i=s.context?.polyglot;if(i?.translations){const c=s.state?.root?.lang||i.defaultLang||"en",o=i.translations[c];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function vt(t){const s=t.__ref,n=t.tag||"div",i=t.context?.designSystem,c=[],o=Object.keys(t);for(let e=0;e<o.length;e++){const f=o[e];if(typeof t[f]!="function"||P.REGISTRY.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||x.CSS_PROPS_REGISTRY[f]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,I.checkAttributeByTagName)(n,f)||c.push({prop:f,fn:t[f]})}for(let e=0;e<c.length;e++){const{prop:f,fn:r}=c[e];s.__exec[f]=r,Object.defineProperty(t,f,{get(){i&&(0,A.pushConfig)(i);try{return r(t,t.state,t.context)}catch{return}finally{i&&(0,A.popConfig)()}},set(a){delete s.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Z(t,s){const n=t.__ref;if(vt(t),typeof t.text=="function"){const c=t.text,o=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let e=c(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&typeof e!="object"&&(typeof e=="string"&&e.includes("{{")&&(e=V.replaceLiteralsWithObjectFields.call(t,e,t.state)),t.tag==="string"?t.node.nodeValue=e:t.node.textContent=e)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}else if(typeof t.text=="string"&&t.text.includes("{{")){const c=t.text,o=(0,j.createEffect)(()=>{if(n.contentManaged)return;const e=V.replaceLiteralsWithObjectFields.call(t,c,t.state);e!=null&&(t.text=e),t.node&&(t.tag==="string"?t.node.nodeValue=e??"":t.node.textContent=e??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&typeof t[c]=="function"&&!P.REGISTRY.has(c)&&!M(c)&&!n.__exec[c]){if(x.CSS_PROPS_REGISTRY[c]){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context),d=x.CSS_PROPS_REGISTRY[e](u,t,t.state,t.context);if(d&&t.node){const l=st(d);(l===null||l!==f)&&(f=l,K(t.node,d))}else t.node&&(e==="show"||e==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c)){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const d=e+":"+String(u);d!==f&&(f=d,K(t.node,{[e]:u}))}else f=void 0,t.node.style[e]=""}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}}if(typeof s.html=="function"){const c=s.html,o=(0,j.createEffect)(()=>{const e=t.context?.designSystem;e&&(0,A.pushConfig)(e);try{const f=c(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{e&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=c}if(typeof s.value=="function"){const c=s.value,o=(0,j.createEffect)(()=>{try{const e=c(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=e==null?"":String(e);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=c}if(typeof s.style=="function"){const c=s.style;let o;const e=(0,j.createEffect)(()=>{const f=c(t,t.state,t.context),r=st(f);(r===null||r!==o)&&(o=r,K(t.node,f))},{depth:n.path.length});n.__effects.push(e),n.__exec.style=c}else if(t.style&&typeof t.style=="object")for(const c in t.style){const o=t.style[c];if(typeof o!="function")continue;let e;const f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=c+":"+String(r);a!==e&&(e=a,K(t.node,{[c]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const c in t.attr)if(typeof t.attr[c]=="function"){const o=t.attr[c],e=c,f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o!="function")continue;const e="aria-"+c.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const c in t.data){const o=t.data[c];if(typeof o!="function")continue;const f="data-"+c.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const i=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(i)for(const c in i){const o=i[c];if(typeof o!="function")continue;const e=(0,j.createEffect)(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(c):t.node.classList.remove(c)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(typeof s.if=="function"){const c=s.if,o=(0,j.createEffect)(()=>{let e;try{e=c(t,t.state,t.context)}catch(r){if(e=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!e,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,N.cacheNode)(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const d=Object.keys(r),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=r[d[p]];if(y?.node?.parentNode===a){u=y.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else J(t,t.parent);z(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,N.detectTag)(t)),R("Init",t,{}),t.node||(t.node=(0,N.cacheNode)(t)),!t.node)return;R("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),rt(t,{});const r=s.if;delete s.if;try{Z(t,s)}finally{s.if=r}z(t),ct(t),it(t,{}),J(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||P.REGISTRY.has(c)||typeof t[c]!="function")continue;const o=c.charCodeAt(0);if(o>=65&&o<=90||M(c))continue;const e=t[c];n.__exec[c]=e;const f=t.tag||"div";if((0,I.checkAttributeByTagName)(f,c)&&!x.CSS_PROPS_REGISTRY[c]&&!(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))){const r=c,a=(0,j.createEffect)(()=>{try{const u=e(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}kt(t),Ct(t)}function z(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),Et(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&K(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const i=t.attr[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.setAttribute&&s.setAttribute(n,i===!0?"":i)}if(t.data&&typeof t.data=="object")for(const n in t.data){const i=t.data[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.dataset&&(s.dataset[n]=i===!0?"":i)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(i=>i&&s.classList.add(i));else if(typeof n=="object")for(const i in n){const c=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];c&&s.classList.add(typeof c=="string"?c:i)}}}}function st(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function K(t,s){if(!t||!s||!t.style)return;let n=null;for(const i in s){const c=s[i];if(c!=null){if(i.charAt(0)==="&"&&typeof c=="object"){n||(n={}),n[i]=c;continue}try{const o=String(c),e=i.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(e,a,r?"important":"")}catch{}}}n&&St(t,n)}let jt=0;function St(t,s){const n=`_ds${jt++}`;t.classList.add(n);const i=t.ownerDocument;let c=i.querySelector("style[data-smbls-scoped]");c||(c=i.createElement("style"),c.setAttribute("data-smbls-scoped",""),i.head.appendChild(c));let o="";for(const e in s){const f="."+n,r=e.replace(/&/g,f).split(",").map(u=>{const d=u.trim();return d.includes(f)?d:f+d}).join(", "),a=s[e];if(typeof a=="object"){let u="",d="";for(const l in a){const p=a[l];if(typeof p=="object"){const y=l.includes("&")?r.split(", ").map(_=>l.replace(/&/g,_)).join(", "):r.split(", ").map(_=>`${_} ${l}`).join(", ");let h="";for(const _ in p)h+=`${_.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[_]};`;d+=`${y} { ${h} }
5
- `}else u+=`${l.replace(/[A-Z]/g,y=>"-"+y.toLowerCase())}: ${p};`}u&&(o+=`${r} { ${u} }
6
- `),d&&(o+=d)}}o&&(c.textContent+=o)}function kt(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let i=0;i<s.length;i++){const c=s[i];if(typeof c!="string"||c.length===0)continue;const o=c.split("."),e=o[0],f=o.slice(1),r={value:!1},a=(0,j.createEffect)(()=>{const u=t.state&&((0,k.isStore)(t.state)?t.state.root:null);if(!u||!(0,k.isStore)(u))return;let d=u;d=d[e];for(let l=0;l<f.length&&!(d==null||typeof d!="object");l++)if((0,k.isStore)(d))d=d[f[l]];else break;if(r.value&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&(0,A.pushConfig)(l);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&(0,W.runPluginHook)("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{l&&(0,A.popConfig)()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const s=t.__ref;s.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const c=n.slice(1);if(!c)continue;const o=t[n];if(!o||typeof o!="object")continue;const e=i==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const d=t[c];if(d===void 0)if(t.state&&c in t.state)u=t.state[c];else{const y=t.context?.cases?.[c];if(y===void 0)return;try{u=typeof y=="function"?y.call(t,t):y}catch(h){u=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof d=="function")try{u=d(t,t.state,t.context)}catch(y){u=!1,s.__conditionalError=y,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,y?.message||y)}else u=d;const l=e?!u:!!u;if(l===f.lastMatch)return;f.lastMatch=l;const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);try{if(l){const y={};for(const _ in o){if(!Object.prototype.hasOwnProperty.call(o,_))continue;const g=typeof o[_]=="function"?o[_](t,t.state,t.context):o[_];if(g!=null)if(x.CSS_PROPS_REGISTRY[_]){const b=x.CSS_PROPS_REGISTRY[_](g,t,t.state,t.context);if(b){const C=Array.isArray(b)?b:[b];for(const O of C)O&&Object.assign(y,O)}}else x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(_)&&(y[_]=g)}const h=Object.keys(y);h.length?(K(t.node,y),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const y of f.appliedKeys)t.node.style[y]="";f.appliedKeys=null}}finally{p&&(0,A.popConfig)()}};s.__conditionalRunners.push(r);const a=(0,j.createEffect)(r,{depth:s.path.length});s.__effects.push(a)}}const B=new WeakSet;function wt(t){const s=t.ownerDocument;!s||B.has(s)||(B.add(s),queueMicrotask(()=>{B.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const q=new WeakSet;function Et(t){const{node:s}=t;if(!s)return;if(q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}q.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const i={};let c=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||P.REGISTRY.has(o))continue;const e=o.charCodeAt(0);if(!(e>=65&&e<=90)&&!M(o)){if(x.CSS_PROPS_REGISTRY[o]){const f=t[o],r=x.CSS_PROPS_REGISTRY[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(i,a);else Object.assign(i,r);c=!0}}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={},a=(u,d,l)=>{if(x.CSS_PROPS_REGISTRY[d]){const p=x.CSS_PROPS_REGISTRY[d](l,t,t.state,t.context);if(p)if(Array.isArray(p))for(const y of p)y&&Object.assign(u,y);else Object.assign(u,p)}else u[d]=l};for(const u in f){let d=f[u];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function")){if(u==="style"&&typeof d=="object"&&!Array.isArray(d)){for(const l in d){let p=d[l];typeof p=="function"&&(p=p(t,t.state,t.context)),!(p==null||typeof p=="function")&&a(r,l,p)}continue}a(r,u,d)}}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const d={};for(const p in r){const y=r[p];d[p]=typeof y=="string"&&!y.includes("!important")?y+" !important":y}const l=o.slice(1);i[`[data-theme="${l}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const p=o.slice(1),y=t.context?.designSystem?.media?.[p]||t.context?.designSystem?.media?.[p];y&&(d=`@media ${y}`)}const l={};for(const p in r){const y=r[p];if(y&&typeof y=="object"&&!Array.isArray(y)){const h={};for(const g in y)if(x.CSS_PROPS_REGISTRY[g]){const b=x.CSS_PROPS_REGISTRY[g](y[g],t,t.state,t.context);if(b)if(Array.isArray(b))for(const C of b)C&&Object.assign(h,C);else Object.assign(h,b)}else h[g]=y[g];const _=p.startsWith(":")?"":" ";if(d.includes(",")){const g=d.split(",").map(b=>`${b.trim()}${_}${p}`).join(", ");i[g]=h}else i[`${d}${_}${p}`]=h}else l[p]=y}Object.keys(l).length&&(i[d]=l)}c=!0}c=!0}}}}if(c){i.display&&String(i.display).includes("!important")&&(s.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,ut.css)(i,null,t.context?.cssPrefix);if(o&&s.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)s.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&wt(s)}const e=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(e!=null){const f=i.display;if(f&&f!==e)if(e==="none"){const r=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,A.popConfig)(),q.delete(t)}}function ct(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const e="aria-"+c.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(e,o===!0?"":o)}const n=(0,I.applyAttrTransforms)(t);for(const c in n){const o=n[c];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(c,o===!0?"":o)}const i=t.tag||"div";for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||typeof t[c]=="function"||P.REGISTRY.has(c)||c==="on"||n[c]!==void 0)continue;const o=c.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(c)&&!(x.CSS_PROPS_REGISTRY[c]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))&&(0,I.checkAttributeByTagName)(i,c)){let e=t[c];if(e==null||e===!1||(typeof e=="string"&&e.includes("{{")&&(e=(0,V.replaceLiteralsWithObjectFields)(e,t,t.state,t.context),t[c]=e),e==null||e===!1||typeof e=="function"||typeof e=="object"))continue;s.setAttribute(c,e===!0?"":e)}}}function Pt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,i=n&&typeof n=="object"&&n.max?String(n.max):null;i&&(s.style.maxHeight=i);const c=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};c(),s.addEventListener("input",c),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",c)}catch{}})}const nt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function rt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||nt.has(n))continue;let i=t[n];if(typeof i=="string"&&/^[A-Za-z_$][\w$]*$/.test(i)){const o=i;i=function(f){return t.call(o,f)}}if(typeof i!="function")continue;const c=bt(n);P.LIFECYCLE_EVENTS.has(c)||(0,et.registerEvent)(xt(c),t,i)}Ot(t)}function Ot(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let i=!1;for(const l of nt){const p=t[l];typeof p=="function"&&(n[l]=p,i=!0)}if(!i)return;const c=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let e=0,f=0,r=0,a=!1;const u=l=>{const p=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];p&&(e=p.clientX,f=p.clientY,r=Date.now(),a=!0)},d=l=>{if(!a)return;a=!1;const p=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!p)return;const y=p.clientX-e,h=p.clientY-f,_=Date.now()-r;if(_>o)return;const g=Math.abs(y),b=Math.abs(h);if(Math.max(g,b)<c)return;let C;if(g>b*1.2)C=y<0?"left":"right";else if(b>g*1.2)C=h<0?"up":"down";else return;const O="onSwipe"+C.charAt(0).toUpperCase()+C.slice(1),S=n[O],w=n.onSwipe;S&&S.call(t,l,t,t.state,t.context),w&&w.call(t,{direction:C,dx:y,dy:h,dt:_,event:l},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",d)}catch{}})}function X(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=X(c,o):n[i]=o}return n}function Q(t,s,n){if(!s||!t.node)return;const i=t.childExtends;if(Array.isArray(s)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const e=t.childProps,f=t.childrenAs;for(let r=0;r<s.length;r++){let a=s[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let d=e;if(typeof e=="function")try{d=e(t,a)}catch{d=null}if(f==="state"){let y=u;(typeof u=="string"||typeof u=="number")&&(y={value:u,text:u}),a=d?{...d,state:y}:{state:y}}else d&&(a=X(d,a));if(i&&!a.ignoreChildExtends)if(a.extends){const y=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(i)?i:[i];a={...a,extends:[...h,...y]}}else a={extends:i,...a};const l=a?.key||u&&typeof u=="object"&&u.key||`${r}`,p=T(a,t,l,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof s=="string"){const c=ot(s,t);if(Array.isArray(c)){Q(t,c,n);return}}if(typeof s=="object")for(const c in s){if(P.REGISTRY.has(c))continue;let o=s[c];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const e=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(i)?i:[i];o={...o,extends:[...f,...e]}}else o={extends:i,...o};T(o,t,c,n)}}}function it(t,s){let{children:n,content:i}=t;const c=t.childExtends;if(typeof n=="function"){const e=n;n=e(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=(0,j.createEffect)(()=>{const u=e(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,y=[],h=new Map;for(let S=0;S<u.length;S++){const w=u[S];let v=p;if(typeof p=="function")try{v=p(t,w)}catch{v=null}const D=v&&v.key||w&&w.key||`${S}`;y.push(D),h.set(D,{rawChild:w,childProps:v})}const _=new Set(y),g=f.__children.slice();for(const S of g)if(!_.has(S)){const w=t[S];w?.remove&&w.remove(),delete t[S]}const b=t.childExtends,O=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const S of y){const w=h.get(S),v=w.rawChild,D=t[S];if(D&&D.state){if(v&&typeof v=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(v);else if(typeof $.update=="function"){for(const E in $)if(!(E==="__element"||E==="root"||E==="parent"||E==="update")&&!Object.prototype.hasOwnProperty.call(v,E))try{$[E]=void 0}catch{}$.update(v)}else for(const E in v)$[E]=v[E]}continue}let H=v;(typeof v=="string"||typeof v=="number")&&(H={value:v,text:v});const m=w.childProps;let L=m?{...m,state:H}:{state:H};if(b&&!L.ignoreChildExtends)if(L.extends){const $=Array.isArray(L.extends)?L.extends:[L.extends],E=Array.isArray(b)?b:[b];L={...L,extends:[...E,...$]}}else L={extends:b,...L};const tt=T(L,t,S,s);tt?.node&&O&&O.appendChild(tt.node)}O&&O.childNodes.length&&t.node&&t.node.appendChild(O),f.__children=y;return}for(const p of[...f.__children]){const y=t[p];y?.remove&&y.remove(),delete t[p]}f.__children=[],Q(t,u,s)},{depth:f.path.length});f.__effects.push(a)}if(Q(t,n||i,s),n||i)return;const o=t.context?.components||{};{const e=Object.keys(t);for(let f=0;f<e.length;f++){const r=e[f];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[r]};delete t[r];for(let d=f+1;d<e.length;d++){const l=e[d],p=l.charCodeAt(0);if(p>=65&&p<=90||P.REGISTRY.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const y=t[l];y!==void 0&&(u[l]=y,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e)||P.REGISTRY.has(e)||typeof t[e]!="object"||t[e]===null)continue;const f=e.charCodeAt(0);if(f<65||f>90)continue;let r=t[e];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[e]||o[`smbls.${e}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),c&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(c)?c:[c];r={...r,extends:[...u,...a]}}else r={extends:c,...r};T(r,t,e,s)}}}function J(t,s,n){const{node:i}=t;if(!i)return;i.ref=t;const c=s?.node||(s?.nodeType?s:null);if(c)if(n?.position==="before"&&n.node)c.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?c.insertBefore(i,o):c.appendChild(i)}else c.appendChild(i)}function R(t,s,n){const i=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,W.runPluginHook)(i,s,n);const c="on"+t,o=s[c];if(typeof o=="function"){const e=t==="Render"||t==="RenderRouter";if(e){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const f=s.context?.designSystem;f&&(0,A.pushConfig)(f);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&(0,W.runPluginHook)("error",s,{hook:c,error:r})||console.error(`[DOMQL] Lifecycle "${c}" error:`,r),s.context?.strictMode)throw r}finally{f&&(0,A.popConfig)(),e&&(s.__ref.__inRender=!1)}}return!0}var Lt=T;
4
+ `):"")}}if(m(o,s,c),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&(0,A.pushConfig)(h);try{const _=o.html(o,o.state,o.context);_!=null&&typeof _!="function"&&(o.node.innerHTML=_)}catch{}finally{h&&(0,A.popConfig)()}}if(R("Create",o,i),R("Complete",o,i),R("Render",o,i),R("RenderRouter",o,i),typeof o.onFrame=="function"){const h=o.onFrame,_=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){_&&(0,A.pushConfig)(_);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{_&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Ct(t,s,n){const i=!s,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&c&&t.context?.state,r=n.state!==void 0&&!o?n.state:t.state&&!(0,k.isStore)(t.state)?t.state:void 0;if(r==null){if(s?.state)t.state=s.state,(0,I.applyStateMethods)(t,t.state);else if(t.context?.state){const e=t.context.state,f={...e},a=t.context?.polyglot;if(a?.translations){const u=e.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const y in d)f[y]===void 0&&(f[y]=d[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&f[y]===void 0&&(f[y]=a.translations[y])}t.state=(0,k.isStore)(f)?f:(0,k.createStore)(f),t.state.__element=t,t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="string"){if(t.state=nt(r,s),t.state&&typeof t.state=="object"&&!(0,k.isStore)(t.state)){const e=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="function"){const e=r(t,s?.state);t.state=(0,k.isStore)(e)?e:(0,k.createStore)(e||{})}else(0,k.isStore)(r)?t.state=r:t.state=(0,k.createStore)({...r});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}function Z(t,s){if(!s)return t;const n=s.split("/");let i=t;for(const c of n){if(i==null)return{};i=i[c]}return i??{}}function nt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const c=t.slice(3);return c?Z(s.state,c):s.state??{}}if(t.startsWith("~/")){const c=s.state?.root||s.state,o=t.slice(2);return o?Z(c,o):c??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=Z(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const i=s.context?.polyglot;if(i?.translations){const c=s.state?.root?.lang||i.defaultLang||"en",o=i.translations[c];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function jt(t){const s=t.__ref,n=t.tag||"div",i=t.context?.designSystem,c=[],o=Object.keys(t);for(let r=0;r<o.length;r++){const e=o[r];if(typeof t[e]!="function"||E.REGISTRY.has(e))continue;const f=e.charCodeAt(0);f>=65&&f<=90||F(e)||x.CSS_PROPS_REGISTRY[e]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(e)||(0,V.checkAttributeByTagName)(n,e)||c.push({prop:e,fn:t[e]})}for(let r=0;r<c.length;r++){const{prop:e,fn:f}=c[r];s.__exec[e]=f,Object.defineProperty(t,e,{get(){i&&(0,A.pushConfig)(i);try{return f(t,t.state,t.context)}catch{return}finally{i&&(0,A.popConfig)()}},set(a){delete s.__exec[e],Object.defineProperty(t,e,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function z(t,s){const n=t.__ref;if(jt(t),typeof t.text=="function"){const c=t.text,o=(0,S.createEffect)(()=>{if(!n.contentManaged)try{let r=c(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=H.replaceLiteralsWithObjectFields.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}else if(typeof t.text=="string"&&t.text.includes("{{")){const c=t.text,o=(0,S.createEffect)(()=>{if(n.contentManaged)return;const r=H.replaceLiteralsWithObjectFields.call(t,c,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&typeof t[c]=="function"&&!E.REGISTRY.has(c)&&!F(c)&&!n.__exec[c]){if(x.CSS_PROPS_REGISTRY[c]){const o=t[c],r=c;let e;const f=(0,S.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context),d=x.CSS_PROPS_REGISTRY[r](u,t,t.state,t.context);if(d&&t.node){const p=rt(d);(p===null||p!==e)&&(e=p,K(t.node,d))}else t.node&&(r==="show"||r==="hide")&&(e=void 0,t.node.style.display="")}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[c]=o}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c)){const o=t[c],r=c;let e;const f=(0,S.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const d=r+":"+String(u);d!==e&&(e=d,K(t.node,{[r]:u}))}else e=void 0,t.node.style[r]=""}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[c]=o}}if(typeof s.html=="function"){const c=s.html,o=(0,S.createEffect)(()=>{const r=t.context?.designSystem;r&&(0,A.pushConfig)(r);try{const e=c(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&(t.node.innerHTML=e)}finally{r&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=c}if(typeof s.value=="function"){const c=s.value,o=(0,S.createEffect)(()=>{try{const r=c(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const e=r==null?"":String(r);if(t.node.value===e)return;const f=typeof document<"u"&&document.activeElement===t.node,a=f&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=f&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=e,f&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=c}if(typeof s.style=="function"){const c=s.style;let o;const r=(0,S.createEffect)(()=>{const e=c(t,t.state,t.context),f=rt(e);(f===null||f!==o)&&(o=f,K(t.node,e))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=c}else if(t.style&&typeof t.style=="object")for(const c in t.style){const o=t.style[c];if(typeof o!="function")continue;let r;const e=(0,S.createEffect)(()=>{try{const f=o(t,t.state,t.context);if(t.node){const a=c+":"+String(f);a!==r&&(r=a,K(t.node,{[c]:f}))}}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.attr&&typeof t.attr=="object"){for(const c in t.attr)if(typeof t.attr[c]=="function"){const o=t.attr[c],r=c,e=(0,S.createEffect)(()=>{try{const f=o(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o!="function")continue;const r="aria-"+c.replace(/[A-Z]/g,f=>"-"+f.toLowerCase()),e=(0,S.createEffect)(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const c in t.data){const o=t.data[c];if(typeof o!="function")continue;const e="data-"+c.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),f=(0,S.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(f)}const i=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(i)for(const c in i){const o=i[c];if(typeof o!="function")continue;const r=(0,S.createEffect)(()=>{try{const e=o(t,t.state,t.context);if(!t.node?.classList)return;typeof e=="string"?t.node.classList.add(e):e?t.node.classList.add(c):t.node.classList.remove(c)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(typeof s.if=="function"){const c=s.if,o=(0,S.createEffect)(()=>{let r;try{r=c(t,t.state,t.context)}catch(f){if(r=!1,n.__ifError=f,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,f?.message||f)}return}const e=n.__if;if(n.__if=!!r,e&&!n.__if&&t.node)t.node.remove();else if(!e&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,$.cacheNode)(t)),t.node&&(t.node.ref=t);const f=t.parent,a=f?.node;if(a&&t.node){let u=null;const d=Object.keys(f),p=d.indexOf(t.key);for(let y=p+1;y<d.length;y++){const l=f[d[y]];if(l?.node?.parentNode===a){u=l.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else m(t,t.parent);q(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,$.detectTag)(t)),R("Init",t,{}),t.node||(t.node=(0,$.cacheNode)(t)),!t.node)return;if(t.tag==="fragment"&&!n.__fragmentAnchor){const u=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(u),n.__fragmentAnchor=u}R("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),at(t,{});const f=s.if;delete s.if;try{z(t,s)}finally{s.if=f}q(t),et(t),ut(t,{}),m(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||E.REGISTRY.has(c)||typeof t[c]!="function")continue;const o=c.charCodeAt(0);if(o>=65&&o<=90||F(c))continue;const r=t[c];n.__exec[c]=r;const e=t.tag||"div";if((0,V.checkAttributeByTagName)(e,c)&&!x.CSS_PROPS_REGISTRY[c]&&!(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))){const f=c,a=(0,S.createEffect)(()=>{try{const u=r(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(f):typeof u!="function"&&typeof u!="object"&&(f==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(f,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}Et(t),Pt(t)}function q(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),Lt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&K(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const i=t.attr[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.setAttribute&&s.setAttribute(n,i===!0?"":i)}if(t.data&&typeof t.data=="object")for(const n in t.data){const i=t.data[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.dataset&&(s.dataset[n]=i===!0?"":i)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(i=>i&&s.classList.add(i));else if(typeof n=="object")for(const i in n){const c=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];c&&s.classList.add(typeof c=="string"?c:i)}}}}function rt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function K(t,s){if(!t||!s||!t.style)return;let n=null;for(const i in s){const c=s[i];if(c!=null){if(i.charAt(0)==="&"&&typeof c=="object"){n||(n={}),n[i]=c;continue}try{const o=String(c),r=i.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),e=o.trim(),f=/\s*!important\s*$/.test(e),a=e.replace(/\s*!important\s*$/,"");t.style.setProperty(r,a,f?"important":"")}catch{}}}n&&wt(t,n)}let kt=0;function wt(t,s){const n=`_ds${kt++}`;t.classList.add(n);const i=t.ownerDocument;let c=i.querySelector("style[data-smbls-scoped]");c||(c=i.createElement("style"),c.setAttribute("data-smbls-scoped",""),i.head.appendChild(c));let o="";for(const r in s){const e="."+n,f=r.replace(/&/g,e).split(",").map(u=>{const d=u.trim();return d.includes(e)?d:e+d}).join(", "),a=s[r];if(typeof a=="object"){let u="",d="";for(const p in a){const y=a[p];if(typeof y=="object"){const l=p.includes("&")?f.split(", ").map(_=>p.replace(/&/g,_)).join(", "):f.split(", ").map(_=>`${_} ${p}`).join(", ");let h="";for(const _ in y)h+=`${_.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[_]};`;d+=`${l} { ${h} }
5
+ `}else u+=`${p.replace(/[A-Z]/g,l=>"-"+l.toLowerCase())}: ${y};`}u&&(o+=`${f} { ${u} }
6
+ `),d&&(o+=d)}}o&&(c.textContent+=o)}function Et(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let i=0;i<s.length;i++){const c=s[i];if(typeof c!="string"||c.length===0)continue;const o=c.split("."),r=o[0],e=o.slice(1),f={value:!1},a=(0,S.createEffect)(()=>{const u=t.state&&((0,k.isStore)(t.state)?t.state.root:null);if(!u||!(0,k.isStore)(u))return;let d=u;d=d[r];for(let p=0;p<e.length&&!(d==null||typeof d!="object");p++)if((0,k.isStore)(d))d=d[e[p]];else break;if(f.value&&(typeof t.onBeforeUpdate=="function"||typeof t.onUpdate=="function")){const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);let y="onBeforeUpdate";try{let l=!1;typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0),y="onUpdate",!l&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context)}catch(l){t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:y,error:l})||console.error(`[DOMQL] subscribeTo ${y} error:`,l)}finally{p&&(0,A.popConfig)()}}},{depth:n.path.length});f.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function Pt(t){const s=t.__ref;s.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const c=n.slice(1);if(!c)continue;const o=t[n];if(!o||typeof o!="object")continue;const r=i==="!",e={lastMatch:!1,appliedKeys:null},f=()=>{if(!t.node)return;let u;const d=t[c];if(d===void 0)if(t.state&&c in t.state)u=t.state[c];else{const l=t.context?.cases?.[c];if(l===void 0)return;try{u=typeof l=="function"?l.call(t,t):l}catch(h){u=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof d=="function")try{u=d(t,t.state,t.context)}catch(l){u=!1,s.__conditionalError=l,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,l?.message||l)}else u=d;const p=r?!u:!!u;if(p===e.lastMatch)return;e.lastMatch=p;const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{if(p){const l={};for(const _ in o){if(!Object.prototype.hasOwnProperty.call(o,_))continue;const g=typeof o[_]=="function"?o[_](t,t.state,t.context):o[_];if(g!=null)if(x.CSS_PROPS_REGISTRY[_]){const b=x.CSS_PROPS_REGISTRY[_](g,t,t.state,t.context);if(b){const C=Array.isArray(b)?b:[b];for(const D of C)D&&Object.assign(l,D)}}else x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(_)&&(l[_]=g)}const h=Object.keys(l);h.length?(K(t.node,l),e.appliedKeys=h):e.appliedKeys=null}else if(e.appliedKeys){for(const l of e.appliedKeys)t.node.style[l]="";e.appliedKeys=null}}finally{y&&(0,A.popConfig)()}};s.__conditionalRunners.push(f);const a=(0,S.createEffect)(f,{depth:s.path.length});s.__effects.push(a)}}const X=new WeakSet;function Ot(t){const s=t.ownerDocument;!s||X.has(s)||(X.add(s),queueMicrotask(()=>{X.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const Q=new WeakSet;let it=!1;function Lt(t){const{node:s}=t;if(!s)return;if(it||(it=!0,(0,tt.css)({display:"none"})),Q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Q.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const i={};let c=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||E.REGISTRY.has(o))continue;const r=o.charCodeAt(0);if(!(r>=65&&r<=90)&&!F(o)){if(x.CSS_PROPS_REGISTRY[o]){const e=t[o],f=x.CSS_PROPS_REGISTRY[o](e,t,t.state,t.context);if(f){if(Array.isArray(f))for(const a of f)a&&Object.assign(i,a);else Object.assign(i,f);c=!0}}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(i[o]=e,c=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(i[o]=e,c=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(i[o]=e,c=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){const f={},a=(u,d,p)=>{if(x.CSS_PROPS_REGISTRY[d]){const y=x.CSS_PROPS_REGISTRY[d](p,t,t.state,t.context);if(y)if(Array.isArray(y))for(const l of y)l&&Object.assign(u,l);else Object.assign(u,y)}else u[d]=p};for(const u in e){let d=e[u];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function")){if(u==="style"&&typeof d=="object"&&!Array.isArray(d)){for(const p in d){let y=d[p];typeof y=="function"&&(y=y(t,t.state,t.context)),!(y==null||typeof y=="function")&&a(f,p,y)}continue}a(f,u,d)}}if(Object.keys(f).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const d={};for(const y in f){const l=f[y];d[y]=typeof l=="string"&&!l.includes("!important")?l+" !important":l}const p=o.slice(1);i[`[data-theme="${p}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const y=o.slice(1),l=t.context?.designSystem?.media?.[y]||t.context?.designSystem?.media?.[y];l&&(d=`@media ${l}`)}const p={};for(const y in f){const l=f[y];if(l&&typeof l=="object"&&!Array.isArray(l)){const h={};for(const _ in l)if(x.CSS_PROPS_REGISTRY[_]){const g=x.CSS_PROPS_REGISTRY[_](l[_],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(h,b);else Object.assign(h,g)}else h[_]=l[_];p[y]=h}else p[y]=l}Object.keys(p).length&&(i[d]=p)}c=!0}c=!0}}}}if(c){i.display&&String(i.display).includes("!important")&&(s.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,tt.css)(i,null,t.context?.cssPrefix);if(o&&s.classList){const e=o.split(" ").filter(Boolean);let f=!1;for(const a of e)s.classList.add(a),f||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(f=!0);f&&Ot(s)}const r=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(r!=null){const e=i.display;if(e&&e!==r)if(r==="none"){const f=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&f.push(a);for(const a of f)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,A.popConfig)(),Q.delete(t)}}function et(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const r="aria-"+c.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(r,o===!0?"":o)}const n=(0,V.applyAttrTransforms)(t);for(const c in n){const o=n[c];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(c,o===!0?"":o)}const i=t.tag||"div";for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||typeof t[c]=="function"||E.REGISTRY.has(c)||c==="on"||n[c]!==void 0)continue;const o=c.charCodeAt(0);if(!(o>=65&&o<=90)&&!F(c)&&!(x.CSS_PROPS_REGISTRY[c]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))&&(0,V.checkAttributeByTagName)(i,c)){let r=t[c];if(r==null||r===!1||(typeof r=="string"&&r.includes("{{")&&(r=(0,H.replaceLiteralsWithObjectFields)(r,t,t.state,t.context),t[c]=r),r==null||r===!1||typeof r=="function"||typeof r=="object"))continue;s.setAttribute(c,r===!0?"":r)}}}function Tt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,i=n&&typeof n=="object"&&n.max?String(n.max):null;i&&(s.style.maxHeight=i);const c=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};c(),s.addEventListener("input",c),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",c)}catch{}})}const ft=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function at(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!F(n)||ft.has(n))continue;let i=t[n];if(typeof i=="string"&&/^[A-Za-z_$][\w$]*$/.test(i)){const o=i;i=function(e){return t.call(o,e)}}if(typeof i!="function")continue;const c=vt(n);E.LIFECYCLE_EVENTS.has(c)||(0,dt.registerEvent)(St(c),t,i)}Rt(t)}function Rt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let i=!1;for(const p of ft){const y=t[p];typeof y=="function"&&(n[p]=y,i=!0)}if(!i)return;const c=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let r=0,e=0,f=0,a=!1;const u=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(r=y.clientX,e=y.clientY,f=Date.now(),a=!0)},d=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const l=y.clientX-r,h=y.clientY-e,_=Date.now()-f;if(_>o)return;const g=Math.abs(l),b=Math.abs(h);if(Math.max(g,b)<c)return;let C;if(g>b*1.2)C=l<0?"left":"right";else if(b>g*1.2)C=h<0?"up":"down";else return;const D="onSwipe"+C.charAt(0).toUpperCase()+C.slice(1),T=n[D],j=n.onSwipe;T&&T.call(t,p,t,t.state,t.context),j&&j.call(t,{direction:C,dx:l,dy:h,dt:_,event:p},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",d)}catch{}})}function B(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=B(c,o):n[i]=o}return n}function J(t,s,n){if(!s||!t.node)return;const i=t.childExtends;if(Array.isArray(s)){const c=t.tag==="fragment",o=t.context?.document||globalThis.document,r=c?null:o?.createDocumentFragment();if(!c&&!r)return;const e=t.childProps,f=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const d=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=e;if(typeof e=="function")try{p=e(t,u)}catch{p=null}if(f==="state"){let h=d;(typeof d=="string"||typeof d=="number")&&(h={value:d,text:d}),u=p?{...p,state:h}:{state:h}}else p&&(u=B(p,u));if(i&&!u.ignoreChildExtends)if(u.extends){const h=Array.isArray(u.extends)?u.extends:[u.extends],_=Array.isArray(i)?i:[i];u={...u,extends:[..._,...h]}}else u={...u,extends:i};const y=u?.key||d&&typeof d=="object"&&d.key||`${a}`,l=N(u,t,y,n);!c&&l?.node&&r.appendChild(l.node)}c||t.node.appendChild(r);return}if(typeof s=="string"){const c=nt(s,t);if(Array.isArray(c)){J(t,c,n);return}}if(typeof s=="object")for(const c in s){if(E.REGISTRY.has(c))continue;let o=s[c];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=B(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const r=Array.isArray(o.extends)?o.extends:[o.extends],e=Array.isArray(i)?i:[i];o={...o,extends:[...e,...r]}}else o={...o,extends:i};N(o,t,c,n)}}}function ut(t,s){let{children:n,content:i}=t;const c=t.childExtends;if(typeof n=="function"){const r=n;n=r(t,t.state,t.context),t.children=n;const e=t.__ref;let f=!1;const a=(0,S.createEffect)(()=>{const u=r(t,t.state,t.context);if(!f){f=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const y=t.childProps,l=[],h=new Map;for(let j=0;j<u.length;j++){const P=u[j];let v=y;if(typeof y=="function")try{v=y(t,P)}catch{v=null}const M=v&&v.key||P&&P.key||`${j}`;l.push(M),h.set(M,{rawChild:P,childProps:v})}const _=new Set(l),g=e.__children.slice();for(const j of g)if(!_.has(j)){const P=t[j];P?.remove&&P.remove(),delete t[j]}const b=t.childExtends,C=t.tag==="fragment",D=t.context?.document||globalThis.document,T=C?null:D?.createDocumentFragment();for(const j of l){const P=h.get(j),v=P.rawChild,M=t[j];if(M&&M.state){if(v&&typeof v=="object"){const L=M.state;if(typeof L.replace=="function")L.replace(v);else if(typeof L.update=="function"){for(const w in L)if(!(w==="__element"||w==="root"||w==="parent"||w==="update")&&!Object.prototype.hasOwnProperty.call(v,w))try{L[w]=void 0}catch{}L.update(v)}else for(const w in v)L[w]=v[w]}continue}let Y=v;(typeof v=="string"||typeof v=="number")&&(Y={value:v,text:v});const ot=P.childProps;let O=ot?{...ot,state:Y}:{state:Y};if(b&&!O.ignoreChildExtends)if(O.extends){const L=Array.isArray(O.extends)?O.extends:[O.extends],w=Array.isArray(b)?b:[b];O={...O,extends:[...w,...L]}}else O={...O,extends:b};const st=N(O,t,j,s);!C&&st?.node&&T&&T.appendChild(st.node)}!C&&T&&T.childNodes.length&&t.node&&t.node.appendChild(T),e.__children=l;return}for(const y of[...e.__children]){const l=t[y];l?.remove&&l.remove(),delete t[y]}e.__children=[],J(t,u,s)},{depth:e.path.length});e.__effects.push(a)}if(J(t,n||i,s),n||i)return;const o=t.context?.components||{};{const r=Object.keys(t);for(let e=0;e<r.length;e++){const f=r[e];if(!f.endsWith("Extends")||typeof t[f]!="string")continue;const a=f.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[f]};delete t[f];for(let d=e+1;d<r.length;d++){const p=r[d],y=p.charCodeAt(0);if(y>=65&&y<=90||E.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const l=t[p];l!==void 0&&(u[p]=l,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||E.REGISTRY.has(r)||typeof t[r]!="object"||t[r]===null)continue;const e=r.charCodeAt(0);if(e<65||e>90)continue;let f=t[r];if(!f.__ref){if(!f.extends&&!f.extend){const a=o[r]||o[`smbls.${r}`];a&&(f={...f,extends:a})}if(t.childProps&&(f=B(t.childProps,f)),c&&!f.ignoreChildExtends)if(f.extends){const a=Array.isArray(f.extends)?f.extends:[f.extends],u=Array.isArray(c)?c:[c];f={...f,extends:[...u,...a]}}else f={...f,extends:c};N(f,t,r,s)}}}function m(t,s,n){const{node:i}=t;if(!i)return;i.ref=t;const c=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(c){const r=c.parentNode;if(r){if(n?.position==="before"&&n.node)r.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;r.insertBefore(i,e||c)}else r.insertBefore(i,c);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;r?o.insertBefore(i,r):o.appendChild(i)}else o.appendChild(i)}function R(t,s,n){const i=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,U.runPluginHook)(i,s,n);const c="on"+t,o=s[c];if(typeof o=="function"){const r=t==="Render"||t==="RenderRouter";if(r){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const e=s.context?.designSystem;e&&(0,A.pushConfig)(e);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(f){if(s.context?.plugins?.length&&(0,U.runPluginHook)("error",s,{hook:c,error:f})||console.error(`[DOMQL] Lifecycle "${c}" error:`,f),s.context?.strictMode)throw f}finally{e&&(0,A.popConfig)(),r&&(s.__ref.__inRender=!1)}}return!0}var Nt=N;
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var _ in o)i(r,_,{get:o[_],enumerable:!0})},h=(r,o,_,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!s.call(r,f)&&f!==_&&i(r,f,{get:()=>o[f],enumerable:!(e=t(o,f))||e.enumerable});return r};var p=r=>h(i({},"__esModule",{value:!0}),r);var u={};d(u,{dispose:()=>n,remove:()=>a});module.exports=p(u);function n(r){if(!r)return;const o=r.__ref;if(o){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(_){console.error("[smbls] onBeforeRemove error:",_)}if(o.__effects){for(let _=0;_<o.__effects.length;_++)o.__effects[_].dispose();o.__effects.length=0}if(o.__eventCleanup){for(let _=0;_<o.__eventCleanup.length;_++)o.__eventCleanup[_]();o.__eventCleanup.length=0}if(o.__children){for(let _=0;_<o.__children.length;_++){const e=o.__children[_],f=r[e];f&&f.__ref&&n(f)}o.__children.length=0}if(r.node?.parentNode&&r.node.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const _=r.parent.__ref.__children.indexOf(r.key);_!==-1&&r.parent.__ref.__children.splice(_,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(_){console.error("[smbls] onRemove error:",_)}r.node=null,r.parent=null,r.__ref=null}}function a(){n(this)}
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(r,o)=>{for(var _ in o)n(r,_,{get:o[_],enumerable:!0})},d=(r,o,_,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!s.call(r,f)&&f!==_&&n(r,f,{get:()=>o[f],enumerable:!(e=i(o,f))||e.enumerable});return r};var h=r=>d(n({},"__esModule",{value:!0}),r);var u={};a(u,{dispose:()=>t,remove:()=>p});module.exports=h(u);function t(r){if(!r)return;const o=r.__ref;if(o){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(_){console.error("[smbls] onBeforeRemove error:",_)}if(o.__effects){for(let _=0;_<o.__effects.length;_++)o.__effects[_].dispose();o.__effects.length=0}if(o.__eventCleanup){for(let _=0;_<o.__eventCleanup.length;_++)o.__eventCleanup[_]();o.__eventCleanup.length=0}if(o.__children){for(let _=0;_<o.__children.length;_++){const e=o.__children[_],f=r[e];f&&f.__ref&&t(f)}o.__children.length=0}if(r.node?.parentNode?r.node.remove():r.tag==="fragment"&&o.__fragmentAnchor?.parentNode&&o.__fragmentAnchor.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const _=r.parent.__ref.__children.indexOf(r.key);_!==-1&&r.parent.__ref.__children.splice(_,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(_){console.error("[smbls] onRemove error:",_)}r.node=null,r.parent=null,r.__ref=null}}function p(){t(this)}
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=(e,o)=>{for(var t in o)l(e,t,{get:o[t],enumerable:!0})},j=(e,o,t,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of h(o))!b.call(e,n)&&n!==t&&l(e,n,{get:()=>o[n],enumerable:!(f=_(o,n))||f.enumerable});return e};var v=e=>j(l({},"__esModule",{value:!0}),e);var C={};g(C,{default:()=>A,update:()=>a});module.exports=v(C);var d=require("@symbo.ls/signal"),s=require("./registry.js"),u=require("./create.js"),y=require("@symbo.ls/utils/function.js");function a(e={},o={}){const t=this,f=t.__ref;if(f){if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!o.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,o)===!1)return t;if((0,d.batch)(()=>{if(e.state&&(0,d.isStore)(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const i=e.style[n];if(i==null)continue;const r=n.replace(/[A-Z]/g,x=>"-"+x.toLowerCase()),c=String(i).replace(/\s*!important\s*$/,"");t.node.style.setProperty(r,c,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const i=e.attr[n];i==null||i===!1?t.node.removeAttribute(n):typeof i!="function"&&typeof i!="object"&&t.node.setAttribute(n,i===!0?"":i)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(s.REGISTRY.has(n)||n==="state")continue;const i=e[n],r=t[n];if(r&&r.__ref&&typeof r.update=="function")r.update(i,o);else if(typeof i=="object"&&i!==null){const c=n.charCodeAt(0);c>=65&&c<=90&&(0,u.create)(i,t,n,o)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=i)}}),t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return(0,y.runPluginHook)("update",t),!o.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,o),t}}var A=a;
1
+ "use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var j=(e,f)=>{for(var t in f)r(e,t,{get:f[t],enumerable:!0})},v=(e,f,t,i)=>{if(f&&typeof f=="object"||typeof f=="function")for(let c of b(f))!g.call(e,c)&&c!==t&&r(e,c,{get:()=>f[c],enumerable:!(i=a(f,c))||i.enumerable});return e};var A=e=>v(r({},"__esModule",{value:!0}),e);var k={};j(k,{default:()=>P,update:()=>x});module.exports=A(k);var d=require("@symbo.ls/signal"),u=require("./registry.js"),_=require("./create.js"),y=require("@symbo.ls/utils/function.js");function x(e={},f={}){const t=this,i=t.__ref;if(!i)return;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!f.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,f)===!1)return t;const c=!e||Object.keys(e).length===0;if((0,d.batch)(()=>{if(e.state&&(0,d.isStore)(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!i.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!i.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!i.__exec.style)for(const n in e.style){const o=e.style[n];if(o==null)continue;const s=n.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),l=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,l,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const o=e.attr[n];o==null||o===!1?t.node.removeAttribute(n):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(n,o===!0?"":o)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(u.REGISTRY.has(n)||n==="state")continue;const o=e[n],s=t[n];if(s&&s.__ref&&typeof s.update=="function")s.update(o,f);else if(typeof o=="object"&&o!==null){const l=n.charCodeAt(0);l>=65&&l<=90&&(0,_.create)(o,t,n,f)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=o)}}),t.node&&c&&i.__effects&&i.__effects.length)for(let n=0;n<i.__effects.length;n++){const o=i.__effects[n];o&&!o._disposed&&!o._isSubscribeToEffect&&typeof o._execute=="function"&&o._execute()}else if(t.node&&i.__conditionalRunners)for(const n of i.__conditionalRunners)n();return(0,y.runPluginHook)("update",t),!f.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,f),t}var P=x;
@@ -1,6 +1,6 @@
1
- import{createStore as W,createScopeStore as ut,isStore as R}from"@symbo.ls/signal";import{createEffect as A}from"@symbo.ls/signal";import{cacheNode as H,detectTag as ct}from"./cache.js";import{REGISTRY as T,LIFECYCLE_EVENTS as dt}from"./registry.js";import{registerEvent as pt}from"./delegate.js";import{applyExtends as yt}from"./extends.js";import{addMethods as lt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as Y}from"@symbo.ls/utils";import{runPluginHook as G}from"@symbo.ls/utils/function.js";import{applyStateMethods as I}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as k,DEFAULT_CSS_PROPERTIES_LIST as C}from"css-in-props";import{css as ht}from"@symbo.ls/css";import{pushConfig as O,popConfig as L}from"@symbo.ls/scratch";import{checkAttributeByTagName as U,applyAttrTransforms as _t}from"attrs-in-props";let gt=1;function M(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function bt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function xt(t){return t.toLowerCase()}function Z(t,c){const n={...t};for(const e in c){const s=n[e],o=c[e];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[e]=Z(s,o):n[e]=o}return n}function K(t,c,n,e={},s){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${gt++}`,o.parent=c||null,o.context=t.context||c?.context||e.context||{},o.context.__create||(o.context.__create=K);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:c?.__ref?.root||o,path:c?.__ref?.path?[...c.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const h=n.indexOf("_");if(h>0){const _=n.substring(0,h),g=o.context?.components;g&&(g[_]||g["smbls."+_])&&(t={extends:_,...t})}}yt(o,t,e);const f=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const _=t[h],g=o[h],b=g&&_&&typeof g=="object"&&typeof _=="object"&&!Array.isArray(g)&&!Array.isArray(_)&&typeof g!="function"&&typeof _!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(g,_):b&&f.has(h)?o[h]={...g,..._}:o[h]=_}function a(h){for(const _ in h){const g=h[_],b=o[_],j=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";j&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=Z(b,g):j&&f.has(_)?o[_]={...b,...g}:o[_]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,d=c?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,p=d||l||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=ut(h,p)}else p&&(o.scope=p);if(t.if!==void 0&&(o.if=t.if),lt(o),At(o,c,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(_){if(h=!1,i.__ifError=_,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,_?.message||_)}}else h=o.if;i.__if=!!h}if(i.__if)typeof t.if=="function"&&(i.__ifInitialized=!0);else return c&&(c[o.key]=o),typeof t.if=="function"&&B(o,{if:t.if}),o;o.tag||(o.tag=ct(o)),N("Init",o,e);const y=o.node=H(o);if(!y)return o;N("AttachNode",o,e),y.setAttribute&&o.key&&y.setAttribute("data-key",o.key),y.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&y.setAttribute("data-smbls-app",o.context.key),o.id&&y.setAttribute&&(y.id=o.id),ft(o,e),B(o,t),q(o),it(o),Pt(o);try{at(o,e)}catch(h){if(typeof console<"u"&&console.error){const _=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
1
+ import{createStore as U,createScopeStore as lt,isStore as R}from"@symbo.ls/signal";import{createEffect as A}from"@symbo.ls/signal";import{cacheNode as Y,detectTag as nt}from"./cache.js";import{REGISTRY as N,LIFECYCLE_EVENTS as ht}from"./registry.js";import{registerEvent as _t}from"./delegate.js";import{applyExtends as gt}from"./extends.js";import{addMethods as bt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as G}from"@symbo.ls/utils";import{runPluginHook as Z}from"@symbo.ls/utils/function.js";import{applyStateMethods as V}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as C,DEFAULT_CSS_PROPERTIES_LIST as j}from"css-in-props";import{css as rt}from"@symbo.ls/css";import{pushConfig as P,popConfig as O}from"@symbo.ls/scratch";import{checkAttributeByTagName as z,applyAttrTransforms as xt}from"attrs-in-props";let At=1;function F(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function vt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function St(t){return t.toLowerCase()}function it(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function W(t,s){const n={...t};for(const e in s){const c=n[e],o=s[e];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[e]=W(c,o):n[e]=o}return n}function K(t,s,n,e={},c){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${At++}`,o.parent=s||null,o.context=t.context||s?.context||e.context||{},o.context.__create||(o.context.__create=K);const r=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const h=n.indexOf("_");if(h>0){const _=n.substring(0,h),g=o.context?.components;g&&(g[_]||g["smbls."+_])&&(t={...t,extends:_})}}gt(o,t,e);const i=new Set(["childProps","attr","style","scope","data"]),f=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const _=t[h],g=o[h],b=g&&_&&typeof g=="object"&&typeof _=="object"&&!Array.isArray(g)&&!Array.isArray(_)&&typeof g!="function"&&typeof _!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=W(g,_):b&&i.has(h)?o[h]={...g,..._}:b&&it(h)?o[h]=W(g,_):o[h]=_}function a(h){for(const _ in h){const g=h[_],b=o[_],v=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";v&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=W(b,g):v&&i.has(_)?o[_]={...b,...g}:v&&it(_)?o[_]=W(b,g):o[_]=g}}f&&a(f),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,d=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=d||p||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=lt(h,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),bt(o),Ct(o,s,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(_){if(h=!1,r.__ifError=_,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,_?.message||_)}}else h=o.if;r.__if=!!h}if(r.__if)typeof t.if=="function"&&(r.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof t.if=="function"&&X(o,{if:t.if}),o;o.tag||(o.tag=nt(o)),$("Init",o,e);const l=o.node=Y(o);if(!l)return o;if(o.tag==="fragment"){const _=(o.context?.document||globalThis.document).createComment("");l.appendChild(_),r.__fragmentAnchor=_}$("AttachNode",o,e),l.setAttribute&&o.key&&l.setAttribute("data-key",o.key),l.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&l.setAttribute("data-smbls-app",o.context.key),o.id&&l.setAttribute&&(l.id=o.id),pt(o,e),X(o,t),Q(o),ut(o),Tt(o);try{yt(o,e)}catch(h){if(typeof console<"u"&&console.error){const _=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
2
2
  `+h.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(tt(o,c,s),c&&(c[o.key]=o,c.__ref?.__children&&(c.__ref.__children.includes(o.key)||c.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&O(h);try{const _=o.html(o,o.state,o.context);_!=null&&typeof _!="function"&&(o.node.innerHTML=_)}catch{}finally{h&&L()}}if(N("Create",o,e),N("Complete",o,e),N("Render",o,e),N("RenderRouter",o,e),typeof o.onFrame=="function"){const h=o.onFrame,_=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){_&&O(_);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{_&&L()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,c,n){const e=!c,s=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=e&&s&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!R(t.state)?t.state:void 0;if(i==null){if(c?.state)t.state=c.state,I(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const p in d)r[p]===void 0&&(r[p]=d[p]);const l=new Set(a.languages||[]);for(const p in a.translations)!l.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=R(r)?r:W(r),t.state.__element=t,t.state.root=t.state,I(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),I(t,t.state);return}if(typeof i=="string"){if(t.state=nt(i,c),t.state&&typeof t.state=="object"&&!R(t.state)){const f=c?.state?.root||c?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}I(t,t.state);return}if(typeof i=="function"){const f=i(t,c?.state);t.state=R(f)?f:W(f||{})}else R(i)?t.state=i:t.state=W({...i});t.state.__element=t,c?.state?(t.state.parent=c.state,t.state.root=c.state.root||c.state):t.state.root=t.state,I(t,t.state)}function z(t,c){if(!c)return t;const n=c.split("/");let e=t;for(const s of n){if(e==null)return{};e=e[s]}return e??{}}function nt(t,c){if(!c)return{};if(t===".")return c.state||{};if(t.startsWith("../")){const s=t.slice(3);return s?z(c.state,s):c.state??{}}if(t.startsWith("~/")){const s=c.state?.root||c.state,o=t.slice(2);return o?z(s,o):s??{}}if(c.state?.[t]!==void 0)return c.state[t];const n=z(c.state,t);if(n!=null&&Object.keys(n).length>0)return n;const e=c.context?.polyglot;if(e?.translations){const s=c.state?.root?.lang||e.defaultLang||"en",o=e.translations[s];if(o?.[t]!==void 0)return o[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}function vt(t){const c=t.__ref,n=t.tag||"div",e=t.context?.designSystem,s=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const f=o[i];if(typeof t[f]!="function"||T.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||k[f]||C&&C.has(f)||U(n,f)||s.push({prop:f,fn:t[f]})}for(let i=0;i<s.length;i++){const{prop:f,fn:r}=s[i];c.__exec[f]=r,Object.defineProperty(t,f,{get(){e&&O(e);try{return r(t,t.state,t.context)}catch{return}finally{e&&L()}},set(a){delete c.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function B(t,c){const n=t.__ref;if(vt(t),typeof t.text=="function"){const s=t.text,o=A(()=>{if(!n.contentManaged)try{let i=s(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&typeof i!="object"&&(typeof i=="string"&&i.includes("{{")&&(i=Y.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=A(()=>{if(n.contentManaged)return;const i=Y.call(t,s,t.state);i!=null&&(t.text=i),t.node&&(t.tag==="string"?t.node.nodeValue=i??"":t.node.textContent=i??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&typeof t[s]=="function"&&!T.has(s)&&!M(s)&&!n.__exec[s]){if(k[s]){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context),d=k[i](u,t,t.state,t.context);if(d&&t.node){const l=rt(d);(l===null||l!==f)&&(f=l,F(t.node,d))}else t.node&&(i==="show"||i==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}else if(C&&C.has(s)){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const d=i+":"+String(u);d!==f&&(f=d,F(t.node,{[i]:u}))}else f=void 0,t.node.style[i]=""}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}}if(typeof c.html=="function"){const s=c.html,o=A(()=>{const i=t.context?.designSystem;i&&O(i);try{const f=s(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{i&&L()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=s}if(typeof c.value=="function"){const s=c.value,o=A(()=>{try{const i=s(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=i==null?"":String(i);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=s}if(typeof c.style=="function"){const s=c.style;let o;const i=A(()=>{const f=s(t,t.state,t.context),r=rt(f);(r===null||r!==o)&&(o=r,F(t.node,f))},{depth:n.path.length});n.__effects.push(i),n.__exec.style=s}else if(t.style&&typeof t.style=="object")for(const s in t.style){const o=t.style[s];if(typeof o!="function")continue;let i;const f=A(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=s+":"+String(r);a!==i&&(i=a,F(t.node,{[s]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const s in t.attr)if(typeof t.attr[s]=="function"){const o=t.attr[s],i=s,f=A(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o!="function")continue;const i="aria-"+s.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=A(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const s in t.data){const o=t.data[s];if(typeof o!="function")continue;const f="data-"+s.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=A(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const e=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(e)for(const s in e){const o=e[s];if(typeof o!="function")continue;const i=A(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(s):t.node.classList.remove(s)}catch{}},{depth:n.path.length});n.__effects.push(i)}if(typeof c.if=="function"){const s=c.if,o=A(()=>{let i;try{i=s(t,t.state,t.context)}catch(r){if(i=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!i,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=H(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const d=Object.keys(r),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=r[d[p]];if(y?.node?.parentNode===a){u=y.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else tt(t,t.parent);q(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=ct(t)),N("Init",t,{}),t.node||(t.node=H(t)),!t.node)return;N("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),ft(t,{});const r=c.if;delete c.if;try{B(t,c)}finally{c.if=r}q(t),it(t),at(t,{}),tt(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||T.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||M(s))continue;const i=t[s];n.__exec[s]=i;const f=t.tag||"div";if(U(f,s)&&!k[s]&&!(C&&C.has(s))){const r=s,a=A(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}kt(t),Ct(t)}function q(t){const{node:c}=t;if(c){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?c.nodeValue=t.text:c.textContent=t.text:typeof t.text=="number"&&(c.textContent=t.text),Et(t),typeof t.html=="string"&&(c.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in c){const n=String(t.value);c.value!==n&&(c.value=n)}if(t.style&&typeof t.style=="object"&&F(c,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const e=t.attr[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.setAttribute&&c.setAttribute(n,e===!0?"":e)}if(t.data&&typeof t.data=="object")for(const n in t.data){const e=t.data[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.dataset&&(c.dataset[n]=e===!0?"":e)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(e=>e&&c.classList.add(e));else if(typeof n=="object")for(const e in n){const s=typeof n[e]=="function"?n[e](t,t.state,t.context):n[e];s&&c.classList.add(typeof s=="string"?s:e)}}}}function rt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function F(t,c){if(!t||!c||!t.style)return;let n=null;for(const e in c){const s=c[e];if(s!=null){if(e.charAt(0)==="&"&&typeof s=="object"){n||(n={}),n[e]=s;continue}try{const o=String(s),i=e.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&St(t,n)}let jt=0;function St(t,c){const n=`_ds${jt++}`;t.classList.add(n);const e=t.ownerDocument;let s=e.querySelector("style[data-smbls-scoped]");s||(s=e.createElement("style"),s.setAttribute("data-smbls-scoped",""),e.head.appendChild(s));let o="";for(const i in c){const f="."+n,r=i.replace(/&/g,f).split(",").map(u=>{const d=u.trim();return d.includes(f)?d:f+d}).join(", "),a=c[i];if(typeof a=="object"){let u="",d="";for(const l in a){const p=a[l];if(typeof p=="object"){const y=l.includes("&")?r.split(", ").map(_=>l.replace(/&/g,_)).join(", "):r.split(", ").map(_=>`${_} ${l}`).join(", ");let h="";for(const _ in p)h+=`${_.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[_]};`;d+=`${y} { ${h} }
5
- `}else u+=`${l.replace(/[A-Z]/g,y=>"-"+y.toLowerCase())}: ${p};`}u&&(o+=`${r} { ${u} }
6
- `),d&&(o+=d)}}o&&(s.textContent+=o)}function kt(t){const c=t.subscribeTo;if(!Array.isArray(c)||c.length===0)return;const n=t.__ref;for(let e=0;e<c.length;e++){const s=c[e];if(typeof s!="string"||s.length===0)continue;const o=s.split("."),i=o[0],f=o.slice(1),r={value:!1},a=A(()=>{const u=t.state&&(R(t.state)?t.state.root:null);if(!u||!R(u))return;let d=u;d=d[i];for(let l=0;l<f.length&&!(d==null||typeof d!="object");l++)if(R(d))d=d[f[l]];else break;if(r.value&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&O(l);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&G("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{l&&L()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const c=t.__ref;c.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const e=n.charAt(0);if(e!=="."&&e!=="!")continue;const s=n.slice(1);if(!s)continue;const o=t[n];if(!o||typeof o!="object")continue;const i=e==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const d=t[s];if(d===void 0)if(t.state&&s in t.state)u=t.state[s];else{const y=t.context?.cases?.[s];if(y===void 0)return;try{u=typeof y=="function"?y.call(t,t):y}catch(h){u=!1,c.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof d=="function")try{u=d(t,t.state,t.context)}catch(y){u=!1,c.__conditionalError=y,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,y?.message||y)}else u=d;const l=i?!u:!!u;if(l===f.lastMatch)return;f.lastMatch=l;const p=t.context?.designSystem;p&&O(p);try{if(l){const y={};for(const _ in o){if(!Object.prototype.hasOwnProperty.call(o,_))continue;const g=typeof o[_]=="function"?o[_](t,t.state,t.context):o[_];if(g!=null)if(k[_]){const b=k[_](g,t,t.state,t.context);if(b){const j=Array.isArray(b)?b:[b];for(const E of j)E&&Object.assign(y,E)}}else C&&C.has(_)&&(y[_]=g)}const h=Object.keys(y);h.length?(F(t.node,y),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const y of f.appliedKeys)t.node.style[y]="";f.appliedKeys=null}}finally{p&&L()}};c.__conditionalRunners.push(r);const a=A(r,{depth:c.path.length});c.__effects.push(a)}}const X=new WeakSet;function wt(t){const c=t.ownerDocument;!c||X.has(c)||(X.add(c),queueMicrotask(()=>{X.delete(c);const n=c.body||c.documentElement;n&&n.offsetWidth}))}const Q=new WeakSet;function Et(t){const{node:c}=t;if(!c)return;if(Q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Q.add(t);const n=t.context?.designSystem;n&&O(n);try{const e={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!M(o)){if(k[o]){const f=t[o],r=k[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(e,a);else Object.assign(e,r);s=!0}}else if(C&&C.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={},a=(u,d,l)=>{if(k[d]){const p=k[d](l,t,t.state,t.context);if(p)if(Array.isArray(p))for(const y of p)y&&Object.assign(u,y);else Object.assign(u,p)}else u[d]=l};for(const u in f){let d=f[u];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function")){if(u==="style"&&typeof d=="object"&&!Array.isArray(d)){for(const l in d){let p=d[l];typeof p=="function"&&(p=p(t,t.state,t.context)),!(p==null||typeof p=="function")&&a(r,l,p)}continue}a(r,u,d)}}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const d={};for(const p in r){const y=r[p];d[p]=typeof y=="string"&&!y.includes("!important")?y+" !important":y}const l=o.slice(1);e[`[data-theme="${l}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const p=o.slice(1),y=t.context?.designSystem?.media?.[p]||t.context?.designSystem?.media?.[p];y&&(d=`@media ${y}`)}const l={};for(const p in r){const y=r[p];if(y&&typeof y=="object"&&!Array.isArray(y)){const h={};for(const g in y)if(k[g]){const b=k[g](y[g],t,t.state,t.context);if(b)if(Array.isArray(b))for(const j of b)j&&Object.assign(h,j);else Object.assign(h,b)}else h[g]=y[g];const _=p.startsWith(":")?"":" ";if(d.includes(",")){const g=d.split(",").map(b=>`${b.trim()}${_}${p}`).join(", ");e[g]=h}else e[`${d}${_}${p}`]=h}else l[p]=y}Object.keys(l).length&&(e[d]=l)}s=!0}s=!0}}}}if(s){e.display&&String(e.display).includes("!important")&&(c.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const o=ht(e,null,t.context?.cssPrefix);if(o&&c.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)c.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&wt(c)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const f=e.display;if(f&&f!==i)if(i==="none"){const r=[];for(const a of c.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)c.classList.remove(a);c.classList.add("_d-none")}else c.style.display=t.display}}}finally{n&&L(),Q.delete(t)}}function it(t){const{node:c}=t;if(!c||!c.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+s.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());c.setAttribute(i,o===!0?"":o)}const n=_t(t);for(const s in n){const o=n[s];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&c.setAttribute(s,o===!0?"":o)}const e=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||T.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(s)&&!(k[s]||C&&C.has(s))&&U(e,s)){let i=t[s];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=Y(i,t,t.state,t.context),t[s]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;c.setAttribute(s,i===!0?"":i)}}}function Pt(t){if(!t.autoGrow)return;const c=t.node;if(!c||c.tagName!=="TEXTAREA")return;const n=t.autoGrow,e=n&&typeof n=="object"&&n.max?String(n.max):null;e&&(c.style.maxHeight=e);const s=()=>{c.style.height="auto",c.style.height=c.scrollHeight+"px"};s(),c.addEventListener("input",s),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("input",s)}catch{}})}const et=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function ft(t,c){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||et.has(n))continue;let e=t[n];if(typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const o=e;e=function(f){return t.call(o,f)}}if(typeof e!="function")continue;const s=bt(n);dt.has(s)||pt(xt(s),t,e)}Ot(t)}function Ot(t){const c=t.node;if(!c||!c.addEventListener)return;const n={};let e=!1;for(const l of et){const p=t[l];typeof p=="function"&&(n[l]=p,e=!0)}if(!e)return;const s=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,f=0,r=0,a=!1;const u=l=>{const p=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];p&&(i=p.clientX,f=p.clientY,r=Date.now(),a=!0)},d=l=>{if(!a)return;a=!1;const p=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!p)return;const y=p.clientX-i,h=p.clientY-f,_=Date.now()-r;if(_>o)return;const g=Math.abs(y),b=Math.abs(h);if(Math.max(g,b)<s)return;let j;if(g>b*1.2)j=y<0?"left":"right";else if(b>g*1.2)j=h<0?"up":"down";else return;const E="onSwipe"+j.charAt(0).toUpperCase()+j.slice(1),v=n[E],S=n.onSwipe;v&&v.call(t,l,t,t.state,t.context),S&&S.call(t,{direction:j,dx:y,dy:h,dt:_,event:l},t,t.state,t.context)};c.addEventListener("touchstart",u,{passive:!0}),c.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("touchstart",u)}catch{}try{c.removeEventListener("touchend",d)}catch{}})}function J(t,c){const n={...t};for(const e in c){const s=n[e],o=c[e];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[e]=J(s,o):n[e]=o}return n}function m(t,c,n){if(!c||!t.node)return;const e=t.childExtends;if(Array.isArray(c)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const i=t.childProps,f=t.childrenAs;for(let r=0;r<c.length;r++){let a=c[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let d=i;if(typeof i=="function")try{d=i(t,a)}catch{d=null}if(f==="state"){let y=u;(typeof u=="string"||typeof u=="number")&&(y={value:u,text:u}),a=d?{...d,state:y}:{state:y}}else d&&(a=J(d,a));if(e&&!a.ignoreChildExtends)if(a.extends){const y=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(e)?e:[e];a={...a,extends:[...h,...y]}}else a={extends:e,...a};const l=a?.key||u&&typeof u=="object"&&u.key||`${r}`,p=K(a,t,l,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof c=="string"){const s=nt(c,t);if(Array.isArray(s)){m(t,s,n);return}}if(typeof c=="object")for(const s in c){if(T.has(s))continue;let o=c[s];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=J(t.childProps,o)),e&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(e)?e:[e];o={...o,extends:[...f,...i]}}else o={extends:e,...o};K(o,t,s,n)}}}function at(t,c){let{children:n,content:e}=t;const s=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=A(()=>{const u=i(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,y=[],h=new Map;for(let v=0;v<u.length;v++){const S=u[v];let x=p;if(typeof p=="function")try{x=p(t,S)}catch{x=null}const D=x&&x.key||S&&S.key||`${v}`;y.push(D),h.set(D,{rawChild:S,childProps:x})}const _=new Set(y),g=f.__children.slice();for(const v of g)if(!_.has(v)){const S=t[v];S?.remove&&S.remove(),delete t[v]}const b=t.childExtends,E=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const v of y){const S=h.get(v),x=S.rawChild,D=t[v];if(D&&D.state){if(x&&typeof x=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(x);else if(typeof $.update=="function"){for(const w in $)if(!(w==="__element"||w==="root"||w==="parent"||w==="update")&&!Object.prototype.hasOwnProperty.call(x,w))try{$[w]=void 0}catch{}$.update(x)}else for(const w in x)$[w]=x[w]}continue}let V=x;(typeof x=="string"||typeof x=="number")&&(V={value:x,text:x});const ot=S.childProps;let P=ot?{...ot,state:V}:{state:V};if(b&&!P.ignoreChildExtends)if(P.extends){const $=Array.isArray(P.extends)?P.extends:[P.extends],w=Array.isArray(b)?b:[b];P={...P,extends:[...w,...$]}}else P={extends:b,...P};const st=K(P,t,v,c);st?.node&&E&&E.appendChild(st.node)}E&&E.childNodes.length&&t.node&&t.node.appendChild(E),f.__children=y;return}for(const p of[...f.__children]){const y=t[p];y?.remove&&y.remove(),delete t[p]}f.__children=[],m(t,u,c)},{depth:f.path.length});f.__effects.push(a)}if(m(t,n||e,c),n||e)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let f=0;f<i.length;f++){const r=i[f];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[r]};delete t[r];for(let d=f+1;d<i.length;d++){const l=i[d],p=l.charCodeAt(0);if(p>=65&&p<=90||T.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const y=t[l];y!==void 0&&(u[l]=y,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.has(i)||typeof t[i]!="object"||t[i]===null)continue;const f=i.charCodeAt(0);if(f<65||f>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),s&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(s)?s:[s];r={...r,extends:[...u,...a]}}else r={extends:s,...r};K(r,t,i,c)}}}function tt(t,c,n){const{node:e}=t;if(!e)return;e.ref=t;const s=c?.node||(c?.nodeType?c:null);if(s)if(n?.position==="before"&&n.node)s.insertBefore(e,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?s.insertBefore(e,o):s.appendChild(e)}else s.appendChild(e)}function N(t,c,n){const e=t.charAt(0).toLowerCase()+t.slice(1);c.context?.plugins?.length&&G(e,c,n);const s="on"+t,o=c[s];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(c.__ref.__inRender)return!0;c.__ref.__inRender=!0}const f=c.context?.designSystem;f&&O(f);try{if(o(c,c.state,c.context,n)===!1)return!1}catch(r){if(c.context?.plugins?.length&&G("error",c,{hook:s,error:r})||console.error(`[DOMQL] Lifecycle "${s}" error:`,r),c.context?.strictMode)throw r}finally{f&&L(),i&&(c.__ref.__inRender=!1)}}return!0}var qt=K;export{K as create,qt as default};
4
+ `):"")}}if(ot(o,s,c),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&P(h);try{const _=o.html(o,o.state,o.context);_!=null&&typeof _!="function"&&(o.node.innerHTML=_)}catch{}finally{h&&O()}}if($("Create",o,e),$("Complete",o,e),$("Render",o,e),$("RenderRouter",o,e),typeof o.onFrame=="function"){const h=o.onFrame,_=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){_&&P(_);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{_&&O()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Ct(t,s,n){const e=!s,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=e&&c&&t.context?.state,r=n.state!==void 0&&!o?n.state:t.state&&!R(t.state)?t.state:void 0;if(r==null){if(s?.state)t.state=s.state,V(t,t.state);else if(t.context?.state){const i=t.context.state,f={...i},a=t.context?.polyglot;if(a?.translations){const u=i.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const y in d)f[y]===void 0&&(f[y]=d[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&f[y]===void 0&&(f[y]=a.translations[y])}t.state=R(f)?f:U(f),t.state.__element=t,t.state.root=t.state,V(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),V(t,t.state);return}if(typeof r=="string"){if(t.state=et(r,s),t.state&&typeof t.state=="object"&&!R(t.state)){const i=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:i,enumerable:!1,configurable:!0,writable:!0})}V(t,t.state);return}if(typeof r=="function"){const i=r(t,s?.state);t.state=R(i)?i:U(i||{})}else R(r)?t.state=r:t.state=U({...r});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,V(t,t.state)}function q(t,s){if(!s)return t;const n=s.split("/");let e=t;for(const c of n){if(e==null)return{};e=e[c]}return e??{}}function et(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const c=t.slice(3);return c?q(s.state,c):s.state??{}}if(t.startsWith("~/")){const c=s.state?.root||s.state,o=t.slice(2);return o?q(c,o):c??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=q(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const e=s.context?.polyglot;if(e?.translations){const c=s.state?.root?.lang||e.defaultLang||"en",o=e.translations[c];if(o?.[t]!==void 0)return o[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}function jt(t){const s=t.__ref,n=t.tag||"div",e=t.context?.designSystem,c=[],o=Object.keys(t);for(let r=0;r<o.length;r++){const i=o[r];if(typeof t[i]!="function"||N.has(i))continue;const f=i.charCodeAt(0);f>=65&&f<=90||F(i)||C[i]||j&&j.has(i)||z(n,i)||c.push({prop:i,fn:t[i]})}for(let r=0;r<c.length;r++){const{prop:i,fn:f}=c[r];s.__exec[i]=f,Object.defineProperty(t,i,{get(){e&&P(e);try{return f(t,t.state,t.context)}catch{return}finally{e&&O()}},set(a){delete s.__exec[i],Object.defineProperty(t,i,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function X(t,s){const n=t.__ref;if(jt(t),typeof t.text=="function"){const c=t.text,o=A(()=>{if(!n.contentManaged)try{let r=c(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=G.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}else if(typeof t.text=="string"&&t.text.includes("{{")){const c=t.text,o=A(()=>{if(n.contentManaged)return;const r=G.call(t,c,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&typeof t[c]=="function"&&!N.has(c)&&!F(c)&&!n.__exec[c]){if(C[c]){const o=t[c],r=c;let i;const f=A(()=>{const a=t.context?.designSystem;a&&P(a);try{const u=o(t,t.state,t.context),d=C[r](u,t,t.state,t.context);if(d&&t.node){const p=ft(d);(p===null||p!==i)&&(i=p,I(t.node,d))}else t.node&&(r==="show"||r==="hide")&&(i=void 0,t.node.style.display="")}finally{a&&O()}},{depth:n.path.length});n.__effects.push(f),n.__exec[c]=o}else if(j&&j.has(c)){const o=t[c],r=c;let i;const f=A(()=>{const a=t.context?.designSystem;a&&P(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const d=r+":"+String(u);d!==i&&(i=d,I(t.node,{[r]:u}))}else i=void 0,t.node.style[r]=""}finally{a&&O()}},{depth:n.path.length});n.__effects.push(f),n.__exec[c]=o}}if(typeof s.html=="function"){const c=s.html,o=A(()=>{const r=t.context?.designSystem;r&&P(r);try{const i=c(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&(t.node.innerHTML=i)}finally{r&&O()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=c}if(typeof s.value=="function"){const c=s.value,o=A(()=>{try{const r=c(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const i=r==null?"":String(r);if(t.node.value===i)return;const f=typeof document<"u"&&document.activeElement===t.node,a=f&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=f&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=i,f&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=c}if(typeof s.style=="function"){const c=s.style;let o;const r=A(()=>{const i=c(t,t.state,t.context),f=ft(i);(f===null||f!==o)&&(o=f,I(t.node,i))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=c}else if(t.style&&typeof t.style=="object")for(const c in t.style){const o=t.style[c];if(typeof o!="function")continue;let r;const i=A(()=>{try{const f=o(t,t.state,t.context);if(t.node){const a=c+":"+String(f);a!==r&&(r=a,I(t.node,{[c]:f}))}}catch{}},{depth:n.path.length});n.__effects.push(i)}if(t.attr&&typeof t.attr=="object"){for(const c in t.attr)if(typeof t.attr[c]=="function"){const o=t.attr[c],r=c,i=A(()=>{try{const f=o(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f))}catch{}},{depth:n.path.length});n.__effects.push(i)}}if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o!="function")continue;const r="aria-"+c.replace(/[A-Z]/g,f=>"-"+f.toLowerCase()),i=A(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f)}catch{}},{depth:n.path.length});n.__effects.push(i)}if(t.data&&typeof t.data=="object")for(const c in t.data){const o=t.data[c];if(typeof o!="function")continue;const i="data-"+c.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),f=A(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(i,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(f)}const e=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(e)for(const c in e){const o=e[c];if(typeof o!="function")continue;const r=A(()=>{try{const i=o(t,t.state,t.context);if(!t.node?.classList)return;typeof i=="string"?t.node.classList.add(i):i?t.node.classList.add(c):t.node.classList.remove(c)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(typeof s.if=="function"){const c=s.if,o=A(()=>{let r;try{r=c(t,t.state,t.context)}catch(f){if(r=!1,n.__ifError=f,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,f?.message||f)}return}const i=n.__if;if(n.__if=!!r,i&&!n.__if&&t.node)t.node.remove();else if(!i&&n.__if)if(n.__ifInitialized){t.node||(t.node=Y(t)),t.node&&(t.node.ref=t);const f=t.parent,a=f?.node;if(a&&t.node){let u=null;const d=Object.keys(f),p=d.indexOf(t.key);for(let y=p+1;y<d.length;y++){const l=f[d[y]];if(l?.node?.parentNode===a){u=l.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else ot(t,t.parent);Q(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=nt(t)),$("Init",t,{}),t.node||(t.node=Y(t)),!t.node)return;if(t.tag==="fragment"&&!n.__fragmentAnchor){const u=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(u),n.__fragmentAnchor=u}$("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),pt(t,{});const f=s.if;delete s.if;try{X(t,s)}finally{s.if=f}Q(t),ut(t),yt(t,{}),ot(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||N.has(c)||typeof t[c]!="function")continue;const o=c.charCodeAt(0);if(o>=65&&o<=90||F(c))continue;const r=t[c];n.__exec[c]=r;const i=t.tag||"div";if(z(i,c)&&!C[c]&&!(j&&j.has(c))){const f=c,a=A(()=>{try{const u=r(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(f):typeof u!="function"&&typeof u!="object"&&(f==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(f,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}Et(t),Pt(t)}function Q(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),Lt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&I(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const e=t.attr[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||s.setAttribute&&s.setAttribute(n,e===!0?"":e)}if(t.data&&typeof t.data=="object")for(const n in t.data){const e=t.data[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||s.dataset&&(s.dataset[n]=e===!0?"":e)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(e=>e&&s.classList.add(e));else if(typeof n=="object")for(const e in n){const c=typeof n[e]=="function"?n[e](t,t.state,t.context):n[e];c&&s.classList.add(typeof c=="string"?c:e)}}}}function ft(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function I(t,s){if(!t||!s||!t.style)return;let n=null;for(const e in s){const c=s[e];if(c!=null){if(e.charAt(0)==="&"&&typeof c=="object"){n||(n={}),n[e]=c;continue}try{const o=String(c),r=e.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),i=o.trim(),f=/\s*!important\s*$/.test(i),a=i.replace(/\s*!important\s*$/,"");t.style.setProperty(r,a,f?"important":"")}catch{}}}n&&wt(t,n)}let kt=0;function wt(t,s){const n=`_ds${kt++}`;t.classList.add(n);const e=t.ownerDocument;let c=e.querySelector("style[data-smbls-scoped]");c||(c=e.createElement("style"),c.setAttribute("data-smbls-scoped",""),e.head.appendChild(c));let o="";for(const r in s){const i="."+n,f=r.replace(/&/g,i).split(",").map(u=>{const d=u.trim();return d.includes(i)?d:i+d}).join(", "),a=s[r];if(typeof a=="object"){let u="",d="";for(const p in a){const y=a[p];if(typeof y=="object"){const l=p.includes("&")?f.split(", ").map(_=>p.replace(/&/g,_)).join(", "):f.split(", ").map(_=>`${_} ${p}`).join(", ");let h="";for(const _ in y)h+=`${_.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[_]};`;d+=`${l} { ${h} }
5
+ `}else u+=`${p.replace(/[A-Z]/g,l=>"-"+l.toLowerCase())}: ${y};`}u&&(o+=`${f} { ${u} }
6
+ `),d&&(o+=d)}}o&&(c.textContent+=o)}function Et(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let e=0;e<s.length;e++){const c=s[e];if(typeof c!="string"||c.length===0)continue;const o=c.split("."),r=o[0],i=o.slice(1),f={value:!1},a=A(()=>{const u=t.state&&(R(t.state)?t.state.root:null);if(!u||!R(u))return;let d=u;d=d[r];for(let p=0;p<i.length&&!(d==null||typeof d!="object");p++)if(R(d))d=d[i[p]];else break;if(f.value&&(typeof t.onBeforeUpdate=="function"||typeof t.onUpdate=="function")){const p=t.context?.designSystem;p&&P(p);let y="onBeforeUpdate";try{let l=!1;typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0),y="onUpdate",!l&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context)}catch(l){t.context?.plugins?.length&&Z("error",t,{hook:y,error:l})||console.error(`[DOMQL] subscribeTo ${y} error:`,l)}finally{p&&O()}}},{depth:n.path.length});f.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function Pt(t){const s=t.__ref;s.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const e=n.charAt(0);if(e!=="."&&e!=="!")continue;const c=n.slice(1);if(!c)continue;const o=t[n];if(!o||typeof o!="object")continue;const r=e==="!",i={lastMatch:!1,appliedKeys:null},f=()=>{if(!t.node)return;let u;const d=t[c];if(d===void 0)if(t.state&&c in t.state)u=t.state[c];else{const l=t.context?.cases?.[c];if(l===void 0)return;try{u=typeof l=="function"?l.call(t,t):l}catch(h){u=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof d=="function")try{u=d(t,t.state,t.context)}catch(l){u=!1,s.__conditionalError=l,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,l?.message||l)}else u=d;const p=r?!u:!!u;if(p===i.lastMatch)return;i.lastMatch=p;const y=t.context?.designSystem;y&&P(y);try{if(p){const l={};for(const _ in o){if(!Object.prototype.hasOwnProperty.call(o,_))continue;const g=typeof o[_]=="function"?o[_](t,t.state,t.context):o[_];if(g!=null)if(C[_]){const b=C[_](g,t,t.state,t.context);if(b){const v=Array.isArray(b)?b:[b];for(const D of v)D&&Object.assign(l,D)}}else j&&j.has(_)&&(l[_]=g)}const h=Object.keys(l);h.length?(I(t.node,l),i.appliedKeys=h):i.appliedKeys=null}else if(i.appliedKeys){for(const l of i.appliedKeys)t.node.style[l]="";i.appliedKeys=null}}finally{y&&O()}};s.__conditionalRunners.push(f);const a=A(f,{depth:s.path.length});s.__effects.push(a)}}const J=new WeakSet;function Ot(t){const s=t.ownerDocument;!s||J.has(s)||(J.add(s),queueMicrotask(()=>{J.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const m=new WeakSet;let at=!1;function Lt(t){const{node:s}=t;if(!s)return;if(at||(at=!0,rt({display:"none"})),m.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}m.add(t);const n=t.context?.designSystem;n&&P(n);try{const e={};let c=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||N.has(o))continue;const r=o.charCodeAt(0);if(!(r>=65&&r<=90)&&!F(o)){if(C[o]){const i=t[o],f=C[o](i,t,t.state,t.context);if(f){if(Array.isArray(f))for(const a of f)a&&Object.assign(e,a);else Object.assign(e,f);c=!0}}else if(j&&j.has(o)){const i=t[o];i!=null&&typeof i!="object"&&(e[o]=i,c=!0)}else if(o.charCodeAt(0)===45){const i=t[o];i!=null&&typeof i!="object"&&(e[o]=i,c=!0)}else if(o.charAt(0)==="&"){const i=t[o];i&&typeof i=="object"&&(e[o]=i,c=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const i=t[o];if(i&&typeof i=="object"){const f={},a=(u,d,p)=>{if(C[d]){const y=C[d](p,t,t.state,t.context);if(y)if(Array.isArray(y))for(const l of y)l&&Object.assign(u,l);else Object.assign(u,y)}else u[d]=p};for(const u in i){let d=i[u];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function")){if(u==="style"&&typeof d=="object"&&!Array.isArray(d)){for(const p in d){let y=d[p];typeof y=="function"&&(y=y(t,t.state,t.context)),!(y==null||typeof y=="function")&&a(f,p,y)}continue}a(f,u,d)}}if(Object.keys(f).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const d={};for(const y in f){const l=f[y];d[y]=typeof l=="string"&&!l.includes("!important")?l+" !important":l}const p=o.slice(1);e[`[data-theme="${p}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const y=o.slice(1),l=t.context?.designSystem?.media?.[y]||t.context?.designSystem?.media?.[y];l&&(d=`@media ${l}`)}const p={};for(const y in f){const l=f[y];if(l&&typeof l=="object"&&!Array.isArray(l)){const h={};for(const _ in l)if(C[_]){const g=C[_](l[_],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(h,b);else Object.assign(h,g)}else h[_]=l[_];p[y]=h}else p[y]=l}Object.keys(p).length&&(e[d]=p)}c=!0}c=!0}}}}if(c){e.display&&String(e.display).includes("!important")&&(s.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const o=rt(e,null,t.context?.cssPrefix);if(o&&s.classList){const i=o.split(" ").filter(Boolean);let f=!1;for(const a of i)s.classList.add(a),f||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(f=!0);f&&Ot(s)}const r=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(r!=null){const i=e.display;if(i&&i!==r)if(r==="none"){const f=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&f.push(a);for(const a of f)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&O(),m.delete(t)}}function ut(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const r="aria-"+c.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());s.setAttribute(r,o===!0?"":o)}const n=xt(t);for(const c in n){const o=n[c];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(c,o===!0?"":o)}const e=t.tag||"div";for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||typeof t[c]=="function"||N.has(c)||c==="on"||n[c]!==void 0)continue;const o=c.charCodeAt(0);if(!(o>=65&&o<=90)&&!F(c)&&!(C[c]||j&&j.has(c))&&z(e,c)){let r=t[c];if(r==null||r===!1||(typeof r=="string"&&r.includes("{{")&&(r=G(r,t,t.state,t.context),t[c]=r),r==null||r===!1||typeof r=="function"||typeof r=="object"))continue;s.setAttribute(c,r===!0?"":r)}}}function Tt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,e=n&&typeof n=="object"&&n.max?String(n.max):null;e&&(s.style.maxHeight=e);const c=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};c(),s.addEventListener("input",c),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",c)}catch{}})}const dt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function pt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!F(n)||dt.has(n))continue;let e=t[n];if(typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const o=e;e=function(i){return t.call(o,i)}}if(typeof e!="function")continue;const c=vt(n);ht.has(c)||_t(St(c),t,e)}Rt(t)}function Rt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let e=!1;for(const p of dt){const y=t[p];typeof y=="function"&&(n[p]=y,e=!0)}if(!e)return;const c=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let r=0,i=0,f=0,a=!1;const u=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(r=y.clientX,i=y.clientY,f=Date.now(),a=!0)},d=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const l=y.clientX-r,h=y.clientY-i,_=Date.now()-f;if(_>o)return;const g=Math.abs(l),b=Math.abs(h);if(Math.max(g,b)<c)return;let v;if(g>b*1.2)v=l<0?"left":"right";else if(b>g*1.2)v=h<0?"up":"down";else return;const D="onSwipe"+v.charAt(0).toUpperCase()+v.slice(1),T=n[D],S=n.onSwipe;T&&T.call(t,p,t,t.state,t.context),S&&S.call(t,{direction:v,dx:l,dy:h,dt:_,event:p},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",d)}catch{}})}function B(t,s){const n={...t};for(const e in s){const c=n[e],o=s[e];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[e]=B(c,o):n[e]=o}return n}function tt(t,s,n){if(!s||!t.node)return;const e=t.childExtends;if(Array.isArray(s)){const c=t.tag==="fragment",o=t.context?.document||globalThis.document,r=c?null:o?.createDocumentFragment();if(!c&&!r)return;const i=t.childProps,f=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const d=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=i;if(typeof i=="function")try{p=i(t,u)}catch{p=null}if(f==="state"){let h=d;(typeof d=="string"||typeof d=="number")&&(h={value:d,text:d}),u=p?{...p,state:h}:{state:h}}else p&&(u=B(p,u));if(e&&!u.ignoreChildExtends)if(u.extends){const h=Array.isArray(u.extends)?u.extends:[u.extends],_=Array.isArray(e)?e:[e];u={...u,extends:[..._,...h]}}else u={...u,extends:e};const y=u?.key||d&&typeof d=="object"&&d.key||`${a}`,l=K(u,t,y,n);!c&&l?.node&&r.appendChild(l.node)}c||t.node.appendChild(r);return}if(typeof s=="string"){const c=et(s,t);if(Array.isArray(c)){tt(t,c,n);return}}if(typeof s=="object")for(const c in s){if(N.has(c))continue;let o=s[c];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=B(t.childProps,o)),e&&!o.ignoreChildExtends)if(o.extends){const r=Array.isArray(o.extends)?o.extends:[o.extends],i=Array.isArray(e)?e:[e];o={...o,extends:[...i,...r]}}else o={...o,extends:e};K(o,t,c,n)}}}function yt(t,s){let{children:n,content:e}=t;const c=t.childExtends;if(typeof n=="function"){const r=n;n=r(t,t.state,t.context),t.children=n;const i=t.__ref;let f=!1;const a=A(()=>{const u=r(t,t.state,t.context);if(!f){f=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const y=t.childProps,l=[],h=new Map;for(let S=0;S<u.length;S++){const w=u[S];let x=y;if(typeof y=="function")try{x=y(t,w)}catch{x=null}const M=x&&x.key||w&&w.key||`${S}`;l.push(M),h.set(M,{rawChild:w,childProps:x})}const _=new Set(l),g=i.__children.slice();for(const S of g)if(!_.has(S)){const w=t[S];w?.remove&&w.remove(),delete t[S]}const b=t.childExtends,v=t.tag==="fragment",D=t.context?.document||globalThis.document,T=v?null:D?.createDocumentFragment();for(const S of l){const w=h.get(S),x=w.rawChild,M=t[S];if(M&&M.state){if(x&&typeof x=="object"){const L=M.state;if(typeof L.replace=="function")L.replace(x);else if(typeof L.update=="function"){for(const k in L)if(!(k==="__element"||k==="root"||k==="parent"||k==="update")&&!Object.prototype.hasOwnProperty.call(x,k))try{L[k]=void 0}catch{}L.update(x)}else for(const k in x)L[k]=x[k]}continue}let H=x;(typeof x=="string"||typeof x=="number")&&(H={value:x,text:x});const st=w.childProps;let E=st?{...st,state:H}:{state:H};if(b&&!E.ignoreChildExtends)if(E.extends){const L=Array.isArray(E.extends)?E.extends:[E.extends],k=Array.isArray(b)?b:[b];E={...E,extends:[...k,...L]}}else E={...E,extends:b};const ct=K(E,t,S,s);!v&&ct?.node&&T&&T.appendChild(ct.node)}!v&&T&&T.childNodes.length&&t.node&&t.node.appendChild(T),i.__children=l;return}for(const y of[...i.__children]){const l=t[y];l?.remove&&l.remove(),delete t[y]}i.__children=[],tt(t,u,s)},{depth:i.path.length});i.__effects.push(a)}if(tt(t,n||e,s),n||e)return;const o=t.context?.components||{};{const r=Object.keys(t);for(let i=0;i<r.length;i++){const f=r[i];if(!f.endsWith("Extends")||typeof t[f]!="string")continue;const a=f.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[f]};delete t[f];for(let d=i+1;d<r.length;d++){const p=r[d],y=p.charCodeAt(0);if(y>=65&&y<=90||N.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const l=t[p];l!==void 0&&(u[p]=l,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||N.has(r)||typeof t[r]!="object"||t[r]===null)continue;const i=r.charCodeAt(0);if(i<65||i>90)continue;let f=t[r];if(!f.__ref){if(!f.extends&&!f.extend){const a=o[r]||o[`smbls.${r}`];a&&(f={...f,extends:a})}if(t.childProps&&(f=B(t.childProps,f)),c&&!f.ignoreChildExtends)if(f.extends){const a=Array.isArray(f.extends)?f.extends:[f.extends],u=Array.isArray(c)?c:[c];f={...f,extends:[...u,...a]}}else f={...f,extends:c};K(f,t,r,s)}}}function ot(t,s,n){const{node:e}=t;if(!e)return;e.ref=t;const c=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(c){const r=c.parentNode;if(r){if(n?.position==="before"&&n.node)r.insertBefore(e,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;r.insertBefore(e,i||c)}else r.insertBefore(e,c);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(e,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;r?o.insertBefore(e,r):o.appendChild(e)}else o.appendChild(e)}function $(t,s,n){const e=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&Z(e,s,n);const c="on"+t,o=s[c];if(typeof o=="function"){const r=t==="Render"||t==="RenderRouter";if(r){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const i=s.context?.designSystem;i&&P(i);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(f){if(s.context?.plugins?.length&&Z("error",s,{hook:c,error:f})||console.error(`[DOMQL] Lifecycle "${c}" error:`,f),s.context?.strictMode)throw f}finally{i&&O(),r&&(s.__ref.__inRender=!1)}}return!0}var Jt=K;export{K as create,Jt as default};
@@ -1 +1 @@
1
- function e(r){if(!r)return;const _=r.__ref;if(_){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(o){console.error("[smbls] onBeforeRemove error:",o)}if(_.__effects){for(let o=0;o<_.__effects.length;o++)_.__effects[o].dispose();_.__effects.length=0}if(_.__eventCleanup){for(let o=0;o<_.__eventCleanup.length;o++)_.__eventCleanup[o]();_.__eventCleanup.length=0}if(_.__children){for(let o=0;o<_.__children.length;o++){const i=_.__children[o],f=r[i];f&&f.__ref&&e(f)}_.__children.length=0}if(r.node?.parentNode&&r.node.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const o=r.parent.__ref.__children.indexOf(r.key);o!==-1&&r.parent.__ref.__children.splice(o,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(o){console.error("[smbls] onRemove error:",o)}r.node=null,r.parent=null,r.__ref=null}}function n(){e(this)}export{e as dispose,n as remove};
1
+ function e(r){if(!r)return;const _=r.__ref;if(_){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(o){console.error("[smbls] onBeforeRemove error:",o)}if(_.__effects){for(let o=0;o<_.__effects.length;o++)_.__effects[o].dispose();_.__effects.length=0}if(_.__eventCleanup){for(let o=0;o<_.__eventCleanup.length;o++)_.__eventCleanup[o]();_.__eventCleanup.length=0}if(_.__children){for(let o=0;o<_.__children.length;o++){const n=_.__children[o],f=r[n];f&&f.__ref&&e(f)}_.__children.length=0}if(r.node?.parentNode?r.node.remove():r.tag==="fragment"&&_.__fragmentAnchor?.parentNode&&_.__fragmentAnchor.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const o=r.parent.__ref.__children.indexOf(r.key);o!==-1&&r.parent.__ref.__children.splice(o,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(o){console.error("[smbls] onRemove error:",o)}r.node=null,r.parent=null,r.__ref=null}}function t(){e(this)}export{e as dispose,t as remove};
@@ -1 +1 @@
1
- import{batch as l,isStore as s}from"@symbo.ls/signal";import{REGISTRY as u}from"./registry.js";import{create as y}from"./create.js";import{runPluginHook as a}from"@symbo.ls/utils/function.js";function x(e={},i={}){const t=this,f=t.__ref;if(f){if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!i.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,i)===!1)return t;if(l(()=>{if(e.state&&s(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const o=e.style[n];if(o==null)continue;const r=n.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(r,c,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const o=e.attr[n];o==null||o===!1?t.node.removeAttribute(n):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(n,o===!0?"":o)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(u.has(n)||n==="state")continue;const o=e[n],r=t[n];if(r&&r.__ref&&typeof r.update=="function")r.update(o,i);else if(typeof o=="object"&&o!==null){const c=n.charCodeAt(0);c>=65&&c<=90&&y(o,t,n,i)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=o)}}),t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return a("update",t),!i.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,i),t}}var j=x;export{j as default,x as update};
1
+ import{batch as r,isStore as u}from"@symbo.ls/signal";import{REGISTRY as _}from"./registry.js";import{create as y}from"./create.js";import{runPluginHook as x}from"@symbo.ls/utils/function.js";function h(e={},i={}){const t=this,f=t.__ref;if(!f)return;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!i.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,i)===!1)return t;const l=!e||Object.keys(e).length===0;if(r(()=>{if(e.state&&u(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const o=e.style[n];if(o==null)continue;const c=n.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),s=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(c,s,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const o=e.attr[n];o==null||o===!1?t.node.removeAttribute(n):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(n,o===!0?"":o)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(_.has(n)||n==="state")continue;const o=e[n],c=t[n];if(c&&c.__ref&&typeof c.update=="function")c.update(o,i);else if(typeof o=="object"&&o!==null){const s=n.charCodeAt(0);s>=65&&s<=90&&y(o,t,n,i)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=o)}}),t.node&&l&&f.__effects&&f.__effects.length)for(let n=0;n<f.__effects.length;n++){const o=f.__effects[n];o&&!o._disposed&&!o._isSubscribeToEffect&&typeof o._execute=="function"&&o._execute()}else if(t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return x("update",t),!i.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,i),t}var v=h;export{v as default,h as update};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/element",
3
- "version": "3.14.446",
3
+ "version": "3.14.577",
4
4
  "description": "Core element creation, update, and disposal engine for smbls v3.14",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",