@symbo.ls/element 3.14.782 → 3.14.783
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/dist/cjs/src/create.js +5 -5
- package/dist/cjs/src/delegate.js +1 -1
- package/dist/cjs/src/dispose.js +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/create.js +5 -5
- package/dist/esm/src/delegate.js +1 -1
- package/dist/esm/src/dispose.js +1 -1
- package/dist/esm/src/version.js +1 -1
- package/package.json +1 -1
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`+
|
|
1
|
+
"use strict";var xt=Object.defineProperty;var ao=Object.getOwnPropertyDescriptor;var uo=Object.getOwnPropertyNames;var lo=Object.prototype.hasOwnProperty;var po=(t,e)=>{for(var s in e)xt(t,s,{get:e[s],enumerable:!0})},ho=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of uo(e))!lo.call(t,n)&&n!==s&&xt(t,n,{get:()=>e[n],enumerable:!(r=ao(e,n))||r.enumerable});return t};var yo=t=>ho(xt({},"__esModule",{value:!0}),t);var Ko={};po(Ko,{BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES:()=>yt,acquireBeforeUpdateGuard:()=>no,create:()=>H,default:()=>Bo,flushMounts:()=>ht,releaseBeforeUpdateGuard:()=>ut,writeElementText:()=>at});module.exports=yo(Ko);var R=require("@symbo.ls/signal"),E=require("@symbo.ls/signal"),Y=require("./cache.js"),U=require("./registry.js"),tt=require("./delegate.js"),to=require("./extends.js"),oo=require("./methods.js"),Wo=require("./dispose.js"),J=require("./devRuntime.js"),I=require("./mountScheduler.js"),W=require("@symbo.ls/utils"),K=require("@symbo.ls/utils/function.js"),m=require("@symbo.ls/state"),A=require("css-in-props"),V=require("@symbo.ls/css"),k=require("@symbo.ls/scratch"),w=require("attrs-in-props"),so=require("./engineRegistry.js"),eo=require("./version.js");const $t=(0,so.resolveElementIdEngine)({uniqId:1,scopedStyleId:0},eo.VERSION),rt=[];let At=!1;function Mt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function _o(){return typeof document<"u"&&document.visibilityState==="hidden"}const go=250;function Nt(){if(!At){if(At=!0,typeof requestAnimationFrame!="function"){setTimeout(ht,0);return}_o()?setTimeout(ht,go):requestAnimationFrame(ht)}}const bo=300,xo=15e4;function ht(){if(At=!1,!rt.length)return;const t=rt.splice(0,rt.length);for(let e=0;e<t.length;e++){const s=t[e];if(s.node){if(!s.node.isConnected){const r=s.__ref||(s.__ref={});r.__mountAttempts=(r.__mountAttempts||0)+1,r.__mountFirstAttemptAt==null&&(r.__mountFirstAttemptAt=Mt());const n=Mt()-r.__mountFirstAttemptAt;r.__mountAttempts<=bo&&n<xo?(rt.push(s),Nt()):console.warn("[DOMQL] onMounted dropped after",r.__mountAttempts,"attempts /",n,"ms \u2014 node never connected:",s.key||s.tag||s);continue}M("Mounted",s,s.__ref?.__mountOptions||{})}}}function Ct(t,e){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=e,rt.push(t),Nt())}function Ft(t,e){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,K.runPluginHook)("contentUpdate",t,e);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s);try{t.onContentUpdate(t,t.state,t.context,e)}catch(r){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{s&&(0,k.popConfig)()}}function Z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Ao(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Co(t){return t.toLowerCase()}function kt(t){const e=t.charCodeAt(0);return e===58||e===64||e===38||e===91}function it(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=it(n,o):s[r]=o}return s}function H(t,e,s,r={},n){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=s||t.key||`_${$t.uniqId++}`,o.parent=e||null,o.context=t.context||e?.context||r.context||{},o.context.__create||(o.context.__create=H);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:e?.__ref?.root||o,path:e?.__ref?.path?[...e.__ref.path,o.key]:[o.key],origin:t};if(s&&!t.extends&&!t.extend){const _=s.indexOf("_"),y=s.indexOf(".");let p=_>0?_:-1;if(y>0&&(p<0||y<p)&&(p=y),p>0){const b=s.substring(0,p),x=o.context?.components;x&&(x[b]||x["smbls."+b])?t={...t,extends:b}:x&&(0,J.isLoudDevRuntime)()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}(0,to.applyExtends)(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),a=o.props&&typeof o.props=="object"?o.props:null;for(const _ in t){if(_==="parent"||_==="node"||_==="__ref"||_==="extends"||_==="context"||_==="props")continue;const y=t[_],p=o[_],b=p&&y&&typeof p=="object"&&typeof y=="object"&&!Array.isArray(p)&&!Array.isArray(y)&&typeof p!="function"&&typeof y!="function";b&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=it(p,y):b&&c.has(_)?o[_]={...p,...y}:b&&kt(_)?o[_]=it(p,y):o[_]=y}function u(_){for(const y in _){const p=_[y],b=o[y],x=b&&p&&typeof b=="object"&&typeof p=="object"&&!Array.isArray(b)&&!Array.isArray(p)&&typeof b!="function"&&typeof p!="function";x&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=it(b,p):x&&c.has(y)?o[y]={...b,...p}:x&&kt(y)?o[y]=it(b,p):o[y]=p}}a&&u(a),t.props&&typeof t.props=="object"&&u(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 d=o.scope&&typeof o.scope=="object"?o.scope:null,f=e?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,h=f||l||null;if(t.scope!==void 0||d){const _={};d&&Object.assign(_,d),t.scope!==void 0&&Object.assign(_,t.scope),o.scope=(0,R.createScopeStore)(_,h)}else h&&(o.scope=h);if(t.if!==void 0&&(o.if=t.if),(0,oo.addMethods)(o),ko(o,e,t),o.if!=null){let _;if(typeof o.if=="function")try{_=o.if(o,o.state,o.context)}catch(y){if(_=!1,i.__ifError=y,typeof console<"u"&&console.warn){const p=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${p} \u2014 treating as false:`,y?.message||y)}}else _=o.if;i.__if=!!_}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return e&&(e[o.key]=o),typeof o.if=="function"&&Kt(o,i,o.if),o;o.tag||(o.tag=(0,Y.detectTag)(o)),M("Init",o,r);const g=o.node=(0,Y.cacheNode)(o);if(!g)return o;if(o.tag==="fragment"){const y=(o.context?.document||globalThis.document).createComment("");g.appendChild(y),i.__fragmentAnchor=y}M("AttachNode",o,r),g.setAttribute&&o.key&&g.setAttribute("data-key",o.key),e&&(e[o.key]=o,e.__ref?.__children&&(e.__ref.__children.includes(o.key)||e.__ref.__children.push(o.key))),g.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&g.setAttribute("data-smbls-app",o.context.key),o.id&&g.setAttribute&&(g.id=o.id),Xt(o,r),Ut(o),vt(o),Zt(o),Io(o);try{Jt(o,r)}catch(_){if(typeof console<"u"&&console.error){const y=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${y}:`,_?.message||_,_?.stack?`
|
|
2
|
+
`+_.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Et(o,!0),Zt(o,e,r),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const d=o.context?.designSystem;d&&(0,k.pushConfig)(d);try{const y=o.html(o,o.state,o.context);y!=null&&typeof y!="function"&&(o.node.innerHTML=y)}catch{}finally{d&&(0,k.popConfig)()}}if(K("Create",o,n),K("Complete",o,n),K("Render",o,n),K("RenderRouter",o,n),Mt(o,n),typeof o.onFrame=="function"){const d=o.onFrame,y=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){y&&(0,k.pushConfig)(y);try{d(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{y&&(0,k.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function bo(t,e,s){const n=!e,r=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=n&&r&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!(0,D.isStore)(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,(0,m.applyStateMethods)(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},l=t.context?.polyglot;if(l?.translations){const u=t.context,f=c.lang||l.defaultLang||"en",p=new Set,h=(y,g)=>{p.has(y)||(0,G.isPolyglotWritableKey)(u,y,a)&&(a[y]=g,p.add(y),(0,G.markPolyglotSeeded)(u,y))},_=l.translations[f];if(_&&typeof _=="object")for(const y in _)h(y,_[y]);const d=new Set(l.languages||[]);for(const y in l.translations)d.has(y)||h(y,l.translations[y])}t.state=(0,D.isStore)(a)?a:(0,D.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=Nt(i,e),t.state&&typeof t.state=="object"&&!(0,D.isStore)(t.state)){const c=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const c=i(t,e?.state);t.state=(0,D.isStore)(c)?c:(0,D.createStore)(c||{})}else(0,D.isStore)(i)?t.state=i:t.state=(0,D.createStore)({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}function xt(t,e){if(!e)return t;const s=e.split("/");let n=t;for(const r of s){if(n==null)return{};n=n[r]}return n??{}}function Nt(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?xt(e.state,r):e.state??{}}if(t.startsWith("~/")){const r=e.state?.root||e.state,o=t.slice(2);return o?xt(r,o):r??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=xt(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const n=e.context?.polyglot;if(n?.translations){const r=e.state?.root?.lang||n.defaultLang||"en",o=n.translations[r];if(o?.[t]!==void 0)return o[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}const xo=new Set(["s","state","ctx","context"]);function Ao(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function ko(t){if(typeof t!="function"||t.length!==2)return!1;const e=Ao(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!xo.has(s)}function So(t){const e=t.__ref,s=t.tag||"div",n=t.context?.designSystem,r=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||F.REGISTRY.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||Q(c)||A.CSS_PROPS_REGISTRY[c]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(c)||(0,v.checkAttributeByTagName)(s,c)||((0,ct.isLoudDevRuntime)()&&ko(t[c])&&console.warn(`[smbls] custom prop "${c}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:c,fn:t[c]}))}for(let i=0;i<r.length;i++){const{prop:c,fn:a}=r[i];e.__exec[c]=a,Object.defineProperty(t,c,{get(){n&&(0,k.pushConfig)(n);try{return a(t,t.state,t.context)}catch{return}finally{n&&(0,k.popConfig)()}},set(l){delete e.__exec[c],Object.defineProperty(t,c,{value:l,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Co(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const n=e[s];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function P(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...n){return Co(t,e),s.apply(this,n)}}function rt(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function j(t,e){return()=>t.path.join(".")+"::"+e}function Ft(t,e){const s=t.__ref,n=!!(e&&e.skipIfEffect);if(So(t),typeof t.text=="function"){const o=t.text,i=P(t,t.textDeps,o),c=(0,w.createEffect)(()=>{if(!s.contentManaged)try{let a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=G.replaceLiteralsWithObjectFields.call(t,a,t.state)),at(t,a))}catch{}},{depth:s.path.length,label:j(s,"text")});s.__effects.push(c),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,w.createEffect)(()=>{if(s.contentManaged)return;const c=G.replaceLiteralsWithObjectFields.call(t,o,t.state);c!=null&&(t.text=c),t.node&&at(t,c??"")},{depth:s.path.length,label:j(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!F.REGISTRY.has(o)&&!Q(o)&&!s.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],c=P(t,t[o+"Deps"],i),a=o;let l;const u=(0,w.createEffect)(()=>{const f=t.context?.designSystem;f&&(0,k.pushConfig)(f);try{const p=c(t,t.state,t.context),h=A.CSS_PROPS_REGISTRY[a](p,t,t.state,t.context),_=a==="show"||a==="hide";if(h&&t.node){const d=kt(h),y=_&&t.node.style.display!=="none";(d===null||d!==l||y)&&(l=d,X(t.node,h))}else if(t.node&&_){l=void 0;const d=s.__explicitDisplay;t.node.style.display=typeof d=="string"?d:""}}finally{f&&(0,k.popConfig)()}},{depth:s.path.length,label:j(s,a)});s.__effects.push(u),s.__exec[o]=i}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],c=P(t,t[o+"Deps"],i),a=o;let l;const u=(0,w.createEffect)(()=>{const f=t.context?.designSystem;f&&(0,k.pushConfig)(f);try{const p=c(t,t.state,t.context);if(t.node)if(p!=null){const h=a+":"+String(p);h!==l&&(l=h,X(t.node,{[a]:p}))}else l=void 0,t.node.style[a]=""}finally{f&&(0,k.popConfig)()}},{depth:s.path.length,label:j(s,a)});s.__effects.push(u),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=P(t,t.htmlDeps,o),c=(0,w.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,k.pushConfig)(a);try{const l=i(t,t.state,t.context);t.node&&l!=null&&typeof l!="function"&&(t.node.innerHTML=l)}finally{a&&(0,k.popConfig)()}},{depth:s.path.length,label:j(s,"html")});s.__effects.push(c),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=P(t,t.valueDeps,o),c=(0,w.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const l=a==null?"":String(a);if(t.node.value===l)return;const u=typeof document<"u"&&document.activeElement===t.node,f=u&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=u&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=l,u&&f!=null&&p!=null)try{t.node.setSelectionRange(f,p)}catch{}}catch{}},{depth:s.path.length,label:j(s,"value")});s.__effects.push(c),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=P(t,t.styleDeps,o);let c;const a=(0,w.createEffect)(()=>{const l=i(t,t.state,t.context),u=kt(l);(u===null||u!==c)&&(c=u,X(t.node,l))},{depth:s.path.length,label:j(s,"style")});s.__effects.push(a),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const c=P(t,rt(t.styleDeps,o),i);let a;const l=(0,w.createEffect)(()=>{try{const u=c(t,t.state,t.context);if(t.node){const f=o+":"+String(u);f!==a&&(a=f,X(t.node,{[o]:u}))}}catch{}},{depth:s.path.length,label:j(s,"style."+o)});s.__effects.push(l)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=P(t,rt(t.attrDeps,o),t.attr[o]),c=o,a=(0,w.createEffect)(()=>{try{const l=i(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!(0,v.isEnumeratedTrueFalseAttr)(c)?t.node.removeAttribute(c):typeof l!="function"&&typeof l!="object"&&t.node.setAttribute(c,(0,v.serializeAttrValue)(c,l)))}catch{}},{depth:s.path.length,label:j(s,"attr."+c)});s.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=P(t,rt(t.ariaDeps,o),t.aria[o]),c="aria-"+o.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),a=(0,w.createEffect)(()=>{try{const l=i(t,t.state,t.context);if(!t.node?.setAttribute)return;l==null?t.node.removeAttribute(c):typeof l!="function"&&typeof l!="object"&&t.node.setAttribute(c,(0,v.serializeAttrValue)(c,l))}catch{}},{depth:s.path.length,label:j(s,"aria."+o)});s.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=P(t,rt(t.dataDeps,o),t.data[o]),a="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),l=(0,w.createEffect)(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null||u===!1?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,u===!0?"":u)}catch{}},{depth:s.path.length,label:j(s,"data."+o)});s.__effects.push(l)}const r=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(r)for(const o in r){if(typeof r[o]!="function")continue;const i=P(t,rt(t.classDeps,o),r[o]),c=(0,w.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:j(s,"class."+o)});s.__effects.push(c)}!n&&typeof t.if=="function"&&Ut(t,s,t.if);for(const o of Object.keys(t)){if(F.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||Q(o))continue;const c=t[o];s.__exec[o]=c;const a=t.tag||"div";if((0,v.checkAttributeByTagName)(a,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const l=(0,v.camelToAttr)(o)||o,u=P(t,t[o+"Deps"],c),f=(0,w.createEffect)(()=>{try{const p=u(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1&&!(0,v.isEnumeratedTrueFalseAttr)(l)?t.node.removeAttribute(l):typeof p!="function"&&typeof p!="object"&&(l==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(l,(0,v.serializeAttrValue)(l,p))))}catch{}},{depth:s.path.length,label:j(s,o)});s.__effects.push(f)}}if(jo(t),Po(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,a=[];const l=(0,w.createEffect)(()=>{const u=[];for(let _=0;_<i.length;_++){const d=i[_];try{u[_]=typeof d=="function"?d(t,t.state,t.context):t.state?.[d]}catch{u[_]=void 0}}if(!c){c=!0,a=u;return}let f=u.length!==a.length;for(let _=0;!f&&_<u.length;_++)u[_]!==a[_]&&(f=!0);const p=a;if(a=u,!f)return;const h=t.context?.designSystem;h&&(0,k.pushConfig)(h);try{o(t,t.state,t.context,{prev:p,next:u})}catch(_){if(t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{h&&(0,k.popConfig)()}},{depth:s.path.length,label:j(s,"onStateUpdate")});s.__effects.push(l)}To(t)}function It(t){const e=t.parent,s=e?.node;if(!s||!t.node){Zt(t,t.parent);return}let n=null;const r=Object.keys(e),o=r.indexOf(t.key);for(let i=o+1;i<r.length;i++){const c=e[r[i]];if(c?.node?.parentNode===s){n=c.node;break}}n?s.insertBefore(t.node,n):s.appendChild(t.node)}function Ut(t,e,s){const n=P(t,t.ifDeps,s),r=(0,w.createEffect)(()=>{let o;try{o=n(t,t.state,t.context)}catch(c){if(o=!1,e.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node)t.node.remove();else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=(0,Y.cacheNode)(t)),t.node&&(t.node.ref=t),It(t),At(t);else{if(e.__ifInitialized=!0,t.tag||(t.tag=(0,Y.detectTag)(t)),K("Init",t,{}),t.node||(t.node=(0,Y.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),e.__fragmentAnchor=a}K("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Yt(t,{}),Ft(t,{skipIfEffect:!0}),At(t),Wt(t),qt(t,{}),It(t),Mt(t,{})}},{depth:e.path.length,label:j(e,"if")});e.__effects.push(r)}function at(t,e){const s=t.node;if(!s)return;const n=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==n&&(s.nodeValue=n);return}const r=t.__ref;let o=r?r.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==n&&(o.nodeValue=n):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),s.insertBefore(o,s.firstChild)):(s.textContent=n,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=o||null)}function At(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),Oo(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"&&X(e,t.style),t.attr&&typeof t.attr=="object")for(const s in t.attr){const n=t.attr[s];typeof n=="function"||typeof n=="object"||n!=null&&(n===!1&&!(0,v.isEnumeratedTrueFalseAttr)(s)||e.setAttribute&&e.setAttribute(s,(0,v.serializeAttrValue)(s,n)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const n=t.data[s];typeof n=="function"||typeof n=="object"||n==null||n===!1||e.dataset&&(e.dataset[s]=n===!0?"":n)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(n=>n&&e.classList.add(n));else if(typeof s=="object")for(const n in s){const r=typeof s[n]=="function"?s[n](t,t.state,t.context):s[n];r&&e.classList.add(typeof r=="string"?r:n)}}}}function kt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function X(t,e){if(!t||!e||!t.style)return;let s=null;for(const n in e){const r=e[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[n]=r;continue}try{const o=String(r),i=n.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=o.trim(),a=/\s*!important\s*$/.test(c),l=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,l,a?"important":"")}catch{}}}s&&vo(t,s)}function vo(t,e){const s=`_ds${Ot.scopedStyleId++}`;t.classList.add(s);const n=t.ownerDocument;let r=n.querySelector("style[data-smbls-scoped]");r||(r=n.createElement("style"),r.setAttribute("data-smbls-scoped",""),n.head.appendChild(r));let o="";for(const i in e){const c="."+s,a=i.replace(/&/g,c).split(",").map(u=>{const f=u.trim();return f.includes(c)?f:c+f}).join(", "),l=e[i];if(typeof l=="object"){let u="",f="";for(const p in l){const h=l[p];if(typeof h=="object"){const _=p.includes("&")?a.split(", ").map(y=>p.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${p}`).join(", ");let d="";for(const y in h)d+=`${y.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${h[y]};`;f+=(0,H.wrapHoverRule)(`${_} { ${d} }`,_)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),f&&(o+=f)}}o&&(r.textContent+=o)}const Bt=new Set;function Kt(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function wo(t,e,s){const n=Kt(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=e(t,t.state,t.context)}catch{return}if(Kt(r)===n)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";Bt.has(o)||(Bt.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function jo(t){const e=t.subscribeTo,s=typeof e=="function";let n=e;if(s)try{n=e(t,t.state,t.context)}catch{n=null}if(s&&(0,ct.isLoudDevRuntime)()&&wo(t,e,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let o=0;o<n.length;o++){const i=n[o];if(typeof i!="string"||i.length===0)continue;const c=i.split("."),a=c[0],l=c.slice(1),u={value:!1},f=(0,w.createEffect)(()=>{const p=t.state&&((0,D.isStore)(t.state)?t.state.root:null);if(!p||!(0,D.isStore)(p))return;let h=p;h=h[a];for(let d=0;d<l.length&&!(h==null||typeof h!="object");d++)if((0,D.isStore)(h))h=h[l[d]];else break;if(!u.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"){const d=t.context?.designSystem;d&&(0,k.pushConfig)(d);try{if(to(r)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>ft(r,!1),g=>{ft(r,!0),t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:g})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",g)}):(ft(r,!1),y===!1&&(_=!0))}}catch(y){ft(r,!0),t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{d&&(0,k.popConfig)()}}if(!_&&t.node&&r.__effects)for(let d=0;d<r.__effects.length;d++){const y=r.__effects[d];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!_&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&(0,k.pushConfig)(d);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{d&&(0,k.popConfig)()}}},{depth:r.path.length,label:j(r,"subscribeTo("+i+")")});u.value=!0,f._isSubscribeToEffect=!0,r.__effects.push(f)}}function St(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}const Vt=new Set;function Eo(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",n=s+"::"+t;Vt.has(n)||(Vt.add(n),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function J(t,e,s){const n={},r=new Set,o=(i,c,a)=>{const l=a?new Set(Object.keys(n)):null;if(A.CSS_PROPS_REGISTRY[i]){const u=A.CSS_PROPS_REGISTRY[i](c,e,e.state,e.context);if(u){const f=Array.isArray(u)?u:[u];for(const p of f)p&&Object.assign(n,p)}}else n[i]=c;if(a)for(const u in n)l.has(u)||r.add(u)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let c=t[i];if(typeof c=="function"&&(c=c(e,e.state,e.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(i==="style"){for(const f in c){let p=c[f];if(typeof p=="function"&&(p=p(e,e.state,e.context)),p==null||typeof p=="function")continue;const h=typeof e[f]=="function"&&(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f));o(f,p,h)}continue}if(St(i,e)){const f=J(c,e,!1);Object.keys(f).length&&(n[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){(0,ct.isLoudDevRuntime)()&&Eo(i,e);continue}let l=i;if(i.charCodeAt(0)===64&&!i.startsWith("@media")&&!i.startsWith("@keyframes")){const f=e.context?.designSystem?.media?.[i.slice(1)];f&&(l=`@media ${f}`)}const u=J(c,e,!1);Object.keys(u).length&&(n[l]=u);continue}const a=typeof e[i]=="function"&&(A.CSS_PROPS_REGISTRY[i]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(i));o(i,c,a)}if(s)for(const i in n)r.add(i);for(const i of r){const c=n[i];typeof c=="string"&&!c.includes("!important")&&(n[i]=c+" !important")}return n}function Ct(t,e){if(e===void 0&&(e=0),e>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Ct(t[s],e+1))return!0}return!1}function Ht(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(St(t,s)){const o=J(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}let n=t;if(t.charAt(0)==="@"&&!t.startsWith("@media")&&!t.startsWith("@keyframes")){const o=s.context?.designSystem?.media?.[t.slice(1)];o&&(n=`@media ${o}`)}const r=J(e,s,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function To(t){const e=t.__ref;for(const s of Object.keys(t)){if(!bt(s))continue;const n=t[s];if(!n||typeof n!="object"||Array.isArray(n)||!Ct(n))continue;let r=null,o;const i=(0,w.createEffect)(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&(0,k.pushConfig)(c);let a,l=!1;try{const u=Ht(s,n,t),f=u?kt(u.block)+"::"+u.cssProp:null;if(f!==null&&f===o)l=!0;else if(o=f,u){const p=(0,H.css)({[u.cssProp]:u.block},null,t.context?.cssPrefix);a=p?p.split(" ").filter(Boolean):null}else a=null}finally{c&&(0,k.popConfig)()}if(!(l||!t.node.classList)){if(r)for(const u of r)t.node.classList.remove(u);if(a&&a.length)for(const u of a)t.node.classList.add(u);r=a}},{depth:e.path.length,label:j(e,"cssBlock("+s+")")});e.__effects.push(i)}}function Po(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const n of Object.keys(t)){const r=n.charAt(0);if(r!=="."&&r!=="!")continue;const o=n.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const f=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${f}: { '${o.slice(f.length)}': {...} }\`.`)}continue}const i=t[n];if(!i||typeof i!="object")continue;const c=r==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},l=()=>{let f;const p=t[o];if(p===void 0){const d=!!t.state&&o in t.state,y=t.state?t.state[o]:void 0;if(d||y!==void 0)f=y;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{f=typeof g=="function"?g.call(t,t):g}catch(b){f=!1,e.__conditionalError=b,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,b?.message||b)}}}else if(typeof p=="function")try{f=p(t,t.state,t.context)}catch(d){f=!1,e.__conditionalError=d,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,d?.message||d)}else f=p;const h=c?!f:!!f;if(!t.node||h===a.lastMatch)return;a.lastMatch=h;const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{if(h){const d={},y={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const E=i[x],L=x.charAt(0);if((L===":"||L==="@"||L==="&")&&E&&typeof E=="object"&&!Array.isArray(E)){if(St(x,t)){const R=J(E,t,!1);Object.keys(R).length&&(y[`[data-theme="${x.slice(1)}"] &`]=R,g=!0)}else{let R=x;if(L==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const T=t.context?.designSystem?.media?.[x.slice(1)];T&&(R=`@media ${T}`)}const q=J(E,t,!1);Object.keys(q).length&&(y[R]=q,g=!0)}continue}const z=typeof E=="function"?E(t,t.state,t.context):E;if(z!=null)if(A.CSS_PROPS_REGISTRY[x]){const R=A.CSS_PROPS_REGISTRY[x](z,t,t.state,t.context);if(R){const q=Array.isArray(R)?R:[R];for(const T of q)T&&Object.assign(d,T)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(d[x]=z)}const b=Object.keys(d);if(b.length){X(t.node,d);for(const x of b)s.set(x,n);a.appliedKeys=b}else a.appliedKeys=null;if(g){const x=(0,H.css)(y,null,t.context?.cssPrefix),E=x?x.split(" ").filter(Boolean):[];if(E.length&&t.node.classList){for(const L of E)t.node.classList.add(L);a.appliedClasses=E}else a.appliedClasses=null}else if(a.appliedClasses){for(const x of a.appliedClasses)t.node.classList.remove(x);a.appliedClasses=null}}else{if(a.appliedKeys){for(const d of a.appliedKeys)s.get(d)===n&&(t.node.style[d]="",s.delete(d));a.appliedKeys=null}if(a.appliedClasses){for(const d of a.appliedClasses)t.node.classList.remove(d);a.appliedClasses=null}}}finally{_&&(0,k.popConfig)()}};e.__conditionalRunners.push(l);const u=(0,w.createEffect)(l,{depth:e.path.length,label:j(e,"conditional("+n+")")});e.__effects.push(u)}}const vt=new WeakSet;function Do(t){const e=t.ownerDocument;!e||vt.has(e)||(vt.add(e),queueMicrotask(()=>{vt.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const wt=new WeakSet;let Gt=!1;function Oo(t){const{node:e}=t;if(!e)return;if(Gt||(Gt=!0,(0,H.css)({display:"none"})),wt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}wt.add(t);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s),(0,A.pushStaticCssPass)();try{const n={};let r=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&A.CSS_PROPS_REGISTRY.theme){const o=A.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const i of o)i&&Object.assign(n,i);else Object.assign(n,o);r=!0}}for(const o of Object.keys(t)){if(typeof t[o]=="function"||F.REGISTRY.has(o)||o==="theme")continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!Q(o)){if(A.CSS_PROPS_REGISTRY[o]){const c=t[o],a=A.CSS_PROPS_REGISTRY[o](c,t,t.state,t.context);if(a){if(Array.isArray(a))for(const l of a)l&&Object.assign(n,l);else Object.assign(n,a);r=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(n[o]=c,r=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(n[o]=c,r=!0)}else if(o.charAt(0)==="&"||o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"&&!Array.isArray(c)){if(Ct(c))continue;const a=Ht(o,c,t);a&&(n[a.cssProp]=a.block,r=!0)}}}}if(r){n.display&&String(n.display).includes("!important")&&(e.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const o=(0,H.css)(n,null,t.context?.cssPrefix);if(o&&e.classList){const c=o.split(" ").filter(Boolean);let a=!1;for(const l of c)e.classList.add(l),a||(l.charCodeAt(0)===95&&l.charCodeAt(1)===99||l.charCodeAt(0)===95&&l.indexOf("_c",1)!==-1)&&(a=!0);a&&Do(e)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=n.display;if(c&&c!==i)if(i==="none"){const a=[];for(const l of e.classList)l.startsWith("_d-")&&l!=="_d-none"&&a.push(l);for(const l of a)e.classList.remove(l);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{(0,A.popStaticCssPass)(),s&&(0,k.popConfig)(),wt.delete(t)}}function Wt(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const o=t.aria[r];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+r.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());e.setAttribute(i,(0,v.serializeAttrValue)(i,o))}const s=(0,v.applyAttrTransforms)(t);for(const r in s){const o=s[r];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(r,o===!0?"":o)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||F.REGISTRY.has(r)||r==="on"||s[r]!==void 0)continue;const o=r.charCodeAt(0);if(!(o>=65&&o<=90)&&!Q(r)&&!(A.CSS_PROPS_REGISTRY[r]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(r))&&(0,v.checkAttributeByTagName)(n,r)){let i=t[r];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=(0,G.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[r]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!(0,v.isEnumeratedTrueFalseAttr)((0,v.camelToAttr)(r)||r))continue;const c=(0,v.camelToAttr)(r)||r;e.setAttribute(c,(0,v.serializeAttrValue)(c,i))}}}function Lo(t,e){const s=t.node,n=t.__ref;let r=n.__autoGrow;if(!e){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&r.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(r.lastMeasure=i)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}})),r.active||(s.addEventListener("input",r.resize),r.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==r.appliedMax&&(o==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,r.appliedMax=o),r.resize()}function $o(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,n=t.autoGrow,r=typeof n=="function"?P(t,t.autoGrowDeps,n):null,o=(0,w.createEffect)(()=>{const i=t.autoGrow;let c=i;if(typeof i=="function")try{c=(i===n&&r?r:i)(t,t.state,t.context)}catch{c=null}Lo(t,c)},{depth:s.path.length,label:j(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),r&&(s.__exec.autoGrow=n)}const zt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Yt(t,e){for(const s of Object.keys(t)){if(!Q(s)||zt.has(s))continue;const n=(0,tt.globalEventKeyInfo)(s);if(n){(0,tt.registerGlobalEvent)(n,t,t[s]);continue}let r=t[s];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const i=r;r=function(a){return t.call(i,a)}}if(typeof r!="function")continue;const o=_o(s);F.LIFECYCLE_EVENTS.has(o)||(0,tt.registerEvent)(go(o),t,r)}Mo(t)}function Mo(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let n=!1;for(const p of zt){const h=t[p];typeof h=="function"&&(s[p]=h,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,a=0,l=!1;const u=p=>{const h=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];h&&(i=h.clientX,c=h.clientY,a=Date.now(),l=!0)},f=p=>{if(!l)return;l=!1;const h=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!h)return;const _=h.clientX-i,d=h.clientY-c,y=Date.now()-a;if(y>o)return;const g=Math.abs(_),b=Math.abs(d);if(Math.max(g,b)<r)return;let x;if(g>b*1.2)x=_<0?"left":"right";else if(b>g*1.2)x=d<0?"up":"down";else return;const E="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),L=s[E],z=s.onSwipe;L&&L.call(t,p,t,t.state,t.context),z&&z.call(t,{direction:x,dx:_,dy:d,dt:y,event:p},t,t.state,t.context)};e.addEventListener("touchstart",u,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",u)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function it(t,e){const s={...t};for(const n in e){const r=s[n],o=e[n];r&&o&&typeof r=="object"&&typeof o=="object"&&!Array.isArray(r)&&!Array.isArray(o)&&typeof r!="function"&&typeof o!="function"?s[n]=it(r,o):s[n]=o}return s}function jt(t,e,s){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const r=t.tag==="fragment",o=t.context?.document||globalThis.document,i=r?null:o?.createDocumentFragment();if(!r&&!i)return;const c=t.childProps,a=t.childrenAs;for(let l=0;l<e.length;l++){let u=e[l];const f=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=c;if(typeof c=="function")try{p=c(t,u)}catch{p=null}if(a==="state"){let d=f;(typeof f=="string"||typeof f=="number")&&(d={value:f,text:f}),u=p?{...p,state:d}:{state:d}}else p&&(u=it(p,u));if(n&&!u.ignoreChildExtends)if(u.extends){const d=Array.isArray(u.extends)?u.extends:[u.extends],y=Array.isArray(n)?n:[n];u={...u,extends:[...y,...d]}}else u={...u,extends:n};const h=u?.key||f&&typeof f=="object"&&f.key||`${l}`;let _;try{_=V(u,t,h,s)}catch(d){if(typeof console<"u"&&console.error){const y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${h}" failed to construct at ${y} (initial render, skipping this row):`,d?.message||d)}continue}!r&&_?.node&&i.appendChild(_.node)}return r||t.node.appendChild(i),!0}if(typeof e=="string"){const r=Nt(e,t);if(Array.isArray(r))return jt(t,r,s)}if(typeof e=="object")for(const r in e){if(F.REGISTRY.has(r))continue;let o=e[r];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=it(t.childProps,o)),n&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(n)?n:[n];o={...o,extends:[...c,...i]}}else o={...o,extends:n};V(o,t,r,s)}}}function Et(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const n=s.options;if(!n||!n.length)return;const r=t.__ref,o=r&&r.__exec&&r.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let u;if(i)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const f=u==null?"":String(u);s.value!==f&&(s.value=f);return}const a=e||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!a)return;let l=-1;for(let u=0;u<n.length;u++)n[u].defaultSelected&&(l=u);l>=0&&s.selectedIndex!==l&&(s.selectedIndex=l)}function qt(t,e){let{children:s,content:n}=t;const r=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(y){if(s=void 0,typeof console<"u"&&console.error){const g=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${g} (initial run, treating as empty):`,y?.message||y)}}t.children=s;const p=t.__ref;let h=!1;const _=P(t,t.childrenDeps,f),d=(0,w.createEffect)(()=>{const y=h;h=!0;let g;try{g=_(t,t.state,t.context)}catch(T){if(typeof console<"u"&&console.error){const N=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${N}${y?"":" (initial tracking run)"}:`,T?.message||T)}return}if(!y||g===t.children)return;t.children=g;const b=typeof t.onContentUpdate=="function",x=b?[]:null,E=b?[]:null,L=b?[]:null;if(Array.isArray(g)&&t.childrenAs==="state"){const T=t.childProps,N=[],Tt=new Map;for(let S=0;S<g.length;S++){const $=g[S];let C=T;if(typeof T=="function")try{C=T(t,$)}catch{C=null}const B=C&&C.key||$&&$.key||`${S}`;N.push(B),Tt.set(B,{rawChild:$,childProps:C})}const oo=new Set(N),so=p.__children.slice();for(const S of so)if(!oo.has(S)){const $=t[S];$?.remove&&$.remove(),delete t[S],E&&E.push(S)}const ot=t.childExtends,ut=t.tag==="fragment",eo=t.context?.document||globalThis.document,st=ut?null:eo?.createDocumentFragment(),pt=new Set;for(const S of N){const $=Tt.get(S),C=$.rawChild,B=t[S];if(B&&B.state){if(C&&typeof C=="object"){const O=B.state,Z=O.$replace||O.replace,Dt=O.$update||O.update;try{if(typeof Z=="function")Z.call(O,C);else if(typeof Dt=="function"){for(const M in O)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(C,M))try{O[M]=void 0}catch{}Dt.call(O,C)}else for(const M in C)O[M]=C[M]}catch(M){if(typeof console<"u"&&console.error){const no=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to patch at ${no} (reconcile, keeping its previous data for this pass):`,M?.message||M)}}}L&&L.push(S);continue}let yt=C;(typeof C=="string"||typeof C=="number")&&(yt={value:C,text:C});const Pt=$.childProps;let I=Pt?{...Pt,state:yt}:{state:yt};if(ot&&!I.ignoreChildExtends)if(I.extends){const O=Array.isArray(I.extends)?I.extends:[I.extends],Z=Array.isArray(ot)?ot:[ot];I={...I,extends:[...Z,...O]}}else I={...I,extends:ot};let ht;try{ht=V(I,t,S,e)}catch(O){if(typeof console<"u"&&console.error){const Z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to construct at ${Z} (reconcile, skipping this row):`,O?.message||O)}pt.add(S);continue}!ut&&ht?.node&&st&&st.appendChild(ht.node),x&&x.push(S)}if(!ut&&st&&st.childNodes.length&&t.node&&t.node.appendChild(st),!ut&&t.node){let S=null;for(const $ of N){const C=t[$]?.node;if(!C)continue;const B=S?S.nextSibling:t.node.firstChild;C!==B&&t.node.insertBefore(C,B),S=C}}p.__children=pt.size?N.filter(S=>!pt.has(S)):N,b&&(x.length||E.length)&&Rt(t,{added:x,removed:E,kept:L}),Et(t,!1);return}const q=b?[...p.__children]:null;for(const T of[...p.__children]){const N=t[T];N?.remove&&N.remove(),delete t[T]}p.__children=[],jt(t,g,e),Et(t,!1),b&&Rt(t,{added:[...p.__children],removed:q,kept:[]})},{depth:p.path.length,label:j(p,"children")});p.__effects.push(d)}const o=jt(t,s,e);if(n!=null&&!(n&&n.__ref)){let f=n;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=it(t.childProps,f)),r&&!f.ignoreChildExtends)if(f.extends){const p=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(r)?r:[r];f={...f,extends:[...h,...p]}}else f={...f,extends:r};V(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let p=0;p<f.length;p++){const h=f[p];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const _=h.slice(0,-7);if(!_||_.charCodeAt(0)<65||_.charCodeAt(0)>90)continue;const d={extends:t[h]};delete t[h];for(let y=p+1;y<f.length;y++){const g=f[y],b=g.charCodeAt(0);if(b>=65&&b<=90||F.REGISTRY.has(g)||typeof t[g]=="function"&&(g.startsWith("on")||g.startsWith(".")))break;const x=t[g];x!==void 0&&(d[g]=x,delete t[g])}t[_]&&typeof t[_]=="object"?t[_]={...d,...t[_]}:t[_]=d}}const c=e?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),l=f=>{if(F.REGISTRY.has(f)||typeof t[f]!="object"||t[f]===null)return;const p=f.charCodeAt(0);if(p<65||p>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const _=i[f]||i[`smbls.${f}`];_&&(h={...h,extends:_})}if(t.childProps&&(h=it(t.childProps,h)),r&&!h.ignoreChildExtends)if(h.extends){const _=Array.isArray(h.extends)?h.extends:[h.extends],d=Array.isArray(r)?r:[r];h={...h,extends:[...d,..._]}}else h={...h,extends:r};V(h,t,f,e)}};if(!c){for(const f of a)l(f);return}(0,W.openMountBudget)();const u=f=>{for(let p=f;p<a.length;p++)if(l(a[p]),p+1<a.length&&(0,W.mountBudgetExhausted)()){const h=p+1;(0,W.enqueueMountWork)(()=>u(h));return}};u(0),(0,W.closeMountBudget)()}function Zt(t,e,s){const{node:n}=t;if(!n)return;n.ref=t;const r=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(r){const i=r.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;i.insertBefore(n,c||r)}else i.insertBefore(n,r);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(n,i):o.appendChild(n)}else o.appendChild(n)}const lt=3;function to(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=lt?!1:(t.__inBeforeUpdate=!0,!0)}function ft(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===lt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${lt}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function K(t,e,s){const n=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&(0,U.runPluginHook)(n,e,s);const r="on"+t,o=e[r];if(typeof o=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(e.__ref[a])return!0;e.__ref[a]=!0}const l=e.context?.designSystem;l&&(0,k.pushConfig)(l);let u=!!a;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const p=e.__ref;return f.catch(h=>{e.context?.plugins?.length&&(0,U.runPluginHook)("error",e,{hook:r,error:h})||console.error(`[DOMQL] Lifecycle "${r}" error:`,h)}).finally(()=>{a&&p&&(p[a]=!1)}),u=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&(0,U.runPluginHook)("error",e,{hook:r,error:f})||console.error(`[DOMQL] Lifecycle "${r}" error:`,f),e.context?.strictMode)throw f}finally{l&&(0,k.popConfig)(),u&&e.__ref&&(e.__ref[a]=!1)}}return!0}var Ro=V;
|
|
4
|
+
`):"")}}if(pt(o,!0),mt(o,e,n),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const _=o.context?.designSystem;_&&(0,k.pushConfig)(_);try{const y=o.html(o,o.state,o.context);y!=null&&typeof y!="function"&&(o.node.innerHTML=y)}catch{}finally{_&&(0,k.popConfig)()}}if(M("Create",o,r),M("Complete",o,r),M("Render",o,r),M("RenderRouter",o,r),Ct(o,r),typeof o.onFrame=="function"){const _=o.onFrame,y=o.context?.designSystem,p=()=>{if(o.node){if(o.node.isConnected){y&&(0,k.pushConfig)(y);try{_(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{y&&(0,k.popConfig)()}}requestAnimationFrame(p)}};requestAnimationFrame(p)}return o}function ko(t,e,s){const r=!e,n=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=r&&n&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!(0,R.isStore)(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,(0,m.applyStateMethods)(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=c.lang||u.defaultLang||"en",l=new Set,h=(y,p)=>{l.has(y)||(0,W.isPolyglotWritableKey)(d,y,a)&&(a[y]=p,l.add(y),(0,W.markPolyglotSeeded)(d,y))},g=u.translations[f];if(g&&typeof g=="object")for(const y in g)h(y,g[y]);const _=new Set(u.languages||[]);for(const y in u.translations)_.has(y)||h(y,u.translations[y])}t.state=(0,R.isStore)(a)?a:(0,R.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=It(i,e),t.state&&typeof t.state=="object"&&!(0,R.isStore)(t.state)){const c=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const c=i(t,e?.state);t.state=(0,R.isStore)(c)?c:(0,R.createStore)(c||{})}else(0,R.isStore)(i)?t.state=i:t.state=(0,R.createStore)({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}function St(t,e){if(!e)return t;const s=e.split("/");let r=t;for(const n of s){if(r==null)return{};r=r[n]}return r??{}}function It(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const n=t.slice(3);return n?St(e.state,n):e.state??{}}if(t.startsWith("~/")){const n=e.state?.root||e.state,o=t.slice(2);return o?St(n,o):n??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=St(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const r=e.context?.polyglot;if(r?.translations){const n=e.state?.root?.lang||r.defaultLang||"en",o=r.translations[n];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}const So=new Set(["s","state","ctx","context"]);function vo(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(r=>r.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function wo(t){if(typeof t!="function"||t.length!==2)return!1;const e=vo(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!So.has(s)}function jo(t){const e=t.__ref,s=t.tag||"div",r=t.context?.designSystem,n=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||U.REGISTRY.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||Z(c)||A.CSS_PROPS_REGISTRY[c]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(c)||(0,w.checkAttributeByTagName)(s,c)||((0,J.isLoudDevRuntime)()&&wo(t[c])&&console.warn(`[smbls] custom prop "${c}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),n.push({prop:c,fn:t[c]}))}for(let i=0;i<n.length;i++){const{prop:c,fn:a}=n[i];e.__exec[c]=a,Object.defineProperty(t,c,{get(){r&&(0,k.pushConfig)(r);try{return a(t,t.state,t.context)}catch{return}finally{r&&(0,k.popConfig)()}},set(u){delete e.__exec[c],Object.defineProperty(t,c,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Eo(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const r=e[s];try{typeof r=="function"?r(t,t.state,t.context):typeof r=="string"&&t.state?.[r]}catch{}}}function O(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...r){return Eo(t,e),s.apply(this,r)}}function ct(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function P(t,e){return()=>t.path.join(".")+"::"+e}function Ut(t,e){const s=t.__ref,r=!!(e&&e.skipIfEffect);if(jo(t),typeof t.text=="function"){const o=t.text,i=O(t,t.textDeps,o),c=(0,E.createEffect)(()=>{if(!s.contentManaged)try{let a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=W.replaceLiteralsWithObjectFields.call(t,a,t.state)),at(t,a))}catch{}},{depth:s.path.length,label:P(s,"text")});s.__effects.push(c),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,E.createEffect)(()=>{if(s.contentManaged)return;const c=W.replaceLiteralsWithObjectFields.call(t,o,t.state);c!=null&&(t.text=c),t.node&&at(t,c??"")},{depth:s.path.length,label:P(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!U.REGISTRY.has(o)&&!Z(o)&&!s.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],c=O(t,t[o+"Deps"],i),a=o;let u,d=null,f;const l=(0,E.createEffect)(()=>{const h=t.context?.designSystem;h&&(0,k.pushConfig)(h);try{const g=c(t,t.state,t.context);(0,A.pushStaticCssPass)();let _;try{_=A.CSS_PROPS_REGISTRY[a](g,t,t.state,t.context)}finally{(0,A.popStaticCssPass)()}if(Array.isArray(_)){const p={};for(const b of _)if(b)for(const x in b)p[x]=b[x];_=p}const y=a==="show"||a==="hide";if(_&&t.node&&To(_)){const p=lt(_);if(p===null||p!==f){f=p;const b=(0,V.css)(_,null,t.context?.cssPrefix),x=b?b.split(" ").filter(Boolean):null;if(t.node.classList){if(d)for(const j of d)t.node.classList.remove(j);if(x&&x.length)for(const j of x)t.node.classList.add(j);d=x}}u=void 0}else if(_&&t.node){if(d){for(const x of d)t.node.classList.remove(x);d=null,f=void 0}const p=lt(_),b=y&&t.node.style.display!=="none";(p===null||p!==u||b)&&(u=p,Q(t.node,_))}else if(t.node&&y){u=void 0;const p=s.__explicitDisplay;t.node.style.display=typeof p=="string"?p:""}}finally{h&&(0,k.popConfig)()}},{depth:s.path.length,label:P(s,a)});s.__effects.push(l),s.__exec[o]=i}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],c=O(t,t[o+"Deps"],i),a=o;let u;const d=(0,E.createEffect)(()=>{const f=t.context?.designSystem;f&&(0,k.pushConfig)(f);try{const l=c(t,t.state,t.context);if(t.node)if(l!=null){const h=a+":"+String(l);h!==u&&(u=h,Q(t.node,{[a]:l}))}else u=void 0,t.node.style[a]=""}finally{f&&(0,k.popConfig)()}},{depth:s.path.length,label:P(s,a)});s.__effects.push(d),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=O(t,t.htmlDeps,o),c=(0,E.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,k.pushConfig)(a);try{const u=i(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{a&&(0,k.popConfig)()}},{depth:s.path.length,label:P(s,"html")});s.__effects.push(c),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=O(t,t.valueDeps,o),c=(0,E.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=a==null?"":String(a);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:s.path.length,label:P(s,"value")});s.__effects.push(c),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=O(t,t.styleDeps,o);let c;const a=(0,E.createEffect)(()=>{const u=i(t,t.state,t.context),d=lt(u);(d===null||d!==c)&&(c=d,Q(t.node,u))},{depth:s.path.length,label:P(s,"style")});s.__effects.push(a),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const c=O(t,ct(t.styleDeps,o),i);let a;const u=(0,E.createEffect)(()=>{try{const d=c(t,t.state,t.context);if(t.node){const f=o+":"+String(d);f!==a&&(a=f,Q(t.node,{[o]:d}))}}catch{}},{depth:s.path.length,label:P(s,"style."+o)});s.__effects.push(u)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=O(t,ct(t.attrDeps,o),t.attr[o]),c=o,a=(0,E.createEffect)(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!(0,w.isEnumeratedTrueFalseAttr)(c)?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,(0,w.serializeAttrValue)(c,u)))}catch{}},{depth:s.path.length,label:P(s,"attr."+c)});s.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=O(t,ct(t.ariaDeps,o),t.aria[o]),c="aria-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=(0,E.createEffect)(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,(0,w.serializeAttrValue)(c,u))}catch{}},{depth:s.path.length,label:P(s,"aria."+o)});s.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=O(t,ct(t.dataDeps,o),t.data[o]),a="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=(0,E.createEffect)(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(a,d===!0?"":d)}catch{}},{depth:s.path.length,label:P(s,"data."+o)});s.__effects.push(u)}const n=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(n)for(const o in n){if(typeof n[o]!="function")continue;const i=O(t,ct(t.classDeps,o),n[o]),c=(0,E.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:P(s,"class."+o)});s.__effects.push(c)}!r&&typeof t.if=="function"&&Kt(t,s,t.if);for(const o of Object.keys(t)){if(U.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||Z(o))continue;const c=t[o];s.__exec[o]=c;const a=t.tag||"div";if((0,w.checkAttributeByTagName)(a,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const u=(0,w.camelToAttr)(o)||o,d=O(t,t[o+"Deps"],c),f=(0,E.createEffect)(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!(0,w.isEnumeratedTrueFalseAttr)(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,(0,w.serializeAttrValue)(u,l))))}catch{}},{depth:s.path.length,label:P(s,o)});s.__effects.push(f)}}if(Lo(t),$o(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,a=[];const u=(0,E.createEffect)(()=>{const d=[];for(let g=0;g<i.length;g++){const _=i[g];try{d[g]=typeof _=="function"?_(t,t.state,t.context):t.state?.[_]}catch{d[g]=void 0}}if(!c){c=!0,a=d;return}let f=d.length!==a.length;for(let g=0;!f&&g<d.length;g++)d[g]!==a[g]&&(f=!0);const l=a;if(a=d,!f)return;const h=t.context?.designSystem;h&&(0,k.pushConfig)(h);try{o(t,t.state,t.context,{prev:l,next:d})}catch(g){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{h&&(0,k.popConfig)()}},{depth:s.path.length,label:P(s,"onStateUpdate")});s.__effects.push(u)}Ro(t)}function Bt(t){const e=t.parent,s=e?.node;if(!s||!t.node){mt(t,t.parent);return}let r=null;const n=Object.keys(e),o=n.indexOf(t.key);for(let i=o+1;i<n.length;i++){const c=e[n[i]];if(c?.node?.parentNode===s){r=c.node;break}}r?s.insertBefore(t.node,r):s.appendChild(t.node)}function Kt(t,e,s){const r=O(t,t.ifDeps,s),n=(0,E.createEffect)(()=>{let o;try{o=r(t,t.state,t.context)}catch(c){if(o=!1,e.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(c){console.error("[smbls] onRemove error:",c)}}else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=(0,Y.cacheNode)(t)),t.node&&(t.node.ref=t),Bt(t),vt(t),M("Render",t,{}),Ct(t,{});else{if(e.__ifInitialized=!0,t.tag||(t.tag=(0,Y.detectTag)(t)),M("Init",t,{}),t.node||(t.node=(0,Y.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),e.__fragmentAnchor=a}M("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Xt(t,{}),Ut(t,{skipIfEffect:!0}),vt(t),Zt(t),Jt(t,{}),Bt(t),M("Create",t,{}),M("Complete",t,{}),M("Render",t,{}),M("RenderRouter",t,{}),Ct(t,{})}},{depth:e.path.length,label:P(e,"if")});e.__effects.push(n)}function at(t,e){const s=t.node;if(!s)return;const r=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==r&&(s.nodeValue=r);return}const n=t.__ref;let o=n?n.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==r&&(o.nodeValue=r):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(r),s.insertBefore(o,s.firstChild)):(s.textContent=r,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),n&&(n.__textNode=o||null)}function vt(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),No(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"&&Q(e,t.style),t.attr&&typeof t.attr=="object")for(const s in t.attr){const r=t.attr[s];typeof r=="function"||typeof r=="object"||r!=null&&(r===!1&&!(0,w.isEnumeratedTrueFalseAttr)(s)||e.setAttribute&&e.setAttribute(s,(0,w.serializeAttrValue)(s,r)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const r=t.data[s];typeof r=="function"||typeof r=="object"||r==null||r===!1||e.dataset&&(e.dataset[s]=r===!0?"":r)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(r=>r&&e.classList.add(r));else if(typeof s=="object")for(const r in s){const n=typeof s[r]=="function"?s[r](t,t.state,t.context):s[r];n&&e.classList.add(typeof n=="string"?n:r)}}}}function lt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function To(t){if(!t||typeof t!="object")return!1;for(const e in t){const s=t[e];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function Q(t,e){if(!t||!e||!t.style)return;let s=null;for(const r in e){const n=e[r];if(n!=null){if(r.charAt(0)==="&"&&typeof n=="object"){s||(s={}),s[r]=n;continue}try{const o=String(n),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=o.trim(),a=/\s*!important\s*$/.test(c),u=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,u,a?"important":"")}catch{}}}s&&Po(t,s)}function Po(t,e){const s=`_ds${$t.scopedStyleId++}`;t.classList.add(s);const r=t.ownerDocument;let n=r.querySelector("style[data-smbls-scoped]");n||(n=r.createElement("style"),n.setAttribute("data-smbls-scoped",""),r.head.appendChild(n));let o="";for(const i in e){const c="."+s,a=i.replace(/&/g,c).split(",").map(d=>{const f=d.trim();return f.includes(c)?f:c+f}).join(", "),u=e[i];if(typeof u=="object"){let d="",f="";for(const l in u){const h=u[l];if(typeof h=="object"){const g=l.includes("&")?a.split(", ").map(y=>l.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${l}`).join(", ");let _="";for(const y in h)_+=`${y.replace(/[A-Z]/g,p=>"-"+p.toLowerCase())}: ${h[y]};`;f+=(0,V.wrapHoverRule)(`${g} { ${_} }`,g)+`
|
|
5
|
+
`}else d+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${h};`}d&&(o+=(0,V.wrapHoverRule)(`${a} { ${d} }`,a)+`
|
|
6
|
+
`),f&&(o+=f)}}o&&(n.textContent+=o)}const Gt=new Set;function Vt(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function Do(t,e,s){const r=Vt(s);queueMicrotask(()=>{if(!t.__ref)return;let n;try{n=e(t,t.state,t.context)}catch{return}if(Vt(n)===r)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";Gt.has(o)||(Gt.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(n)?n.join(", "):String(n)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Lo(t){const e=t.subscribeTo,s=typeof e=="function";let r=e;if(s)try{r=e(t,t.state,t.context)}catch{r=null}if(s&&(0,J.isLoudDevRuntime)()&&Do(t,e,Array.isArray(r)?r:[]),!Array.isArray(r)||r.length===0)return;const n=t.__ref;for(let o=0;o<r.length;o++){const i=r[o];if(typeof i!="string"||i.length===0)continue;const c=i.split("."),a=c[0],u=c.slice(1),d={value:!1},f=(0,E.createEffect)(()=>{const l=t.state&&((0,R.isStore)(t.state)?t.state.root:null);if(!l||!(0,R.isStore)(l))return;let h=l;h=h[a];for(let _=0;_<u.length&&!(h==null||typeof h!="object");_++)if((0,R.isStore)(h))h=h[u[_]];else break;if(!d.value)return;let g=!1;if(typeof t.onBeforeUpdate=="function"){const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{if(no(n)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>ut(n,!1),p=>{ut(n,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}):(ut(n,!1),y===!1&&(g=!0))}}catch(y){ut(n,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{_&&(0,k.popConfig)()}}if(!g&&t.node&&n.__effects)for(let _=0;_<n.__effects.length;_++){const y=n.__effects[_];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!g&&typeof t.onUpdate=="function"){const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{_&&(0,k.popConfig)()}}},{depth:n.path.length,label:P(n,"subscribeTo("+i+")")});d.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function wt(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}function jt(t,e){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=e.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const Ht=new Set;function Oo(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",r=s+"::"+t;Ht.has(r)||(Ht.add(r),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function X(t,e,s){const r={},n=new Set,o=(i,c,a)=>{const u=a?new Set(Object.keys(r)):null;if(A.CSS_PROPS_REGISTRY[i]){const d=A.CSS_PROPS_REGISTRY[i](c,e,e.state,e.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(r,l)}}else r[i]=c;if(a)for(const d in r)u.has(d)||n.add(d)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let c=t[i];if(typeof c=="function"&&(c=c(e,e.state,e.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(i==="style"){for(const f in c){let l=c[f];if(typeof l=="function"&&(l=l(e,e.state,e.context)),l==null||typeof l=="function")continue;const h=typeof e[f]=="function"&&(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f));o(f,l,h)}continue}if(wt(i,e)){const f=X(c,e,!1);Object.keys(f).length&&(r[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){(0,J.isLoudDevRuntime)()&&Oo(i,e);continue}const u=jt(i,e),d=X(c,e,!1);Object.keys(d).length&&(r[u]=d);continue}const a=typeof e[i]=="function"&&(A.CSS_PROPS_REGISTRY[i]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(i));o(i,c,a)}if(s)for(const i in r)n.add(i);for(const i of n){const c=r[i];typeof c=="string"&&!c.includes("!important")&&(r[i]=c+" !important")}return r}function Et(t,e){if(e===void 0&&(e=0),e>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Et(t[s],e+1))return!0}return!1}function Wt(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(wt(t,s)){const o=X(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}const r=jt(t,s),n=X(e,s,!1);return Object.keys(n).length?{cssProp:r,block:n}:null}function Ro(t){const e=t.__ref;for(const s of Object.keys(t)){if(!kt(s))continue;const r=t[s];if(!r||typeof r!="object"||Array.isArray(r)||!Et(r))continue;let n=null,o;const i=(0,E.createEffect)(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&(0,k.pushConfig)(c);let a,u=!1;try{const d=Wt(s,r,t),f=d?lt(d.block)+"::"+d.cssProp:null;if(f!==null&&f===o)u=!0;else if(o=f,d){const l=(0,V.css)({[d.cssProp]:d.block},null,t.context?.cssPrefix);a=l?l.split(" ").filter(Boolean):null}else a=null}finally{c&&(0,k.popConfig)()}if(!(u||!t.node.classList)){if(n)for(const d of n)t.node.classList.remove(d);if(a&&a.length)for(const d of a)t.node.classList.add(d);n=a}},{depth:e.path.length,label:P(e,"cssBlock("+s+")")});e.__effects.push(i)}}function $o(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const r of Object.keys(t)){const n=r.charAt(0);if(n!=="."&&n!=="!")continue;const o=r.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const h=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${n}\` is read as one prop name. Nest the selector inside instead: \`${n}${h}: { '${o.slice(h.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const c=n==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let h;const g=t[o];if(g===void 0){const p=!!t.state&&o in t.state,b=t.state?t.state[o]:void 0;if(p||b!==void 0)h=b;else{const x=t.context?.cases?.[o];if(x===void 0)return;try{h=typeof x=="function"?x.call(t,t):x}catch(j){h=!1,e.__conditionalError=j,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,j?.message||j)}}}else if(typeof g=="function")try{h=g(t,t.state,t.context)}catch(p){h=!1,e.__conditionalError=p,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,p?.message||p)}else h=g;const _=c?!h:!!h;if(!t.node||_===a.lastMatch)return;a.lastMatch=_;const y=t.context?.designSystem;y&&(0,k.pushConfig)(y);try{if(_){const p={},b={};let x=!1;for(const C in i){if(!Object.prototype.hasOwnProperty.call(i,C))continue;const T=i[C],z=C.charAt(0);if((z===":"||z==="@"||z==="&"||z==="[")&&T&&typeof T=="object"&&!Array.isArray(T)){if(wt(C,t)){const D=X(T,t,!1);Object.keys(D).length&&(b[`[data-theme="${C.slice(1)}"] &`]=D,x=!0)}else{const D=jt(C,t),L=X(T,t,!1);Object.keys(L).length&&(b[D]=L,x=!0)}continue}const ot=typeof T=="function"?T(t,t.state,t.context):T;if(ot!=null)if(A.CSS_PROPS_REGISTRY[C]){const D=A.CSS_PROPS_REGISTRY[C](ot,t,t.state,t.context);if(D){const L=Array.isArray(D)?D:[D];for(const st of L)st&&Object.assign(p,st)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(C)&&(p[C]=ot)}const j=Object.keys(p);if(j.length){Q(t.node,p);for(const C of j)s.set(C,r);a.appliedKeys=j}else a.appliedKeys=null;if(x){const C=(0,V.css)(b,null,t.context?.cssPrefix),T=C?C.split(" ").filter(Boolean):[];if(T.length&&t.node.classList){for(const z of T)t.node.classList.add(z);a.appliedClasses=T}else a.appliedClasses=null}else if(a.appliedClasses){for(const C of a.appliedClasses)t.node.classList.remove(C);a.appliedClasses=null}}else{if(a.appliedKeys){for(const p of a.appliedKeys)s.get(p)===r&&(t.node.style[p]="",s.delete(p));a.appliedKeys=null}if(a.appliedClasses){for(const p of a.appliedClasses)t.node.classList.remove(p);a.appliedClasses=null}}}finally{y&&(0,k.popConfig)()}};e.__conditionalRunners.push(u);const d=O(t,t[o+"Deps"],u),f=(0,E.createEffect)(d,{depth:e.path.length,label:P(e,"conditional("+r+")")}),l=e.__exec&&e.__exec[o]||t[o];f._sources.size===0&&typeof l=="function"&&(0,J.isLoudDevRuntime)()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${o}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),e.__effects.push(f)}}const Tt=new WeakSet;function Mo(t){const e=t.ownerDocument;!e||Tt.has(e)||(Tt.add(e),queueMicrotask(()=>{Tt.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const Pt=new WeakSet;let zt=!1;function Yt(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Dt(t,e){const s={...t};for(const r in e){const n=e[r],o=s[r];s[r]=n&&typeof n=="object"&&o&&typeof o=="object"?Dt(o,n):n}return s}function qt(t,e){const s={};for(const r in t){const n=t[r];if(n&&typeof n=="object"){const o=qt(n,e);Object.keys(o).length&&(s[r]=o)}else e.has(r)||(s[r]=n)}return s}function No(t){const{node:e}=t;if(!e)return;if(zt||(zt=!0,(0,V.css)({display:"none"})),Pt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Pt.add(t);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s),(0,A.pushStaticCssPass)();try{const r={};let n=!1,o=null,i=null,c=null;const a=(u,d)=>{if(d&&typeof d=="object"&&Yt(u)){i||(i={});const f=i[u];f&&(d=Dt(f,d)),i[u]=d}else(d===null||typeof d!="object")&&(c||(c=new Set),c.add(u));r[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&A.CSS_PROPS_REGISTRY.theme){const u=A.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const h=f[l];h&&typeof h=="object"&&Yt(l)&&(o||(o={}),o[l]=h),r[l]=h}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);n=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||U.REGISTRY.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!Z(u)){if(A.CSS_PROPS_REGISTRY[u]){const f=t[u],l=A.CSS_PROPS_REGISTRY[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const h of l)if(h)for(const g in h)a(g,h[g])}else for(const h in l)a(h,l[h]);n=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),n=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),n=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Et(f))continue;const l=Wt(u,f,t);l&&(a(l.cssProp,l.block),n=!0)}}}}if(o)for(const u in o){let d=c?qt(o[u],c):o[u];i&&i[u]&&(d=Dt(d,i[u])),Object.keys(d).length?r[u]=d:delete r[u]}if(n){r.display&&String(r.display).includes("!important")&&(e.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const u=(0,V.css)(r,null,t.context?.cssPrefix);if(u&&e.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const h of f)e.classList.add(h),l||(h.charCodeAt(0)===95&&h.charCodeAt(1)===99||h.charCodeAt(0)===95&&h.indexOf("_c",1)!==-1)&&(l=!0);l&&Mo(e)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=r.display;if(f&&f!==d)if(d==="none"){const l=[];for(const h of e.classList)h.startsWith("_d-")&&h!=="_d-none"&&l.push(h);for(const h of l)e.classList.remove(h);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{(0,A.popStaticCssPass)(),s&&(0,k.popConfig)(),Pt.delete(t)}}function Zt(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const o=t.aria[n];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());e.setAttribute(i,(0,w.serializeAttrValue)(i,o))}const s=(0,w.applyAttrTransforms)(t);for(const n in s){const o=s[n];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(n,o===!0?"":o)}const r=t.tag||"div";for(const n of Object.keys(t)){if(typeof t[n]=="function"||U.REGISTRY.has(n)||n==="on"||s[n]!==void 0)continue;const o=n.charCodeAt(0);if(!(o>=65&&o<=90)&&!Z(n)&&!(A.CSS_PROPS_REGISTRY[n]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(n))&&(0,w.checkAttributeByTagName)(r,n)){let i=t[n];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=(0,W.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[n]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!(0,w.isEnumeratedTrueFalseAttr)((0,w.camelToAttr)(n)||n))continue;const c=(0,w.camelToAttr)(n)||n;e.setAttribute(c,(0,w.serializeAttrValue)(c,i))}}}function Fo(t,e){const s=t.node,r=t.__ref;let n=r.__autoGrow;if(!e){if(n&&n.active){try{s.removeEventListener("input",n.resize)}catch{}s.style.height="",n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""),n.active=!1,n.appliedMax=null,n.lastMeasure=0}return}n||(n=r.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&n.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(n.lastMeasure=i)}},r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{try{s.removeEventListener("input",n.resize)}catch{}})),n.active||(s.addEventListener("input",n.resize),n.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==n.appliedMax&&(o==null?n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,n.appliedMax=o),n.resize()}function Io(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,r=t.autoGrow,n=typeof r=="function"?O(t,t.autoGrowDeps,r):null,o=(0,E.createEffect)(()=>{const i=t.autoGrow;let c=i;if(typeof i=="function")try{c=(i===r&&n?n:i)(t,t.state,t.context)}catch{c=null}Fo(t,c)},{depth:s.path.length,label:P(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),n&&(s.__exec.autoGrow=r)}const Qt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Xt(t,e){for(const s of Object.keys(t)){if(!Z(s)||Qt.has(s))continue;const r=(0,tt.globalEventKeyInfo)(s);if(r){(0,tt.registerGlobalEvent)(r,t,t[s]);continue}let n=t[s];if(typeof n=="string"&&/^[A-Za-z_$][\w$]*$/.test(n)){const i=n;n=function(a){return t.call(i,a)}}if(typeof n!="function")continue;const o=Ao(s);U.LIFECYCLE_EVENTS.has(o)||(0,tt.registerEvent)(Co(o),t,n)}Uo(t)}function Uo(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let r=!1;for(const l of Qt){const h=t[l];typeof h=="function"&&(s[l]=h,r=!0)}if(!r)return;const n=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,a=0,u=!1;const d=l=>{const h=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];h&&(i=h.clientX,c=h.clientY,a=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const h=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!h)return;const g=h.clientX-i,_=h.clientY-c,y=Date.now()-a;if(y>o)return;const p=Math.abs(g),b=Math.abs(_);if(Math.max(p,b)<n)return;let x;if(p>b*1.2)x=g<0?"left":"right";else if(b>p*1.2)x=_<0?"up":"down";else return;const j="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),C=s[j],T=s.onSwipe;C&&C.call(t,l,t,t.state,t.context),T&&T.call(t,{direction:x,dx:g,dy:_,dt:y,event:l},t,t.state,t.context)};e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",d)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function ft(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=ft(n,o):s[r]=o}return s}function Lt(t,e,s,r){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const o=t.tag==="fragment",i=t.context?.document||globalThis.document,c=o?null:i?.createDocumentFragment();if(!o&&!c)return;const a=t.childProps,u=t.childrenAs,d=y=>{let p=e[y];const b=p;(typeof p=="string"||typeof p=="number")&&(p={text:p});let x=a;if(typeof a=="function")try{x=a(t,p)}catch{x=null}if(u==="state"){let C=b;(typeof b=="string"||typeof b=="number")&&(C={value:b,text:b}),p=x?{...x,state:C}:{state:C}}else x&&(p=ft(x,p));if(n&&!p.ignoreChildExtends)if(p.extends){const C=Array.isArray(p.extends)?p.extends:[p.extends],T=Array.isArray(n)?n:[n];p={...p,extends:[...T,...C]}}else p={...p,extends:n};const j=p?.key||b&&typeof b=="object"&&b.key||`${y}`;try{return H(p,t,j,s)}catch(C){if(typeof console<"u"&&console.error){const T=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${j}" failed to construct at ${T} (initial render, skipping this row):`,C?.message||C)}return null}},f=t.__ref;if(!(r===!0&&!o&&!!f&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let y=0;y<e.length;y++){const p=d(y);!o&&p?.node&&c.appendChild(p.node)}return o||t.node.appendChild(c),!0}const h=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;(0,I.openMountBudget)();let g=null;const _=y=>{if(f.__disposed||f.__childrenChunkGen!==h){g&&g.parentNode&&g.remove();return}for(let p=y;p<e.length;p++){const b=d(p);if(b?.node&&(g?t.node.insertBefore(b.node,g):c.appendChild(b.node)),p+1<e.length&&(0,I.mountBudgetExhausted)()){g||(g=i.createComment("smbls-mount"),c.appendChild(g),t.node.appendChild(c));const x=p+1;(0,I.enqueueMountWork)(()=>_(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&pt(t,!0)):t.node.appendChild(c)};return _(0),(0,I.closeMountBudget)(),!0}if(typeof e=="string"){const o=It(e,t);if(Array.isArray(o))return Lt(t,o,s,r)}if(typeof e=="object")for(const o in e){if(U.REGISTRY.has(o))continue;let i=e[o];if(!(i==null||i===!1)){if((typeof i=="string"||typeof i=="number")&&(i={text:i}),t.childProps&&(i=ft(t.childProps,i)),n&&!i.ignoreChildExtends)if(i.extends){const c=Array.isArray(i.extends)?i.extends:[i.extends],a=Array.isArray(n)?n:[n];i={...i,extends:[...a,...c]}}else i={...i,extends:n};H(i,t,o,s)}}}function pt(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const r=s.options;if(!r||!r.length)return;const n=t.__ref,o=n&&n.__exec&&n.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);s.value!==f&&(s.value=f);return}const a=e||!(n&&n.__selectSynced);if(n&&(n.__selectSynced=!0),!a)return;let u=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(u=d);u>=0&&s.selectedIndex!==u&&(s.selectedIndex=u)}function Jt(t,e){let{children:s,content:r}=t;const n=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(y){if(s=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,y?.message||y)}}t.children=s;const l=t.__ref;let h=!1;const g=O(t,t.childrenDeps,f),_=(0,E.createEffect)(()=>{const y=h;h=!0;let p;try{p=g(t,t.state,t.context)}catch(D){if(typeof console<"u"&&console.error){const L=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${L}${y?"":" (initial tracking run)"}:`,D?.message||D)}return}if(!y||p===t.children)return;t.children=p,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const b=typeof t.onContentUpdate=="function",x=b?[]:null,j=b?[]:null,C=b?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const D=t.childProps,L=[],st=new Map;for(let S=0;S<p.length;S++){const N=p[S];let v=D;if(typeof D=="function")try{v=D(t,N)}catch{v=null}const G=v&&v.key||N&&N.key||`${S}`;L.push(G),st.set(G,{rawChild:N,childProps:v})}const ro=new Set(L),io=l.__children.slice();for(const S of io)if(!ro.has(S)){const N=t[S];N?.remove&&N.remove(),delete t[S],j&&j.push(S)}const et=t.childExtends,dt=t.tag==="fragment",co=t.context?.document||globalThis.document,nt=dt?null:co?.createDocumentFragment(),_t=new Set;for(const S of L){const N=st.get(S),v=N.rawChild,G=t[S];if(G&&G.state){if(v&&typeof v=="object"){const $=G.state,q=$.$replace||$.replace,Rt=$.$update||$.update;try{if(typeof q=="function")q.call($,v);else if(typeof Rt=="function"){for(const F in $)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(v,F))try{$[F]=void 0}catch{}Rt.call($,v)}else for(const F in v)$[F]=v[F]}catch(F){if(typeof console<"u"&&console.error){const fo=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to patch at ${fo} (reconcile, keeping its previous data for this pass):`,F?.message||F)}}}C&&C.push(S);continue}let gt=v;(typeof v=="string"||typeof v=="number")&&(gt={value:v,text:v});const Ot=N.childProps;let B=Ot?{...Ot,state:gt}:{state:gt};if(et&&!B.ignoreChildExtends)if(B.extends){const $=Array.isArray(B.extends)?B.extends:[B.extends],q=Array.isArray(et)?et:[et];B={...B,extends:[...q,...$]}}else B={...B,extends:et};let bt;try{bt=H(B,t,S,e)}catch($){if(typeof console<"u"&&console.error){const q=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to construct at ${q} (reconcile, skipping this row):`,$?.message||$)}_t.add(S);continue}!dt&&bt?.node&&nt&&nt.appendChild(bt.node),x&&x.push(S)}if(!dt&&nt&&nt.childNodes.length&&t.node&&t.node.appendChild(nt),!dt&&t.node){let S=null;for(const N of L){const v=t[N]?.node;if(!v)continue;const G=S?S.nextSibling:t.node.firstChild;v!==G&&t.node.insertBefore(v,G),S=v}}l.__children=_t.size?L.filter(S=>!_t.has(S)):L,b&&(x.length||j.length)&&Ft(t,{added:x,removed:j,kept:C}),pt(t,!1);return}const ot=b?[...l.__children]:null;for(const D of[...l.__children]){const L=t[D];L?.remove&&L.remove(),delete t[D]}l.__children=[],Lt(t,p,e),pt(t,!1),b&&Ft(t,{added:[...l.__children],removed:ot,kept:[]})},{depth:l.path.length,label:P(l,"children")});l.__effects.push(_)}const o=Lt(t,s,e,!0);if(r!=null&&!(r&&r.__ref)){let f=r;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=ft(t.childProps,f)),n&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(n)?n:[n];f={...f,extends:[...h,...l]}}else f={...f,extends:n};H(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const h=f[l];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const g=h.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const _={extends:t[h]};delete t[h];for(let y=l+1;y<f.length;y++){const p=f[y],b=p.charCodeAt(0);if(b>=65&&b<=90||U.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const x=t[p];x!==void 0&&(_[p]=x,delete t[p])}t[g]&&typeof t[g]=="object"?t[g]={..._,...t[g]}:t[g]=_}}const c=e?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),u=f=>{if(U.REGISTRY.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const g=i[f]||i[`smbls.${f}`];g&&(h={...h,extends:g})}if(t.childProps&&(h=ft(t.childProps,h)),n&&!h.ignoreChildExtends)if(h.extends){const g=Array.isArray(h.extends)?h.extends:[h.extends],_=Array.isArray(n)?n:[n];h={...h,extends:[..._,...g]}}else h={...h,extends:n};H(h,t,f,e)}};if(!c){for(const f of a)u(f);return}(0,I.openMountBudget)();const d=f=>{for(let l=f;l<a.length;l++)if(u(a[l]),l+1<a.length&&(0,I.mountBudgetExhausted)()){const h=l+1;(0,I.enqueueMountWork)(()=>d(h));return}};d(0),(0,I.closeMountBudget)()}function mt(t,e,s){const{node:r}=t;if(!r)return;r.ref=t;const n=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(n){const i=n.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;i.insertBefore(r,c||n)}else i.insertBefore(r,n);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}const yt=3;function no(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=yt?!1:(t.__inBeforeUpdate=!0,!0)}function ut(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===yt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${yt}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function M(t,e,s){const r=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&(0,K.runPluginHook)(r,e,s);const n="on"+t,o=e[n];if(typeof o=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(e.__ref[a])return!0;e.__ref[a]=!0}const u=e.context?.designSystem;u&&(0,k.pushConfig)(u);let d=!!a;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const l=e.__ref;return f.catch(h=>{e.context?.plugins?.length&&(0,K.runPluginHook)("error",e,{hook:n,error:h})||console.error(`[DOMQL] Lifecycle "${n}" error:`,h)}).finally(()=>{a&&l&&(l[a]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&(0,K.runPluginHook)("error",e,{hook:n,error:f})||console.error(`[DOMQL] Lifecycle "${n}" error:`,f),e.context?.strictMode)throw f}finally{u&&(0,k.popConfig)(),d&&e.__ref&&(e.__ref[a]=!1)}}return!0}var Bo=H;
|
package/dist/cjs/src/delegate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},V=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!S.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(n=D(t,o))||n.enumerable});return e};var A=e=>V(p({},"__esModule",{value:!0}),e);var F={};T(F,{addDelegatedEvent:()=>v,globalEventKeyInfo:()=>B,isDelegatable:()=>h,registerEvent:()=>x,registerGlobalEvent:()=>W,removeDelegatedEvent:()=>b});module.exports=A(F);var c=require("./registry.js"),l=require("@symbo.ls/scratch");const E=new WeakMap,M={passive:!0},m={passive:!0,capture:!0},_=(e,t)=>c.PASSIVE_EVENTS.has(e)?t?m:M:t||!1;function y(e){let t=E.get(e);return t||(t={handlers:new Map,installed:new Set},E.set(e,t)),t}function I(e,t){const r=y(t);if(r.installed.has(e))return;r.installed.add(e);const n=e==="focus"||e==="blur"||e==="focusin"||e==="focusout"||e==="mouseenter"||e==="mouseleave",o=e==="mouseenter"||e==="mouseleave";t.addEventListener(e,s=>{let i=s.target;for(;i&&i!==t;){const u=r.handlers.get(e);if(u){const f=u.get(i);if(f){if(o&&s.relatedTarget&&i.contains(s.relatedTarget)){i=i.parentNode;continue}if(f(s),s.cancelBubble)return}}i=i.parentNode}},_(e,n))}function v(e,t,r,n){n||(n=t.ownerDocument?.documentElement||t.getRootNode());const o=y(n);I(e,n),o.handlers.has(e)||o.handlers.set(e,new WeakMap),o.handlers.get(e).set(t,r)}function b(e,t,r){r||(r=t.ownerDocument?.documentElement||t.getRootNode());const n=E.get(r);if(!n)return;const o=n.handlers.get(e);o&&o.delete(t)}function h(e){return c.DELEGATED_EVENTS.has(e)&&!c.LIFECYCLE_EVENTS.has(e)}function w(e,t){const{context:r}=e,n=r?.designSystem;return o=>{n&&(0,l.pushConfig)(n);try{const s=t.call(e,o,e,e.state,r);if(s&&typeof s.then=="function"){s.catch(i=>{e.error=i,console.error("[DOMQL] Async event error:",i)}).finally(()=>{n&&(0,l.popConfig)()});return}}catch(s){if(e.error=s,console.error("[DOMQL] Event error:",s),r?.strictMode)throw s}n&&(0,l.popConfig)()}}function x(e,t,r){const{node:n,context:o}=t;if(!n)return;const s=w(t,r),i=c.NON_BUBBLING_EVENTS.has(e);if(!i&&h(e)){const u=o?.rootNode||n.ownerDocument?.documentElement;v(e,n,s,u)}else n.addEventListener(e,s,_(e,!1));t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{if(!i&&h(e)){const u=o?.rootNode||n.ownerDocument?.documentElement;b(e,n,u)}else n.removeEventListener(e,s,_(e,!1))})}const g=[["onDocument","document"],["onWindow","window"],["onVisualViewport","visualViewport"],["onMediaQuery","mediaQuery"]];function B(e){if(typeof e!="string")return null;for(let t=0;t<g.length;t++){const r=g[t][0];if(e.length<=r.length||!e.startsWith(r))continue;const n=e.charCodeAt(r.length);if(!(n<65||n>90))return{target:g[t][1],eventName:e.slice(r.length).toLowerCase()}}return null}const R=/^[A-Za-z_$][\w$]*$/;function q(e,t,r){let n=t,o=!1,s,i=!1,u=null;if(t&&typeof t=="object"&&typeof t!="function"&&(n=t.handler,o=!!t.capture,i=!!t.once,typeof t.passive=="boolean"&&(s=t.passive),typeof t.query=="string"&&(u=t.query)),typeof n=="string"&&R.test(n)){const f=n;n=function(d){return e.call(f,d)}}return typeof n!="function"?null:(s===void 0&&(s=c.PASSIVE_EVENTS.has(r)),{handler:n,capture:o,passive:s,once:i,query:u})}function G(e,t,r){const n=e.node?.ownerDocument||e.context?.document||(typeof document<"u"?document:null);if(!n||typeof n.addEventListener!="function")return null;if(t==="document")return n;const o=n.defaultView||(typeof window<"u"?window:null);if(!o)return null;if(t==="window")return typeof o.addEventListener=="function"?o:null;if(t==="visualViewport"){const s=o.visualViewport;return s&&typeof s.addEventListener=="function"?s:null}if(t==="mediaQuery"){const s=r&&r.query;if(typeof s!="string"||!s.trim()||typeof o.matchMedia!="function")return null;try{return o.matchMedia(s)||null}catch{return null}}return null}function Q(e,t,r,n){try{return e.addEventListener(t,r,n),!0}catch{return typeof e.addListener=="function"?(e.addListener(r),!0):!1}}function O(e,t,r,n){try{e.removeEventListener(t,r,n)}catch{typeof e.removeListener=="function"&&e.removeListener(r)}}function P(e){const t=e.node;if(!t)return!1;const r=t.nodeType===11?e.__ref?.__fragmentAnchor:t;return r?r.isConnected!==!1:!1}function W(e,t,r){if(t.__ref){if(Array.isArray(r)){if(e.target!=="mediaQuery")return;for(let o=0;o<r.length;o++)L(e,t,r[o]);return}L(e,t,r)}}function L(e,t,r){const n=t.__ref,o=q(t,r,e.eventName);if(!o||e.target==="mediaQuery"&&e.eventName!=="change")return;const s=G(t,e.target,o);if(!s)return;const i=e.target+":"+(o.query?o.query+":":"")+e.eventName+":"+(o.capture?1:0);if(n.__globalEvents&&n.__globalEvents.has(i))return;const u=w(t,o.handler),f=d=>{P(t)&&u(d)},a={capture:o.capture,passive:o.passive,once:o.once};Q(s,e.eventName,f,a)&&(n.__globalEvents||(n.__globalEvents=new Map),n.__globalEvents.set(i,{target:s,eventName:e.eventName,listener:f,options:a}),n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{O(s,e.eventName,f,a),n.__globalEvents&&n.__globalEvents.delete(i)}))}
|
package/dist/cjs/src/dispose.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var t in o)n(r,t,{get:o[t],enumerable:!0})},p=(r,o,t,_)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!a.call(r,f)&&f!==t&&n(r,f,{get:()=>o[f],enumerable:!(_=s(o,f))||_.enumerable});return r};var h=r=>p(n({},"__esModule",{value:!0}),r);var v={};d(v,{dispose:()=>i,remove:()=>u});module.exports=h(v);function i(r){if(!r)return;const o=r.__ref;if(!o)return;o.__disposed=!0;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){const _=o.__children.slice();o.__children.length=0;for(let f=0;f<_.length;f++){const e=r[_[f]];e&&e.__ref&&i(e)}}r.node?.parentNode?r.node.remove():r.tag==="fragment"&&o.__fragmentAnchor?.parentNode&&o.__fragmentAnchor.remove();const t=r.state?.$destroy||r.state?.destroy;if(typeof t=="function"&&r.state.__element===r&&t.call(r.state),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 u(){i(this)}
|
package/dist/cjs/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var E=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},I=(t,o,e,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of s(o))!x.call(t,c)&&c!==e&&n(t,c,{get:()=>o[c],enumerable:!(p=r(o,c))||p.enumerable});return t};var N=t=>I(n({},"__esModule",{value:!0}),t);var R={};E(R,{VERSION:()=>O});module.exports=N(R);const O="3.14.
|
|
1
|
+
var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var E=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},I=(t,o,e,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of s(o))!x.call(t,c)&&c!==e&&n(t,c,{get:()=>o[c],enumerable:!(p=r(o,c))||p.enumerable});return t};var N=t=>I(n({},"__esModule",{value:!0}),t);var R={};E(R,{VERSION:()=>O});module.exports=N(R);const O="3.14.783";
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
2
|
-
`+
|
|
1
|
+
import{createStore as _t,createScopeStore as _o,isStore as K}from"@symbo.ls/signal";import{createEffect as w}from"@symbo.ls/signal";import{cacheNode as gt,detectTag as Ft}from"./cache.js";import{REGISTRY as G,LIFECYCLE_EVENTS as go}from"./registry.js";import{registerEvent as bo,registerGlobalEvent as xo,globalEventKeyInfo as Ao}from"./delegate.js";import{applyExtends as Co}from"./extends.js";import{addMethods as ko}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as tt}from"./devRuntime.js";import{mountBudgetExhausted as It,openMountBudget as Ut,closeMountBudget as Bt,enqueueMountWork as Kt}from"./mountScheduler.js";import{replaceLiteralsWithObjectFields as bt,isPolyglotWritableKey as So,markPolyglotSeeded as vo}from"@symbo.ls/utils";import{runPluginHook as B}from"@symbo.ls/utils/function.js";import{applyStateMethods as ot}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as L,DEFAULT_CSS_PROPERTIES_LIST as P,pushStaticCssPass as Gt,popStaticCssPass as Vt}from"css-in-props";import{css as st,wrapHoverRule as Ht}from"@symbo.ls/css";import{pushConfig as R,popConfig as $}from"@symbo.ls/scratch";import{checkAttributeByTagName as xt,applyAttrTransforms as wo,camelToAttr as At,serializeAttrValue as z,isEnumeratedTrueFalseAttr as ft}from"attrs-in-props";import{resolveElementIdEngine as jo}from"./engineRegistry.js";import{VERSION as Eo}from"./version.js";const Wt=jo({uniqId:1,scopedStyleId:0},Eo),et=[];let Ct=!1;function zt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function To(){return typeof document<"u"&&document.visibilityState==="hidden"}const Po=250;function Yt(){if(!Ct){if(Ct=!0,typeof requestAnimationFrame!="function"){setTimeout(kt,0);return}To()?setTimeout(kt,Po):requestAnimationFrame(kt)}}const Do=300,Lo=15e4;function kt(){if(Ct=!1,!et.length)return;const t=et.splice(0,et.length);for(let e=0;e<t.length;e++){const s=t[e];if(s.node){if(!s.node.isConnected){const r=s.__ref||(s.__ref={});r.__mountAttempts=(r.__mountAttempts||0)+1,r.__mountFirstAttemptAt==null&&(r.__mountFirstAttemptAt=zt());const n=zt()-r.__mountFirstAttemptAt;r.__mountAttempts<=Do&&n<Lo?(et.push(s),Yt()):console.warn("[DOMQL] onMounted dropped after",r.__mountAttempts,"attempts /",n,"ms \u2014 node never connected:",s.key||s.tag||s);continue}M("Mounted",s,s.__ref?.__mountOptions||{})}}}function St(t,e){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=e,et.push(t),Yt())}function qt(t,e){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&B("contentUpdate",t,e);const s=t.context?.designSystem;s&&R(s);try{t.onContentUpdate(t,t.state,t.context,e)}catch(r){if(t.context?.plugins?.length&&B("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{s&&$()}}function Y(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Oo(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Ro(t){return t.toLowerCase()}function vt(t){const e=t.charCodeAt(0);return e===58||e===64||e===38||e===91}function nt(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=nt(n,o):s[r]=o}return s}function H(t,e,s,r={},n){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=s||t.key||`_${Wt.uniqId++}`,o.parent=e||null,o.context=t.context||e?.context||r.context||{},o.context.__create||(o.context.__create=H);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:e?.__ref?.root||o,path:e?.__ref?.path?[...e.__ref.path,o.key]:[o.key],origin:t};if(s&&!t.extends&&!t.extend){const _=s.indexOf("_"),y=s.indexOf(".");let p=_>0?_:-1;if(y>0&&(p<0||y<p)&&(p=y),p>0){const b=s.substring(0,p),x=o.context?.components;x&&(x[b]||x["smbls."+b])?t={...t,extends:b}:x&&tt()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}Co(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),a=o.props&&typeof o.props=="object"?o.props:null;for(const _ in t){if(_==="parent"||_==="node"||_==="__ref"||_==="extends"||_==="context"||_==="props")continue;const y=t[_],p=o[_],b=p&&y&&typeof p=="object"&&typeof y=="object"&&!Array.isArray(p)&&!Array.isArray(y)&&typeof p!="function"&&typeof y!="function";b&&_.charCodeAt(0)>=65&&_.charCodeAt(0)<=90?o[_]=nt(p,y):b&&c.has(_)?o[_]={...p,...y}:b&&vt(_)?o[_]=nt(p,y):o[_]=y}function u(_){for(const y in _){const p=_[y],b=o[y],x=b&&p&&typeof b=="object"&&typeof p=="object"&&!Array.isArray(b)&&!Array.isArray(p)&&typeof b!="function"&&typeof p!="function";x&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=nt(b,p):x&&c.has(y)?o[y]={...b,...p}:x&&vt(y)?o[y]=nt(b,p):o[y]=p}}a&&u(a),t.props&&typeof t.props=="object"&&u(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 d=o.scope&&typeof o.scope=="object"?o.scope:null,f=e?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,h=f||l||null;if(t.scope!==void 0||d){const _={};d&&Object.assign(_,d),t.scope!==void 0&&Object.assign(_,t.scope),o.scope=_o(_,h)}else h&&(o.scope=h);if(t.if!==void 0&&(o.if=t.if),ko(o),$o(o,e,t),o.if!=null){let _;if(typeof o.if=="function")try{_=o.if(o,o.state,o.context)}catch(y){if(_=!1,i.__ifError=y,typeof console<"u"&&console.warn){const p=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${p} \u2014 treating as false:`,y?.message||y)}}else _=o.if;i.__if=!!_}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return e&&(e[o.key]=o),typeof o.if=="function"&&Jt(o,i,o.if),o;o.tag||(o.tag=Ft(o)),M("Init",o,r);const g=o.node=gt(o);if(!g)return o;if(o.tag==="fragment"){const y=(o.context?.document||globalThis.document).createComment("");g.appendChild(y),i.__fragmentAnchor=y}M("AttachNode",o,r),g.setAttribute&&o.key&&g.setAttribute("data-key",o.key),e&&(e[o.key]=o,e.__ref?.__children&&(e.__ref.__children.includes(o.key)||e.__ref.__children.push(o.key))),g.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&g.setAttribute("data-smbls-app",o.context.key),o.id&&g.setAttribute&&(g.id=o.id),fo(o,r),Qt(o),jt(o),io(o),Qo(o);try{ao(o,r)}catch(_){if(typeof console<"u"&&console.error){const y=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${y}:`,_?.message||_,_?.stack?`
|
|
2
|
+
`+_.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Pt(o,!0),to(o,e,r),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const d=o.context?.designSystem;d&&D(d);try{const y=o.html(o,o.state,o.context);y!=null&&typeof y!="function"&&(o.node.innerHTML=y)}catch{}finally{d&&O()}}if(B("Create",o,n),B("Complete",o,n),B("Render",o,n),B("RenderRouter",o,n),Ut(o,n),typeof o.onFrame=="function"){const d=o.onFrame,y=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){y&&D(y);try{d(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{y&&O()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Do(t,e,s){const n=!e,r=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=n&&r&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,m(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},l=t.context?.polyglot;if(l?.translations){const u=t.context,f=c.lang||l.defaultLang||"en",p=new Set,h=(y,g)=>{p.has(y)||go(u,y,a)&&(a[y]=g,p.add(y),bo(u,y))},_=l.translations[f];if(_&&typeof _=="object")for(const y in _)h(y,_[y]);const d=new Set(l.languages||[]);for(const y in l.translations)d.has(y)||h(y,l.translations[y])}t.state=K(a)?a:pt(a),t.state.__element=t,t.state.root=t.state,m(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),m(t,t.state);return}if(typeof i=="string"){if(t.state=Kt(i,e),t.state&&typeof t.state=="object"&&!K(t.state)){const c=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}m(t,t.state);return}if(typeof i=="function"){const c=i(t,e?.state);t.state=K(c)?c:pt(c||{})}else K(i)?t.state=i:t.state=pt({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,m(t,t.state)}function kt(t,e){if(!e)return t;const s=e.split("/");let n=t;for(const r of s){if(n==null)return{};n=n[r]}return n??{}}function Kt(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?kt(e.state,r):e.state??{}}if(t.startsWith("~/")){const r=e.state?.root||e.state,o=t.slice(2);return o?kt(r,o):r??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=kt(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const n=e.context?.polyglot;if(n?.translations){const r=e.state?.root?.lang||n.defaultLang||"en",o=n.translations[r];if(o?.[t]!==void 0)return o[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}const Oo=new Set(["s","state","ctx","context"]);function Lo(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function $o(t){if(typeof t!="function"||t.length!==2)return!1;const e=Lo(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Oo.has(s)}function Mo(t){const e=t.__ref,s=t.tag||"div",n=t.context?.designSystem,r=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||V.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||q(c)||E[c]||w&&w.has(c)||_t(s,c)||(rt()&&$o(t[c])&&console.warn(`[smbls] custom prop "${c}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:c,fn:t[c]}))}for(let i=0;i<r.length;i++){const{prop:c,fn:a}=r[i];e.__exec[c]=a,Object.defineProperty(t,c,{get(){n&&D(n);try{return a(t,t.state,t.context)}catch{return}finally{n&&O()}},set(l){delete e.__exec[c],Object.defineProperty(t,c,{value:l,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Ro(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const n=e[s];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function T(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...n){return Ro(t,e),s.apply(this,n)}}function st(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function C(t,e){return()=>t.path.join(".")+"::"+e}function Vt(t,e){const s=t.__ref,n=!!(e&&e.skipIfEffect);if(Mo(t),typeof t.text=="function"){const o=t.text,i=T(t,t.textDeps,o),c=S(()=>{if(!s.contentManaged)try{let a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=ht.call(t,a,t.state)),at(t,a))}catch{}},{depth:s.path.length,label:C(s,"text")});s.__effects.push(c),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=S(()=>{if(s.contentManaged)return;const c=ht.call(t,o,t.state);c!=null&&(t.text=c),t.node&&at(t,c??"")},{depth:s.path.length,label:C(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!V.has(o)&&!q(o)&&!s.__exec[o]){if(E[o]){const i=t[o],c=T(t,t[o+"Deps"],i),a=o;let l;const u=S(()=>{const f=t.context?.designSystem;f&&D(f);try{const p=c(t,t.state,t.context),h=E[a](p,t,t.state,t.context),_=a==="show"||a==="hide";if(h&&t.node){const d=Ct(h),y=_&&t.node.style.display!=="none";(d===null||d!==l||y)&&(l=d,Z(t.node,h))}else if(t.node&&_){l=void 0;const d=s.__explicitDisplay;t.node.style.display=typeof d=="string"?d:""}}finally{f&&O()}},{depth:s.path.length,label:C(s,a)});s.__effects.push(u),s.__exec[o]=i}else if(w&&w.has(o)){const i=t[o],c=T(t,t[o+"Deps"],i),a=o;let l;const u=S(()=>{const f=t.context?.designSystem;f&&D(f);try{const p=c(t,t.state,t.context);if(t.node)if(p!=null){const h=a+":"+String(p);h!==l&&(l=h,Z(t.node,{[a]:p}))}else l=void 0,t.node.style[a]=""}finally{f&&O()}},{depth:s.path.length,label:C(s,a)});s.__effects.push(u),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=T(t,t.htmlDeps,o),c=S(()=>{const a=t.context?.designSystem;a&&D(a);try{const l=i(t,t.state,t.context);t.node&&l!=null&&typeof l!="function"&&(t.node.innerHTML=l)}finally{a&&O()}},{depth:s.path.length,label:C(s,"html")});s.__effects.push(c),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=T(t,t.valueDeps,o),c=S(()=>{try{const a=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const l=a==null?"":String(a);if(t.node.value===l)return;const u=typeof document<"u"&&document.activeElement===t.node,f=u&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=u&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=l,u&&f!=null&&p!=null)try{t.node.setSelectionRange(f,p)}catch{}}catch{}},{depth:s.path.length,label:C(s,"value")});s.__effects.push(c),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=T(t,t.styleDeps,o);let c;const a=S(()=>{const l=i(t,t.state,t.context),u=Ct(l);(u===null||u!==c)&&(c=u,Z(t.node,l))},{depth:s.path.length,label:C(s,"style")});s.__effects.push(a),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const c=T(t,st(t.styleDeps,o),i);let a;const l=S(()=>{try{const u=c(t,t.state,t.context);if(t.node){const f=o+":"+String(u);f!==a&&(a=f,Z(t.node,{[o]:u}))}}catch{}},{depth:s.path.length,label:C(s,"style."+o)});s.__effects.push(l)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=T(t,st(t.attrDeps,o),t.attr[o]),c=o,a=S(()=>{try{const l=i(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!ct(c)?t.node.removeAttribute(c):typeof l!="function"&&typeof l!="object"&&t.node.setAttribute(c,Y(c,l)))}catch{}},{depth:s.path.length,label:C(s,"attr."+c)});s.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=T(t,st(t.ariaDeps,o),t.aria[o]),c="aria-"+o.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),a=S(()=>{try{const l=i(t,t.state,t.context);if(!t.node?.setAttribute)return;l==null?t.node.removeAttribute(c):typeof l!="function"&&typeof l!="object"&&t.node.setAttribute(c,Y(c,l))}catch{}},{depth:s.path.length,label:C(s,"aria."+o)});s.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=T(t,st(t.dataDeps,o),t.data[o]),a="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),l=S(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null||u===!1?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,u===!0?"":u)}catch{}},{depth:s.path.length,label:C(s,"data."+o)});s.__effects.push(l)}const r=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(r)for(const o in r){if(typeof r[o]!="function")continue;const i=T(t,st(t.classDeps,o),r[o]),c=S(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:C(s,"class."+o)});s.__effects.push(c)}!n&&typeof t.if=="function"&&Gt(t,s,t.if);for(const o of Object.keys(t)){if(V.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||q(o))continue;const c=t[o];s.__exec[o]=c;const a=t.tag||"div";if(_t(a,o)&&!E[o]&&!(w&&w.has(o))){const l=gt(o)||o,u=T(t,t[o+"Deps"],c),f=S(()=>{try{const p=u(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1&&!ct(l)?t.node.removeAttribute(l):typeof p!="function"&&typeof p!="object"&&(l==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(l,Y(l,p))))}catch{}},{depth:s.path.length,label:C(s,o)});s.__effects.push(f)}}if(Io(t),Ko(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,a=[];const l=S(()=>{const u=[];for(let _=0;_<i.length;_++){const d=i[_];try{u[_]=typeof d=="function"?d(t,t.state,t.context):t.state?.[d]}catch{u[_]=void 0}}if(!c){c=!0,a=u;return}let f=u.length!==a.length;for(let _=0;!f&&_<u.length;_++)u[_]!==a[_]&&(f=!0);const p=a;if(a=u,!f)return;const h=t.context?.designSystem;h&&D(h);try{o(t,t.state,t.context,{prev:p,next:u})}catch(_){if(t.context?.plugins?.length&&U("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{h&&O()}},{depth:s.path.length,label:C(s,"onStateUpdate")});s.__effects.push(l)}Bo(t)}function Ht(t){const e=t.parent,s=e?.node;if(!s||!t.node){to(t,t.parent);return}let n=null;const r=Object.keys(e),o=r.indexOf(t.key);for(let i=o+1;i<r.length;i++){const c=e[r[i]];if(c?.node?.parentNode===s){n=c.node;break}}n?s.insertBefore(t.node,n):s.appendChild(t.node)}function Gt(t,e,s){const n=T(t,t.ifDeps,s),r=S(()=>{let o;try{o=n(t,t.state,t.context)}catch(c){if(o=!1,e.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node)t.node.remove();else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=yt(t)),t.node&&(t.node.ref=t),Ht(t),St(t);else{if(e.__ifInitialized=!0,t.tag||(t.tag=Mt(t)),B("Init",t,{}),t.node||(t.node=yt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),e.__fragmentAnchor=a}B("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Jt(t,{}),Vt(t,{skipIfEffect:!0}),St(t),Qt(t),mt(t,{}),Ht(t),Ut(t,{})}},{depth:e.path.length,label:C(e,"if")});e.__effects.push(r)}function at(t,e){const s=t.node;if(!s)return;const n=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==n&&(s.nodeValue=n);return}const r=t.__ref;let o=r?r.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==n&&(o.nodeValue=n):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),s.insertBefore(o,s.firstChild)):(s.textContent=n,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=o||null)}function St(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),Ho(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"&&Z(e,t.style),t.attr&&typeof t.attr=="object")for(const s in t.attr){const n=t.attr[s];typeof n=="function"||typeof n=="object"||n!=null&&(n===!1&&!ct(s)||e.setAttribute&&e.setAttribute(s,Y(s,n)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const n=t.data[s];typeof n=="function"||typeof n=="object"||n==null||n===!1||e.dataset&&(e.dataset[s]=n===!0?"":n)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(n=>n&&e.classList.add(n));else if(typeof s=="object")for(const n in s){const r=typeof s[n]=="function"?s[n](t,t.state,t.context):s[n];r&&e.classList.add(typeof r=="string"?r:n)}}}}function Ct(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Z(t,e){if(!t||!e||!t.style)return;let s=null;for(const n in e){const r=e[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[n]=r;continue}try{const o=String(r),i=n.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=o.trim(),a=/\s*!important\s*$/.test(c),l=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,l,a?"important":"")}catch{}}}s&&No(t,s)}function No(t,e){const s=`_ds${Nt.scopedStyleId++}`;t.classList.add(s);const n=t.ownerDocument;let r=n.querySelector("style[data-smbls-scoped]");r||(r=n.createElement("style"),r.setAttribute("data-smbls-scoped",""),n.head.appendChild(r));let o="";for(const i in e){const c="."+s,a=i.replace(/&/g,c).split(",").map(u=>{const f=u.trim();return f.includes(c)?f:c+f}).join(", "),l=e[i];if(typeof l=="object"){let u="",f="";for(const p in l){const h=l[p];if(typeof h=="object"){const _=p.includes("&")?a.split(", ").map(y=>p.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${p}`).join(", ");let d="";for(const y in h)d+=`${y.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${h[y]};`;f+=Rt(`${_} { ${d} }`,_)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),f&&(o+=f)}}o&&(r.textContent+=o)}const Wt=new Set;function zt(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function Fo(t,e,s){const n=zt(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=e(t,t.state,t.context)}catch{return}if(zt(r)===n)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";Wt.has(o)||(Wt.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Io(t){const e=t.subscribeTo,s=typeof e=="function";let n=e;if(s)try{n=e(t,t.state,t.context)}catch{n=null}if(s&&rt()&&Fo(t,e,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let o=0;o<n.length;o++){const i=n[o];if(typeof i!="string"||i.length===0)continue;const c=i.split("."),a=c[0],l=c.slice(1),u={value:!1},f=S(()=>{const p=t.state&&(K(t.state)?t.state.root:null);if(!p||!K(p))return;let h=p;h=h[a];for(let d=0;d<l.length&&!(h==null||typeof h!="object");d++)if(K(h))h=h[l[d]];else break;if(!u.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"){const d=t.context?.designSystem;d&&D(d);try{if(Yo(r)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>ft(r,!1),g=>{ft(r,!0),t.context?.plugins?.length&&U("error",t,{hook:"onBeforeUpdate",error:g})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",g)}):(ft(r,!1),y===!1&&(_=!0))}}catch(y){ft(r,!0),t.context?.plugins?.length&&U("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{d&&O()}}if(!_&&t.node&&r.__effects)for(let d=0;d<r.__effects.length;d++){const y=r.__effects[d];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!_&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&D(d);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&U("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{d&&O()}}},{depth:r.path.length,label:C(r,"subscribeTo("+i+")")});u.value=!0,f._isSubscribeToEffect=!0,r.__effects.push(f)}}function vt(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}const Yt=new Set;function Uo(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",n=s+"::"+t;Yt.has(n)||(Yt.add(n),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Q(t,e,s){const n={},r=new Set,o=(i,c,a)=>{const l=a?new Set(Object.keys(n)):null;if(E[i]){const u=E[i](c,e,e.state,e.context);if(u){const f=Array.isArray(u)?u:[u];for(const p of f)p&&Object.assign(n,p)}}else n[i]=c;if(a)for(const u in n)l.has(u)||r.add(u)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let c=t[i];if(typeof c=="function"&&(c=c(e,e.state,e.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(i==="style"){for(const f in c){let p=c[f];if(typeof p=="function"&&(p=p(e,e.state,e.context)),p==null||typeof p=="function")continue;const h=typeof e[f]=="function"&&(E[f]||w&&w.has(f));o(f,p,h)}continue}if(vt(i,e)){const f=Q(c,e,!1);Object.keys(f).length&&(n[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){rt()&&Uo(i,e);continue}let l=i;if(i.charCodeAt(0)===64&&!i.startsWith("@media")&&!i.startsWith("@keyframes")){const f=e.context?.designSystem?.media?.[i.slice(1)];f&&(l=`@media ${f}`)}const u=Q(c,e,!1);Object.keys(u).length&&(n[l]=u);continue}const a=typeof e[i]=="function"&&(E[i]||w&&w.has(i));o(i,c,a)}if(s)for(const i in n)r.add(i);for(const i of r){const c=n[i];typeof c=="string"&&!c.includes("!important")&&(n[i]=c+" !important")}return n}function wt(t,e){if(e===void 0&&(e=0),e>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&wt(t[s],e+1))return!0}return!1}function qt(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(vt(t,s)){const o=Q(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}let n=t;if(t.charAt(0)==="@"&&!t.startsWith("@media")&&!t.startsWith("@keyframes")){const o=s.context?.designSystem?.media?.[t.slice(1)];o&&(n=`@media ${o}`)}const r=Q(e,s,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function Bo(t){const e=t.__ref;for(const s of Object.keys(t)){if(!At(s))continue;const n=t[s];if(!n||typeof n!="object"||Array.isArray(n)||!wt(n))continue;let r=null,o;const i=S(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&D(c);let a,l=!1;try{const u=qt(s,n,t),f=u?Ct(u.block)+"::"+u.cssProp:null;if(f!==null&&f===o)l=!0;else if(o=f,u){const p=it({[u.cssProp]:u.block},null,t.context?.cssPrefix);a=p?p.split(" ").filter(Boolean):null}else a=null}finally{c&&O()}if(!(l||!t.node.classList)){if(r)for(const u of r)t.node.classList.remove(u);if(a&&a.length)for(const u of a)t.node.classList.add(u);r=a}},{depth:e.path.length,label:C(e,"cssBlock("+s+")")});e.__effects.push(i)}}function Ko(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const n of Object.keys(t)){const r=n.charAt(0);if(r!=="."&&r!=="!")continue;const o=n.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const f=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${f}: { '${o.slice(f.length)}': {...} }\`.`)}continue}const i=t[n];if(!i||typeof i!="object")continue;const c=r==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},l=()=>{let f;const p=t[o];if(p===void 0){const d=!!t.state&&o in t.state,y=t.state?t.state[o]:void 0;if(d||y!==void 0)f=y;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{f=typeof g=="function"?g.call(t,t):g}catch(b){f=!1,e.__conditionalError=b,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,b?.message||b)}}}else if(typeof p=="function")try{f=p(t,t.state,t.context)}catch(d){f=!1,e.__conditionalError=d,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,d?.message||d)}else f=p;const h=c?!f:!!f;if(!t.node||h===a.lastMatch)return;a.lastMatch=h;const _=t.context?.designSystem;_&&D(_);try{if(h){const d={},y={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const v=i[x],L=x.charAt(0);if((L===":"||L==="@"||L==="&")&&v&&typeof v=="object"&&!Array.isArray(v)){if(vt(x,t)){const R=Q(v,t,!1);Object.keys(R).length&&(y[`[data-theme="${x.slice(1)}"] &`]=R,g=!0)}else{let R=x;if(L==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const j=t.context?.designSystem?.media?.[x.slice(1)];j&&(R=`@media ${j}`)}const W=Q(v,t,!1);Object.keys(W).length&&(y[R]=W,g=!0)}continue}const H=typeof v=="function"?v(t,t.state,t.context):v;if(H!=null)if(E[x]){const R=E[x](H,t,t.state,t.context);if(R){const W=Array.isArray(R)?R:[R];for(const j of W)j&&Object.assign(d,j)}}else w&&w.has(x)&&(d[x]=H)}const b=Object.keys(d);if(b.length){Z(t.node,d);for(const x of b)s.set(x,n);a.appliedKeys=b}else a.appliedKeys=null;if(g){const x=it(y,null,t.context?.cssPrefix),v=x?x.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const L of v)t.node.classList.add(L);a.appliedClasses=v}else a.appliedClasses=null}else if(a.appliedClasses){for(const x of a.appliedClasses)t.node.classList.remove(x);a.appliedClasses=null}}else{if(a.appliedKeys){for(const d of a.appliedKeys)s.get(d)===n&&(t.node.style[d]="",s.delete(d));a.appliedKeys=null}if(a.appliedClasses){for(const d of a.appliedClasses)t.node.classList.remove(d);a.appliedClasses=null}}}finally{_&&O()}};e.__conditionalRunners.push(l);const u=S(l,{depth:e.path.length,label:C(e,"conditional("+n+")")});e.__effects.push(u)}}const jt=new WeakSet;function Vo(t){const e=t.ownerDocument;!e||jt.has(e)||(jt.add(e),queueMicrotask(()=>{jt.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const Et=new WeakSet;let Zt=!1;function Ho(t){const{node:e}=t;if(!e)return;if(Zt||(Zt=!0,it({display:"none"})),Et.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Et.add(t);const s=t.context?.designSystem;s&&D(s),xo();try{const n={};let r=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&E.theme){const o=E.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const i of o)i&&Object.assign(n,i);else Object.assign(n,o);r=!0}}for(const o of Object.keys(t)){if(typeof t[o]=="function"||V.has(o)||o==="theme")continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!q(o)){if(E[o]){const c=t[o],a=E[o](c,t,t.state,t.context);if(a){if(Array.isArray(a))for(const l of a)l&&Object.assign(n,l);else Object.assign(n,a);r=!0}}else if(w&&w.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(n[o]=c,r=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(n[o]=c,r=!0)}else if(o.charAt(0)==="&"||o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"&&!Array.isArray(c)){if(wt(c))continue;const a=qt(o,c,t);a&&(n[a.cssProp]=a.block,r=!0)}}}}if(r){n.display&&String(n.display).includes("!important")&&(e.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const o=it(n,null,t.context?.cssPrefix);if(o&&e.classList){const c=o.split(" ").filter(Boolean);let a=!1;for(const l of c)e.classList.add(l),a||(l.charCodeAt(0)===95&&l.charCodeAt(1)===99||l.charCodeAt(0)===95&&l.indexOf("_c",1)!==-1)&&(a=!0);a&&Vo(e)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=n.display;if(c&&c!==i)if(i==="none"){const a=[];for(const l of e.classList)l.startsWith("_d-")&&l!=="_d-none"&&a.push(l);for(const l of a)e.classList.remove(l);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{Ao(),s&&O(),Et.delete(t)}}function Qt(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const o=t.aria[r];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+r.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());e.setAttribute(i,Y(i,o))}const s=ko(t);for(const r in s){const o=s[r];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(r,o===!0?"":o)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||V.has(r)||r==="on"||s[r]!==void 0)continue;const o=r.charCodeAt(0);if(!(o>=65&&o<=90)&&!q(r)&&!(E[r]||w&&w.has(r))&&_t(n,r)){let i=t[r];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=ht(i,t,t.state,t.context),t[r]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!ct(gt(r)||r))continue;const c=gt(r)||r;e.setAttribute(c,Y(c,i))}}}function Go(t,e){const s=t.node,n=t.__ref;let r=n.__autoGrow;if(!e){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&r.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(r.lastMeasure=i)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}})),r.active||(s.addEventListener("input",r.resize),r.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==r.appliedMax&&(o==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,r.appliedMax=o),r.resize()}function Wo(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,n=t.autoGrow,r=typeof n=="function"?T(t,t.autoGrowDeps,n):null,o=S(()=>{const i=t.autoGrow;let c=i;if(typeof i=="function")try{c=(i===n&&r?r:i)(t,t.state,t.context)}catch{c=null}Go(t,c)},{depth:s.path.length,label:C(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),r&&(s.__exec.autoGrow=n)}const Xt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Jt(t,e){for(const s of Object.keys(t)){if(!q(s)||Xt.has(s))continue;const n=fo(s);if(n){ao(n,t,t[s]);continue}let r=t[s];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const i=r;r=function(a){return t.call(i,a)}}if(typeof r!="function")continue;const o=To(s);io.has(o)||co(Po(o),t,r)}zo(t)}function zo(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let n=!1;for(const p of Xt){const h=t[p];typeof h=="function"&&(s[p]=h,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,a=0,l=!1;const u=p=>{const h=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];h&&(i=h.clientX,c=h.clientY,a=Date.now(),l=!0)},f=p=>{if(!l)return;l=!1;const h=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!h)return;const _=h.clientX-i,d=h.clientY-c,y=Date.now()-a;if(y>o)return;const g=Math.abs(_),b=Math.abs(d);if(Math.max(g,b)<r)return;let x;if(g>b*1.2)x=_<0?"left":"right";else if(b>g*1.2)x=d<0?"up":"down";else return;const v="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),L=s[v],H=s.onSwipe;L&&L.call(t,p,t,t.state,t.context),H&&H.call(t,{direction:x,dx:_,dy:d,dt:y,event:p},t,t.state,t.context)};e.addEventListener("touchstart",u,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",u)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function et(t,e){const s={...t};for(const n in e){const r=s[n],o=e[n];r&&o&&typeof r=="object"&&typeof o=="object"&&!Array.isArray(r)&&!Array.isArray(o)&&typeof r!="function"&&typeof o!="function"?s[n]=et(r,o):s[n]=o}return s}function Tt(t,e,s){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const r=t.tag==="fragment",o=t.context?.document||globalThis.document,i=r?null:o?.createDocumentFragment();if(!r&&!i)return;const c=t.childProps,a=t.childrenAs;for(let l=0;l<e.length;l++){let u=e[l];const f=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=c;if(typeof c=="function")try{p=c(t,u)}catch{p=null}if(a==="state"){let d=f;(typeof f=="string"||typeof f=="number")&&(d={value:f,text:f}),u=p?{...p,state:d}:{state:d}}else p&&(u=et(p,u));if(n&&!u.ignoreChildExtends)if(u.extends){const d=Array.isArray(u.extends)?u.extends:[u.extends],y=Array.isArray(n)?n:[n];u={...u,extends:[...y,...d]}}else u={...u,extends:n};const h=u?.key||f&&typeof f=="object"&&f.key||`${l}`;let _;try{_=G(u,t,h,s)}catch(d){if(typeof console<"u"&&console.error){const y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${h}" failed to construct at ${y} (initial render, skipping this row):`,d?.message||d)}continue}!r&&_?.node&&i.appendChild(_.node)}return r||t.node.appendChild(i),!0}if(typeof e=="string"){const r=Kt(e,t);if(Array.isArray(r))return Tt(t,r,s)}if(typeof e=="object")for(const r in e){if(V.has(r))continue;let o=e[r];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=et(t.childProps,o)),n&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(n)?n:[n];o={...o,extends:[...c,...i]}}else o={...o,extends:n};G(o,t,r,s)}}}function Pt(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const n=s.options;if(!n||!n.length)return;const r=t.__ref,o=r&&r.__exec&&r.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let u;if(i)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const f=u==null?"":String(u);s.value!==f&&(s.value=f);return}const a=e||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!a)return;let l=-1;for(let u=0;u<n.length;u++)n[u].defaultSelected&&(l=u);l>=0&&s.selectedIndex!==l&&(s.selectedIndex=l)}function mt(t,e){let{children:s,content:n}=t;const r=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(y){if(s=void 0,typeof console<"u"&&console.error){const g=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${g} (initial run, treating as empty):`,y?.message||y)}}t.children=s;const p=t.__ref;let h=!1;const _=T(t,t.childrenDeps,f),d=S(()=>{const y=h;h=!0;let g;try{g=_(t,t.state,t.context)}catch(j){if(typeof console<"u"&&console.error){const N=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${N}${y?"":" (initial tracking run)"}:`,j?.message||j)}return}if(!y||g===t.children)return;t.children=g;const b=typeof t.onContentUpdate=="function",x=b?[]:null,v=b?[]:null,L=b?[]:null;if(Array.isArray(g)&&t.childrenAs==="state"){const j=t.childProps,N=[],Ot=new Map;for(let A=0;A<g.length;A++){const $=g[A];let k=j;if(typeof j=="function")try{k=j(t,$)}catch{k=null}const I=k&&k.key||$&&$.key||`${A}`;N.push(I),Ot.set(I,{rawChild:$,childProps:k})}const oo=new Set(N),so=p.__children.slice();for(const A of so)if(!oo.has(A)){const $=t[A];$?.remove&&$.remove(),delete t[A],v&&v.push(A)}const X=t.childExtends,nt=t.tag==="fragment",eo=t.context?.document||globalThis.document,J=nt?null:eo?.createDocumentFragment(),ut=new Set;for(const A of N){const $=Ot.get(A),k=$.rawChild,I=t[A];if(I&&I.state){if(k&&typeof k=="object"){const P=I.state,z=P.$replace||P.replace,$t=P.$update||P.update;try{if(typeof z=="function")z.call(P,k);else if(typeof $t=="function"){for(const M in P)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(k,M))try{P[M]=void 0}catch{}$t.call(P,k)}else for(const M in k)P[M]=k[M]}catch(M){if(typeof console<"u"&&console.error){const no=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${A}" failed to patch at ${no} (reconcile, keeping its previous data for this pass):`,M?.message||M)}}}L&&L.push(A);continue}let dt=k;(typeof k=="string"||typeof k=="number")&&(dt={value:k,text:k});const Lt=$.childProps;let F=Lt?{...Lt,state:dt}:{state:dt};if(X&&!F.ignoreChildExtends)if(F.extends){const P=Array.isArray(F.extends)?F.extends:[F.extends],z=Array.isArray(X)?X:[X];F={...F,extends:[...z,...P]}}else F={...F,extends:X};let lt;try{lt=G(F,t,A,e)}catch(P){if(typeof console<"u"&&console.error){const z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${A}" failed to construct at ${z} (reconcile, skipping this row):`,P?.message||P)}ut.add(A);continue}!nt&<?.node&&J&&J.appendChild(lt.node),x&&x.push(A)}if(!nt&&J&&J.childNodes.length&&t.node&&t.node.appendChild(J),!nt&&t.node){let A=null;for(const $ of N){const k=t[$]?.node;if(!k)continue;const I=A?A.nextSibling:t.node.firstChild;k!==I&&t.node.insertBefore(k,I),A=k}}p.__children=ut.size?N.filter(A=>!ut.has(A)):N,b&&(x.length||v.length)&&Bt(t,{added:x,removed:v,kept:L}),Pt(t,!1);return}const W=b?[...p.__children]:null;for(const j of[...p.__children]){const N=t[j];N?.remove&&N.remove(),delete t[j]}p.__children=[],Tt(t,g,e),Pt(t,!1),b&&Bt(t,{added:[...p.__children],removed:W,kept:[]})},{depth:p.path.length,label:C(p,"children")});p.__effects.push(d)}const o=Tt(t,s,e);if(n!=null&&!(n&&n.__ref)){let f=n;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=et(t.childProps,f)),r&&!f.ignoreChildExtends)if(f.extends){const p=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(r)?r:[r];f={...f,extends:[...h,...p]}}else f={...f,extends:r};G(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let p=0;p<f.length;p++){const h=f[p];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const _=h.slice(0,-7);if(!_||_.charCodeAt(0)<65||_.charCodeAt(0)>90)continue;const d={extends:t[h]};delete t[h];for(let y=p+1;y<f.length;y++){const g=f[y],b=g.charCodeAt(0);if(b>=65&&b<=90||V.has(g)||typeof t[g]=="function"&&(g.startsWith("on")||g.startsWith(".")))break;const x=t[g];x!==void 0&&(d[g]=x,delete t[g])}t[_]&&typeof t[_]=="object"?t[_]={...d,...t[_]}:t[_]=d}}const c=e?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),l=f=>{if(V.has(f)||typeof t[f]!="object"||t[f]===null)return;const p=f.charCodeAt(0);if(p<65||p>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const _=i[f]||i[`smbls.${f}`];_&&(h={...h,extends:_})}if(t.childProps&&(h=et(t.childProps,h)),r&&!h.ignoreChildExtends)if(h.extends){const _=Array.isArray(h.extends)?h.extends:[h.extends],d=Array.isArray(r)?r:[r];h={...h,extends:[...d,..._]}}else h={...h,extends:r};G(h,t,f,e)}};if(!c){for(const f of a)l(f);return}yo();const u=f=>{for(let p=f;p<a.length;p++)if(l(a[p]),p+1<a.length&&po()){const h=p+1;_o(()=>u(h));return}};u(0),ho()}function to(t,e,s){const{node:n}=t;if(!n)return;n.ref=t;const r=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(r){const i=r.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;i.insertBefore(n,c||r)}else i.insertBefore(n,r);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(n,i):o.appendChild(n)}else o.appendChild(n)}const Dt=3;function Yo(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Dt?!1:(t.__inBeforeUpdate=!0,!0)}function ft(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Dt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Dt}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function B(t,e,s){const n=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&U(n,e,s);const r="on"+t,o=e[r];if(typeof o=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(e.__ref[a])return!0;e.__ref[a]=!0}const l=e.context?.designSystem;l&&D(l);let u=!!a;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const p=e.__ref;return f.catch(h=>{e.context?.plugins?.length&&U("error",e,{hook:r,error:h})||console.error(`[DOMQL] Lifecycle "${r}" error:`,h)}).finally(()=>{a&&p&&(p[a]=!1)}),u=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&U("error",e,{hook:r,error:f})||console.error(`[DOMQL] Lifecycle "${r}" error:`,f),e.context?.strictMode)throw f}finally{l&&O(),u&&e.__ref&&(e.__ref[a]=!1)}}return!0}var gs=G;export{Dt as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,Yo as acquireBeforeUpdateGuard,G as create,gs as default,xt as flushMounts,ft as releaseBeforeUpdateGuard,at as writeElementText};
|
|
4
|
+
`):"")}}if(dt(o,!0),uo(o,e,n),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const _=o.context?.designSystem;_&&R(_);try{const y=o.html(o,o.state,o.context);y!=null&&typeof y!="function"&&(o.node.innerHTML=y)}catch{}finally{_&&$()}}if(M("Create",o,r),M("Complete",o,r),M("Render",o,r),M("RenderRouter",o,r),St(o,r),typeof o.onFrame=="function"){const _=o.onFrame,y=o.context?.designSystem,p=()=>{if(o.node){if(o.node.isConnected){y&&R(y);try{_(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{y&&$()}}requestAnimationFrame(p)}};requestAnimationFrame(p)}return o}function $o(t,e,s){const r=!e,n=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=r&&n&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,ot(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=c.lang||u.defaultLang||"en",l=new Set,h=(y,p)=>{l.has(y)||So(d,y,a)&&(a[y]=p,l.add(y),vo(d,y))},g=u.translations[f];if(g&&typeof g=="object")for(const y in g)h(y,g[y]);const _=new Set(u.languages||[]);for(const y in u.translations)_.has(y)||h(y,u.translations[y])}t.state=K(a)?a:_t(a),t.state.__element=t,t.state.root=t.state,ot(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ot(t,t.state);return}if(typeof i=="string"){if(t.state=Zt(i,e),t.state&&typeof t.state=="object"&&!K(t.state)){const c=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}ot(t,t.state);return}if(typeof i=="function"){const c=i(t,e?.state);t.state=K(c)?c:_t(c||{})}else K(i)?t.state=i:t.state=_t({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,ot(t,t.state)}function wt(t,e){if(!e)return t;const s=e.split("/");let r=t;for(const n of s){if(r==null)return{};r=r[n]}return r??{}}function Zt(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const n=t.slice(3);return n?wt(e.state,n):e.state??{}}if(t.startsWith("~/")){const n=e.state?.root||e.state,o=t.slice(2);return o?wt(n,o):n??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=wt(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const r=e.context?.polyglot;if(r?.translations){const n=e.state?.root?.lang||r.defaultLang||"en",o=r.translations[n];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}const Mo=new Set(["s","state","ctx","context"]);function No(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(r=>r.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Fo(t){if(typeof t!="function"||t.length!==2)return!1;const e=No(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Mo.has(s)}function Io(t){const e=t.__ref,s=t.tag||"div",r=t.context?.designSystem,n=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||G.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||Y(c)||L[c]||P&&P.has(c)||xt(s,c)||(tt()&&Fo(t[c])&&console.warn(`[smbls] custom prop "${c}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),n.push({prop:c,fn:t[c]}))}for(let i=0;i<n.length;i++){const{prop:c,fn:a}=n[i];e.__exec[c]=a,Object.defineProperty(t,c,{get(){r&&R(r);try{return a(t,t.state,t.context)}catch{return}finally{r&&$()}},set(u){delete e.__exec[c],Object.defineProperty(t,c,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Uo(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const r=e[s];try{typeof r=="function"?r(t,t.state,t.context):typeof r=="string"&&t.state?.[r]}catch{}}}function D(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...r){return Uo(t,e),s.apply(this,r)}}function rt(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function j(t,e){return()=>t.path.join(".")+"::"+e}function Qt(t,e){const s=t.__ref,r=!!(e&&e.skipIfEffect);if(Io(t),typeof t.text=="function"){const o=t.text,i=D(t,t.textDeps,o),c=w(()=>{if(!s.contentManaged)try{let a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=bt.call(t,a,t.state)),at(t,a))}catch{}},{depth:s.path.length,label:j(s,"text")});s.__effects.push(c),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=w(()=>{if(s.contentManaged)return;const c=bt.call(t,o,t.state);c!=null&&(t.text=c),t.node&&at(t,c??"")},{depth:s.path.length,label:j(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!G.has(o)&&!Y(o)&&!s.__exec[o]){if(L[o]){const i=t[o],c=D(t,t[o+"Deps"],i),a=o;let u,d=null,f;const l=w(()=>{const h=t.context?.designSystem;h&&R(h);try{const g=c(t,t.state,t.context);Gt();let _;try{_=L[a](g,t,t.state,t.context)}finally{Vt()}if(Array.isArray(_)){const p={};for(const b of _)if(b)for(const x in b)p[x]=b[x];_=p}const y=a==="show"||a==="hide";if(_&&t.node&&Bo(_)){const p=ut(_);if(p===null||p!==f){f=p;const b=st(_,null,t.context?.cssPrefix),x=b?b.split(" ").filter(Boolean):null;if(t.node.classList){if(d)for(const S of d)t.node.classList.remove(S);if(x&&x.length)for(const S of x)t.node.classList.add(S);d=x}}u=void 0}else if(_&&t.node){if(d){for(const x of d)t.node.classList.remove(x);d=null,f=void 0}const p=ut(_),b=y&&t.node.style.display!=="none";(p===null||p!==u||b)&&(u=p,q(t.node,_))}else if(t.node&&y){u=void 0;const p=s.__explicitDisplay;t.node.style.display=typeof p=="string"?p:""}}finally{h&&$()}},{depth:s.path.length,label:j(s,a)});s.__effects.push(l),s.__exec[o]=i}else if(P&&P.has(o)){const i=t[o],c=D(t,t[o+"Deps"],i),a=o;let u;const d=w(()=>{const f=t.context?.designSystem;f&&R(f);try{const l=c(t,t.state,t.context);if(t.node)if(l!=null){const h=a+":"+String(l);h!==u&&(u=h,q(t.node,{[a]:l}))}else u=void 0,t.node.style[a]=""}finally{f&&$()}},{depth:s.path.length,label:j(s,a)});s.__effects.push(d),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=D(t,t.htmlDeps,o),c=w(()=>{const a=t.context?.designSystem;a&&R(a);try{const u=i(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{a&&$()}},{depth:s.path.length,label:j(s,"html")});s.__effects.push(c),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=D(t,t.valueDeps,o),c=w(()=>{try{const a=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=a==null?"":String(a);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:s.path.length,label:j(s,"value")});s.__effects.push(c),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=D(t,t.styleDeps,o);let c;const a=w(()=>{const u=i(t,t.state,t.context),d=ut(u);(d===null||d!==c)&&(c=d,q(t.node,u))},{depth:s.path.length,label:j(s,"style")});s.__effects.push(a),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const c=D(t,rt(t.styleDeps,o),i);let a;const u=w(()=>{try{const d=c(t,t.state,t.context);if(t.node){const f=o+":"+String(d);f!==a&&(a=f,q(t.node,{[o]:d}))}}catch{}},{depth:s.path.length,label:j(s,"style."+o)});s.__effects.push(u)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=D(t,rt(t.attrDeps,o),t.attr[o]),c=o,a=w(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!ft(c)?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,z(c,u)))}catch{}},{depth:s.path.length,label:j(s,"attr."+c)});s.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=D(t,rt(t.ariaDeps,o),t.aria[o]),c="aria-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=w(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,z(c,u))}catch{}},{depth:s.path.length,label:j(s,"aria."+o)});s.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=D(t,rt(t.dataDeps,o),t.data[o]),a="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=w(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(a,d===!0?"":d)}catch{}},{depth:s.path.length,label:j(s,"data."+o)});s.__effects.push(u)}const n=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(n)for(const o in n){if(typeof n[o]!="function")continue;const i=D(t,rt(t.classDeps,o),n[o]),c=w(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:j(s,"class."+o)});s.__effects.push(c)}!r&&typeof t.if=="function"&&Jt(t,s,t.if);for(const o of Object.keys(t)){if(G.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||Y(o))continue;const c=t[o];s.__exec[o]=c;const a=t.tag||"div";if(xt(a,o)&&!L[o]&&!(P&&P.has(o))){const u=At(o)||o,d=D(t,t[o+"Deps"],c),f=w(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!ft(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,z(u,l))))}catch{}},{depth:s.path.length,label:j(s,o)});s.__effects.push(f)}}if(Vo(t),zo(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,a=[];const u=w(()=>{const d=[];for(let g=0;g<i.length;g++){const _=i[g];try{d[g]=typeof _=="function"?_(t,t.state,t.context):t.state?.[_]}catch{d[g]=void 0}}if(!c){c=!0,a=d;return}let f=d.length!==a.length;for(let g=0;!f&&g<d.length;g++)d[g]!==a[g]&&(f=!0);const l=a;if(a=d,!f)return;const h=t.context?.designSystem;h&&R(h);try{o(t,t.state,t.context,{prev:l,next:d})}catch(g){if(t.context?.plugins?.length&&B("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{h&&$()}},{depth:s.path.length,label:j(s,"onStateUpdate")});s.__effects.push(u)}Wo(t)}function Xt(t){const e=t.parent,s=e?.node;if(!s||!t.node){uo(t,t.parent);return}let r=null;const n=Object.keys(e),o=n.indexOf(t.key);for(let i=o+1;i<n.length;i++){const c=e[n[i]];if(c?.node?.parentNode===s){r=c.node;break}}r?s.insertBefore(t.node,r):s.appendChild(t.node)}function Jt(t,e,s){const r=D(t,t.ifDeps,s),n=w(()=>{let o;try{o=r(t,t.state,t.context)}catch(c){if(o=!1,e.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(c){console.error("[smbls] onRemove error:",c)}}else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=gt(t)),t.node&&(t.node.ref=t),Xt(t),jt(t),M("Render",t,{}),St(t,{});else{if(e.__ifInitialized=!0,t.tag||(t.tag=Ft(t)),M("Init",t,{}),t.node||(t.node=gt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),e.__fragmentAnchor=a}M("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),fo(t,{}),Qt(t,{skipIfEffect:!0}),jt(t),io(t),ao(t,{}),Xt(t),M("Create",t,{}),M("Complete",t,{}),M("Render",t,{}),M("RenderRouter",t,{}),St(t,{})}},{depth:e.path.length,label:j(e,"if")});e.__effects.push(n)}function at(t,e){const s=t.node;if(!s)return;const r=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==r&&(s.nodeValue=r);return}const n=t.__ref;let o=n?n.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==r&&(o.nodeValue=r):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(r),s.insertBefore(o,s.firstChild)):(s.textContent=r,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),n&&(n.__textNode=o||null)}function jt(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),qo(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"&&q(e,t.style),t.attr&&typeof t.attr=="object")for(const s in t.attr){const r=t.attr[s];typeof r=="function"||typeof r=="object"||r!=null&&(r===!1&&!ft(s)||e.setAttribute&&e.setAttribute(s,z(s,r)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const r=t.data[s];typeof r=="function"||typeof r=="object"||r==null||r===!1||e.dataset&&(e.dataset[s]=r===!0?"":r)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(r=>r&&e.classList.add(r));else if(typeof s=="object")for(const r in s){const n=typeof s[r]=="function"?s[r](t,t.state,t.context):s[r];n&&e.classList.add(typeof n=="string"?n:r)}}}}function ut(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Bo(t){if(!t||typeof t!="object")return!1;for(const e in t){const s=t[e];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function q(t,e){if(!t||!e||!t.style)return;let s=null;for(const r in e){const n=e[r];if(n!=null){if(r.charAt(0)==="&"&&typeof n=="object"){s||(s={}),s[r]=n;continue}try{const o=String(n),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=o.trim(),a=/\s*!important\s*$/.test(c),u=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,u,a?"important":"")}catch{}}}s&&Ko(t,s)}function Ko(t,e){const s=`_ds${Wt.scopedStyleId++}`;t.classList.add(s);const r=t.ownerDocument;let n=r.querySelector("style[data-smbls-scoped]");n||(n=r.createElement("style"),n.setAttribute("data-smbls-scoped",""),r.head.appendChild(n));let o="";for(const i in e){const c="."+s,a=i.replace(/&/g,c).split(",").map(d=>{const f=d.trim();return f.includes(c)?f:c+f}).join(", "),u=e[i];if(typeof u=="object"){let d="",f="";for(const l in u){const h=u[l];if(typeof h=="object"){const g=l.includes("&")?a.split(", ").map(y=>l.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${l}`).join(", ");let _="";for(const y in h)_+=`${y.replace(/[A-Z]/g,p=>"-"+p.toLowerCase())}: ${h[y]};`;f+=Ht(`${g} { ${_} }`,g)+`
|
|
5
|
+
`}else d+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${h};`}d&&(o+=Ht(`${a} { ${d} }`,a)+`
|
|
6
|
+
`),f&&(o+=f)}}o&&(n.textContent+=o)}const mt=new Set;function to(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function Go(t,e,s){const r=to(s);queueMicrotask(()=>{if(!t.__ref)return;let n;try{n=e(t,t.state,t.context)}catch{return}if(to(n)===r)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";mt.has(o)||(mt.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(n)?n.join(", "):String(n)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Vo(t){const e=t.subscribeTo,s=typeof e=="function";let r=e;if(s)try{r=e(t,t.state,t.context)}catch{r=null}if(s&&tt()&&Go(t,e,Array.isArray(r)?r:[]),!Array.isArray(r)||r.length===0)return;const n=t.__ref;for(let o=0;o<r.length;o++){const i=r[o];if(typeof i!="string"||i.length===0)continue;const c=i.split("."),a=c[0],u=c.slice(1),d={value:!1},f=w(()=>{const l=t.state&&(K(t.state)?t.state.root:null);if(!l||!K(l))return;let h=l;h=h[a];for(let _=0;_<u.length&&!(h==null||typeof h!="object");_++)if(K(h))h=h[u[_]];else break;if(!d.value)return;let g=!1;if(typeof t.onBeforeUpdate=="function"){const _=t.context?.designSystem;_&&R(_);try{if(Jo(n)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>lt(n,!1),p=>{lt(n,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}):(lt(n,!1),y===!1&&(g=!0))}}catch(y){lt(n,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{_&&$()}}if(!g&&t.node&&n.__effects)for(let _=0;_<n.__effects.length;_++){const y=n.__effects[_];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!g&&typeof t.onUpdate=="function"){const _=t.context?.designSystem;_&&R(_);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&B("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{_&&$()}}},{depth:n.path.length,label:j(n,"subscribeTo("+i+")")});d.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function Et(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}function Tt(t,e){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=e.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const oo=new Set;function Ho(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",r=s+"::"+t;oo.has(r)||(oo.add(r),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Z(t,e,s){const r={},n=new Set,o=(i,c,a)=>{const u=a?new Set(Object.keys(r)):null;if(L[i]){const d=L[i](c,e,e.state,e.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(r,l)}}else r[i]=c;if(a)for(const d in r)u.has(d)||n.add(d)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let c=t[i];if(typeof c=="function"&&(c=c(e,e.state,e.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(i==="style"){for(const f in c){let l=c[f];if(typeof l=="function"&&(l=l(e,e.state,e.context)),l==null||typeof l=="function")continue;const h=typeof e[f]=="function"&&(L[f]||P&&P.has(f));o(f,l,h)}continue}if(Et(i,e)){const f=Z(c,e,!1);Object.keys(f).length&&(r[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){tt()&&Ho(i,e);continue}const u=Tt(i,e),d=Z(c,e,!1);Object.keys(d).length&&(r[u]=d);continue}const a=typeof e[i]=="function"&&(L[i]||P&&P.has(i));o(i,c,a)}if(s)for(const i in r)n.add(i);for(const i of n){const c=r[i];typeof c=="string"&&!c.includes("!important")&&(r[i]=c+" !important")}return r}function Pt(t,e){if(e===void 0&&(e=0),e>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Pt(t[s],e+1))return!0}return!1}function so(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(Et(t,s)){const o=Z(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}const r=Tt(t,s),n=Z(e,s,!1);return Object.keys(n).length?{cssProp:r,block:n}:null}function Wo(t){const e=t.__ref;for(const s of Object.keys(t)){if(!vt(s))continue;const r=t[s];if(!r||typeof r!="object"||Array.isArray(r)||!Pt(r))continue;let n=null,o;const i=w(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&R(c);let a,u=!1;try{const d=so(s,r,t),f=d?ut(d.block)+"::"+d.cssProp:null;if(f!==null&&f===o)u=!0;else if(o=f,d){const l=st({[d.cssProp]:d.block},null,t.context?.cssPrefix);a=l?l.split(" ").filter(Boolean):null}else a=null}finally{c&&$()}if(!(u||!t.node.classList)){if(n)for(const d of n)t.node.classList.remove(d);if(a&&a.length)for(const d of a)t.node.classList.add(d);n=a}},{depth:e.path.length,label:j(e,"cssBlock("+s+")")});e.__effects.push(i)}}function zo(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const r of Object.keys(t)){const n=r.charAt(0);if(n!=="."&&n!=="!")continue;const o=r.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const h=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${n}\` is read as one prop name. Nest the selector inside instead: \`${n}${h}: { '${o.slice(h.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const c=n==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let h;const g=t[o];if(g===void 0){const p=!!t.state&&o in t.state,b=t.state?t.state[o]:void 0;if(p||b!==void 0)h=b;else{const x=t.context?.cases?.[o];if(x===void 0)return;try{h=typeof x=="function"?x.call(t,t):x}catch(S){h=!1,e.__conditionalError=S,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,S?.message||S)}}}else if(typeof g=="function")try{h=g(t,t.state,t.context)}catch(p){h=!1,e.__conditionalError=p,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,p?.message||p)}else h=g;const _=c?!h:!!h;if(!t.node||_===a.lastMatch)return;a.lastMatch=_;const y=t.context?.designSystem;y&&R(y);try{if(_){const p={},b={};let x=!1;for(const A in i){if(!Object.prototype.hasOwnProperty.call(i,A))continue;const v=i[A],V=A.charAt(0);if((V===":"||V==="@"||V==="&"||V==="[")&&v&&typeof v=="object"&&!Array.isArray(v)){if(Et(A,t)){const E=Z(v,t,!1);Object.keys(E).length&&(b[`[data-theme="${A.slice(1)}"] &`]=E,x=!0)}else{const E=Tt(A,t),T=Z(v,t,!1);Object.keys(T).length&&(b[E]=T,x=!0)}continue}const Q=typeof v=="function"?v(t,t.state,t.context):v;if(Q!=null)if(L[A]){const E=L[A](Q,t,t.state,t.context);if(E){const T=Array.isArray(E)?E:[E];for(const X of T)X&&Object.assign(p,X)}}else P&&P.has(A)&&(p[A]=Q)}const S=Object.keys(p);if(S.length){q(t.node,p);for(const A of S)s.set(A,r);a.appliedKeys=S}else a.appliedKeys=null;if(x){const A=st(b,null,t.context?.cssPrefix),v=A?A.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const V of v)t.node.classList.add(V);a.appliedClasses=v}else a.appliedClasses=null}else if(a.appliedClasses){for(const A of a.appliedClasses)t.node.classList.remove(A);a.appliedClasses=null}}else{if(a.appliedKeys){for(const p of a.appliedKeys)s.get(p)===r&&(t.node.style[p]="",s.delete(p));a.appliedKeys=null}if(a.appliedClasses){for(const p of a.appliedClasses)t.node.classList.remove(p);a.appliedClasses=null}}}finally{y&&$()}};e.__conditionalRunners.push(u);const d=D(t,t[o+"Deps"],u),f=w(d,{depth:e.path.length,label:j(e,"conditional("+r+")")}),l=e.__exec&&e.__exec[o]||t[o];f._sources.size===0&&typeof l=="function"&&tt()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${o}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),e.__effects.push(f)}}const Dt=new WeakSet;function Yo(t){const e=t.ownerDocument;!e||Dt.has(e)||(Dt.add(e),queueMicrotask(()=>{Dt.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const Lt=new WeakSet;let eo=!1;function no(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Ot(t,e){const s={...t};for(const r in e){const n=e[r],o=s[r];s[r]=n&&typeof n=="object"&&o&&typeof o=="object"?Ot(o,n):n}return s}function ro(t,e){const s={};for(const r in t){const n=t[r];if(n&&typeof n=="object"){const o=ro(n,e);Object.keys(o).length&&(s[r]=o)}else e.has(r)||(s[r]=n)}return s}function qo(t){const{node:e}=t;if(!e)return;if(eo||(eo=!0,st({display:"none"})),Lt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Lt.add(t);const s=t.context?.designSystem;s&&R(s),Gt();try{const r={};let n=!1,o=null,i=null,c=null;const a=(u,d)=>{if(d&&typeof d=="object"&&no(u)){i||(i={});const f=i[u];f&&(d=Ot(f,d)),i[u]=d}else(d===null||typeof d!="object")&&(c||(c=new Set),c.add(u));r[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&L.theme){const u=L.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const h=f[l];h&&typeof h=="object"&&no(l)&&(o||(o={}),o[l]=h),r[l]=h}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);n=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||G.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!Y(u)){if(L[u]){const f=t[u],l=L[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const h of l)if(h)for(const g in h)a(g,h[g])}else for(const h in l)a(h,l[h]);n=!0}}else if(P&&P.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),n=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),n=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Pt(f))continue;const l=so(u,f,t);l&&(a(l.cssProp,l.block),n=!0)}}}}if(o)for(const u in o){let d=c?ro(o[u],c):o[u];i&&i[u]&&(d=Ot(d,i[u])),Object.keys(d).length?r[u]=d:delete r[u]}if(n){r.display&&String(r.display).includes("!important")&&(e.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const u=st(r,null,t.context?.cssPrefix);if(u&&e.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const h of f)e.classList.add(h),l||(h.charCodeAt(0)===95&&h.charCodeAt(1)===99||h.charCodeAt(0)===95&&h.indexOf("_c",1)!==-1)&&(l=!0);l&&Yo(e)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=r.display;if(f&&f!==d)if(d==="none"){const l=[];for(const h of e.classList)h.startsWith("_d-")&&h!=="_d-none"&&l.push(h);for(const h of l)e.classList.remove(h);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{Vt(),s&&$(),Lt.delete(t)}}function io(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const o=t.aria[n];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());e.setAttribute(i,z(i,o))}const s=wo(t);for(const n in s){const o=s[n];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(n,o===!0?"":o)}const r=t.tag||"div";for(const n of Object.keys(t)){if(typeof t[n]=="function"||G.has(n)||n==="on"||s[n]!==void 0)continue;const o=n.charCodeAt(0);if(!(o>=65&&o<=90)&&!Y(n)&&!(L[n]||P&&P.has(n))&&xt(r,n)){let i=t[n];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=bt(i,t,t.state,t.context),t[n]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!ft(At(n)||n))continue;const c=At(n)||n;e.setAttribute(c,z(c,i))}}}function Zo(t,e){const s=t.node,r=t.__ref;let n=r.__autoGrow;if(!e){if(n&&n.active){try{s.removeEventListener("input",n.resize)}catch{}s.style.height="",n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""),n.active=!1,n.appliedMax=null,n.lastMeasure=0}return}n||(n=r.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&n.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(n.lastMeasure=i)}},r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{try{s.removeEventListener("input",n.resize)}catch{}})),n.active||(s.addEventListener("input",n.resize),n.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==n.appliedMax&&(o==null?n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,n.appliedMax=o),n.resize()}function Qo(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,r=t.autoGrow,n=typeof r=="function"?D(t,t.autoGrowDeps,r):null,o=w(()=>{const i=t.autoGrow;let c=i;if(typeof i=="function")try{c=(i===r&&n?n:i)(t,t.state,t.context)}catch{c=null}Zo(t,c)},{depth:s.path.length,label:j(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),n&&(s.__exec.autoGrow=r)}const co=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function fo(t,e){for(const s of Object.keys(t)){if(!Y(s)||co.has(s))continue;const r=Ao(s);if(r){xo(r,t,t[s]);continue}let n=t[s];if(typeof n=="string"&&/^[A-Za-z_$][\w$]*$/.test(n)){const i=n;n=function(a){return t.call(i,a)}}if(typeof n!="function")continue;const o=Oo(s);go.has(o)||bo(Ro(o),t,n)}Xo(t)}function Xo(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let r=!1;for(const l of co){const h=t[l];typeof h=="function"&&(s[l]=h,r=!0)}if(!r)return;const n=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,a=0,u=!1;const d=l=>{const h=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];h&&(i=h.clientX,c=h.clientY,a=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const h=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!h)return;const g=h.clientX-i,_=h.clientY-c,y=Date.now()-a;if(y>o)return;const p=Math.abs(g),b=Math.abs(_);if(Math.max(p,b)<n)return;let x;if(p>b*1.2)x=g<0?"left":"right";else if(b>p*1.2)x=_<0?"up":"down";else return;const S="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),A=s[S],v=s.onSwipe;A&&A.call(t,l,t,t.state,t.context),v&&v.call(t,{direction:x,dx:g,dy:_,dt:y,event:l},t,t.state,t.context)};e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",d)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function it(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=it(n,o):s[r]=o}return s}function Rt(t,e,s,r){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const o=t.tag==="fragment",i=t.context?.document||globalThis.document,c=o?null:i?.createDocumentFragment();if(!o&&!c)return;const a=t.childProps,u=t.childrenAs,d=y=>{let p=e[y];const b=p;(typeof p=="string"||typeof p=="number")&&(p={text:p});let x=a;if(typeof a=="function")try{x=a(t,p)}catch{x=null}if(u==="state"){let A=b;(typeof b=="string"||typeof b=="number")&&(A={value:b,text:b}),p=x?{...x,state:A}:{state:A}}else x&&(p=it(x,p));if(n&&!p.ignoreChildExtends)if(p.extends){const A=Array.isArray(p.extends)?p.extends:[p.extends],v=Array.isArray(n)?n:[n];p={...p,extends:[...v,...A]}}else p={...p,extends:n};const S=p?.key||b&&typeof b=="object"&&b.key||`${y}`;try{return H(p,t,S,s)}catch(A){if(typeof console<"u"&&console.error){const v=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to construct at ${v} (initial render, skipping this row):`,A?.message||A)}return null}},f=t.__ref;if(!(r===!0&&!o&&!!f&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let y=0;y<e.length;y++){const p=d(y);!o&&p?.node&&c.appendChild(p.node)}return o||t.node.appendChild(c),!0}const h=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;Ut();let g=null;const _=y=>{if(f.__disposed||f.__childrenChunkGen!==h){g&&g.parentNode&&g.remove();return}for(let p=y;p<e.length;p++){const b=d(p);if(b?.node&&(g?t.node.insertBefore(b.node,g):c.appendChild(b.node)),p+1<e.length&&It()){g||(g=i.createComment("smbls-mount"),c.appendChild(g),t.node.appendChild(c));const x=p+1;Kt(()=>_(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&dt(t,!0)):t.node.appendChild(c)};return _(0),Bt(),!0}if(typeof e=="string"){const o=Zt(e,t);if(Array.isArray(o))return Rt(t,o,s,r)}if(typeof e=="object")for(const o in e){if(G.has(o))continue;let i=e[o];if(!(i==null||i===!1)){if((typeof i=="string"||typeof i=="number")&&(i={text:i}),t.childProps&&(i=it(t.childProps,i)),n&&!i.ignoreChildExtends)if(i.extends){const c=Array.isArray(i.extends)?i.extends:[i.extends],a=Array.isArray(n)?n:[n];i={...i,extends:[...a,...c]}}else i={...i,extends:n};H(i,t,o,s)}}}function dt(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const r=s.options;if(!r||!r.length)return;const n=t.__ref,o=n&&n.__exec&&n.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);s.value!==f&&(s.value=f);return}const a=e||!(n&&n.__selectSynced);if(n&&(n.__selectSynced=!0),!a)return;let u=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(u=d);u>=0&&s.selectedIndex!==u&&(s.selectedIndex=u)}function ao(t,e){let{children:s,content:r}=t;const n=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(y){if(s=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,y?.message||y)}}t.children=s;const l=t.__ref;let h=!1;const g=D(t,t.childrenDeps,f),_=w(()=>{const y=h;h=!0;let p;try{p=g(t,t.state,t.context)}catch(E){if(typeof console<"u"&&console.error){const T=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${T}${y?"":" (initial tracking run)"}:`,E?.message||E)}return}if(!y||p===t.children)return;t.children=p,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const b=typeof t.onContentUpdate=="function",x=b?[]:null,S=b?[]:null,A=b?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const E=t.childProps,T=[],X=new Map;for(let C=0;C<p.length;C++){const N=p[C];let k=E;if(typeof E=="function")try{k=E(t,N)}catch{k=null}const U=k&&k.key||N&&N.key||`${C}`;T.push(U),X.set(U,{rawChild:N,childProps:k})}const lo=new Set(T),po=l.__children.slice();for(const C of po)if(!lo.has(C)){const N=t[C];N?.remove&&N.remove(),delete t[C],S&&S.push(C)}const J=t.childExtends,ct=t.tag==="fragment",ho=t.context?.document||globalThis.document,m=ct?null:ho?.createDocumentFragment(),pt=new Set;for(const C of T){const N=X.get(C),k=N.rawChild,U=t[C];if(U&&U.state){if(k&&typeof k=="object"){const O=U.state,W=O.$replace||O.replace,Nt=O.$update||O.update;try{if(typeof W=="function")W.call(O,k);else if(typeof Nt=="function"){for(const F in O)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(k,F))try{O[F]=void 0}catch{}Nt.call(O,k)}else for(const F in k)O[F]=k[F]}catch(F){if(typeof console<"u"&&console.error){const yo=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to patch at ${yo} (reconcile, keeping its previous data for this pass):`,F?.message||F)}}}A&&A.push(C);continue}let ht=k;(typeof k=="string"||typeof k=="number")&&(ht={value:k,text:k});const Mt=N.childProps;let I=Mt?{...Mt,state:ht}:{state:ht};if(J&&!I.ignoreChildExtends)if(I.extends){const O=Array.isArray(I.extends)?I.extends:[I.extends],W=Array.isArray(J)?J:[J];I={...I,extends:[...W,...O]}}else I={...I,extends:J};let yt;try{yt=H(I,t,C,e)}catch(O){if(typeof console<"u"&&console.error){const W=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${W} (reconcile, skipping this row):`,O?.message||O)}pt.add(C);continue}!ct&&yt?.node&&m&&m.appendChild(yt.node),x&&x.push(C)}if(!ct&&m&&m.childNodes.length&&t.node&&t.node.appendChild(m),!ct&&t.node){let C=null;for(const N of T){const k=t[N]?.node;if(!k)continue;const U=C?C.nextSibling:t.node.firstChild;k!==U&&t.node.insertBefore(k,U),C=k}}l.__children=pt.size?T.filter(C=>!pt.has(C)):T,b&&(x.length||S.length)&&qt(t,{added:x,removed:S,kept:A}),dt(t,!1);return}const Q=b?[...l.__children]:null;for(const E of[...l.__children]){const T=t[E];T?.remove&&T.remove(),delete t[E]}l.__children=[],Rt(t,p,e),dt(t,!1),b&&qt(t,{added:[...l.__children],removed:Q,kept:[]})},{depth:l.path.length,label:j(l,"children")});l.__effects.push(_)}const o=Rt(t,s,e,!0);if(r!=null&&!(r&&r.__ref)){let f=r;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=it(t.childProps,f)),n&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(n)?n:[n];f={...f,extends:[...h,...l]}}else f={...f,extends:n};H(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const h=f[l];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const g=h.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const _={extends:t[h]};delete t[h];for(let y=l+1;y<f.length;y++){const p=f[y],b=p.charCodeAt(0);if(b>=65&&b<=90||G.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const x=t[p];x!==void 0&&(_[p]=x,delete t[p])}t[g]&&typeof t[g]=="object"?t[g]={..._,...t[g]}:t[g]=_}}const c=e?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),u=f=>{if(G.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const g=i[f]||i[`smbls.${f}`];g&&(h={...h,extends:g})}if(t.childProps&&(h=it(t.childProps,h)),n&&!h.ignoreChildExtends)if(h.extends){const g=Array.isArray(h.extends)?h.extends:[h.extends],_=Array.isArray(n)?n:[n];h={...h,extends:[..._,...g]}}else h={...h,extends:n};H(h,t,f,e)}};if(!c){for(const f of a)u(f);return}Ut();const d=f=>{for(let l=f;l<a.length;l++)if(u(a[l]),l+1<a.length&&It()){const h=l+1;Kt(()=>d(h));return}};d(0),Bt()}function uo(t,e,s){const{node:r}=t;if(!r)return;r.ref=t;const n=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(n){const i=n.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;i.insertBefore(r,c||n)}else i.insertBefore(r,n);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}const $t=3;function Jo(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=$t?!1:(t.__inBeforeUpdate=!0,!0)}function lt(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===$t&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${$t}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function M(t,e,s){const r=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&B(r,e,s);const n="on"+t,o=e[n];if(typeof o=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(e.__ref[a])return!0;e.__ref[a]=!0}const u=e.context?.designSystem;u&&R(u);let d=!!a;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const l=e.__ref;return f.catch(h=>{e.context?.plugins?.length&&B("error",e,{hook:n,error:h})||console.error(`[DOMQL] Lifecycle "${n}" error:`,h)}).finally(()=>{a&&l&&(l[a]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&B("error",e,{hook:n,error:f})||console.error(`[DOMQL] Lifecycle "${n}" error:`,f),e.context?.strictMode)throw f}finally{u&&$(),d&&e.__ref&&(e.__ref[a]=!1)}}return!0}var ks=H;export{$t as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,Jo as acquireBeforeUpdateGuard,H as create,ks as default,kt as flushMounts,lt as releaseBeforeUpdateGuard,at as writeElementText};
|
package/dist/esm/src/delegate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DELEGATED_EVENTS as
|
|
1
|
+
import{DELEGATED_EVENTS as L,LIFECYCLE_EVENTS as v,PASSIVE_EVENTS as E,NON_BUBBLING_EVENTS as b}from"./registry.js";import{pushConfig as D,popConfig as _}from"@symbo.ls/scratch";const a=new WeakMap,C={passive:!0},S={passive:!0,capture:!0},d=(e,t)=>E.has(e)?t?S:C:t||!1;function g(e){let t=a.get(e);return t||(t={handlers:new Map,installed:new Set},a.set(e,t)),t}function T(e,t){const r=g(t);if(r.installed.has(e))return;r.installed.add(e);const n=e==="focus"||e==="blur"||e==="focusin"||e==="focusout"||e==="mouseenter"||e==="mouseleave",o=e==="mouseenter"||e==="mouseleave";t.addEventListener(e,s=>{let i=s.target;for(;i&&i!==t;){const u=r.handlers.get(e);if(u){const c=u.get(i);if(c){if(o&&s.relatedTarget&&i.contains(s.relatedTarget)){i=i.parentNode;continue}if(c(s),s.cancelBubble)return}}i=i.parentNode}},d(e,n))}function V(e,t,r,n){n||(n=t.ownerDocument?.documentElement||t.getRootNode());const o=g(n);T(e,n),o.handlers.has(e)||o.handlers.set(e,new WeakMap),o.handlers.get(e).set(t,r)}function A(e,t,r){r||(r=t.ownerDocument?.documentElement||t.getRootNode());const n=a.get(r);if(!n)return;const o=n.handlers.get(e);o&&o.delete(t)}function h(e){return L.has(e)&&!v.has(e)}function y(e,t){const{context:r}=e,n=r?.designSystem;return o=>{n&&D(n);try{const s=t.call(e,o,e,e.state,r);if(s&&typeof s.then=="function"){s.catch(i=>{e.error=i,console.error("[DOMQL] Async event error:",i)}).finally(()=>{n&&_()});return}}catch(s){if(e.error=s,console.error("[DOMQL] Event error:",s),r?.strictMode)throw s}n&&_()}}function Q(e,t,r){const{node:n,context:o}=t;if(!n)return;const s=y(t,r),i=b.has(e);if(!i&&h(e)){const u=o?.rootNode||n.ownerDocument?.documentElement;V(e,n,s,u)}else n.addEventListener(e,s,d(e,!1));t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{if(!i&&h(e)){const u=o?.rootNode||n.ownerDocument?.documentElement;A(e,n,u)}else n.removeEventListener(e,s,d(e,!1))})}const p=[["onDocument","document"],["onWindow","window"],["onVisualViewport","visualViewport"],["onMediaQuery","mediaQuery"]];function O(e){if(typeof e!="string")return null;for(let t=0;t<p.length;t++){const r=p[t][0];if(e.length<=r.length||!e.startsWith(r))continue;const n=e.charCodeAt(r.length);if(!(n<65||n>90))return{target:p[t][1],eventName:e.slice(r.length).toLowerCase()}}return null}const M=/^[A-Za-z_$][\w$]*$/;function m(e,t,r){let n=t,o=!1,s,i=!1,u=null;if(t&&typeof t=="object"&&typeof t!="function"&&(n=t.handler,o=!!t.capture,i=!!t.once,typeof t.passive=="boolean"&&(s=t.passive),typeof t.query=="string"&&(u=t.query)),typeof n=="string"&&M.test(n)){const c=n;n=function(l){return e.call(c,l)}}return typeof n!="function"?null:(s===void 0&&(s=E.has(r)),{handler:n,capture:o,passive:s,once:i,query:u})}function I(e,t,r){const n=e.node?.ownerDocument||e.context?.document||(typeof document<"u"?document:null);if(!n||typeof n.addEventListener!="function")return null;if(t==="document")return n;const o=n.defaultView||(typeof window<"u"?window:null);if(!o)return null;if(t==="window")return typeof o.addEventListener=="function"?o:null;if(t==="visualViewport"){const s=o.visualViewport;return s&&typeof s.addEventListener=="function"?s:null}if(t==="mediaQuery"){const s=r&&r.query;if(typeof s!="string"||!s.trim()||typeof o.matchMedia!="function")return null;try{return o.matchMedia(s)||null}catch{return null}}return null}function x(e,t,r,n){try{return e.addEventListener(t,r,n),!0}catch{return typeof e.addListener=="function"?(e.addListener(r),!0):!1}}function B(e,t,r,n){try{e.removeEventListener(t,r,n)}catch{typeof e.removeListener=="function"&&e.removeListener(r)}}function R(e){const t=e.node;if(!t)return!1;const r=t.nodeType===11?e.__ref?.__fragmentAnchor:t;return r?r.isConnected!==!1:!1}function P(e,t,r){if(t.__ref){if(Array.isArray(r)){if(e.target!=="mediaQuery")return;for(let o=0;o<r.length;o++)w(e,t,r[o]);return}w(e,t,r)}}function w(e,t,r){const n=t.__ref,o=m(t,r,e.eventName);if(!o||e.target==="mediaQuery"&&e.eventName!=="change")return;const s=I(t,e.target,o);if(!s)return;const i=e.target+":"+(o.query?o.query+":":"")+e.eventName+":"+(o.capture?1:0);if(n.__globalEvents&&n.__globalEvents.has(i))return;const u=y(t,o.handler),c=l=>{R(t)&&u(l)},f={capture:o.capture,passive:o.passive,once:o.once};x(s,e.eventName,c,f)&&(n.__globalEvents||(n.__globalEvents=new Map),n.__globalEvents.set(i,{target:s,eventName:e.eventName,listener:c,options:f}),n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{B(s,e.eventName,c,f),n.__globalEvents&&n.__globalEvents.delete(i)}))}export{V as addDelegatedEvent,O as globalEventKeyInfo,h as isDelegatable,Q as registerEvent,P as registerGlobalEvent,A as removeDelegatedEvent};
|
package/dist/esm/src/dispose.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(r){if(!r)return;const
|
|
1
|
+
function n(r){if(!r)return;const _=r.__ref;if(!_)return;_.__disposed=!0;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){const o=_.__children.slice();_.__children.length=0;for(let f=0;f<o.length;f++){const t=r[o[f]];t&&t.__ref&&n(t)}}r.node?.parentNode?r.node.remove():r.tag==="fragment"&&_.__fragmentAnchor?.parentNode&&_.__fragmentAnchor.remove();const e=r.state?.$destroy||r.state?.destroy;if(typeof e=="function"&&r.state.__element===r&&e.call(r.state),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 i(){n(this)}export{n as dispose,i as remove};
|
package/dist/esm/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="3.14.
|
|
1
|
+
const o="3.14.783";export{o as VERSION};
|