@symbo.ls/element 3.14.802 → 3.14.804
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/src/bridge.js +1 -1
- package/dist/cjs/src/create.js +5 -5
- package/dist/cjs/src/cssLonghands.js +1 -1
- package/dist/cjs/src/dispose.js +1 -1
- package/dist/cjs/src/extends.js +1 -1
- package/dist/cjs/src/inertOutside.js +1 -1
- package/dist/cjs/src/mountScheduler.js +1 -1
- package/dist/cjs/src/pluginHooks.js +1 -0
- package/dist/cjs/src/runContext.js +1 -0
- package/dist/cjs/src/update.js +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/bridge.js +1 -1
- package/dist/esm/src/create.js +5 -5
- package/dist/esm/src/cssLonghands.js +1 -1
- package/dist/esm/src/dispose.js +1 -1
- package/dist/esm/src/extends.js +1 -1
- package/dist/esm/src/inertOutside.js +1 -1
- package/dist/esm/src/mountScheduler.js +1 -1
- package/dist/esm/src/pluginHooks.js +1 -0
- package/dist/esm/src/runContext.js +1 -0
- package/dist/esm/src/update.js +1 -1
- package/dist/esm/src/version.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var
|
|
1
|
+
"use strict";var h=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!x.call(e,o)&&o!==n&&h(e,o,{get:()=>t[o],enumerable:!(r=N(t,o))||r.enumerable});return e};var L=e=>k(h({},"__esModule",{value:!0}),e);var Y={};P(Y,{inertOutsidePlugin:()=>U});module.exports=L(Y);var F=require("@symbo.ls/signal"),M=require("./runContext.js");const a="inertOutside",D=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT","BASE","TITLE"]),q='a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable="false"])',W={attributes:!0,attributeFilter:["inert"]},w=new WeakMap,g=new WeakMap,d=new Set,O=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function f(e){try{return(0,M.untrack)(e)}catch(t){console.error("[smbls] inertOutside:",t)}}function _(e){const t=()=>f(e);typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function B(e){if(!e||!e.defaultView||!("activeElement"in e))return null;let t=w.get(e);if(t)return t;const n=e.defaultView.MutationObserver||globalThis.MutationObserver;return typeof n!="function"?null:(t={doc:e,layers:[],held:new Map,top:null,observer:null},t.observer=new n(r=>f(()=>b(t,r))),w.set(e,t),t)}function S(e,t){const n=e.element.node;return!!n&&n.nodeType===1&&n.isConnected&&n.ownerDocument===t}function V(e){const t=e.activeElement;return t&&t!==e.body&&t!==e.documentElement?t:null}const T=e=>!!(e.closest&&e.closest("[inert]"));function j(e){const t=e.ownerDocument,n=new Set,r=[];for(let o=e;o!==t.body;o=o.parentNode){const c=o.parentNode;if(!c||c.nodeType!==1||c===t.documentElement)break;r.push(c);for(let u=c.firstElementChild;u;u=u.nextElementSibling)u!==o&&!D.has(u.tagName)&&n.add(u)}return{outside:n,parents:r}}function m(e,t){for(let n=0;n<t.length;n++){const{type:r,target:o}=t[n];r==="attributes"&&e.held.has(o)&&e.held.set(o,!o.hasAttribute("inert"))}}function b(e,t){const{doc:n,held:r,observer:o}=e;t&&m(e,t),m(e,o.takeRecords());const c=e.top,u=[];for(const s of e.layers){const y=S(s,n);y&&!s.live&&(u.push(s),s.returnFocus=V(n)),s.live=y}u.length&&(e.layers=e.layers.filter(s=>!u.includes(s)).concat(u));let i=null;for(let s=e.layers.length-1;s>=0&&!i;s--)e.layers[s].live&&(i=e.layers[s]);e.top=i;const{outside:p,parents:v}=i?j(i.element.node):{outside:new Set,parents:[]};for(const[s,y]of r)p.has(s)||(y&&s.removeAttribute("inert"),r.delete(s));for(const s of p)r.has(s)||r.set(s,!1),s.hasAttribute("inert")||(s.setAttribute("inert",""),r.set(s,!0));o.takeRecords(),o.disconnect();for(const s of v)o.observe(s,{childList:!0});for(const s of r.keys())o.observe(s,W);if(e.layers.some(s=>!s.live)?d.add(e):d.delete(e),i===c)return;const l=c&&!(c.declared&&c.live)?c:null;if(i&&u.includes(i))l&&l.returnFocus&&(i.returnFocus=l.returnFocus),_(()=>A(e,i));else if(l){const s=l.returnFocus;_(()=>z(e,l,s))}l&&(l.returnFocus=null)}function A(e,t){const n=t.element.node;if(e.top!==t||!n||!n.isConnected)return;const r=e.doc,o=r.activeElement;if(o&&n.contains(o))return;const c=new Set,u=(i,p)=>{if(c.has(i)||(c.add(i),i.matches(":disabled")))return!1;const v=p&&i.getAttribute("tabindex");return v&&parseInt(v,10)<0?!1:(i.focus(),r.activeElement===i)};for(const i of n.querySelectorAll("[autofocus]"))if(u(i,!1))return;for(const i of n.querySelectorAll(q))if(u(i,!0))return;o&&o!==r.body&&typeof o.blur=="function"&&o.blur()}function z(e,t,n){if(t.declared&&t.live)return;const r=e.doc,o=r.activeElement,c=t.element.node;(!o||o===r.body||c&&c.contains(o)||T(o))&&(n&&n.isConnected&&n.ownerDocument===r&&!T(n)&&(n.focus({preventScroll:!0}),r.activeElement===n)||e.top&&A(e,e.top))}function E(e,t){if(e.declared===t)return;const n=e.manager;if(e.declared=t,e.live=!1,t)n.layers.push(e);else{const r=n.layers.indexOf(e);r!==-1&&n.layers.splice(r,1)}b(n)}function C(e){let t=e[a];if(typeof t=="function")try{t=t(e,e.state,e.context)}catch{t=!1}return!!t}function I(e){let t=g.get(e);if(t)return t;const n=e.__ref,r=e.node;if(!n||!r||r.nodeType!==1)return null;const o=B(r.ownerDocument);if(!o)return null;t={element:e,manager:o,declared:!1,live:!1,returnFocus:null},g.set(e,t);const c=(0,F.createEffect)(()=>{const u=C(e);f(()=>E(t,u))},{depth:n.path.length,label:()=>n.path.join(".")+"::"+a});return n.__effects||(n.__effects=[]),n.__effects.push(c),n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>f(()=>E(t,!1))),t}function K(){for(const e of d){if(!e.doc.defaultView){d.delete(e);continue}e.layers.some(t=>!t.live&&S(t,e.doc))&&b(e)}}const U={name:a,create(e){O(e,a)&&f(()=>I(e))},render(){d.size&&f(K)},update(e){O(e,a)&&f(()=>{const t=I(e);t&&E(t,C(e))})}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!g.call(e,s)&&s!==n&&a(e,s,{get:()=>t[s],enumerable:!(r=h(t,s))||r.enumerable});return e};var y=e=>m(a({},"__esModule",{value:!0}),e);var S={};M(S,{MOUNT_YIELD_BUDGET_MS:()=>x,__flushMountQueueSync:()=>k,__pendingMountChunks:()=>B,__resetMountQueue:()=>U,childCostMeter:()=>w,closeMountBudget:()=>E,enqueueMountWork:()=>b,mountBudgetExhausted:()=>T,openMountBudget:()=>D});module.exports=y(S);const x=50,u=[];let i=!1,o=0,f=!1;function c(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function d(e){const t=typeof globalThis<"u"?globalThis.scheduler:null;if(t&&typeof t.yield=="function"){t.yield().then(e,e);return}if(typeof MessageChannel=="function"){const n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e()},n.port2.postMessage(0);return}setTimeout(e,0)}function T(e=0){return!o||c()-o+e<50?!1:(f=!0,!0)}function w(){let e=0,t=0,n=0;return{begin(){n=c()},end(){const r=c()-n;e+=r,t++;const s=e/t;return r>s?r:s}}}let l=0;function D(){l===0&&!o&&(o=c(),f=!1),l++}function E(){l>0&&l--,l===0&&!i&&(o=0,f=!1)}function b(e){u.push(e),i||(i=!0,d(p))}function p(){for(o=c(),f=!1;u.length;){const e=u.shift();try{e()}catch(t){typeof console<"u"&&console.error&&console.error("[smbls] deferred mount chunk failed:",t?.message||t)}if(f||c()-o>=50)break}if(u.length){d(p);return}i=!1,o=0,f=!1,l=0}function k(){let t=0;for(o=0;u.length&&t++<1e5;){const n=u.shift();try{n()}catch(r){typeof console<"u"&&console.error&&console.error("[smbls] deferred mount chunk failed:",r?.message||r)}}i=!1,o=0,f=!1,l=0}function B(){return u.length}function U(){u.length=0,i=!1,o=0,f=!1,l=0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!p.call(t,o)&&o!==n&&l(t,o,{get:()=>e[o],enumerable:!(r=g(e,o))||r.enumerable});return t};var y=t=>x(l({},"__esModule",{value:!0}),t);var H={};d(H,{dispatchPluginHook:()=>a,hasPluginHook:()=>u,reportLifecycleError:()=>P});module.exports=y(H);var s=require("@symbo.ls/utils/function.js");const f=new WeakMap;let i=null,c=null;function k(t,e){let n=t===i?c:f.get(t);(!n||n.length!==t.length)&&(n={length:t.length,hooks:new Map},f.set(t,n)),i=t,c=n;let r=n.hooks.get(e);if(r===void 0){r=!1;for(const o of t)if(typeof o[e]=="function"){r=!0;break}n.hooks.set(e,r)}return r}function u(t,e){const n=t&&t.context&&t.context.plugins;return!!(n&&n.length&&k(n,e))}function a(t,e,...n){return u(e,t)?(0,s.runPluginHook)(t,e,...n):!1}function P(t,e,n){a("error",t,{hook:e,error:n})||console.error(`[DOMQL] Lifecycle "${e}" error:`,n)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.create;var n=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var s in t)n(r,s,{get:t[s],enumerable:!0})},u=(r,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of l(t))!g.call(r,e)&&e!==s&&n(r,e,{get:()=>t[e],enumerable:!(c=f(t,e))||c.enumerable});return r};var m=(r,t,s)=>(s=r!=null?a(p(r)):{},u(t||!r||!r.__esModule?n(s,"default",{value:r,enumerable:!0}):s,r)),x=r=>u(n({},"__esModule",{value:!0}),r);var O={};y(O,{untrack:()=>v,withDesignSystem:()=>b});module.exports=x(O);var o=m(require("@symbo.ls/signal"),1),i=require("@symbo.ls/scratch");function b(r,t){const s=r&&r.context&&r.context.designSystem;if(!s)return t();(0,i.pushConfig)(s);try{return t()}finally{(0,i.popConfig)()}}const v=o.untrack||(r=>{const t=o.getObserver();if(!t)return r();o.setObserver(null);try{return r()}finally{o.setObserver(t)}});
|
package/dist/cjs/src/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var A=(o,f)=>{for(var t in f)a(o,t,{get:f[t],enumerable:!0})},U=(o,f,t,r)=>{if(f&&typeof f=="object"||typeof f=="function")for(let s of g(f))!P.call(o,s)&&s!==t&&a(o,s,{get:()=>f[s],enumerable:!(r=b(f,s))||r.enumerable});return o};var j=o=>U(a({},"__esModule",{value:!0}),o);var S={};A(S,{default:()=>B,update:()=>x});module.exports=j(S);var u=require("@symbo.ls/signal"),_=require("./registry.js"),i=require("./create.js"),y=require("./pluginHooks.js"),v=require("./cssLonghands.js");function x(o={},f={}){const t=this,r=t.__ref;if(!r)return;if((typeof o=="string"||typeof o=="number")&&(o={text:o}),!f.preventListeners&&typeof t.onBeforeUpdate=="function"&&(0,i.acquireBeforeUpdateGuard)(r))try{const e=t.onBeforeUpdate(t,t.state,t.context,f);if(e&&typeof e.then=="function")e.then(()=>(0,i.releaseBeforeUpdateGuard)(r,!1),n=>{(0,i.releaseBeforeUpdateGuard)(r,!0),(0,y.dispatchPluginHook)("error",t,{hook:"onBeforeUpdate",error:n})||console.error("[DOMQL] onBeforeUpdate error:",n)});else if((0,i.releaseBeforeUpdateGuard)(r,!1),e===!1)return t}catch(e){throw(0,i.releaseBeforeUpdateGuard)(r,!0),e}const s=!o||Object.keys(o).length===0,l=[];let h=!1;(0,u.batch)(()=>{if(o.state&&(0,u.isStore)(t.state)&&t.state.$update(o.state),o.text!==void 0&&(t.text=o.text,!r.__exec.text&&t.node&&(0,i.writeElementText)(t,o.text??"")),o.html!==void 0&&(t.html=o.html,!r.__exec.html&&t.node&&(t.node.innerHTML=o.html)),o.style&&t.node?.style){if(!r.__exec.style){const e=(0,i.resolveStyleBlock)(t,o.style);for(const n in e){const c=e[n];if(c==null)continue;const d=(0,v.cssPropName)(n),p=String(c).replace(/\s*!important\s*$/,"");t.node.style.setProperty(d,p,"important")}}t.style||(t.style={}),Object.assign(t.style,o.style)}if(o.attr&&t.node?.setAttribute){for(const e in o.attr){const n=o.attr[e];(0,i.writeAttr)(t.node,e,n)}t.attr||(t.attr={}),Object.assign(t.attr,o.attr)}if(o.data&&t.node?.dataset){for(const e in o.data)t.node.dataset[e]=o.data[e];t.data||(t.data={}),Object.assign(t.data,o.data)}if(o.vars&&typeof o.vars=="object"&&!Array.isArray(o.vars)){const e=t.vars&&typeof t.vars=="object"&&!Array.isArray(t.vars)?t.vars:null;t.vars={...e,...o.vars},h=!0}for(const e in o){if(_.REGISTRY.has(e)||e==="state")continue;const n=o[e],c=t[e];if(c&&c.__ref&&typeof c.update=="function")c.update(n,f);else if(typeof n=="object"&&n!==null){const d=e.charCodeAt(0);d>=65&&d<=90&&(0,i.create)(n,t,e,f)}else e!=="text"&&e!=="html"&&e!=="style"&&e!=="attr"&&e!=="data"&&(t[e]=n,typeof n!="function"&&l.push(e))}});for(let e=0;e<l.length;e++)(0,i.reconcileAttrProp)(t,l[e]);if(t.node){let e=h;for(let n=0;!e&&n<l.length;n++)(0,i.isStaticCssProp)(l[n])&&(e=!0);e&&(0,i.recompileStaticCss)(t)}if(t.node&&s&&r.__effects&&r.__effects.length)for(let e=0;e<r.__effects.length;e++){const n=r.__effects[e];n&&!n._disposed&&!n._isSubscribeToEffect&&typeof n._execute=="function"&&n._execute()}else if(t.node&&r.__conditionalRunners)for(const e of r.__conditionalRunners)e();return(0,y.dispatchPluginHook)("update",t),!f.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,f),t}var B=x;
|
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.804";
|
package/dist/esm/src/bridge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEffect as
|
|
1
|
+
import{createEffect as a}from"@symbo.ls/signal";import{withDesignSystem as f,untrack as h}from"./runContext.js";import{reportLifecycleError as s}from"./pluginHooks.js";import{isLoudDevRuntime as p}from"./devRuntime.js";const y=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);function c(t,r,n){return h(()=>f(t,()=>r.call(t,n,t,t.state,t.context)))}function g(t,r){if(!p())return;const n=r.__children&&r.__children.length>0;!n&&t.html==null||console.warn(`[smbls] bridge host "${r.path.join(".")}" renders DOMQL ${n?"children":"html"} inside the node it hands to its library \u2014 the library owns that subtree and may replace them. Keep DOMQL children beside the host, not in it.`)}function w(t){const r=t.__ref,n=t.node;if(!r||!n||r.__bridge||typeof t.onBridgeMount!="function"||!("scrollHeight"in n))return;const o=r.__bridge={settled:!1,failed:!1,disposed:!1,destroyed:!1,instance:void 0,effect:null};r.contentManaged=!0,g(t,r);let i;try{i=c(t,t.onBridgeMount,n)}catch(e){if(o.failed=!0,s(t,"onBridgeMount",e),t.context?.strictMode)throw e;return}if(i&&typeof i.then=="function"){i.then(e=>d(t,o,e),e=>{o.failed=!0,s(t,"onBridgeMount",e)});return}d(t,o,i)}function d(t,r,n){if(r.settled=!0,r.instance=n,r.disposed){u(t,r);return}if(Object.defineProperty(t,"bridge",{value:n,writable:!0,configurable:!0,enumerable:!1}),typeof t.onBridgeUpdate!="function")return;const o=t.__ref;r.effect=a(()=>{r.disposed||f(t,()=>{try{const i=t.onBridgeUpdate.call(t,r.instance,t,t.state,t.context);i&&typeof i.then=="function"&&i.catch(e=>s(t,"onBridgeUpdate",e))}catch(i){s(t,"onBridgeUpdate",i)}})},{depth:o.path.length,label:()=>o.path.join(".")+"::onBridgeUpdate"}),o.__effects.push(r.effect)}function D(t){const r=t.__ref?.__bridge;!r||r.disposed||(r.disposed=!0,r.effect&&r.effect.dispose(),r.settled&&u(t,r))}function u(t,r){if(r.destroyed)return;r.destroyed=!0;const n=r.instance;if(r.instance=void 0,y(t,"bridge")&&(t.bridge=void 0),typeof t.onBridgeDestroy=="function")try{const o=c(t,t.onBridgeDestroy,n);o&&typeof o.then=="function"&&o.catch(i=>s(t,"onBridgeDestroy",i))}catch(o){s(t,"onBridgeDestroy",o)}}export{D as destroyBridge,w as mountBridge};
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
2
|
-
`+
|
|
1
|
+
import{createStore as oo,createScopeStore as on,isStore as W}from"@symbo.ls/signal";import{createEffect as j,getObserver as sn}from"@symbo.ls/signal";import{withDesignSystem as X,untrack as Nt}from"./runContext.js";import{cacheNode as so,detectTag as Do,adoptHydrationNode as nn}from"./cache.js";import{REGISTRY as H,LIFECYCLE_EVENTS as en}from"./registry.js";import{registerEvent as rn,registerGlobalEvent as cn,globalEventKeyInfo as fn}from"./delegate.js";import{mountBridge as an}from"./bridge.js";import{applyExtends as un,openMergeLayer as dn,closeMergeLayer as ln}from"./extends.js";import{addMethods as pn}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as st}from"./devRuntime.js";import{mountBudgetExhausted as Lo,openMountBudget as Ro,closeMountBudget as Mo,enqueueMountWork as No,childCostMeter as Fo}from"./mountScheduler.js";import{replaceLiteralsWithObjectFields as $,isPolyglotWritableKey as hn,markPolyglotSeeded as yn,polyglotSeededKeys as _n}from"@symbo.ls/utils";import*as Ft from"@symbo.ls/utils";import{dispatchPluginHook as bt,hasPluginHook as gn,reportLifecycleError as $t}from"./pluginHooks.js";import{applyStateMethods as at}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as I,DEFAULT_CSS_PROPERTIES_LIST as U,pushStaticCssPass as $o,popStaticCssPass as Io,resolveStyleBlockTokens as bn}from"css-in-props";import{css as At,wrapHoverRule as Bo}from"@symbo.ls/css";import{pushConfig as Y,popConfig as q}from"@symbo.ls/scratch";import{checkAttributeByTagName as xt,applyAttrTransforms as An,ATTR_TRANSFORMS as no,camelToAttr as wt,serializeAttrValue as J,isEnumeratedTrueFalseAttr as It,extractConditionalAttrs as xn}from"attrs-in-props";import{resolveElementIdEngine as wn}from"./engineRegistry.js";import{CSS_LONGHAND_SHORTHANDS as Bt,CSS_SHORTHAND_LONGHANDS as Sn,cssShorthandStatesLonghand as Ho,cssPropName as Uo,cssCamelName as Vo}from"./cssLonghands.js";import{isAttributeFirst as Go,isCssProp as nt}from"./attributeFirst.js";import{VERSION as Cn}from"./version.js";const Ko=wn({uniqId:1,scopedStyleId:0},Cn),St=[],et=new Set;let eo=!1,Wo=0,ut=null,Ct=null;function dt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function zo(){return typeof document<"u"&&document.visibilityState==="hidden"}const kn=250,vn=1e3;function jn(){return Ct&&(Ct!==(typeof requestAnimationFrame=="function"?requestAnimationFrame:null)||zo())?!0:dt()-Wo>=vn}function En(){if(eo=!0,Wo=dt(),Ct=null,typeof requestAnimationFrame!="function"){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(ro,0);ut=t?()=>t(o):null;return}if(zo()){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(ro,kn);ut=t?()=>t(o):null}else{const t=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:null;Ct=requestAnimationFrame;const o=requestAnimationFrame(ro);ut=t?()=>t(o):null}}function Ht(){if(eo){if(!jn())return;const t=ut;if(ut=null,t)try{t()}catch{}}En()}const Yo=300,qo=15e4;function ro(){if(eo=!1,ut=null,Ct=null,et.size&&je(),!St.length)return;const t=St.splice(0,St.length);for(let o=0;o<t.length;o++){const s=t[o];if(s.node){if(!s.node.isConnected){const n=s.__ref||(s.__ref={});n.__mountAttempts=(n.__mountAttempts||0)+1,n.__mountFirstAttemptAt==null&&(n.__mountFirstAttemptAt=dt());const e=dt()-n.__mountFirstAttemptAt;n.__mountAttempts<=Yo&&e<qo?(St.push(s),Ht()):console.warn("[DOMQL] onMounted dropped after",n.__mountAttempts,"attempts /",e,"ms \u2014 node never connected:",s.key||s.tag||s);continue}typeof s.onBridgeMount=="function"&&an(s),typeof s.onMounted=="function"&&D("Mounted",s,s.__ref?.__mountOptions||{})}}}function io(t,o){const s=t.__ref?.__autoGrow;s&&s.active&&Lt(t,!0),!(typeof t.onMounted!="function"&&typeof t.onBridgeMount!="function")&&(t.__ref.__mountOptions=o,St.push(t),Ht())}function Zo(t,o){typeof t.onContentUpdate=="function"&&(bt("contentUpdate",t,o),X(t,()=>{try{t.onContentUpdate(t,t.state,t.context,o)}catch(s){if($t(t,"onContentUpdate",s),t.context?.strictMode)throw s}}))}function Z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Pn(t){return t.charAt(2).toLowerCase()+t.slice(3)}function On(t){return t.toLowerCase()}function co(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function kt(t,o){const s={...t};for(const n in o){const e=s[n],c=o[n];e&&c&&typeof e=="object"&&typeof c=="object"&&!Array.isArray(e)&&!Array.isArray(c)&&typeof e!="function"&&typeof c!="function"?s[n]=kt(e,c):s[n]=c}return s}function Ut(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function Qo(t,o,s,n){return Vt(n,Ut(t)||(o&&typeof o=="object"?Ut(o.key):void 0)||String(s))}function Vt(t,o){if(!t||typeof o!="string")return o;let s=o;for(;Tn(t,s);)s="$"+s;return s!==o&&Dn(t,o,s),s}function Tn(t,o){if(H.has(o)&&o!=="content")return!0;if(!(o in t))return!1;const s=t[o];return!(s&&typeof s=="object"&&s.__ref&&s.parent===t)}const Xo=new Set;function Dn(t,o,s){if(!st())return;const n=t.__ref&&t.__ref.path&&t.__ref.path.join(".")||t.key||"<root>",e=n+"::"+o;Xo.has(e)||(Xo.add(e),console.warn(`[smbls] a child keyed "${o}" at ${n} names a property of its parent; it lives at el["${s}"] (data-key="${s}") so the parent keeps its own "${o}". Prefix the data keys to keep plain el.<key> access.`))}function m(t,o,s,n={},e){if(sn())return Nt(()=>m(t,o,s,n,e));if(t==null||t===!1)return null;const c=Qn(t);(typeof t=="string"||typeof t=="number")&&(t={text:t}),s=Ut(s);const a=Ut(t.key),r=Object.create(null);r.key=s||(a&&o?Vt(o,a):a)||`_${Ko.uniqId++}`,r.parent=o||null,r.context=t.context||o?.context||n.context||{},r.context.__create||(r.context.__create=m);const i=r.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||r,path:o?.__ref?.path?[...o.__ref.path,r.key]:[r.key],origin:t};c&&(i.__runtimeSource=c);const f=t;if(t=mo(r,t,s,a,o,n),r.if!=null){let u;if(typeof r.if=="function")try{u=r.if(r,r.state,r.context)}catch(l){if(u=!1,i.__ifError=l,typeof console<"u"&&console.warn){const g=r.key||r.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,l?.message||l)}}else u=r.if;i.__if=!!u}if(i.__if)typeof r.if=="function"&&(i.__ifInitialized=!0);else{o&&(o[r.key]=r);const u=Mn(t,s,r.context?.components);return u.length&&(i.__ifLateMerge={definition:f,key:s,ownKey:a,names:u,options:n}),typeof r.if=="function"&&_s(r,i,r.if),r}r.tag||(r.tag=Do(r)),D("Init",r,n);const d=r.node=nn(r)||so(r);if(!d)return r;if(r.tag==="fragment"){const l=(r.context?.document||globalThis.document).createComment("");d.appendChild(l),i.__fragmentAnchor=l}D("AttachNode",r,n),d.setAttribute&&r.key&&d.setAttribute("data-key",r.key),o&&(o[r.key]=r,o.__ref?.__children&&(o.__ref.__children.includes(r.key)||o.__ref.__children.push(r.key))),d.setAttribute&&r.context?.scopeSelector&&r.context.scopeSelector!==":root"&&r.context.key&&r.key===r.context.key&&d.setAttribute("data-smbls-app",r.context.key),r.id&&d.setAttribute&&(d.id=r.id),Ys(r,n),ps(r),ys(r);try{qs(r,n)}catch(u){if(typeof console<"u"&&console.error){const l=r.__ref?.path?.join(".")||r.key||"<root>";console.error(`[smbls] createChildren failed at ${l}:`,u?.message||u,u?.stack?`
|
|
2
|
+
`+u.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(qt(r,!0),Is(r,o,e),typeof r.html=="function"&&r.node&&!r.node.innerHTML){const d=r.context?.designSystem;d&&L(d);try{const h=r.html(r,r.state,r.context);h!=null&&typeof h!="function"&&(r.node.innerHTML=h)}catch{}finally{d&&D()}}if(M("Create",r,n),M("Complete",r,n),M("Render",r,n),M("RenderRouter",r,n),ro(r,n),typeof r.onFrame=="function"){const d=r.onFrame,h=r.context?.designSystem,y=()=>{if(r.node){if(r.node.isConnected){h&&L(h);try{d(r,r.state,r.context)}catch(A){console.error("[DOMQL] onFrame error:",A)}finally{h&&D()}}requestAnimationFrame(y)}};requestAnimationFrame(y)}return r}function Yo(t,o,s,n,e,i){if(s&&!o.extends&&!o.extend){const b=s.indexOf("_"),w=s.indexOf(".");let p=b>0?b:-1;if(w>0&&(p<0||w<p)&&(p=w),p>0){const _=s.substring(0,p),x=t.context?.components;x&&(x[_]||x["smbls."+_])?o={...o,extends:_}:x&&nt()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${_}" but neither "${_}" nor "smbls.${_}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}t.__ref&&(t.__ref.__mergeLayer=null),Xs(t,o,i);const a=Js(t),c=a?a.rank:0,r=new Set(["childProps","attr","style","scope","data","vars"]),f=t.props&&typeof t.props=="object"?t.props:null;for(const b in o){if(b==="parent"||b==="node"||b==="__ref"||b==="extends"||b==="context"||b==="props")continue;if(b==="key"){n&&(t.key=e?Gt(e,n):n);continue}const w=o[b];a&&a.set(b,c);const p=t[b],_=p&&w&&typeof p=="object"&&typeof w=="object"&&!Array.isArray(p)&&!Array.isArray(w)&&typeof p!="function"&&typeof w!="function";_&&b.charCodeAt(0)>=65&&b.charCodeAt(0)<=90?t[b]=Pt(p,w):_&&r.has(b)?t[b]={...p,...w}:_&&io(b)?t[b]=Pt(p,w):t[b]=w}function l(b){for(const w in b){const p=b[w],_=t[w],x=_&&p&&typeof _=="object"&&typeof p=="object"&&!Array.isArray(_)&&!Array.isArray(p)&&typeof _!="function"&&typeof p!="function";x&&w.charCodeAt(0)>=65&&w.charCodeAt(0)<=90?t[w]=Pt(_,p):x&&r.has(w)?t[w]={..._,...p}:x&&io(w)?t[w]=Pt(_,p):t[w]=p}}if(f&&l(f),o.props&&typeof o.props=="object"&&(l(o.props),a))for(const b in o.props)a.set(b,c);o.classlist!==void 0&&(t.classlist=o.classlist),o.text!==void 0&&(t.text=o.text),o.html!==void 0&&(t.html=o.html);const u=t.scope&&typeof t.scope=="object"?t.scope:null,d=e?.scope,h=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,y=d||h||null;if(o.scope!==void 0||u){const b={};u&&Object.assign(b,u),o.scope!==void 0&&Object.assign(b,o.scope),t.scope=Ws(b,y)}else y&&(t.scope=y);o.if!==void 0&&(t.if=o.if);const A=t.__ref,g=Nn(t,A&&A.__runtimeSource);return A&&(A.__declaredArrays=g||void 0),ms(t),xn(t,e,o,i),o}const gn=new Set(["key","parent","context","__ref"]);function bn(t,o){for(const e of Object.keys(t))gn.has(e)||delete t[e];const s=Ut();s&&J(null);let n=o.definition;if(!n.extends&&!n.extend&&typeof o.key=="string"){const e=t.context?.components||{},i=e[o.key]||e["smbls."+o.key];i&&(n={...n,extends:i})}try{Yo(t,n,o.key,o.ownKey,t.parent,o.options)}finally{s&&J(s)}}function An(t,o,s){const n=s||{},e=c=>!!(n[c]||n["smbls."+c]),i=[],a=[];if(t.extends&&a.push(...Array.isArray(t.extends)?t.extends:[t.extends]),t.extend&&a.push(...Array.isArray(t.extend)?t.extend:[t.extend]),a.length){for(const c of a){if(typeof c!="string")continue;const r=c.includes(">")?c.split(">")[0].trim():c;e(r)||i.push(r)}return i}if(typeof o=="string"&&/^[A-Z]/.test(o)){let c=-1;const r=o.indexOf("_"),f=o.indexOf(".");r>0&&(c=r),f>0&&(c<0||f<c)&&(c=f);const l=c>0?o.substring(0,c):o;e(l)||i.push(l)}return i}function co(t,o,s){if(typeof t.onStateInit!="function"&&!t.context?.plugins?.length)return;const n=t.state;t.state=o;try{M("StateInit",t,s)}finally{t.state=n}}function xn(t,o,s,n){const e=!o,i=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,a=e&&i&&t.context?.state,c=s.state!==void 0&&!a?s.state:t.state&&!z(t.state)?t.state:void 0;if(c==null){if(o?.state)t.state=o.state,dt(t,t.state);else if(t.context?.state){const r=t.context.state,f={...r},l=t.context?.polyglot;if(l?.translations){const u=t.context,d=r.lang||l.defaultLang||"en",h=new Set,y=(b,w)=>{h.has(b)||tn(u,b,f)&&(f[b]=w,h.add(b),on(u,b,w))},A=l.translations[d];if(A&&typeof A=="object")for(const b in A)y(b,A[b]);const g=new Set(l.languages||[]);for(const b in l.translations)g.has(b)||y(b,l.translations[b])}z(f)||co(t,f,n),t.state=z(f)?f:to(f),t.state.__element=t,t.state.root=t.state,dt(t,t.state),ut.promoteActiveRootState?.(r,t.state),M("StateCreated",t,n)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),dt(t,t.state);return}if(typeof c=="string"){if(t.state=qo(c,o),t.state&&typeof t.state=="object"&&!z(t.state)){const r=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:r,enumerable:!1,configurable:!0,writable:!0})}dt(t,t.state),Sn(t,c,o),M("StateCreated",t,n);return}if(typeof c=="function"){const r=c(t,o?.state);if(z(r))t.state=r;else{const f=r||{};co(t,f,n),t.state=to(f)}}else if(z(c))t.state=c;else{const r={...c};co(t,r,n),t.state=to(r)}t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,dt(t,t.state),ut.promoteActiveRootState?.(c,t.state),M("StateCreated",t,n)}function fo(t,o){if(!o)return t;const s=o.split("/");let n=t;for(const e of s){if(n==null)return{};n=n[e]}return n??{}}function qo(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")){const e=t.slice(3);return e?fo(o.state,e):o.state??{}}if(t.startsWith("~/")){const e=o.state?.root||o.state,i=t.slice(2);return i?fo(e,i):e??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=fo(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const n=o.context?.polyglot;if(n?.translations){const e=o.state?.root?.lang||n.defaultLang||"en",i=n.translations[e];if(i?.[t]!==void 0)return i[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}function wn(t,o){let s=o.state,n=t;if(t.startsWith("~/")?(s=o.state&&(o.state.root||o.state),n=t.slice(2)):t.startsWith("../")&&(n=t.slice(3)),!n||!s||typeof s!="object")return;const e=s[n];if(e!==void 0||n.indexOf("/")===-1)return e;let i=s;for(const a of n.split("/")){if(i==null||typeof i!="object")return;i=i[a]}return i}function Sn(t,o,s){const n=t.__ref;if(!n||!s||o==="."||!z(s.state))return;n.__stateBinding&&n.__stateBinding.dispose();const e=Ut();e&&J(null);try{const i=j(()=>{const a=wn(o,s);if(!a||typeof a!="object"||a===t.state)return;const c=Ut();J(null);try{Zo(t,t.state,a,!0)}finally{J(c)}},{depth:n.path?n.path.length:0,label:v(n,"state")});i._isStateBinding=!0,n.__stateBinding=i,n.__effects&&n.__effects.push(i)}finally{e&&J(e)}}function Zo(t,o,s,n){const e=t.__ref;if(!e)return;if(n||t.state===o){t.state=s,n&&dt(t,s),Qo(e);const a=e.__children;if(a)for(let c=0;c<a.length;c++){const r=t[a[c]];r&&r.__ref&&r.parent===t&&Zo(r,o,s,!1)}return}if(e.__stateBinding){e.__stateBinding._notify();return}const i=t.state;i&&typeof i=="object"&&i.parent===o&&(i.parent=s,Qo(e))}function Qo(t){const o=t.__effects;if(o)for(let s=0;s<o.length;s++){const n=o[s];n&&!n._disposed&&!n._isStateBinding&&!n._isSubscribeToEffect&&typeof n._notify=="function"&&n._notify()}}const Cn=new Set(["s","state","ctx","context"]);function kn(t){try{const s=(typeof ut.getFunctionSource=="function"?ut.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function vn(t){let o;try{o=typeof ut.getFunctionSource=="function"?ut.getFunctionSource(t):Function.prototype.toString.call(t)}catch{return!0}if(typeof o!="string")return!0;const s=o.match(/^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/)||o.match(/^[^(]*\(([^)]*)\)/);if(!s)return!0;const n=o.slice(s.index+s[0].length);if(/\bstate\b|\barguments\b|\bcall\s*\(/.test(n))return!0;const i=s[1].split(",").map(c=>c.trim())[1];if(!i)return!1;if(!/^[A-Za-z_$][\w$]*$/.test(i.split("=")[0].trim()))return!0;const a=i.split("=")[0].trim();return new RegExp("(^|[^\\w$.])"+a.replace(/\$/g,"\\$")+"(?![\\w$])").test(n)}const jn=3,En=/^(is|has)[A-Z0-9_$]/,Pn=new Set(["routerOptions"]),Xo=new WeakSet;function On(t,o){if(typeof t!="function"||t.length!==2||o&&(En.test(o)||Pn.has(o))||Xo.has(t))return!1;const s=kn(t);if(s.length<2)return!1;const n=s[1].replace(/[{}[\]]/g,"").trim();return n.length<jn||Cn.has(n)?!1:(Xo.add(t),!0)}function Tn(t){const o=t.__ref,s=t.tag||"div",n=t.context?.designSystem,e=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const c=i[a];if(typeof t[c]!="function"||H.has(c))continue;const r=c.charCodeAt(0);r>=65&&r<=90||Z(c)||U[c]||V&&V.has(c)||r!==45&&(kt(s,c)||(nt()&&On(t[c],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).`),e.push({prop:c,fn:t[c]})))}for(let a=0;a<e.length;a++){const{prop:c,fn:r}=e[a];o.__exec[c]=r,Object.defineProperty(t,c,{get(){n&&L(n);try{return r(t,t.state,t.context)}catch{return}finally{n&&D()}},set(f){delete o.__exec[c],Object.defineProperty(t,c,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Ln(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const n=o[s];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function T(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...n){return Ln(t,o),s.apply(this,n)}}function yt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function v(t,o){return()=>t.path.join(".")+"::"+o}const Jo=new Set;function R(t,o,s){if(!nt())return;const n=v(t,o)();Jo.has(n)||(Jo.add(n),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const mo=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,Dn=(t,o)=>{let s;try{s=String(t)}catch{return}if(!s.includes("{{"))return;mo.lastIndex=0;let n;for(;(n=mo.exec(s))!==null;)n[2].includes("{{")&&o.add(n[2])},Rn=(t,o)=>!Z(t)&&!et(o,t),ao=(t,o,s,n,e)=>{if(typeof o=="string"){!e&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&Rn(t,n)&&Dn(o,s)},uo=new WeakMap,Ot=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),Tt=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const o=t.props;return o&&typeof o=="object"&&!Array.isArray(o)?ft(t,o):t},Lt=(t,o)=>t&&o?ft(t,o):t||o||null,ts=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&Ot(s,o)},_t=(t,o)=>ts(t,o)?Tt(t.__ref.__runtimeSource[o]):null,Dt=(t,o)=>(o&&t&&typeof t=="object"&&uo.set(t,o),t),Mn=t=>{if(!t||typeof t!="object")return;const o=uo.get(t);return o&&uo.delete(t),o},lo=(t,o,s)=>{if(typeof t=="string"){t.includes("{{")&&o.add(t);return}if(!(!t||typeof t!="object"||s.has(t))){if(s.add(t),Array.isArray(t)){for(let n=0;n<t.length;n++)lo(t[n],o,s);return}if(!t.__ref)for(const n of Object.keys(t)){if(n==="state")continue;const e=Object.getOwnPropertyDescriptor(t,n);e&&"value"in e&&lo(e.value,o,s)}}},Nn=(t,o)=>{let s=null;for(const n of Object.keys(t)){if(H.has(n)||o&&Ot(o,n))continue;const e=Object.getOwnPropertyDescriptor(t,n),i=e&&e.value;if(!Array.isArray(i))continue;const a=new Set;lo(i,a,new Set),a.size&&(s||(s=new Map),s.set(i,a))}return s},os=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const n=s.__ref&&s.__ref.__declaredArrays,e=n&&n.get(o);if(!e)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of e)i.__authoredTemplates.add(a);return}},ss=["attr","aria","data","metadata"],Fn=t=>{if(ss.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},$n=(t,o)=>{const s=new Set,n=t.tag||"div";for(const e of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,e),a=i&&i.value,c=!!o&&Ot(o,e);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Fn(e))continue;const r=c?o[e]:null,f=r&&typeof r=="object"?r:null,l=e.charCodeAt(0)===46||e.charCodeAt(0)===33;for(const u in a){const d=c&&(!f||Ot(f,u)),h=a[u];if(l&&h&&typeof h=="object"&&!Array.isArray(h)&&ss.includes(u)){for(const y in h)ao(y,h[y],s,n,d);continue}ao(u,h,s,n,d)}continue}ao(e,a,s,n,c)}return s};function ns(t,o){const s=t.__ref,n=!!(o&&o.skipIfEffect),e=$n(t,s.__runtimeSource);if(s.__authoredTemplates)for(const r of e)s.__authoredTemplates.add(r);else s.__authoredTemplates=e;if(Tn(t),typeof t.text=="function"){const r=t.text,f=T(t,t.textDeps,r),l=j(()=>{if(!s.contentManaged)try{let u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&typeof u!="object"&&(typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),Wt(t,u))}catch(u){R(s,"text",u)}},{depth:s.path.length,label:v(s,"text")});s.__effects.push(l),s.__exec.text=r}else if(typeof t.text=="string"&&t.text.includes("{{")){const r=t.text,f=j(()=>{if(s.contentManaged)return;const l=I.call(t,r,t.state);l!=null&&(t.text=l),t.node&&Wt(t,l??"")},{depth:s.path.length,label:v(s,"text")});s.__effects.push(f),s.__exec.text=r}const i=t.tag||"div";for(const r of Object.keys(t))if(typeof t[r]=="function"&&!H.has(r)&&!Z(r)&&!s.__exec[r]&&!Io(i,r)){if(U[r]){const f=t[r],l=T(t,t[r+"Deps"],f),u=r;let d,h=null,y=null,A;const g=j(()=>{const b=t.context?.designSystem;b&&L(b);try{const w=l(t,t.state,t.context);Mo();let p;try{p=U[u](w,t,t.state,t.context)}finally{No()}if(Array.isArray(p)){const x={};for(const S of p)if(S)for(const k in S)x[k]=S[k];p=x}const _=u==="show"||u==="hide";if(p&&t.node&&In(p)){const x=Nt(p);if(x===null||x!==A){A=x;const S=Ct(p,null,t.context?.cssPrefix),k=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(y)for(const C of y)t.node.classList.remove(C);if(k&&k.length)for(const C of k)t.node.classList.add(C);y=k}}d=void 0,h=null}else if(p&&t.node){if(y){for(const S of y)t.node.classList.remove(S);y=null,A=void 0}const x=Nt(p);if(x===null||x!==d||!bt(t.node,h)){d=x;const S=ds(t,p);h=gt(t.node,S)}}else t.node&&_&&(d=void 0,h=null,t.node.style.display="")}finally{b&&D()}},{depth:s.path.length,label:v(s,u)});s.__effects.push(g),s.__exec[r]=f}else if(V&&V.has(r)){const f=t[r],l=T(t,t[r+"Deps"],f),u=r;let d,h=null;const y=j(()=>{const A=t.context?.designSystem;A&&L(A);try{const g=l(t,t.state,t.context);if(t.node)if(g!=null){const b=u+":"+String(g);if(b!==d||!bt(t.node,h)){d=b;const w={[u]:g},p=ds(t,w);h=gt(t.node,p)}}else d=void 0,h=null,t.node.style[u]=""}finally{A&&D()}},{depth:s.path.length,label:v(s,u)});s.__effects.push(y),s.__exec[r]=f}else if(r.charCodeAt(0)===45){const f=t[r];as(t,r,f,t[r+"Deps"],r),s.__exec[r]=f}}if(Un(t),typeof t.html=="function"){const r=t.html,f=T(t,t.htmlDeps,r),l=j(()=>{const u=t.context?.designSystem;u&&L(u);try{const d=f(t,t.state,t.context);t.node&&d!=null&&typeof d!="function"&&(t.node.innerHTML=d)}finally{u&&D()}},{depth:s.path.length,label:v(s,"html")});s.__effects.push(l),s.__exec.html=r}if(typeof t.value=="function"){const r=t.value,f=T(t,t.valueDeps,r),l=j(()=>{try{let u=f(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),is(t,u)}catch(u){R(s,"value",u)}},{depth:s.path.length,label:v(s,"value")});s.__effects.push(l),s.__exec.value=r}else if(typeof t.value=="string"&&t.value.includes("{{")){const r=t.value,f=j(()=>{try{is(t,I.call(t,r,t.state))}catch(l){R(s,"value",l)}},{depth:s.path.length,label:v(s,"value")});s.__effects.push(f),s.__exec.value=r}if(typeof t.style=="function"){const r=t.style,f=T(t,t.styleDeps,r);let l,u=null;const d=j(()=>{const h=_o(t,f(t,t.state,t.context)),y=Nt(h);(y===null||y!==l||!bt(t.node,u))&&(l=y,Kt(t.node,u,h),X(t.node,h),u=gt(t.node,h))},{depth:s.path.length,label:v(s,"style")});s.__effects.push(d),s.__exec.style=r}else if(t.style&&typeof t.style=="object")for(const r in t.style){const f=t.style[r];if(typeof f!="function")continue;const l=T(t,yt(t.styleDeps,r),f);let u,d=null;const h=j(()=>{try{const y=l(t,t.state,t.context);if(t.node){const A=r+":"+String(y);if(A!==u||!bt(t.node,d)){u=A;const g=_o(t,{[r]:y});Kt(t.node,d,Object.assign({},g,{[r]:""})),X(t.node,g),d=gt(t.node,g)}}}catch(y){R(s,"style."+r,y)}},{depth:s.path.length,label:v(s,"style."+r)});s.__effects.push(h)}if(t.attr&&typeof t.attr=="object"){for(const r in t.attr)if(typeof t.attr[r]=="function"){const f=T(t,yt(t.attrDeps,r),t.attr[r]),l=r,u=j(()=>{try{let d=f(t,t.state,t.context);if(typeof d=="string"&&d.includes("{{")&&(d=I.call(t,d,t.state)),t.node?.setAttribute){const h=Rt(t.node,l);d==null||d===!1&&!lt(l)?t.node.removeAttribute(l):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(l,W(l,d)),Mt(t.node,h)}}catch(d){R(s,"attr."+l,d)}},{depth:s.path.length,label:v(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}else if(typeof t.attr[r]=="string"&&t.attr[r].includes("{{")){const f=t.attr[r],l=r,u=j(()=>{try{const d=I.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,W(l,d??""))}catch(d){R(s,"attr."+l,d)}},{depth:s.path.length,label:v(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}}if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const f=t.aria[r];if(typeof f=="string"&&f.includes("{{")){const h=f,y="aria-"+r.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),A=j(()=>{try{const g=I.call(t,h,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(y,W(y,g??""))}catch(g){R(s,"aria."+r,g)}},{depth:s.path.length,label:v(s,"aria."+r)});A._attrName=y,s.__effects.push(A);continue}if(typeof f!="function")continue;const l=T(t,yt(t.ariaDeps,r),t.aria[r]),u="aria-"+r.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),d=j(()=>{try{const h=l(t,t.state,t.context);if(!t.node?.setAttribute)return;h==null?t.node.removeAttribute(u):typeof h!="function"&&typeof h!="object"&&t.node.setAttribute(u,W(u,h))}catch(h){R(s,"aria."+r,h)}},{depth:s.path.length,label:v(s,"aria."+r)});d._attrName=u,s.__effects.push(d)}if(t.data&&typeof t.data=="object")for(const r in t.data){const f=t.data[r];if(typeof f=="string"&&f.includes("{{")){const y=f,A="data-"+r.replace(/[A-Z]/g,b=>"-"+b.toLowerCase()),g=j(()=>{try{const b=I.call(t,y,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(A,b??"")}catch(b){R(s,"data."+r,b)}},{depth:s.path.length,label:v(s,"data."+r)});g._attrName=A,s.__effects.push(g);continue}if(typeof f!="function")continue;const l=T(t,yt(t.dataDeps,r),t.data[r]),d="data-"+r.replace(/[A-Z]/g,y=>"-"+y.toLowerCase()),h=j(()=>{try{const y=l(t,t.state,t.context);if(!t.node?.setAttribute)return;y==null||y===!1?t.node.removeAttribute(d):typeof y!="function"&&typeof y!="object"&&t.node.setAttribute(d,y===!0?"":y)}catch(y){R(s,"data."+r,y)}},{depth:s.path.length,label:v(s,"data."+r)});h._attrName=d,s.__effects.push(h)}const a=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(a)for(const r in a){if(typeof a[r]!="function")continue;const f=T(t,yt(t.classDeps,r),a[r]),l=j(()=>{try{const u=f(t,t.state,t.context);if(!t.node?.classList)return;typeof u=="string"?t.node.classList.add(u):u?t.node.classList.add(r):t.node.classList.remove(r)}catch(u){R(s,"class."+r,u)}},{depth:s.path.length,label:v(s,"class."+r)});s.__effects.push(l)}!n&&typeof t.if=="function"&&rs(t,s,t.if);for(const r of Object.keys(t)){if(H.has(r)||typeof t[r]!="function")continue;const f=r.charCodeAt(0);if(f>=65&&f<=90||Z(r))continue;const l=t[r];s.__exec[r]=l;const u=t.tag||"div";if(kt(u,r)&&!et(u,r)){const d=vt(r)||r,h=T(t,t[r+"Deps"],l),y=j(()=>{try{let A=h(t,t.state,t.context);if(typeof A=="string"&&A.includes("{{")&&(A=I.call(t,A,t.state)),t.node?.setAttribute){const g=Rt(t.node,d);A==null||A===!1&&!lt(d)?t.node.removeAttribute(d):typeof A!="function"&&typeof A!="object"&&(d==="src"&&"src"in t.node?t.node.src=A:t.node.setAttribute(d,W(d,A))),Mt(t.node,g)}}catch(A){R(s,r,A)}},{depth:s.path.length,label:v(s,r)});y._attrName=d.toLowerCase(),s.__effects.push(y)}}const c=t.tag||"div";for(const r of Object.keys(t)){if(H.has(r))continue;const f=t[r];if(typeof f!="string"||!f.includes("{{"))continue;const l=r.charCodeAt(0);if(l>=65&&l<=90||Z(r)||et(c,r)||so[r]||!kt(c,r))continue;const u=vt(r)||r,d=j(()=>{try{const h=I.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,W(u,h??""))}catch(h){R(s,r,h)}},{depth:s.path.length,label:v(s,r)});d._attrName=u.toLowerCase(),s.__effects.push(d)}if(zn(t),oe(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const r=t.onStateUpdate,f=t.stateDeps;let l=!1,u=[];const d=j(()=>{const h=[];for(let b=0;b<f.length;b++){const w=f[b];try{h[b]=typeof w=="function"?w(t,t.state,t.context):t.state?.[w]}catch{h[b]=void 0}}if(!l){l=!0,u=h;return}let y=h.length!==u.length;for(let b=0;!y&&b<h.length;b++)h[b]!==u[b]&&(y=!0);const A=u;if(u=h,!y)return;const g=t.context?.designSystem;g&&L(g);try{r(t,t.state,t.context,{prev:A,next:h})}catch(b){if(t.context?.plugins?.length&&q("error",t,{hook:"onStateUpdate",error:b})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',b),t.context?.strictMode)throw b}finally{g&&D()}},{depth:s.path.length,label:v(s,"onStateUpdate")});s.__effects.push(d)}Qn(t)}function es(t){const o=t.parent,s=o?.node;if(!s||!t.node){Is(t,t.parent);return}let n=null;const e=Object.keys(o),i=e.indexOf(t.key);for(let a=i+1;a<e.length;a++){const c=o[e[a]];if(c?.node?.parentNode===s){n=c.node;break}}n?s.insertBefore(t.node,n):s.appendChild(t.node)}function rs(t,o,s){let n=T(t,t.ifDeps,s);const e=j(()=>{const i=!o.__ifInitialized&&o.__ifLateMerge;if(i){const r=t.context?.components||{};i.names.some(f=>r[f]||r["smbls."+f])&&(o.__ifLateMerge=null,bn(t,i),n=T(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=n(t,t.state,t.context)}catch(r){if(a=!1,o.__ifError=r,typeof console<"u"&&console.warn){const f=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${f} \u2014 treating as false:`,r?.message||r)}return}const c=o.__if;if(o.__if=!!a,c&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(r){console.error("[smbls] onRemove error:",r)}}else if(!c&&o.__if)if(o.__ifInitialized)t.node||(t.node=oo(t)),t.node&&(t.node.ref=t),es(t),po(t),xo(t),M("Render",t,{}),ro(t,{});else{if(o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=Oo(t)),M("Init",t,{}),t.node||(t.node=oo(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"&&!o.__fragmentAnchor){const f=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(f),o.__fragmentAnchor=f}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),Fs(t,{}),ns(t,{skipIfEffect:!0}),po(t),Es(t),xo(t),Ms(t),$s(t,{}),es(t),M("Create",t,{}),M("Complete",t,{}),M("Render",t,{}),M("RenderRouter",t,{}),ro(t,{})}},{depth:o.path.length,label:v(o,"if")});o.__effects.push(e)}function Wt(t,o){const s=t.node;if(!s)return;const n=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==n&&(s.nodeValue=n);return}const e=t.__ref;let i=e?e.__textNode:null;if(i&&i.parentNode!==s&&(i=null),!i){const a=s.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==n&&(i.nodeValue=n):s.firstChild?(i=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),s.insertBefore(i,s.firstChild)):(s.textContent=n,i=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),e&&(e.__textNode=i||null)}function Rt(t,o){return o!=="checked"||!t||t.tagName!=="INPUT"?null:t.hasAttribute("checked")}function Mt(t,o){if(o===null)return;const s=t.hasAttribute("checked");s!==o&&t.checked!==s&&(t.checked=s)}function is(t,o){const s=t.node;if(!s||!("value"in s))return;const n=o==null?"":String(o);if(s.value===n)return;const e=typeof document<"u"&&document.activeElement===s,i=e&&typeof s.selectionStart=="number"?s.selectionStart:null,a=e&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=n,e&&i!=null&&a!=null)try{s.setSelectionRange(i,a)}catch{}const c=t.__ref&&t.__ref.__autoGrow;c&&c.active&&c.resize()}function po(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Wt(t,t.text),js(t),typeof t.html=="string"&&(o.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in o){const s=String(t.value);o.value!==s&&(o.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const n in t.style)if(typeof t.style[n]=="function"){s={};for(const e in t.style)typeof t.style[e]!="function"&&(s[e]=t.style[e]);break}X(o,_o(t,s))}if(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&&(typeof n=="string"&&n.includes("{{")||n===!1&&!lt(s)||o.setAttribute&&o.setAttribute(s,W(s,n)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&o.setAttribute&&o.setAttribute("data-theme",t.themeModifier),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||typeof n=="string"&&n.includes("{{")||o.dataset&&(o.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&&o.classList.add(n));else if(typeof s=="object")for(const n in s){const e=typeof s[n]=="function"?s[n](t,t.state,t.context):s[n];e&&o.classList.add(typeof e=="string"?e:n)}}}}function Nt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function In(t){if(!t||typeof t!="object")return!1;for(const o in t){const s=t[o];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function gt(t,o){if(!t||!t.style||!o)return null;const s=t.style,n=[];for(const e in o){if(o[e]==null||e.charAt(0)==="&")continue;const a=Q(e);n.push(a,ho(s,a),cs(s,a))}return n}function ho(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function cs(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Q(t){return it(t)?t:t.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())}function Kt(t,o,s){if(!t||!t.style||!o||!o.length)return;const n=t.style,e=new Set;if(s&&typeof s=="object")for(const i in s)s[i]==null||i.charAt(0)==="&"||e.add(Q(i));for(let i=0;i<o.length;i+=3){const a=o[i];e.has(a)||ho(n,a)===o[i+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function bt(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let n=0;n<o.length;n+=3)if(ho(s,o[n])!==o[n+1]||cs(s,o[n])!==o[n+2])return!1;return!0}const it=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,fs=t=>typeof t=="number"||t===!0||typeof t=="string"&&t!=="",zt=t=>it(t)?t:"--"+t;function Yt(t,o){if(!tt(t))return null;let s=null;for(const n of Object.keys(t)){if(!n)continue;let e=t[n];if(typeof e=="function"){if(!o)continue;e=e(o,o.state,o.context)}fs(e)&&(s||(s={}),s[zt(n)]=e)}return s}function as(t,o,s,n,e){const i=t.__ref,a=T(t,n,s);let c,r=null;const f=j(()=>{const l=t.context?.designSystem;l&&L(l);try{const u=a(t,t.state,t.context),d=t.node;if(!d||!d.style)return;if(!fs(u)){Kt(d,r,null),c=void 0,r=null;return}const h=String(u);if(h!==c||!bt(d,r)){c=h;const y={[o]:u};X(d,y),r=gt(d,y)}}catch(u){R(i,e,u)}finally{l&&D()}},{depth:i.path.length,label:v(i,e)});i.__effects.push(f)}function Un(t){const o=t.__ref,s=t.vars;if(typeof s=="function"){Bn(t,s),o.__exec.vars=s;return}if(tt(s))for(const n of Object.keys(s)){const e=s[n];!n||typeof e!="function"||as(t,zt(n),e,yt(t.varsDeps,n),"vars."+n)}}function Bn(t,o){const s=t.__ref,n=T(t,t.varsDeps,o);let e,i=null;const a=j(()=>{const c=t.context?.designSystem;c&&L(c);try{const r=Yt(n(t,t.state,t.context)),f=t.node;if(!f||!f.style)return;const l=Nt(r);(l===null||l!==e||!bt(f,i))&&(e=l,Kt(f,i,r),r&&X(f,r),i=r?gt(f,r):null,s.__varsInline=r?new Set(Object.keys(r)):null)}catch(r){R(s,"vars",r)}finally{c&&D()}},{depth:s.path.length,label:v(s,"vars")});s.__effects.push(a)}function yo(t,o){if(typeof t[o]=="function"&&(et(t.tag||"div",o)||o.charCodeAt(0)===45))return!0;if(!it(o))return!1;const s=t.vars;if(typeof s=="function"){const n=t.__ref&&t.__ref.__varsInline;return!!(n&&n.has(o))}if(!tt(s))return!1;for(const n of Object.keys(s))if(typeof s[n]=="function"&&zt(n)===o)return!0;return!1}function Hn(t){let o=null;for(const s in t)t[s]!=null&&s.charAt(0)!=="&"&&(o||(o=new Set),o.add(Q(s)));return o}function Vn(t,o,s,n){const e=t.__ref;if(!e)return;let i=null;if(s)for(const a of s){if(n&&n.has(a))continue;const c=o[a];if(c==null||typeof c=="object")continue;const r=Q(a);Bt[r]&&(i||(i={}),i[r]=c)}e.__declaredLonghands=i}function us(t,o){const s=t.__ref,n=s&&s.__declaredLonghands;if(!n||!o)return null;let e=null;for(const i in n){if(o.has(i))continue;const a=Bt[i];let c=!1;for(let r=0;r<a.length;r++)if(o.has(a[r])){c=!0;break}c&&(e||(e={}),e[i]=n[i])}return e}function ds(t,o){const s=t.node;X(s,o);const n=Hn(o);if(!n)return o;const e=t.__ref;if(e)if(e.__inlineCssKeys)for(const a of n)e.__inlineCssKeys.add(a);else e.__inlineCssKeys=new Set(n);const i=us(t,n);return i?(X(s,i),Object.assign({},o,i)):o}function Gn(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=us(t,o.__inlineCssKeys);s&&X(t.node,s)}function _o(t,o){if(!o||typeof o!="object")return o;const s=t&&t.context&&t.context.designSystem;s&&L(s);try{return sn(o,t)}catch{return o}finally{s&&D()}}function X(t,o){if(!t||!o||!t.style)return;let s=null;for(const n in o){const e=o[n];if(e!=null){if(n.charAt(0)==="&"&&typeof e=="object"){s||(s={}),s[n]=e;continue}try{const i=String(e),a=it(n)?n:n.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),c=i.trim(),r=/\s*!important\s*$/.test(c),f=c.replace(/\s*!important\s*$/,"");t.style.setProperty(a,f,r?"important":"")}catch{}}}s&&Wn(t,s)}function Wn(t,o){const s=`_ds${Uo.scopedStyleId++}`;t.classList.add(s);const n=t.ownerDocument;let e=n.querySelector("style[data-smbls-scoped]");e||(e=n.createElement("style"),e.setAttribute("data-smbls-scoped",""),n.head.appendChild(e));let i="";for(const a in o){const c="."+s,r=a.replace(/&/g,c).split(",").map(l=>{const u=l.trim();return u.includes(c)?u:c+u}).join(", "),f=o[a];if(typeof f=="object"){let l="",u="";for(const d in f){const h=f[d];if(typeof h=="object"){const y=d.includes("&")?r.split(", ").map(g=>d.replace(/&/g,g)).join(", "):r.split(", ").map(g=>`${g} ${d}`).join(", ");let A="";for(const g in h)A+=`${Q(g)}: ${h[g]};`;u+=Fo(`${y} { ${A} }`,y)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),u&&(i+=u)}}i&&(e.textContent+=i)}const ls=new Set;function ps(t){if(!Array.isArray(t))return"";const o=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&o.push(t[s]);return o.sort(),o.join("|")}function Kn(t,o,s){const n=ps(s);queueMicrotask(()=>{if(!t.__ref)return;let e;try{e=o(t,t.state,t.context)}catch{return}if(ps(e)===n)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";ls.has(i)||(ls.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(e)?e.join(", "):String(e)}]. 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 zn(t){const o=t.subscribeTo,s=typeof o=="function";let n=o;if(s)try{n=o(t,t.state,t.context)}catch{n=null}if(s&&nt()&&Kn(t,o,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const e=t.__ref;for(let i=0;i<n.length;i++){const a=n[i];if(typeof a!="string"||a.length===0)continue;const c=a.split("."),r=c[0],f=c.slice(1),l={value:!1},u=j(()=>{const d=t.state&&(z(t.state)?t.state.root:null);if(!d||!z(d))return;let h=d;h=h[r];for(let A=0;A<f.length&&!(h==null||typeof h!="object");A++)if(z(h))h=h[f[A]];else break;if(!l.value)return;let y=!1;if(typeof t.onBeforeUpdate=="function"){const A=t.context?.designSystem;A&&L(A);try{if(ge(e)){const g=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});g&&typeof g.then=="function"?g.then(()=>Zt(e,!1),b=>{Zt(e,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:b})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",b)}):(Zt(e,!1),g===!1&&(y=!0))}}catch(g){Zt(e,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:g})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",g)}finally{A&&D()}}if(!y&&t.node&&e.__effects)for(let A=0;A<e.__effects.length;A++){const g=e.__effects[A];g&&g!==u&&!g._disposed&&!g._isSubscribeToEffect&&typeof g._execute=="function"&&g._execute()}if(!y&&typeof t.onUpdate=="function"){const A=t.context?.designSystem;A&&L(A);try{t.onUpdate(t,t.state,t.context)}catch(g){t.context?.plugins?.length&&q("error",t,{hook:"onUpdate",error:g})||console.error("[DOMQL] subscribeTo onUpdate error:",g)}finally{A&&D()}}},{depth:e.path.length,label:v(e,"subscribeTo("+a+")")});l.value=!0,u._isSubscribeToEffect=!0,e.__effects.push(u)}}function go(t,o){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!o.context?.designSystem?.media?.[t.slice(1)])}function bo(t,o){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=o.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const hs=new Set;function Yn(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",n=s+"::"+t;hs.has(n)||(hs.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.`))}const ys=new Map;function qn(t){let o=ys.get(t);if(o)return o;o=[];const s=n=>{if(n)for(const e of n)o.push(e.replace(/-([a-z])/g,(i,a)=>a.toUpperCase()))};return s(Bt[t]),s(cn[t]),ys.set(t,o),o}function _s(t,o,s){if(yo(t,o)||s&&s.has(o))return!0;const n=qn(Q(o));for(let e=0;e<n.length;e++){const i=n[e];if(yo(t,i)||s&&s.has(i))return!0}return!1}function At(t,o,s,n){const e={},i=new Set,a=(c,r,f)=>{const l=f?new Set(Object.keys(e)):null;if(U[c]){const u=U[c](r,o,o.state,o.context);if(u){const d=Array.isArray(u)?u:[u];for(const h of d)h&&Object.assign(e,h)}}else e[c]=r;if(f)for(const u in e)l.has(u)||i.add(u)};for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;let r=t[c];if(typeof r=="function"&&(r=r(o,o.state,o.context)),!(r==null||typeof r=="function")){if(typeof r=="object"&&!Array.isArray(r)){if(c==="style"){for(const u in r){let d=r[u];typeof d=="function"&&(d=d(o,o.state,o.context)),!(d==null||typeof d=="function")&&a(u,d,_s(o,u,n))}continue}if(c==="vars"){const u=Yt(r,o);if(u)for(const d in u)a(d,u[d],yo(o,d)||!!(n&&n.has(d)));continue}if(go(c,o)){const u=At(r,o,!1,n);Object.keys(u).length&&(e[`[data-theme="${c.slice(1)}"] &`]=u);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(c)){nt()&&Yn(c,o);continue}const f=bo(c,o),l=At(r,o,!1,n);Object.keys(l).length&&(e[f]=l);continue}a(c,r,_s(o,c,n))}}if(s)for(const c in e)i.add(c);for(const c of i){const r=e[c];typeof r=="string"&&!r.includes("!important")&&(e[c]=r+" !important")}return e}const tt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function gs(t,o){for(const s in o){const n=o[s];t[s]=tt(n)?gs(tt(t[s])?t[s]:{},n):n}return t}function Zn(t,o){if(!tt(o))return;let s;for(const n of t.split(" ")){const e=n?o[n]:null;tt(e)&&(s=gs(s||{},e))}return s}function Ao(t,o){if(o===void 0&&(o=0),o>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)&&Ao(t[s],o+1))return!0}return!1}function bs(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(go(t,s)){const i=At(o,s,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const n=bo(t,s),e=At(o,s,!1);return Object.keys(e).length?{cssProp:n,block:e}:null}function Qn(t){const o=t.__ref;for(const s of Object.keys(t)){if(!io(s))continue;const n=t[s];if(!n||typeof n!="object"||Array.isArray(n)||!Ao(n))continue;let e=null,i;const a=j(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&L(c);let r,f=!1;try{const l=bs(s,n,t),u=l?Nt(l.block)+"::"+l.cssProp:null;if(u!==null&&u===i)f=!0;else if(i=u,l){const d=Ct({[l.cssProp]:l.block},null,t.context?.cssPrefix);r=d?d.split(" ").filter(Boolean):null}else r=null}finally{c&&D()}if(!(f||!t.node.classList)){if(e)for(const l of e)t.node.classList.remove(l);if(r&&r.length)for(const l of r)t.node.classList.add(l);e=r}},{depth:o.path.length,label:v(o,"cssBlock("+s+")")});o.__effects.push(a)}}const Xn=()=>!0,Jn=(t,o)=>{const s=t.charAt(0);return(s===":"||s==="@"||s==="&"||s==="[")&&o&&typeof o=="object"&&!Array.isArray(o)?!0:!!U[t]||!!(V&&V.has(t))||it(t)||t==="vars"};function mn(t,o,s){const n={};let e=!1;for(const c in s)Object.prototype.hasOwnProperty.call(s,c)&&(c!=="data"&&c!=="aria"&&(Jn(c,s[c])||H.has(c))?n[c]=!0:e=!0);if(!e)return null;const i=en({[o]:s},t.tag||"div",n,Xn);let a=null;for(const c in i)/^on/i.test(c)||(a||(a={}),a[c]=i[c]);return a}function As(t,o,s,n,e,i){const a=t.node;let c=null;const r=f=>{(c||(c=[])).push(f)};for(const f in n){const l=o.owners.get(f),u=l===s;if(!i&&l!==void 0&&!u)continue;let d;try{d=n[f](t)}catch(A){R(t.__ref,"conditional("+s+")."+f,A),u&&r(f);continue}if(typeof d=="string"&&d.includes("{{")&&(d=I.call(t,d,t.state)),u&&a.getAttribute(f)!==o.written.get(f)){r(f);continue}if(d==null||typeof d=="object"||typeof d=="function"){u&&xs(a,o,f);continue}const h=d===!1&&!lt(f)?null:String(W(f,d));if(r(f),u&&h===o.written.get(f))continue;l===void 0&&o.base.set(f,a.getAttribute(f));const y=Rt(a,f);h==null?a.removeAttribute(f):a.setAttribute(f,h),Mt(a,y),o.owners.set(f,s),o.written.set(f,h)}e.appliedAttrs=c}function xs(t,o,s){if(t.getAttribute(s)===o.written.get(s)){const n=o.base.get(s),e=Rt(t,s);n==null?t.removeAttribute(s):t.setAttribute(s,n),Mt(t,e)}o.owners.delete(s),o.base.delete(s),o.written.delete(s)}function te(t,o,s,n){const e=n.appliedAttrs;if(n.appliedAttrs=null,!!e)for(const i of e)o.owners.get(i)===s&&xs(t.node,o,i)}function xo(t){const o=t.__ref&&t.__ref.__conditionalAttrs,s=t.node;if(!(!o||!o.owners.size||!s||!s.getAttribute))for(const n of o.owners.keys()){const e=o.written.get(n),i=s.getAttribute(n);i!==e&&(o.base.set(n,i),e==null?s.removeAttribute(n):s.setAttribute(n,e))}}function oe(t){const o=t.__ref;o.__conditionalRunners=[];let s=null;const n=new Map;for(const e of Object.keys(t)){const i=e.charAt(0);if(i!=="."&&i!=="!")continue;const a=e.slice(1);if(!a)continue;if(/[:@\s>~+[\]]/.test(a)){if(typeof console<"u"&&console.warn){const g=a.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${i}\` is read as one prop name. Nest the selector inside instead: \`${i}${g}: { '${a.slice(g.length)}': {...} }\`.`)}continue}const c=t[e];if(!c||typeof c!="object")continue;const r=i==="!",f={lastMatch:!1,appliedKeys:null,appliedClasses:null,appliedAttrs:null},l=mn(t,e,c);l&&!s&&(s=o.__conditionalAttrs={owners:new Map,base:new Map,written:new Map});const u=new Set;for(const g in c){if(!Object.prototype.hasOwnProperty.call(c,g))continue;const b=g.charAt(0),w=c[g];if(!((b===":"||b==="@"||b==="&"||b==="[")&&w&&typeof w=="object"&&!Array.isArray(w))){if(g==="vars"&&tt(w)){for(const p of Object.keys(w))p&&u.add(zt(p));continue}u.add(g)}}const d=()=>{let g;const b=t[a];if(b===void 0){const _=!!t.state&&a in t.state,x=t.state?t.state[a]:void 0;if(_||x!==void 0)g=x;else{const S=t.context?.cases?.[a];if(S===void 0)return;try{g=typeof S=="function"?S.call(t,t):S}catch(k){g=!1,o.__conditionalError=k,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,k?.message||k)}}}else if(typeof b=="function")try{g=b(t,t.state,t.context)}catch(_){g=!1,o.__conditionalError=_,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else g=b;const w=r?!g:!!g;if(!t.node)return;const p=t.context?.designSystem;if(w===f.lastMatch){if(w&&l&&t.node.setAttribute){p&&L(p);try{As(t,s,e,l,f,!1)}finally{p&&D()}}return}f.lastMatch=w,p&&L(p);try{if(w){const _={},x={};let S=!1;for(const C in c){if(!Object.prototype.hasOwnProperty.call(c,C))continue;const N=c[C],ot=C.charAt(0);if((ot===":"||ot==="@"||ot==="&"||ot==="[")&&N&&typeof N=="object"&&!Array.isArray(N)){if(go(C,t)){const P=At(N,t,!1,u);Object.keys(P).length&&(x[`[data-theme="${C.slice(1)}"] &`]=P,S=!0)}else{const P=bo(C,t),F=At(N,t,!1,u);Object.keys(F).length&&(x[P]=F,S=!0)}continue}const st=typeof N=="function"?N(t,t.state,t.context):N;if(st!=null){if(U[C]){const P=U[C](st,t,t.state,t.context);if(P){const F=Array.isArray(P)?P:[P];for(const xt of F)xt&&Object.assign(_,xt)}}else if(V&&V.has(C))_[C]=st;else if(it(C))_[C]=st;else if(C==="vars"){const P=Yt(st,t);P&&Object.assign(_,P)}}}const k=Object.keys(_);if(k.length){X(t.node,_);for(const C of k)n.set(C,e);f.appliedKeys=k}else f.appliedKeys=null;if(S){const C=Ct(x,null,t.context?.cssPrefix,{state:!0}),N=C?C.split(" ").filter(Boolean):[];if(N.length&&t.node.classList){for(const ot of N)t.node.classList.add(ot);f.appliedClasses=N}else f.appliedClasses=null}else if(f.appliedClasses){for(const C of f.appliedClasses)t.node.classList.remove(C);f.appliedClasses=null}l&&t.node.setAttribute&&As(t,s,e,l,f,!0)}else{if(f.appliedAttrs&&te(t,s,e,f),f.appliedKeys){for(const _ of f.appliedKeys)n.get(_)===e&&(it(_)?t.node.style.removeProperty(_):t.node.style[_]="",n.delete(_));f.appliedKeys=null}if(f.appliedClasses){for(const _ of f.appliedClasses)t.node.classList.remove(_);f.appliedClasses=null}}}finally{p&&D()}};o.__conditionalRunners.push(d);const h=T(t,t[a+"Deps"],d),y=j(h,{depth:o.path.length,label:v(o,"conditional("+e+")")}),A=o.__exec&&o.__exec[a]||t[a];y._sources.size===0&&typeof A=="function"&&nt()&&vn(A)&&console.warn(`[smbls] conditional \`${e}\` 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 \`${a}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(y)}}const wo=new WeakSet,ws=new WeakSet,Ss=new WeakSet;function se(t){if(Ss.has(t))return!1;if(!ws.has(t)){ws.add(t);const o=t.defaultView,s=()=>{Ss.add(t)};o&&typeof o.requestAnimationFrame=="function"?o.requestAnimationFrame(s):setTimeout(s,0)}return!0}function ne(t){const o=t.ownerDocument;!o||wo.has(o)||se(o)||(wo.add(o),queueMicrotask(()=>{wo.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const So=new WeakSet;let Cs=!1;function ks(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Co(t,o){const s={...t};for(const n in o){const e=o[n],i=s[n];s[n]=e&&typeof e=="object"&&i&&typeof i=="object"?Co(i,e):e}return s}function vs(t,o){const s={};for(const n in t){const e=t[n];if(e&&typeof e=="object"){const i=vs(e,o);Object.keys(i).length&&(s[n]=i)}else o.has(n)||(s[n]=e)}return s}function ee(t,o,s){let n=null;for(const[e,i]of o){const a=Q(e),c=Bt[a];if(c)for(let r=0;r<c.length;r++){const f=c[r].replace(/-([a-z])/g,(y,A)=>A.toUpperCase()),l=t[f]!=null?o.get(f):void 0,u=s&&s.get(c[r]),d=l!==void 0&&l>i&&$o(c[r],t[f],a),h=!d&&u!==void 0&&u>i&&$o(c[r],void 0,a);if(d||h){d&&delete t[e],n||(n=new Set),n.add(e);break}}}return n}function js(t){const{node:o}=t;if(!o)return;if(Cs||(Cs=!0,Ct({display:"none"})),So.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}So.add(t);const s=t.context?.designSystem;s&&L(s),Mo();try{const n={};let e=!1,i=[],a=null,c=null,r=null;const f=t.__ref&&t.__ref.__mergeLayer;let l,u=null,d=null;const h=(p,_)=>{if(_&&typeof _=="object"&&ks(p)){c||(c={});const x=c[p];x&&(_=Co(x,_)),c[p]=_}else(_===null||typeof _!="object")&&(r||(r=new Set),r.add(p),l!==void 0&&(u||(u=new Map),u.set(p,l)));n[p]=_};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&U.theme){const p=U.theme(t.theme,t,t.state,t.context);if(p){const _=x=>{for(const S in x){const k=x[S];k&&typeof k=="object"&&ks(S)&&(a||(a={}),a[S]=k),n[S]=k}};if(Array.isArray(p))for(const x of p)x&&_(x);else _(p);e=!0}}const y=(p,_)=>{if(p==="vars"){const x=Yt(_);if(x){for(const S in x)h(S,x[S]);e=!0}return}if(U[p]){const x=U[p](_,t,t.state,t.context);if(x){if(Array.isArray(x)){for(const S of x)if(S)for(const k in S)h(k,S[k])}else for(const S in x)h(S,x[S]);e=!0}}else if(V&&V.has(p))_!=null&&typeof _!="object"&&(h(p,_),e=!0);else if(p.charCodeAt(0)===45)_!=null&&typeof _!="object"&&(h(p,_),e=!0);else if((p.charAt(0)==="&"||p.charAt(0)==="@"||p.charAt(0)===":"||p.charAt(0)==="[")&&_&&typeof _=="object"&&!Array.isArray(_)){if(Ao(_))return;const x=bs(p,_,t);x&&(h(x.cssProp,x.block),e=!0)}};if(typeof t.class=="string"){const p=Zn(t.class,t.context?.designSystem?.class);if(p)for(const _ in p)y(_,p[_])}const A=r?new Set(r):null,g=t.tag||"div";for(const p of Object.keys(t)){if(typeof t[p]=="function"){const x=f&&f.get(p);x!==void 0&&et(g,p)&&(d||(d=new Map),d.set(Q(p),x));continue}if(l=f?f.get(p):void 0,p==="vars"){y(p,t[p]);continue}if(H.has(p)||p==="theme")continue;const _=p.charCodeAt(0);_>=65&&_<=90||Z(p)||Io(g,p)||y(p,t[p])}l=void 0;const b=u?ee(n,u,d):null;if(a)for(const p in a){let _=r?vs(a[p],r):a[p];c&&c[p]&&(_=Co(_,c[p])),Object.keys(_).length?n[p]=_:delete n[p]}if(Vn(t,n,r,b?new Set([...A||[],...b]):A),e){n.display&&String(n.display).includes("!important")&&(o.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const p=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof p=="string"&&p!==""&&n.display&&n.display!==p&&(n.display=p);const _=Ct(n,null,t.context?.cssPrefix);if(i=_?_.split(" ").filter(Boolean):[],_&&o.classList){const x=i;let S=!1;for(const k of x)o.classList.add(k),S||(k.charCodeAt(0)===95&&k.charCodeAt(1)===99||k.charCodeAt(0)===95&&k.indexOf("_c",1)!==-1)&&(S=!0);S&&ne(o)}}const w=t.__ref;if(w){const p=w.__staticCssClasses;if(p&&o.classList){const _=new Set(i);for(const x of p)_.has(x)||o.classList.remove(x)}w.__staticCssClasses=i}Gn(t)}finally{No(),s&&D(),So.delete(t)}}const We=t=>!!U[t]||!!(V&&V.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Ke(t){t&&t.node&&js(t)}function Es(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const i=t.aria[e];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());o.setAttribute(a,W(a,i))}const s=nn(t);for(const e in s){const i=s[e];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&o.setAttribute(e,i===!0?"":i)}const n=t.tag||"div";for(const e of Object.keys(t)){if(typeof t[e]=="function"||H.has(e)||e==="on"||s[e]!==void 0)continue;const i=e.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(e)&&!et(n,e)&&kt(n,e)){let a=t[e];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!so[e])continue;a=I.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!lt(vt(e)||e))continue;const c=vt(e)||e;o.setAttribute(c,W(c,a))}}}function ze(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const n=o.charCodeAt(0);if(n>=65&&n<=90||Z(o))return;const e=t.tag||"div";if(et(e,o)||!kt(e,o))return;const i=vt(o)||o,a=i.toLowerCase(),c=t.__ref&&t.__ref.__effects;let r=!1;if(c)for(let d=0;d<c.length;d++){const h=c[d];h&&h._attrName===a&&!h._disposed&&typeof h._execute=="function"&&(r=!0,h._execute())}if(r)return;let f=t[o];const l=so[o];if(l&&f!=null){const d=l(t);d!==void 0&&(f=d)}typeof f=="string"&&f.includes("{{")&&(f=I.call(t,f,t.state));const u=Rt(s,i);f==null||f===!1&&!lt(i)?s.removeAttribute(i):typeof f!="function"&&typeof f!="object"&&s.setAttribute(i,W(i,f)),Mt(s,u)}function re(t,o){const s=t.node,n=t.__ref;let e=n.__autoGrow;if(!o){if(e&&e.active){try{s.removeEventListener("input",e.resize)}catch{}Os(e),rt.delete(t),s.style.height="",e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""),Ds(s,e,!1),e.active=!1,e.appliedMax=null,e.lastMeasure=0}return}e||(e=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!s.isConnected){Ft(t,!0);return}if(!(s.scrollHeight>0)){e.awaitingLayout=!0,Ps(t,e);return}e.awaitingLayout=!1;const a=fe(s),c=ae(a),r=s.style.height;s.style.height="0px",c&&vo(s);const f=s.scrollHeight;if(!(f>0)){s.style.height=r,c&&vo(s);return}const l=ue(s,a),u=l!=null&&f<l?l:f,d=pe(a),h=d!=null&&u>d;s.style.height=le(h?d:u,a)+"px",c&&vo(s),Ds(s,e,h),e.lastMeasure=f,e.lastWidth=s.clientWidth,Ps(t,e)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{s.removeEventListener("input",e.resize)}catch{}Os(e),rt.delete(t)})),e.active||(s.addEventListener("input",e.resize),e.active=!0,ce(t,e));const i=typeof o=="object"&&o.max!=null?String(o.max):null;i!==e.appliedMax&&(i==null?e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=i,e.appliedMax=i),e.resize()}function Ft(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),rt.add(t),Ht())}function ie(){const t=Array.from(rt);rt.clear();for(let o=0;o<t.length;o++){const s=t[o],n=s.node,e=s.__ref?.__autoGrow;if(!(!n||!e||!e.active)){if(!n.isConnected){e.firstAttemptAt==null&&(e.firstAttemptAt=ht()),e.attachAttempts+=1,e.attachAttempts<=Vo&&ht()-e.firstAttemptAt<Go&&(rt.add(s),Ht());continue}e.attachAttempts=0,e.firstAttemptAt=null,e.resize()}}}function Ps(t,o){if(o.watch)return;const s=t.node;if(!s)return;const n=s.ownerDocument&&s.ownerDocument.defaultView,e=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof e!="function")return;const i=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,Ft(t,!0);return}const c=s.clientWidth;o.lastWidth!=null&&Math.abs(c-o.lastWidth)<.5||(o.lastWidth=c,Ft(t,!0))};let a;try{a=new e(i),a.observe(s)}catch{return}o.watch=a}function Os(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function ce(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,n=s&&s.fonts&&s.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{o.active&&t.node&&Ft(t,!0)},()=>{})}function fe(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;try{return o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{return null}}const ct=t=>typeof t=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(t)?parseFloat(t):null,ko=t=>(ct(t.paddingTop)||0)+(ct(t.paddingBottom)||0),Ts=t=>(ct(t.borderTopWidth)||0)+(ct(t.borderBottomWidth)||0);function ae(t){if(!t)return!1;const o=String(t.transitionProperty||"").split(","),s=String(t.transitionDuration||"0s").split(",");for(let n=0;n<o.length;n++){const e=o[n].trim();if(!(e!=="all"&&e!=="height")&&parseFloat(s[n%s.length])>0)return!0}return!1}function vo(t){if(typeof t.getAnimations!="function")return;let o;try{o=t.getAnimations()}catch{return}for(let s=0;s<o.length;s++){const n=o[s];if(n&&n.transitionProperty==="height")try{n.cancel()}catch{}}}function ue(t,o){if(!o||!t.hasAttribute||!t.hasAttribute("rows"))return null;const s=parseInt(t.getAttribute("rows"),10);if(!(s>0))return null;const n=ct(o.lineHeight)||de(t,o);return n>0?s*n+ko(o):null}const $t=["fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","lineHeight","letterSpacing"],Ls=new WeakMap;function de(t,o){const s=t.ownerDocument,n=s&&(s.body||s.documentElement);if(!n||!s.createElement)return null;let e=Ls.get(s);e||(e=new Map,Ls.set(s,e));const i=$t.map(f=>o[f]||"").join("|");if(e.has(i))return e.get(i);const a=s.createElement("textarea");a.rows=1,a.setAttribute("aria-hidden","true"),a.tabIndex=-1;const c=a.style;c.position="absolute",c.visibility="hidden",c.top="0",c.left="-9999px",c.height="auto",c.minHeight="0",c.maxHeight="none",c.padding="0",c.border="0",c.boxSizing="content-box",c.overflow="hidden";for(let f=0;f<$t.length;f++)o[$t[f]]&&(c[$t[f]]=o[$t[f]]);let r=0;try{n.appendChild(a),r=a.clientHeight}catch{r=0}finally{a.parentNode&&a.parentNode.removeChild(a)}return r>0?(e.set(i,r),r):null}function le(t,o){return o?o.boxSizing==="border-box"?t+Ts(o):o.boxSizing==="content-box"?Math.max(0,t-ko(o)):t:t}function pe(t){if(!t)return null;const o=ct(t.maxHeight);if(o==null||!(o>0))return null;const s=ko(t),n=Ts(t),e=t.boxSizing==="border-box"?o-n:o+s,i=ct(t.lineHeight);if(!(i>0))return e;const a=Math.floor((e-s)/i+1e-6);return a>=1?a*i+s:e}function Ds(t,o,s){s?o.appliedScroll||(t.style.overflowY="auto",o.appliedScroll=!0):o.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),o.appliedScroll=!1)}const Rs=["srcObject","muted"],he=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function ye(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let n=0;n<Rs.length;n++){const e=Rs[n],i=t[e];if(i===void 0||!(e in o))continue;const a=c=>{const r=he(e,c);if(o[e]!==r)try{o[e]=r}catch(f){R(s,e,f)}};if(typeof i=="function"){const c=T(t,t[e+"Deps"],i),r=j(()=>{try{a(c(t,t.state,t.context))}catch(f){R(s,e,f)}},{depth:s.path.length,label:v(s,e)});s.__effects.push(r),s.__exec[e]=i}else a(i);e==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Ms(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,n=t.autoGrow,e=typeof n=="function"?T(t,t.autoGrowDeps,n):null,i=j(()=>{const a=t.autoGrow;let c=a;if(typeof a=="function")try{c=(a===n&&e?e:a)(t,t.state,t.context)}catch{c=null}re(t,c)},{depth:s.path.length,label:v(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(i),e&&(s.__exec.autoGrow=n)}const Ns=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Fs(t,o){for(const s of Object.keys(t)){if(!Z(s)||Ns.has(s))continue;const n=Zs(s);if(n){qs(n,t,t[s]);continue}let e=t[s],i=null;if(e&&typeof e=="object"&&!Array.isArray(e)&&(i=e,e=i.handler),typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const c=e;e=function(f){return t.call(c,f)}}if(typeof e!="function")continue;const a=pn(s);zs.has(a)||Ys(hn(a),t,e,i)}_e(t)}function _e(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let n=!1;for(const d of Ns){const h=t[d];typeof h=="function"&&(s[d]=h,n=!0)}if(!n)return;const e=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,c=0,r=0,f=!1;const l=d=>{const h=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];h&&(a=h.clientX,c=h.clientY,r=Date.now(),f=!0)},u=d=>{if(!f)return;f=!1;const h=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!h)return;const y=h.clientX-a,A=h.clientY-c,g=Date.now()-r;if(g>i)return;const b=Math.abs(y),w=Math.abs(A);if(Math.max(b,w)<e)return;let p;if(b>w*1.2)p=y<0?"left":"right";else if(w>b*1.2)p=A<0?"up":"down";else return;const _="onSwipe"+p.charAt(0).toUpperCase()+p.slice(1),x=s[_],S=s.onSwipe;x&&x.call(t,d,t,t.state,t.context),S&&S.call(t,{direction:p,dx:y,dy:A,dt:g,event:d},t,t.state,t.context)};o.addEventListener("touchstart",l,{passive:!0}),o.addEventListener("touchend",u,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",l)}catch{}try{o.removeEventListener("touchend",u)}catch{}})}function ft(t,o){const s={...t};for(const n in o){const e=s[n],i=o[n];e&&i&&typeof e=="object"&&typeof i=="object"&&!Array.isArray(e)&&!Array.isArray(i)&&typeof e!="function"&&typeof i!="function"?s[n]=ft(e,i):s[n]=i}return s}function jo(t,o,s,n,e){if(!o||!t.node)return;const i=t.childExtends,a=_t(t,"childProps");if(Array.isArray(o)){const c=t.tag==="fragment",r=t.context?.document||globalThis.document,f=c?null:r?.createDocumentFragment();if(!c&&!f)return;const l=t.childProps,u=t.childrenAs,d=w=>{let p=o[w];const _=p;(typeof p=="string"||typeof p=="number")&&(p={text:p});let x=l;if(typeof l=="function")try{x=l(t,p)}catch{x=null}let S=typeof l=="function"?Tt(x):a;if(e&&u!=="state"&&(S=Lt(S,Tt(_))),u==="state"){let C=_;(typeof _=="string"||typeof _=="number")&&(C={value:_,text:_}),p=x?{...x,state:C}:{state:C}}else x&&(p=ft(x,p));if(i&&!p.ignoreChildExtends)if(p.extends){const C=Array.isArray(p.extends)?p.extends:[p.extends],N=Array.isArray(i)?i:[i];p={...p,extends:[...N,...C]}}else p={...p,extends:i};const k=Ko(p?.key,_,w,t);try{return m(Dt(p,S),t,k,s)}catch(C){if(typeof console<"u"&&console.error){const N=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${k}" failed to construct at ${N} (initial render, skipping this row):`,C?.message||C)}return null}},h=t.__ref;if(!(n===!0&&!c&&!!h&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let w=0;w<o.length;w++){const p=d(w);!c&&p?.node&&f.appendChild(p.node)}return c||t.node.appendChild(f),!0}const A=h.__childrenChunkGen=(h.__childrenChunkGen||0)+1;Lo();let g=null;const b=w=>{if(h.__disposed||h.__childrenChunkGen!==A){g&&g.parentNode&&g.remove();return}for(let p=w;p<o.length;p++){const _=d(p);if(_?.node&&(g?t.node.insertBefore(_.node,g):f.appendChild(_.node)),p+1<o.length&&To()){g||(g=r.createComment("smbls-mount"),f.appendChild(g),t.node.appendChild(f));const x=p+1;Ro(()=>b(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&qt(t,!0)):t.node.appendChild(f)};return b(0),Do(),!0}if(typeof o=="string"){const c=qo(o,t);if(Array.isArray(c))return jo(t,c,s,n,!0)}if(typeof o=="object")for(const c in o){if(H.has(c))continue;let r=o[c];if(r==null||r===!1)continue;const f=e?Lt(a,Tt(r)):a;if((typeof r=="string"||typeof r=="number")&&(r={text:r}),t.childProps&&(r=ft(t.childProps,r)),i&&!r.ignoreChildExtends)if(r.extends){const l=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(i)?i:[i];r={...r,extends:[...u,...l]}}else r={...r,extends:i};m(Dt(r,f),t,Gt(t,c),s)}}function qt(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const n=s.options;if(!n||!n.length)return;const e=t.__ref,i=e&&e.__exec&&e.__exec.value,a=typeof i=="function",c=t.value!=null&&typeof t.value!="function";if(a||c){let l;if(a)try{l=i(t,t.state,t.context)}catch{return}else l=t.value,typeof l=="string"&&l.includes("{{")&&(l=I.call(t,l,t.state));const u=l==null?"":String(l);s.value!==u&&(s.value=u);return}const r=o||!(e&&e.__selectSynced);if(e&&(e.__selectSynced=!0),!r)return;let f=-1;for(let l=0;l<n.length;l++)n[l].defaultSelected&&(f=l);f>=0&&s.selectedIndex!==f&&(s.selectedIndex=f)}function $s(t,o){let{children:s,content:n}=t;const e=t.childExtends,i=typeof s=="function"||ts(t,"children");if(typeof s=="function"){const y=s;try{s=y(t,t.state,t.context)}catch(p){if(s=void 0,typeof console<"u"&&console.error){const _=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${_} (initial run, treating as empty):`,p?.message||p)}}os(t,s),t.children=s;const A=t.__ref;let g=!1;const b=T(t,t.childrenDeps,y),w=j(()=>{const p=g;g=!0;let _;try{_=b(t,t.state,t.context)}catch(P){if(typeof console<"u"&&console.error){const F=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${F}${p?"":" (initial tracking run)"}:`,P?.message||P)}return}if(!p||_===t.children)return;os(t,_),t.children=_,A.__childrenChunkGen!=null&&A.__childrenChunkGen++;const x=typeof t.onContentUpdate=="function",S=x?[]:null,k=x?[]:null,C=x?[]:null;if(Array.isArray(_)&&t.childrenAs==="state"){const P=t.childProps,F=[],xt=new Map;for(let E=0;E<_.length;E++){const G=_[E];let O=P;if(typeof P=="function")try{O=P(t,G)}catch{O=null}const Y=Ko(O&&O.key,G,E,t);F.push(Y),xt.set(Y,{rawChild:G,childProps:O})}const Us=new Set(F),Bs=A.__children.slice();for(const E of Bs)if(!Us.has(E)){const G=t[E];G?.remove&&G.remove(),delete t[E],k&&k.push(E)}const wt=t.childExtends,It=t.tag==="fragment",Hs=t.context?.document||globalThis.document,St=It?null:Hs?.createDocumentFragment(),Qt=new Set;for(const E of F){const G=xt.get(E),O=G.rawChild,Y=t[E];if(Y&&Y.state){if(O&&typeof O=="object"){const $=Y.state,at=$.$replace||$.replace,Po=$.$update||$.update;try{if(typeof at=="function")at.call($,O);else if(typeof Po=="function"){for(const B in $)if(!(B==="__element"||B==="root"||B==="parent"||B==="update")&&!Object.prototype.hasOwnProperty.call(O,B))try{$[B]=void 0}catch{}Po.call($,O)}else for(const B in O)$[B]=O[B]}catch(B){if(typeof console<"u"&&console.error){const Gs=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to patch at ${Gs} (reconcile, keeping its previous data for this pass):`,B?.message||B)}}}C&&C.push(E);continue}let Xt=O;(typeof O=="string"||typeof O=="number")&&(Xt={value:O,text:O});const Jt=G.childProps;let K=Jt?{...Jt,state:Xt}:{state:Xt};const Vs=typeof P=="function"?Tt(Jt):_t(t,"childProps");if(wt&&!K.ignoreChildExtends)if(K.extends){const $=Array.isArray(K.extends)?K.extends:[K.extends],at=Array.isArray(wt)?wt:[wt];K={...K,extends:[...at,...$]}}else K={...K,extends:wt};let mt;try{mt=m(Dt(K,Vs),t,E,o)}catch($){if(typeof console<"u"&&console.error){const at=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${at} (reconcile, skipping this row):`,$?.message||$)}Qt.add(E);continue}!It&&mt?.node&&St&&St.appendChild(mt.node),S&&S.push(E)}if(!It&&St&&St.childNodes.length&&t.node&&t.node.appendChild(St),!It&&t.node){let E=null;for(const G of F){const O=t[G]?.node;if(!O)continue;const Y=E?E.nextSibling:t.node.firstChild;O!==Y&&t.node.insertBefore(O,Y),E=O}}A.__children=Qt.size?F.filter(E=>!Qt.has(E)):F,x&&(S.length||k.length)&&Wo(t,{added:S,removed:k,kept:C}),qt(t,!1);return}const st=x?[...A.__children]:null;for(const P of[...A.__children]){const F=t[P];F?.remove&&F.remove(),delete t[P]}A.__children=[],jo(t,_,o,!1,!0),qt(t,!1),x&&Wo(t,{added:[...A.__children],removed:st,kept:[]})},{depth:A.path.length,label:v(A,"children")});A.__effects.push(w)}const a=jo(t,s,o,!0,i);if(n!=null&&!(n&&n.__ref)){let y=n;if(typeof y=="string"||typeof y=="number"?y={text:y}:typeof y!="object"&&(y={}),t.childProps&&(y=ft(t.childProps,y)),e&&!y.ignoreChildExtends)if(y.extends){const g=Array.isArray(y.extends)?y.extends:[y.extends],b=Array.isArray(e)?e:[e];y={...y,extends:[...b,...g]}}else y={...y,extends:e};const A=Lt(_t(t,"childProps"),_t(t,"content"));m(Dt(y,A),t,"content",o)}if(s&&!a)return;const c=t.context?.components||{},r=t.__ref&&t.__ref.__runtimeSource,f=r?{}:null;{const y=Object.keys(t);for(let A=0;A<y.length;A++){const g=y[A];if(!g.endsWith("Extends")||typeof t[g]!="string")continue;const b=g.slice(0,-7);if(!b||b.charCodeAt(0)<65||b.charCodeAt(0)>90)continue;const w={extends:t[g]};delete t[g];for(let p=A+1;p<y.length;p++){const _=y[p],x=_.charCodeAt(0);if(x>=65&&x<=90||H.has(_)||typeof t[_]=="function"&&(_.startsWith("on")||_.startsWith(".")))break;const S=t[_];S!==void 0&&(w[_]=S,delete t[_],f&&Ot(r,_)&&(f[b]||(f[b]={}),f[b][_]=r[_]))}t[b]&&typeof t[b]=="object"?t[b]={...w,...t[b]}:t[b]=w}}const l=o?.mountYield===!0||t.yieldChildren===!0,u=Object.keys(t),d=y=>{if(H.has(y)||typeof t[y]!="object"||t[y]===null)return;const A=y.charCodeAt(0);if(A<65||A>90)return;let g=t[y];if(g.__ref)return;if(!g.extends&&!g.extend){const w=c[y]||c[`smbls.${y}`];w&&(g={...g,extends:w})}if(t.childProps&&(g=ft(t.childProps,g)),e&&!g.ignoreChildExtends)if(g.extends){const w=Array.isArray(g.extends)?g.extends:[g.extends],p=Array.isArray(e)?e:[e];g={...g,extends:[...p,...w]}}else g={...g,extends:e};const b=r?Lt(_t(t,"childProps"),Lt(f[y]||null,_t(t,y))):null;m(Dt(g,b),t,y,o)};if(!l){for(const y of u)d(y);return}Lo();const h=y=>{for(let A=y;A<u.length;A++)if(d(u[A]),A+1<u.length&&To()){const g=A+1;Ro(()=>h(g));return}};h(0),Do()}function Is(t,o,s){const{node:n}=t;if(!n)return;n.ref=t;const e=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(e){const a=e.parentNode;if(a){if(s?.position==="before"&&s.node)a.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;a.insertBefore(n,c||e)}else a.insertBefore(n,e);return}}const i=o?.node||(o?.nodeType?o:null);if(i)if(s?.position==="before"&&s.node)i.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;a?i.insertBefore(n,a):i.appendChild(n)}else i.appendChild(n)}const Eo=3;function ge(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Eo?!1:(t.__inBeforeUpdate=!0,!0)}function Zt(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Eo&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Eo}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,o,s){const n=t.charAt(0).toLowerCase()+t.slice(1);o.context?.plugins?.length&&q(n,o,s);const e="on"+t,i=o[e];if(typeof i=="function"){const r=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(r){if(o.__ref[r])return!0;o.__ref[r]=!0}const f=o.context?.designSystem;f&&L(f);let l=!!r;try{const u=i(o,o.state,o.context,s);if(u&&typeof u.then=="function"){const d=o.__ref;return u.catch(h=>{o.context?.plugins?.length&&q("error",o,{hook:e,error:h})||console.error(`[DOMQL] Lifecycle "${e}" error:`,h)}).finally(()=>{r&&d&&(d[r]=!1)}),l=!1,!0}if(u===!1)return!1}catch(u){if(o.context?.plugins?.length&&q("error",o,{hook:e,error:u})||console.error(`[DOMQL] Lifecycle "${e}" error:`,u),o.context?.strictMode)throw u}finally{f&&D(),l&&o.__ref&&(o.__ref[r]=!1)}}return!0}var Ye=m;export{Eo as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,ge as acquireBeforeUpdateGuard,Rt as checkedBefore,m as create,Ye as default,eo as flushMounts,Mt as followChecked,We as isStaticCssProp,Ke as recompileStaticCss,ze as reconcileAttrProp,Zt as releaseBeforeUpdateGuard,_o as resolveStyleBlock,Wt as writeElementText};
|
|
4
|
+
`):"")}}if(Zt(r,!0),Zs(r,o,e),typeof r.html=="function"&&r.node&&!r.node.innerHTML&&X(r,()=>{try{const u=r.html(r,r.state,r.context);u!=null&&typeof u!="function"&&(r.node.innerHTML=u)}catch{}}),D("Create",r,n),D("Complete",r,n),D("Render",r,n),D("RenderRouter",r,n),io(r,n),typeof r.onFrame=="function"){const u=r.onFrame,l=r.context?.designSystem,g=()=>{if(r.node){if(r.node.isConnected){l&&Y(l);try{u(r,r.state,r.context)}catch(x){console.error("[DOMQL] onFrame error:",x)}finally{l&&q()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return r}const Jo=new Set(["childProps","attr","style","scope","data","vars"]);function mo(t,o,s,n,e,c){if(s&&!o.extends&&!o.extend){const p=s.indexOf("_"),h=s.indexOf(".");let _=p>0?p:-1;if(h>0&&(_<0||h<_)&&(_=h),_>0){const w=s.substring(0,_),y=t.context?.components;y&&(y[w]||y["smbls."+w])?o={...o,extends:w}:y&&st()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${w}" but neither "${w}" nor "smbls.${w}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}t.__ref&&(t.__ref.__mergeLayer=null),un(t,o,c);const a=dn(t),r=t.props&&typeof t.props=="object"?t.props:null;for(const p in o){if(p==="parent"||p==="node"||p==="__ref"||p==="extends"||p==="context"||p==="props")continue;if(p==="key"){n&&(t.key=e?Vt(e,n):n);continue}const h=o[p];a&&a.mark(p);const _=t[p],w=_&&h&&typeof _=="object"&&typeof h=="object"&&!Array.isArray(_)&&!Array.isArray(h)&&typeof _!="function"&&typeof h!="function";w&&p.charCodeAt(0)>=65&&p.charCodeAt(0)<=90?t[p]=kt(_,h):w&&Jo.has(p)?t[p]={..._,...h}:w&&co(p)?t[p]=kt(_,h):t[p]=h}function i(p){for(const h in p){const _=p[h],w=t[h],y=w&&_&&typeof w=="object"&&typeof _=="object"&&!Array.isArray(w)&&!Array.isArray(_)&&typeof w!="function"&&typeof _!="function";y&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?t[h]=kt(w,_):y&&Jo.has(h)?t[h]={...w,..._}:y&&co(h)?t[h]=kt(w,_):t[h]=_}}if(r&&i(r),o.props&&typeof o.props=="object"&&(i(o.props),a))for(const p in o.props)a.mark(p);ln(t),o.classlist!==void 0&&(t.classlist=o.classlist),o.text!==void 0&&(t.text=o.text),o.html!==void 0&&(t.html=o.html);const f=t.scope&&typeof t.scope=="object"?t.scope:null,d=e?.scope,u=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,l=d||u||null;if(o.scope!==void 0||f){const p={};f&&Object.assign(p,f),o.scope!==void 0&&Object.assign(p,o.scope),t.scope=on(p,l)}else l&&(t.scope=l);o.if!==void 0&&(t.if=o.if);const g=t.__ref,x=Xn(t,g&&g.__runtimeSource);return g&&(g.__declaredArrays=x||void 0),pn(t),Nn(t,e,o,c),o}const Ln=new Set(["key","parent","context","__ref"]);function Rn(t,o){for(const n of Object.keys(t))Ln.has(n)||delete t[n];let s=o.definition;if(!s.extends&&!s.extend&&typeof o.key=="string"){const n=t.context?.components||{},e=n[o.key]||n["smbls."+o.key];e&&(s={...s,extends:e})}Nt(()=>mo(t,s,o.key,o.ownKey,t.parent,o.options))}function Mn(t,o,s){const n=s||{},e=r=>!!(n[r]||n["smbls."+r]),c=[],a=[];if(t.extends&&a.push(...Array.isArray(t.extends)?t.extends:[t.extends]),t.extend&&a.push(...Array.isArray(t.extend)?t.extend:[t.extend]),a.length){for(const r of a){if(typeof r!="string")continue;const i=r.includes(">")?r.split(">")[0].trim():r;e(i)||c.push(i)}return c}if(typeof o=="string"&&/^[A-Z]/.test(o)){let r=-1;const i=o.indexOf("_"),f=o.indexOf(".");i>0&&(r=i),f>0&&(r<0||f<r)&&(r=f);const d=r>0?o.substring(0,r):o;e(d)||c.push(d)}return c}function fo(t,o,s){if(typeof t.onStateInit!="function"&&!gn(t,"stateInit"))return;const n=t.state;t.state=o;try{D("StateInit",t,s)}finally{t.state=n}}const ao=t=>({isDataOnlyKey:o=>_n(t).has(o)});function Nn(t,o,s,n){const e=!o,c=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,a=e&&c&&t.context?.state,r=s.state!==void 0&&!a?s.state:t.state&&!W(t.state)?t.state:void 0;if(r==null){if(o?.state)t.state=o.state,at(t,t.state);else if(t.context?.state){const i=t.context.state,f={...i},d=t.context?.polyglot;if(d?.translations){const u=t.context,l=i.lang||d.defaultLang||"en",g=new Set,x=(_,w)=>{g.has(_)||hn(u,_,f)&&(f[_]=w,g.add(_),yn(u,_,w))},p=d.translations[l];if(p&&typeof p=="object")for(const _ in p)x(_,p[_]);const h=new Set(d.languages||[]);for(const _ in d.translations)h.has(_)||x(_,d.translations[_])}W(f)||fo(t,f,n),t.state=W(f)?f:oo(f,ao(t.context)),t.state.__element=t,t.state.root=t.state,at(t,t.state),Ft.promoteActiveRootState?.(i,t.state),D("StateCreated",t,n)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),at(t,t.state);return}if(typeof r=="string"){if(t.state=ss(r,o),t.state&&typeof t.state=="object"&&!W(t.state)){const i=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:i,enumerable:!1,configurable:!0,writable:!0})}at(t,t.state),$n(t,r,o),D("StateCreated",t,n);return}if(typeof r=="function"){const i=r(t,o?.state);if(W(i))t.state=i;else{const f=i||{};fo(t,f,n),t.state=oo(f,o?.state?void 0:ao(t.context))}}else if(W(r))t.state=r;else{const i={...r};fo(t,i,n),t.state=oo(i,o?.state?void 0:ao(t.context))}t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,at(t,t.state),Ft.promoteActiveRootState?.(r,t.state),D("StateCreated",t,n)}function ts(t,o){if(!o)return t;const s=o.split("/");let n=t;for(const e of s){if(n==null)return{};n=n[e]}return n??{}}function os(t,o){const s=o.state;return t.startsWith("~/")?[s&&(s.root||s),t.slice(2)]:t.startsWith("../")?[s,t.slice(3)]:[s,t]}function ss(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")||t.startsWith("~/")){const[e,c]=os(t,o);return c?ts(e,c):e??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=ts(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const n=o.context?.polyglot;if(n?.translations){const e=o.state?.root?.lang||n.defaultLang||"en",c=n.translations[e];if(c?.[t]!==void 0)return c[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}function Fn(t,o){const[s,n]=os(t,o);if(!n||!s||typeof s!="object")return;const e=s[n];if(e!==void 0||n.indexOf("/")===-1)return e;let c=s;for(const a of n.split("/")){if(c==null||typeof c!="object")return;c=c[a]}return c}function $n(t,o,s){const n=t.__ref;if(!n||!s||o==="."||!W(s.state))return;n.__stateBinding&&n.__stateBinding.dispose();const e=Nt(()=>j(()=>{const c=Fn(o,s);!c||typeof c!="object"||c===t.state||Nt(()=>ns(t,t.state,c,!0))},{depth:n.path?n.path.length:0,label:v(n,"state")}));e._isStateBinding=!0,n.__stateBinding=e,n.__effects&&n.__effects.push(e)}function ns(t,o,s,n){const e=t.__ref;if(!e)return;if(n||t.state===o){t.state=s,n&&at(t,s),es(e);const a=e.__children;if(a)for(let r=0;r<a.length;r++){const i=t[a[r]];i&&i.__ref&&i.parent===t&&ns(i,o,s,!1)}return}if(e.__stateBinding){e.__stateBinding._notify();return}const c=t.state;c&&typeof c=="object"&&c.parent===o&&(c.parent=s,es(e))}function es(t){const o=t.__effects;if(o)for(let s=0;s<o.length;s++){const n=o[s];n&&!n._disposed&&!n._isStateBinding&&!n._isSubscribeToEffect&&typeof n._notify=="function"&&n._notify()}}const In=new Set(["s","state","ctx","context"]),uo=new WeakMap;function rs(t){if(uo.has(t))return uo.get(t);let o=null;try{const s=typeof Ft.getFunctionSource=="function"?Ft.getFunctionSource(t):Function.prototype.toString.call(t);if(typeof s=="string"){const n=s.match(/^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/)||s.match(/^[^(]*\(([^)]*)\)/);n&&(o={params:n[1].split(",").map(e=>e.trim()),body:s.slice(n.index+n[0].length)})}}catch{}return uo.set(t,o),o}function Bn(t){const o=rs(t);return o?o.params.map(s=>s.split("=")[0].trim()).filter(Boolean):[]}const is=new WeakMap;function Hn(t){let o=is.get(t);return o===void 0&&(o=Un(rs(t)),is.set(t,o)),o}function Un(t){if(!t)return!0;const o=t.body;if(/\bstate\b|\barguments\b|\bcall\s*\(/.test(o))return!0;const s=t.params[1];if(!s)return!1;if(!/^[A-Za-z_$][\w$]*$/.test(s.split("=")[0].trim()))return!0;const n=s.split("=")[0].trim();return new RegExp("(^|[^\\w$.])"+n.replace(/\$/g,"\\$")+"(?![\\w$])").test(o)}const Vn=3,Gn=/^(is|has)[A-Z0-9_$]/,Kn=new Set(["routerOptions"]),cs=new WeakSet;function Wn(t,o){if(typeof t!="function"||t.length!==2||o&&(Gn.test(o)||Kn.has(o))||cs.has(t))return!1;const s=Bn(t);if(s.length<2)return!1;const n=s[1].replace(/[{}[\]]/g,"").trim();return n.length<Vn||In.has(n)?!1:(cs.add(t),!0)}function zn(t){const o=t.__ref,s=t.tag||"div",n=t.context?.designSystem,e=[],c=Object.keys(t);for(let a=0;a<c.length;a++){const r=c[a];if(typeof t[r]!="function"||H.has(r))continue;const i=r.charCodeAt(0);i>=65&&i<=90||Z(r)||I[r]||U&&U.has(r)||i!==45&&(xt(s,r)||(st()&&Wn(t[r],r)&&console.warn(`[smbls] custom prop "${r}"${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('${r}', \u2026) instead of reading el.${r}(\u2026) directly (see RULES.md Rule 8).`),e.push({prop:r,fn:t[r]})))}for(let a=0;a<e.length;a++){const{prop:r,fn:i}=e[a];o.__exec[r]=i,Object.defineProperty(t,r,{get(){n&&Y(n);try{return i(t,t.state,t.context)}catch{return}finally{n&&q()}},set(f){delete o.__exec[r],Object.defineProperty(t,r,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Yn(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const n=o[s];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function T(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...n){return Yn(t,o),s.apply(this,n)}}function lt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function v(t,o){return()=>t.path.join(".")+"::"+o}const fs=new Set;function L(t,o,s){if(!st())return;const n=v(t,o)();fs.has(n)||(fs.add(n),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const as=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,qn=(t,o)=>{let s;try{s=String(t)}catch{return}if(!s.includes("{{"))return;as.lastIndex=0;let n;for(;(n=as.exec(s))!==null;)n[2].includes("{{")&&o.add(n[2])},Zn=(t,o)=>!Z(t)&&!nt(o,t),lo=(t,o,s,n,e)=>{if(typeof o=="string"){!e&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&Zn(t,n)&&qn(o,s)},po=new WeakMap,vt=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),jt=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const o=t.props;return o&&typeof o=="object"&&!Array.isArray(o)?it(t,o):t},Et=(t,o)=>t&&o?it(t,o):t||o||null,us=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&vt(s,o)},pt=(t,o)=>us(t,o)?jt(t.__ref.__runtimeSource[o]):null,Pt=(t,o)=>(o&&t&&typeof t=="object"&&po.set(t,o),t),Qn=t=>{if(!t||typeof t!="object")return;const o=po.get(t);return o&&po.delete(t),o},ho=(t,o,s)=>{if(typeof t=="string"){t.includes("{{")&&o.add(t);return}if(!(!t||typeof t!="object"||s.has(t))){if(s.add(t),Array.isArray(t)){for(let n=0;n<t.length;n++)ho(t[n],o,s);return}if(!t.__ref)for(const n of Object.keys(t)){if(n==="state")continue;const e=Object.getOwnPropertyDescriptor(t,n);e&&"value"in e&&ho(e.value,o,s)}}},Xn=(t,o)=>{let s=null;for(const n of Object.keys(t)){if(H.has(n)||o&&vt(o,n))continue;const e=Object.getOwnPropertyDescriptor(t,n),c=e&&e.value;if(!Array.isArray(c))continue;const a=new Set;ho(c,a,new Set),a.size&&(s||(s=new Map),s.set(c,a))}return s},ds=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const n=s.__ref&&s.__ref.__declaredArrays,e=n&&n.get(o);if(!e)continue;const c=t.__ref;c.__authoredTemplates||(c.__authoredTemplates=new Set);for(const a of e)c.__authoredTemplates.add(a);return}},ls=["attr","aria","data","metadata"],Jn=t=>{if(ls.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},mn=(t,o)=>{const s=new Set,n=t.tag||"div";for(const e of Object.keys(t)){const c=Object.getOwnPropertyDescriptor(t,e),a=c&&c.value,r=!!o&&vt(o,e);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Jn(e))continue;const i=r?o[e]:null,f=i&&typeof i=="object"?i:null,d=e.charCodeAt(0)===46||e.charCodeAt(0)===33;for(const u in a){const l=r&&(!f||vt(f,u)),g=a[u];if(d&&g&&typeof g=="object"&&!Array.isArray(g)&&ls.includes(u)){for(const x in g)lo(x,g[x],s,n,l);continue}lo(u,g,s,n,l)}continue}lo(e,a,s,n,r)}return s};function ps(t,o){const s=t.__ref,n=!!(o&&o.skipIfEffect),e=mn(t,s.__runtimeSource);if(s.__authoredTemplates)for(const i of e)s.__authoredTemplates.add(i);else s.__authoredTemplates=e;if(zn(t),typeof t.text=="function"){const i=t.text,f=T(t,t.textDeps,i),d=j(()=>{if(!s.contentManaged)try{let u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&typeof u!="object"&&(typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),Gt(t,u))}catch(u){L(s,"text",u)}},{depth:s.path.length,label:v(s,"text")});s.__effects.push(d),s.__exec.text=i}else if(typeof t.text=="string"&&t.text.includes("{{")){const i=t.text,f=j(()=>{if(s.contentManaged)return;const d=$.call(t,i,t.state);d!=null&&(t.text=d),t.node&&Gt(t,d??"")},{depth:s.path.length,label:v(s,"text")});s.__effects.push(f),s.__exec.text=i}const c=t.tag||"div";for(const i of Object.keys(t))if(typeof t[i]=="function"&&!H.has(i)&&!Z(i)&&!s.__exec[i]&&!Go(c,i)){if(I[i]){const f=t[i],d=T(t,t[i+"Deps"],f),u=i;let l,g=null,x=null,p;const h=j(()=>{const _=t.context?.designSystem;_&&Y(_);try{const w=d(t,t.state,t.context);$o();let y;try{y=I[u](w,t,t.state,t.context)}finally{Io()}if(Array.isArray(y)){const A={};for(const S of y)if(S)for(const C in S)A[C]=S[C];y=A}const b=u==="show"||u==="hide";if(y&&t.node&&se(y)){const A=ht(y);if(A===null||A!==p){p=A;const S=At(y,null,t.context?.cssPrefix),C=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(x)for(const k of x)t.node.classList.remove(k);if(C&&C.length)for(const k of C)t.node.classList.add(k);x=C}}l=void 0,g=null}else if(y&&t.node){if(x){for(const S of x)t.node.classList.remove(S);x=null,p=void 0}const A=ht(y);if(A===null||A!==l||!Tt(t.node,g)){l=A;const S=ks(t,y);g=Ot(t.node,S)}}else t.node&&b&&(l=void 0,g=null,t.node.style.display="")}finally{_&&q()}},{depth:s.path.length,label:v(s,u)});s.__effects.push(h),s.__exec[i]=f}else if(U&&U.has(i)){const f=t[i],d=T(t,t[i+"Deps"],f),u=i;let l,g=null;const x=j(()=>{const p=t.context?.designSystem;p&&Y(p);try{const h=d(t,t.state,t.context);if(t.node)if(h!=null){const _=u+":"+String(h);if(_!==l||!Tt(t.node,g)){l=_;const w={[u]:h},y=ks(t,w);g=Ot(t.node,y)}}else l=void 0,g=null,t.node.style[u]=""}finally{p&&q()}},{depth:s.path.length,label:v(s,u)});s.__effects.push(x),s.__exec[i]=f}else if(i.charCodeAt(0)===45){const f=t[i];ws(t,i,f,t[i+"Deps"],i),s.__exec[i]=f}}if(ne(t),typeof t.html=="function"){const i=t.html,f=T(t,t.htmlDeps,i),d=j(()=>{X(t,()=>{const u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)})},{depth:s.path.length,label:v(s,"html")});s.__effects.push(d),s.__exec.html=i}if(typeof t.value=="function"){const i=t.value,f=T(t,t.valueDeps,i),d=j(()=>{try{let u=f(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),gs(t,u)}catch(u){L(s,"value",u)}},{depth:s.path.length,label:v(s,"value")});s.__effects.push(d),s.__exec.value=i}else if(typeof t.value=="string"&&t.value.includes("{{")){const i=t.value,f=j(()=>{try{gs(t,$.call(t,i,t.state))}catch(d){L(s,"value",d)}},{depth:s.path.length,label:v(s,"value")});s.__effects.push(f),s.__exec.value=i}if(typeof t.style=="function"){const i=t.style,f=T(t,t.styleDeps,i);let d,u=null,l,g,x,p;const h=j(()=>{const _=f(t,t.state,t.context),w=t.context&&t.context.designSystem;let y;if(_&&typeof _=="object"&&_===l&&w===x){const A=ht(_);y=A!==null&&A===g?p:qt(t,_),g=A}else y=qt(t,_),g=void 0;l=_,x=w,p=y;const b=ht(y);(b===null||b!==d||!Tt(t.node,u))&&(d=b,_o(t.node,u,y),tt(t.node,y),u=Ot(t.node,y))},{depth:s.path.length,label:v(s,"style")});s.__effects.push(h),s.__exec.style=i}else if(t.style&&typeof t.style=="object")for(const i in t.style){const f=t.style[i];if(typeof f!="function")continue;const d=T(t,lt(t.styleDeps,i),f);let u,l=null;const g=j(()=>{try{const x=d(t,t.state,t.context);if(t.node){const p=i+":"+String(x);if(p!==u||!Tt(t.node,l)){u=p;const h=qt(t,{[i]:x});_o(t.node,l,Object.assign({},h,{[i]:""})),tt(t.node,h),l=Ot(t.node,h)}}}catch(x){L(s,"style."+i,x)}},{depth:s.path.length,label:v(s,"style."+i)});s.__effects.push(g)}if(t.attr&&typeof t.attr=="object"){for(const i in t.attr)if(typeof t.attr[i]=="function"){const f=T(t,lt(t.attrDeps,i),t.attr[i]),d=i,u=j(()=>{try{let l=f(t,t.state,t.context);typeof l=="string"&&l.includes("{{")&&(l=$.call(t,l,t.state)),t.node?.setAttribute&&Kt(t.node,d,l)}catch(l){L(s,"attr."+d,l)}},{depth:s.path.length,label:v(s,"attr."+d)});u._attrName=d.toLowerCase(),s.__effects.push(u)}else if(typeof t.attr[i]=="string"&&t.attr[i].includes("{{")){const f=t.attr[i],d=i,u=j(()=>{try{const l=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(d,J(d,l??""))}catch(l){L(s,"attr."+d,l)}},{depth:s.path.length,label:v(s,"attr."+d)});u._attrName=d.toLowerCase(),s.__effects.push(u)}}if(t.aria&&typeof t.aria=="object")for(const i in t.aria){const f=t.aria[i];if(typeof f=="string"&&f.includes("{{")){const g=f,x="aria-"+i.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),p=j(()=>{try{const h=$.call(t,g,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(x,J(x,h??""))}catch(h){L(s,"aria."+i,h)}},{depth:s.path.length,label:v(s,"aria."+i)});p._attrName=x,s.__effects.push(p);continue}if(typeof f!="function")continue;const d=T(t,lt(t.ariaDeps,i),t.aria[i]),u="aria-"+i.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),l=j(()=>{try{const g=d(t,t.state,t.context);if(!t.node?.setAttribute)return;Kt(t.node,u,g)}catch(g){L(s,"aria."+i,g)}},{depth:s.path.length,label:v(s,"aria."+i)});l._attrName=u,s.__effects.push(l)}if(t.data&&typeof t.data=="object")for(const i in t.data){const f=t.data[i];if(typeof f=="string"&&f.includes("{{")){const x=f,p="data-"+i.replace(/[A-Z]/g,_=>"-"+_.toLowerCase()),h=j(()=>{try{const _=$.call(t,x,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,_??"")}catch(_){L(s,"data."+i,_)}},{depth:s.path.length,label:v(s,"data."+i)});h._attrName=p,s.__effects.push(h);continue}if(typeof f!="function")continue;const d=T(t,lt(t.dataDeps,i),t.data[i]),l="data-"+i.replace(/[A-Z]/g,x=>"-"+x.toLowerCase()),g=j(()=>{try{const x=d(t,t.state,t.context);if(!t.node?.setAttribute)return;x==null||x===!1?t.node.removeAttribute(l):typeof x!="function"&&typeof x!="object"&&t.node.setAttribute(l,x===!0?"":x)}catch(x){L(s,"data."+i,x)}},{depth:s.path.length,label:v(s,"data."+i)});g._attrName=l,s.__effects.push(g)}const a=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(a)for(const i in a){if(typeof a[i]!="function")continue;const f=T(t,lt(t.classDeps,i),a[i]),d=j(()=>{try{const u=f(t,t.state,t.context);if(!t.node?.classList)return;typeof u=="string"?t.node.classList.add(u):u?t.node.classList.add(i):t.node.classList.remove(i)}catch(u){L(s,"class."+i,u)}},{depth:s.path.length,label:v(s,"class."+i)});s.__effects.push(d)}!n&&typeof t.if=="function"&&_s(t,s,t.if);for(const i of Object.keys(t)){if(H.has(i)||typeof t[i]!="function")continue;const f=i.charCodeAt(0);if(f>=65&&f<=90||Z(i))continue;const d=t[i];s.__exec[i]=d;const u=t.tag||"div";if(xt(u,i)&&!nt(u,i)){const l=wt(i)||i,g=T(t,t[i+"Deps"],d),x=j(()=>{try{let p=g(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=$.call(t,p,t.state)),t.node?.setAttribute&&Kt(t.node,l,p,!0)}catch(p){L(s,i,p)}},{depth:s.path.length,label:v(s,i)});x._attrName=l.toLowerCase(),s.__effects.push(x)}}const r=t.tag||"div";for(const i of Object.keys(t)){if(H.has(i))continue;const f=t[i];if(typeof f!="string"||!f.includes("{{"))continue;const d=i.charCodeAt(0);if(d>=65&&d<=90||Z(i)||nt(r,i)||no[i]||!xt(r,i))continue;const u=wt(i)||i,l=j(()=>{try{const g=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,J(u,g??""))}catch(g){L(s,i,g)}},{depth:s.path.length,label:v(s,i)});l._attrName=u.toLowerCase(),s.__effects.push(l)}if(ue(t),Ae(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const i=t.onStateUpdate,f=t.stateDeps;let d=!1,u=[];const l=j(()=>{const g=[];for(let h=0;h<f.length;h++){const _=f[h];try{g[h]=typeof _=="function"?_(t,t.state,t.context):t.state?.[_]}catch{g[h]=void 0}}if(!d){d=!0,u=g;return}let x=g.length!==u.length;for(let h=0;!x&&h<g.length;h++)g[h]!==u[h]&&(x=!0);const p=u;u=g,x&&X(t,()=>{try{i(t,t.state,t.context,{prev:p,next:g})}catch(h){if($t(t,"onStateUpdate",h),t.context?.strictMode)throw h}})},{depth:s.path.length,label:v(s,"onStateUpdate")});s.__effects.push(l)}he(t)}function hs(t){const o=t.parent,s=o?.node;if(!s||!t.node){Zs(t,t.parent);return}let n=null;const e=Object.keys(o),c=e.indexOf(t.key);for(let a=c+1;a<e.length;a++){const r=o[e[a]];if(r?.node?.parentNode===s){n=r.node;break}}n?s.insertBefore(t.node,n):s.appendChild(t.node)}function ys(t){bs(t),ke(t),Ms(t),Fe(t),Ne(t)}function _s(t,o,s){let n=T(t,t.ifDeps,s);const e=j(()=>{const c=!o.__ifInitialized&&o.__ifLateMerge;if(c){const i=t.context?.components||{};c.names.some(f=>i[f]||i["smbls."+f])&&(o.__ifLateMerge=null,Rn(t,c),n=T(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=n(t,t.state,t.context)}catch(i){if(a=!1,o.__ifError=i,typeof console<"u"&&console.warn){const f=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${f} \u2014 treating as false:`,i?.message||i)}return}const r=o.__if;if(o.__if=!!a,r&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(i){console.error("[smbls] onRemove error:",i)}}else if(!r&&o.__if)if(o.__ifInitialized)t.node||(t.node=so(t)),t.node&&(t.node.ref=t),hs(t),bs(t),Ms(t),D("Render",t,{}),io(t,{});else{if(o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=Do(t)),D("Init",t,{}),t.node||(t.node=so(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"&&!o.__fragmentAnchor){const f=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(f),o.__fragmentAnchor=f}D("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Ys(t,{}),ps(t,{skipIfEffect:!0}),ys(t),qs(t,{}),hs(t),D("Create",t,{}),D("Complete",t,{}),D("Render",t,{}),D("RenderRouter",t,{}),io(t,{})}},{depth:o.path.length,label:v(o,"if")});o.__effects.push(e)}function Gt(t,o){const s=t.node;if(!s)return;const n=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==n&&(s.nodeValue=n);return}const e=t.__ref;let c=e?e.__textNode:null;if(c&&c.parentNode!==s&&(c=null),!c){const a=s.firstChild;a&&a.nodeType===3&&(c=a)}c?c.nodeValue!==n&&(c.nodeValue=n):s.firstChild?(c=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),s.insertBefore(c,s.firstChild)):(s.textContent=n,c=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),e&&(e.__textNode=c||null)}function te(t,o){return o!=="checked"||!t||t.tagName!=="INPUT"?null:t.hasAttribute("checked")}function oe(t,o){if(o===null)return;const s=t.hasAttribute("checked");s!==o&&t.checked!==s&&(t.checked=s)}function Kt(t,o,s,n){s==null||s===!1&&!It(o)?Wt(t,o,null):typeof s=="function"||typeof s=="object"||(n&&o==="src"&&"src"in t?t.src=s:Wt(t,o,J(o,s)))}function Wt(t,o,s){const n=te(t,o);s==null?t.removeAttribute(o):t.setAttribute(o,s),oe(t,n)}function gs(t,o){const s=t.node;if(!s||!("value"in s))return;const n=o==null?"":String(o);if(s.value===n)return;const e=typeof document<"u"&&document.activeElement===s,c=e&&typeof s.selectionStart=="number"?s.selectionStart:null,a=e&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=n,e&&c!=null&&a!=null)try{s.setSelectionRange(c,a)}catch{}const r=t.__ref&&t.__ref.__autoGrow;r&&r.active&&r.resize()}function bs(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Gt(t,t.text),Bs(t),typeof t.html=="string"&&(o.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in o){const s=String(t.value);o.value!==s&&(o.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const n in t.style)if(typeof t.style[n]=="function"){s={};for(const e in t.style)typeof t.style[e]!="function"&&(s[e]=t.style[e]);break}tt(o,qt(t,s))}if(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&&(typeof n=="string"&&n.includes("{{")||n===!1&&!It(s)||o.setAttribute&&o.setAttribute(s,J(s,n)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&o.setAttribute&&o.setAttribute("data-theme",t.themeModifier),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||typeof n=="string"&&n.includes("{{")||o.dataset&&(o.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&&o.classList.add(n));else if(typeof s=="object")for(const n in s){const e=typeof s[n]=="function"?s[n](t,t.state,t.context):s[n];e&&o.classList.add(typeof e=="string"?e:n)}}}}function ht(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function se(t){if(!t||typeof t!="object")return!1;for(const o in t){const s=t[o];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function Ot(t,o){if(!t||!t.style||!o)return null;const s=t.style,n=[];for(const e in o){if(o[e]==null||e.charAt(0)==="&")continue;const a=Q(e);n.push(a,yo(s,a),As(s,a))}return n}function yo(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function As(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Q(t){return Uo(t)}function _o(t,o,s){if(!t||!t.style||!o||!o.length)return;const n=t.style,e=new Set;if(s&&typeof s=="object")for(const c in s)s[c]==null||c.charAt(0)==="&"||e.add(Q(c));for(let c=0;c<o.length;c+=3){const a=o[c];e.has(a)||yo(n,a)===o[c+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function Tt(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let n=0;n<o.length;n+=3)if(yo(s,o[n])!==o[n+1]||As(s,o[n])!==o[n+2])return!1;return!0}const Dt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,xs=t=>typeof t=="number"||t===!0||typeof t=="string"&&t!=="",zt=t=>Dt(t)?t:"--"+t;function Yt(t,o){if(!ot(t))return null;let s=null;for(const n of Object.keys(t)){if(!n)continue;let e=t[n];if(typeof e=="function"){if(!o)continue;e=e(o,o.state,o.context)}xs(e)&&(s||(s={}),s[zt(n)]=e)}return s}function ws(t,o,s,n,e){Ss(t,e,T(t,n,s),c=>xs(c)?{[o]:c}:null)}function Ss(t,o,s,n,e){const c=t.__ref;let a,r=null;const i=j(()=>{X(t,()=>{try{const f=n(s(t,t.state,t.context)),d=t.node;if(!d||!d.style)return;const u=ht(f);(u===null||u!==a||!Tt(d,r))&&(a=u,_o(d,r,f),f&&tt(d,f),r=f?Ot(d,f):null,e&&e(f))}catch(f){L(c,o,f)}})},{depth:c.path.length,label:v(c,o)});c.__effects.push(i)}function ne(t){const o=t.__ref,s=t.vars;if(typeof s=="function"){ee(t,s),o.__exec.vars=s;return}if(ot(s))for(const n of Object.keys(s)){const e=s[n];!n||typeof e!="function"||ws(t,zt(n),e,lt(t.varsDeps,n),"vars."+n)}}function ee(t,o){const s=t.__ref;Ss(t,"vars",T(t,t.varsDeps,o),n=>Yt(n),n=>{s.__varsInline=n?new Set(Object.keys(n)):null})}function go(t,o){if(typeof t[o]=="function"&&(nt(t.tag||"div",o)||o.charCodeAt(0)===45))return!0;if(!Dt(o))return!1;const s=t.vars;if(typeof s=="function"){const n=t.__ref&&t.__ref.__varsInline;return!!(n&&n.has(o))}if(!ot(s))return!1;for(const n of Object.keys(s))if(typeof s[n]=="function"&&zt(n)===o)return!0;return!1}function re(t){let o=null;for(const s in t)t[s]!=null&&s.charAt(0)!=="&"&&(o||(o=new Set),o.add(Q(s)));return o}function ie(t,o,s,n){const e=t.__ref;if(!e)return;let c=null;if(s)for(const a of s){if(n&&n.has(a))continue;const r=o[a];if(r==null||typeof r=="object")continue;const i=Q(a);Bt[i]&&(c||(c={}),c[i]=r)}e.__declaredLonghands=c}function Cs(t,o){const s=t.__ref,n=s&&s.__declaredLonghands;if(!n||!o)return null;let e=null;for(const c in n){if(o.has(c))continue;const a=Bt[c];let r=!1;for(let i=0;i<a.length;i++)if(o.has(a[i])){r=!0;break}r&&(e||(e={}),e[c]=n[c])}return e}function ks(t,o){const s=t.node;tt(s,o);const n=re(o);if(!n)return o;const e=t.__ref;if(e)if(e.__inlineCssKeys)for(const a of n)e.__inlineCssKeys.add(a);else e.__inlineCssKeys=new Set(n);const c=Cs(t,n);return c?(tt(s,c),Object.assign({},o,c)):o}function ce(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=Cs(t,o.__inlineCssKeys);s&&tt(t.node,s)}function qt(t,o){return!o||typeof o!="object"?o:X(t,()=>{try{return bn(o,t)}catch{return o}})}function tt(t,o){if(!t||!o||!t.style)return;let s=null;for(const n in o){const e=o[n];if(e!=null){if(n.charAt(0)==="&"&&typeof e=="object"){s||(s={}),s[n]=e;continue}try{const c=String(e),a=Uo(n),r=c.trim(),i=/\s*!important\s*$/.test(r),f=r.replace(/\s*!important\s*$/,"");t.style.setProperty(a,f,i?"important":"")}catch{}}}s&&fe(t,s)}function fe(t,o){const s=`_ds${Ko.scopedStyleId++}`;t.classList.add(s);const n=t.ownerDocument;let e=n.querySelector("style[data-smbls-scoped]");e||(e=n.createElement("style"),e.setAttribute("data-smbls-scoped",""),n.head.appendChild(e));let c="";for(const a in o){const r="."+s,i=a.replace(/&/g,r).split(",").map(d=>{const u=d.trim();return u.includes(r)?u:r+u}).join(", "),f=o[a];if(typeof f=="object"){let d="",u="";for(const l in f){const g=f[l];if(typeof g=="object"){const x=l.includes("&")?i.split(", ").map(h=>l.replace(/&/g,h)).join(", "):i.split(", ").map(h=>`${h} ${l}`).join(", ");let p="";for(const h in g)p+=`${Q(h)}: ${g[h]};`;u+=Bo(`${x} { ${p} }`,x)+`
|
|
5
|
+
`}else d+=`${Q(l)}: ${g};`}d&&(c+=Bo(`${i} { ${d} }`,i)+`
|
|
6
|
+
`),u&&(c+=u)}}c&&(e.textContent+=c)}const vs=new Set;function js(t){if(!Array.isArray(t))return"";const o=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&o.push(t[s]);return o.sort(),o.join("|")}function ae(t,o,s){const n=js(s);queueMicrotask(()=>{if(!t.__ref)return;let e;try{e=o(t,t.state,t.context)}catch{return}if(js(e)===n)return;const c=t.__ref.path?t.__ref.path.join("."):t.key||"?";vs.has(c)||(vs.add(c),console.warn(`[smbls] subscribeTo function at "${c}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(e)?e.join(", "):String(e)}]. 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 ue(t){const o=t.subscribeTo,s=typeof o=="function";let n=o;if(s)try{n=o(t,t.state,t.context)}catch{n=null}if(s&&st()&&ae(t,o,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const e=t.__ref;for(let c=0;c<n.length;c++){const a=n[c];if(typeof a!="string"||a.length===0)continue;const r=a.split("."),i=r[0],f=r.slice(1),d={value:!1},u=j(()=>{const l=t.state&&(W(t.state)?t.state.root:null);if(!l||!W(l))return;let g=l;g=g[i];for(let p=0;p<f.length&&!(g==null||typeof g!="object");p++)if(W(g))g=g[f[p]];else break;if(!d.value)return;let x=!1;if(typeof t.onBeforeUpdate=="function"&&X(t,()=>{try{if(Ie(e)){const p=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});p&&typeof p.then=="function"?p.then(()=>Qt(e,!1),h=>{Qt(e,!0),bt("error",t,{hook:"onBeforeUpdate",error:h})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",h)}):(Qt(e,!1),p===!1&&(x=!0))}}catch(p){Qt(e,!0),bt("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}}),!x&&t.node&&e.__effects)for(let p=0;p<e.__effects.length;p++){const h=e.__effects[p];h&&h!==u&&!h._disposed&&!h._isSubscribeToEffect&&typeof h._execute=="function"&&h._execute()}!x&&typeof t.onUpdate=="function"&&X(t,()=>{try{t.onUpdate(t,t.state,t.context)}catch(p){bt("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}})},{depth:e.path.length,label:v(e,"subscribeTo("+a+")")});d.value=!0,u._isSubscribeToEffect=!0,e.__effects.push(u)}}function bo(t,o){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!o.context?.designSystem?.media?.[t.slice(1)])}function Ao(t,o){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=o.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const Es=new Set;function de(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",n=s+"::"+t;Es.has(n)||(Es.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.`))}const Ps=new Map;function le(t){let o=Ps.get(t);if(o)return o;o=[];const s=n=>{if(n)for(const e of n)o.push(Vo(e))};return s(Bt[t]),s(Sn[t]),Ps.set(t,o),o}function Os(t,o,s){if(go(t,o)||s&&s.has(o))return!0;const n=le(Q(o));for(let e=0;e<n.length;e++){const c=n[e];if(go(t,c)||s&&s.has(c))return!0}return!1}function yt(t,o,s,n){const e={},c=new Set,a=(r,i,f)=>{const d=f?new Set(Object.keys(e)):null;if(I[r]){const u=I[r](i,o,o.state,o.context);if(u){const l=Array.isArray(u)?u:[u];for(const g of l)g&&Object.assign(e,g)}}else e[r]=i;if(f)for(const u in e)d.has(u)||c.add(u)};for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];if(typeof i=="function"&&(i=i(o,o.state,o.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(r==="style"){for(const u in i){let l=i[u];typeof l=="function"&&(l=l(o,o.state,o.context)),!(l==null||typeof l=="function")&&a(u,l,Os(o,u,n))}continue}if(r==="vars"){const u=Yt(i,o);if(u)for(const l in u)a(l,u[l],go(o,l)||!!(n&&n.has(l)));continue}if(bo(r,o)){const u=yt(i,o,!1,n);Object.keys(u).length&&(e[`[data-theme="${r.slice(1)}"] &`]=u);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(r)){st()&&de(r,o);continue}const f=Ao(r,o),d=yt(i,o,!1,n);Object.keys(d).length&&(e[f]=d);continue}a(r,i,Os(o,r,n))}}if(s)for(const r in e)c.add(r);for(const r of c){const i=e[r];typeof i=="string"&&!i.includes("!important")&&(e[r]=i+" !important")}return e}const ot=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Ts(t,o){for(const s in o){const n=o[s];t[s]=ot(n)?Ts(ot(t[s])?t[s]:{},n):n}return t}function pe(t,o){if(!ot(o))return;let s;for(const n of t.split(" ")){const e=n?o[n]:null;ot(e)&&(s=Ts(s||{},e))}return s}function xo(t,o){if(o===void 0&&(o=0),o>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)&&xo(t[s],o+1))return!0}return!1}function Ds(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(bo(t,s)){const c=yt(o,s,!1);return Object.keys(c).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:c}:null}const n=Ao(t,s),e=yt(o,s,!1);return Object.keys(e).length?{cssProp:n,block:e}:null}function he(t){const o=t.__ref;for(const s of Object.keys(t)){if(!co(s))continue;const n=t[s];if(!n||typeof n!="object"||Array.isArray(n)||!xo(n))continue;let e=null,c;const a=j(()=>{if(!t.node)return;const r=t.context?.designSystem;r&&Y(r);let i,f=!1;try{const d=Ds(s,n,t),u=d?ht(d.block)+"::"+d.cssProp:null;if(u!==null&&u===c)f=!0;else if(c=u,d){const l=At({[d.cssProp]:d.block},null,t.context?.cssPrefix);i=l?l.split(" ").filter(Boolean):null}else i=null}finally{r&&q()}if(!(f||!t.node.classList)){if(e)for(const d of e)t.node.classList.remove(d);if(i&&i.length)for(const d of i)t.node.classList.add(d);e=i}},{depth:o.path.length,label:v(o,"cssBlock("+s+")")});o.__effects.push(a)}}const ye=()=>!0,_e=(t,o)=>{const s=t.charAt(0);return(s===":"||s==="@"||s==="&"||s==="[")&&o&&typeof o=="object"&&!Array.isArray(o)?!0:!!I[t]||!!(U&&U.has(t))||Dt(t)||t==="vars"};function ge(t,o,s){const n={};let e=!1;for(const r in s)Object.prototype.hasOwnProperty.call(s,r)&&(r!=="data"&&r!=="aria"&&(_e(r,s[r])||H.has(r))?n[r]=!0:e=!0);if(!e)return null;const c=xn({[o]:s},t.tag||"div",n,ye);let a=null;for(const r in c)/^on/i.test(r)||(a||(a={}),a[r]=c[r]);return a}function Ls(t,o,s,n,e,c){const a=t.node;let r=null;const i=f=>{(r||(r=[])).push(f)};for(const f in n){const d=o.owners.get(f),u=d===s;if(!c&&d!==void 0&&!u)continue;let l;try{l=n[f](t)}catch(x){L(t.__ref,"conditional("+s+")."+f,x),u&&i(f);continue}if(typeof l=="string"&&l.includes("{{")&&(l=$.call(t,l,t.state)),u&&a.getAttribute(f)!==o.written.get(f)){i(f);continue}if(l==null||typeof l=="object"||typeof l=="function"){u&&Rs(a,o,f);continue}const g=l===!1&&!It(f)?null:String(J(f,l));i(f),!(u&&g===o.written.get(f))&&(d===void 0&&o.base.set(f,a.getAttribute(f)),Wt(a,f,g),o.owners.set(f,s),o.written.set(f,g))}e.appliedAttrs=r}function Rs(t,o,s){t.getAttribute(s)===o.written.get(s)&&Wt(t,s,o.base.get(s)),o.owners.delete(s),o.base.delete(s),o.written.delete(s)}function be(t,o,s,n){const e=n.appliedAttrs;if(n.appliedAttrs=null,!!e)for(const c of e)o.owners.get(c)===s&&Rs(t.node,o,c)}function Ms(t){const o=t.__ref&&t.__ref.__conditionalAttrs,s=t.node;if(!(!o||!o.owners.size||!s||!s.getAttribute))for(const n of o.owners.keys()){const e=o.written.get(n),c=s.getAttribute(n);c!==e&&(o.base.set(n,c),e==null?s.removeAttribute(n):s.setAttribute(n,e))}}function Ae(t){const o=t.__ref;o.__conditionalRunners=[];let s=null;const n=new Map;for(const e of Object.keys(t)){const c=e.charAt(0);if(c!=="."&&c!=="!")continue;const a=e.slice(1);if(!a)continue;if(/[:@\s>~+[\]]/.test(a)){if(typeof console<"u"&&console.warn){const h=a.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${c}\` is read as one prop name. Nest the selector inside instead: \`${c}${h}: { '${a.slice(h.length)}': {...} }\`.`)}continue}const r=t[e];if(!r||typeof r!="object")continue;const i=c==="!",f={lastMatch:!1,appliedKeys:null,appliedClasses:null,appliedAttrs:null},d=ge(t,e,r);d&&!s&&(s=o.__conditionalAttrs={owners:new Map,base:new Map,written:new Map});const u=new Set;for(const h in r){if(!Object.prototype.hasOwnProperty.call(r,h))continue;const _=h.charAt(0),w=r[h];if(!((_===":"||_==="@"||_==="&"||_==="[")&&w&&typeof w=="object"&&!Array.isArray(w))){if(h==="vars"&&ot(w)){for(const y of Object.keys(w))y&&u.add(zt(y));continue}u.add(h)}}const l=()=>{let h;const _=t[a];if(_===void 0){const b=!!t.state&&a in t.state,A=t.state?t.state[a]:void 0;if(b||A!==void 0)h=A;else{const S=t.context?.cases?.[a];if(S===void 0)return;try{h=typeof S=="function"?S.call(t,t):S}catch(C){h=!1,o.__conditionalError=C,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,C?.message||C)}}}else if(typeof _=="function")try{h=_(t,t.state,t.context)}catch(b){h=!1,o.__conditionalError=b,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,b?.message||b)}else h=_;const w=i?!h:!!h;if(!t.node)return;const y=t.context?.designSystem;if(w===f.lastMatch){if(w&&d&&t.node.setAttribute){y&&Y(y);try{Ls(t,s,e,d,f,!1)}finally{y&&q()}}return}f.lastMatch=w,y&&Y(y);try{if(w){const b={},A={};let S=!1;for(const k in r){if(!Object.prototype.hasOwnProperty.call(r,k))continue;const E=r[k],V=k.charAt(0);if((V===":"||V==="@"||V==="&"||V==="[")&&E&&typeof E=="object"&&!Array.isArray(E)){if(bo(k,t)){const M=yt(E,t,!1,u);Object.keys(M).length&&(A[`[data-theme="${k.slice(1)}"] &`]=M,S=!0)}else{const M=Ao(k,t),R=yt(E,t,!1,u);Object.keys(R).length&&(A[M]=R,S=!0)}continue}const ct=typeof E=="function"?E(t,t.state,t.context):E;if(ct!=null){if(I[k]){const M=I[k](ct,t,t.state,t.context);if(M){const R=Array.isArray(M)?M:[M];for(const N of R)N&&Object.assign(b,N)}}else if(U&&U.has(k))b[k]=ct;else if(Dt(k))b[k]=ct;else if(k==="vars"){const M=Yt(ct,t);M&&Object.assign(b,M)}}}const C=Object.keys(b);if(C.length){tt(t.node,b);for(const k of C)n.set(k,e);f.appliedKeys=C}else f.appliedKeys=null;if(S){const k=At(A,null,t.context?.cssPrefix,{state:!0}),E=k?k.split(" ").filter(Boolean):[];if(E.length&&t.node.classList){for(const V of E)t.node.classList.add(V);f.appliedClasses=E}else f.appliedClasses=null}else if(f.appliedClasses){for(const k of f.appliedClasses)t.node.classList.remove(k);f.appliedClasses=null}d&&t.node.setAttribute&&Ls(t,s,e,d,f,!0)}else{if(f.appliedAttrs&&be(t,s,e,f),f.appliedKeys){for(const b of f.appliedKeys)n.get(b)===e&&(Dt(b)?t.node.style.removeProperty(b):t.node.style[b]="",n.delete(b));f.appliedKeys=null}if(f.appliedClasses){for(const b of f.appliedClasses)t.node.classList.remove(b);f.appliedClasses=null}}}finally{y&&q()}};o.__conditionalRunners.push(l);const g=T(t,t[a+"Deps"],l),x=j(g,{depth:o.path.length,label:v(o,"conditional("+e+")")}),p=o.__exec&&o.__exec[a]||t[a];x._sources.size===0&&typeof p=="function"&&st()&&Hn(p)&&console.warn(`[smbls] conditional \`${e}\` 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 \`${a}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(x)}}const wo=new WeakSet,So=new WeakMap;function xe(t){const o=So.get(t);if(o==="painted")return!1;if(o===void 0){So.set(t,"open");const s=t.defaultView,n=()=>{So.set(t,"painted")};s&&typeof s.requestAnimationFrame=="function"?s.requestAnimationFrame(n):setTimeout(n,0)}return!0}function we(t){const o=t.ownerDocument;!o||wo.has(o)||xe(o)||(wo.add(o),queueMicrotask(()=>{wo.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const Co=new WeakSet;let Ns=!1;function Fs(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function ko(t,o){const s={...t};for(const n in o){const e=o[n],c=s[n];s[n]=e&&typeof e=="object"&&c&&typeof c=="object"?ko(c,e):e}return s}function $s(t,o){const s={};for(const n in t){const e=t[n];if(e&&typeof e=="object"){const c=$s(e,o);Object.keys(c).length&&(s[n]=c)}else o.has(n)||(s[n]=e)}return s}function Se(t,o,s){let n=1/0,e=-1/0;for(const a of o.values())a<n&&(n=a),a>e&&(e=a);if(s)for(const a of s.values())a>e&&(e=a);if(e<=n)return null;let c=null;for(const[a,r]of o){if(r===e)continue;const i=Ce(a);if(i)for(let f=0;f<i.length;f+=3){const d=i[f],u=i[f+1],l=i[f+2],g=t[u]!=null?o.get(u):void 0,x=s&&s.get(d),p=g!==void 0&&g>r&&Ho(d,t[u],l),h=!p&&x!==void 0&&x>r&&Ho(d,void 0,l);if(p||h){p&&delete t[a],c||(c=new Set),c.add(a);break}}}return c}const Is=new Map;function Ce(t){let o=Is.get(t);if(o!==void 0)return o;const s=Q(t),n=Bt[s];if(o=null,Array.isArray(n)){o=[];for(const e of n)o.push(e,Vo(e),s)}return Is.set(t,o),o}function Bs(t){const{node:o}=t;if(!o)return;if(Ns||(Ns=!0,At({display:"none"})),Co.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Co.add(t);const s=t.context?.designSystem;s&&Y(s),$o();try{const n={};let e=!1,c=[],a=null,r=null,i=null;const f=t.__ref&&t.__ref.__mergeLayer;let d,u=null,l=null;const g=(y,b)=>{if(b&&typeof b=="object"&&Fs(y)){r||(r={});const A=r[y];A&&(b=ko(A,b)),r[y]=b}else(b===null||typeof b!="object")&&(i||(i=new Set),i.add(y),d!==void 0&&(u||(u=new Map),u.set(y,d)));n[y]=b};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&I.theme){const y=I.theme(t.theme,t,t.state,t.context);if(y){const b=A=>{for(const S in A){const C=A[S];C&&typeof C=="object"&&Fs(S)&&(a||(a={}),a[S]=C),n[S]=C}};if(Array.isArray(y))for(const A of y)A&&b(A);else b(y);e=!0}}const x=(y,b)=>{if(y==="vars"){const A=Yt(b);if(A){for(const S in A)g(S,A[S]);e=!0}return}if(I[y]){const A=I[y](b,t,t.state,t.context);if(A){if(Array.isArray(A)){for(const S of A)if(S)for(const C in S)g(C,S[C])}else for(const S in A)g(S,A[S]);e=!0}}else if(U&&U.has(y))b!=null&&typeof b!="object"&&(g(y,b),e=!0);else if(y.charCodeAt(0)===45)b!=null&&typeof b!="object"&&(g(y,b),e=!0);else if((y.charAt(0)==="&"||y.charAt(0)==="@"||y.charAt(0)===":"||y.charAt(0)==="[")&&b&&typeof b=="object"&&!Array.isArray(b)){if(xo(b))return;const A=Ds(y,b,t);A&&(g(A.cssProp,A.block),e=!0)}};if(typeof t.class=="string"){const y=pe(t.class,t.context?.designSystem?.class);if(y)for(const b in y)x(b,y[b])}const p=i?new Set(i):null,h=t.tag||"div";for(const y of Object.keys(t)){if(typeof t[y]=="function"){const A=f&&f.get(y);A!==void 0&&nt(h,y)&&(l||(l=new Map),l.set(Q(y),A));continue}if(d=f?f.get(y):void 0,y==="vars"){x(y,t[y]);continue}if(H.has(y)||y==="theme")continue;const b=y.charCodeAt(0);b>=65&&b<=90||Z(y)||Go(h,y)||x(y,t[y])}d=void 0;const _=u?Se(n,u,l):null;if(a)for(const y in a){let b=i?$s(a[y],i):a[y];r&&r[y]&&(b=ko(b,r[y])),Object.keys(b).length?n[y]=b:delete n[y]}if(ie(t,n,i,_?new Set([...p||[],..._]):p),e){n.display&&String(n.display).includes("!important")&&(o.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const y=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof y=="string"&&y!==""&&n.display&&n.display!==y&&(n.display=y);const b=At(n,null,t.context?.cssPrefix);if(c=b?b.split(" ").filter(Boolean):[],b&&o.classList){const A=c;let S=!1;for(const C of A)o.classList.add(C),S||(C.charCodeAt(0)===95&&C.charCodeAt(1)===99||C.charCodeAt(0)===95&&C.indexOf("_c",1)!==-1)&&(S=!0);S&&we(o)}}const w=t.__ref;if(w){const y=w.__staticCssClasses;if(y&&o.classList){const b=new Set(c);for(const A of y)b.has(A)||o.classList.remove(A)}w.__staticCssClasses=c}ce(t)}finally{Io(),s&&q(),Co.delete(t)}}const lr=t=>!!I[t]||!!(U&&U.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function pr(t){t&&t.node&&Bs(t)}function ke(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const c=t.aria[e];if(typeof c=="function"||typeof c=="object"||c==null||typeof c=="string"&&c.includes("{{"))continue;const a="aria-"+e.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());o.setAttribute(a,J(a,c))}const s=An(t);for(const e in s){const c=s[e];c!=null&&c!==!1&&typeof c!="function"&&typeof c!="object"&&o.setAttribute(e,c===!0?"":c)}const n=t.tag||"div";for(const e of Object.keys(t)){if(typeof t[e]=="function"||H.has(e)||e==="on"||s[e]!==void 0)continue;const c=e.charCodeAt(0);if(!(c>=65&&c<=90)&&!Z(e)&&!nt(n,e)&&xt(n,e)){let a=t[e];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!no[e])continue;a=$.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!It(wt(e)||e))continue;const r=wt(e)||e;o.setAttribute(r,J(r,a))}}}function hr(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const n=o.charCodeAt(0);if(n>=65&&n<=90||Z(o))return;const e=t.tag||"div";if(nt(e,o)||!xt(e,o))return;const c=wt(o)||o,a=c.toLowerCase(),r=t.__ref&&t.__ref.__effects;let i=!1;if(r)for(let u=0;u<r.length;u++){const l=r[u];l&&l._attrName===a&&!l._disposed&&typeof l._execute=="function"&&(i=!0,l._execute())}if(i)return;let f=t[o];const d=no[o];if(d&&f!=null){const u=d(t);u!==void 0&&(f=u)}typeof f=="string"&&f.includes("{{")&&(f=$.call(t,f,t.state)),Kt(s,c,f)}function ve(t,o){const s=t.node,n=t.__ref;let e=n.__autoGrow;if(!o){if(e&&e.active){try{s.removeEventListener("input",e.resize)}catch{}Us(e),et.delete(t),s.style.height="",e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""),Ks(s,e,!1),e.active=!1,e.appliedMax=null,e.lastMeasure=0}return}e||(e=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!s.isConnected){Lt(t,!0);return}if(!(s.scrollHeight>0)){e.awaitingLayout=!0,Hs(t,e);return}e.awaitingLayout=!1;const a=Pe(s),r=Oe(a),i=s.style.height;s.style.height="0px",r&&jo(s);const f=s.scrollHeight;if(!(f>0)){s.style.height=i,r&&jo(s);return}const d=Te(s,a),u=d!=null&&f<d?d:f,l=Re(a),g=l!=null&&u>l;s.style.height=Le(g?l:u,a)+"px",r&&jo(s),Ks(s,e,g),e.lastMeasure=f,e.lastWidth=s.clientWidth,Hs(t,e)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{s.removeEventListener("input",e.resize)}catch{}Us(e),et.delete(t)})),e.active||(s.addEventListener("input",e.resize),e.active=!0,Ee(t,e));const c=typeof o=="object"&&o.max!=null?String(o.max):null;c!==e.appliedMax&&(c==null?e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=c,e.appliedMax=c),e.resize()}function Lt(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),et.add(t),Ht())}function je(){const t=Array.from(et);et.clear();for(let o=0;o<t.length;o++){const s=t[o],n=s.node,e=s.__ref?.__autoGrow;if(!(!n||!e||!e.active)){if(!n.isConnected){e.firstAttemptAt==null&&(e.firstAttemptAt=dt()),e.attachAttempts+=1,e.attachAttempts<=Yo&&dt()-e.firstAttemptAt<qo&&(et.add(s),Ht());continue}e.attachAttempts=0,e.firstAttemptAt=null,e.resize()}}}function Hs(t,o){if(o.watch)return;const s=t.node;if(!s)return;const n=s.ownerDocument&&s.ownerDocument.defaultView,e=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof e!="function")return;const c=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,Lt(t,!0);return}const r=s.clientWidth;o.lastWidth!=null&&Math.abs(r-o.lastWidth)<.5||(o.lastWidth=r,Lt(t,!0))};let a;try{a=new e(c),a.observe(s)}catch{return}o.watch=a}function Us(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function Ee(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,n=s&&s.fonts&&s.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{o.active&&t.node&&Lt(t,!0)},()=>{})}function Pe(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;try{return o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{return null}}const rt=t=>typeof t=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(t)?parseFloat(t):null,vo=t=>(rt(t.paddingTop)||0)+(rt(t.paddingBottom)||0),Vs=t=>(rt(t.borderTopWidth)||0)+(rt(t.borderBottomWidth)||0);function Oe(t){if(!t)return!1;const o=String(t.transitionProperty||"").split(","),s=String(t.transitionDuration||"0s").split(",");for(let n=0;n<o.length;n++){const e=o[n].trim();if(!(e!=="all"&&e!=="height")&&parseFloat(s[n%s.length])>0)return!0}return!1}function jo(t){if(typeof t.getAnimations!="function")return;let o;try{o=t.getAnimations()}catch{return}for(let s=0;s<o.length;s++){const n=o[s];if(n&&n.transitionProperty==="height")try{n.cancel()}catch{}}}function Te(t,o){if(!o||!t.hasAttribute||!t.hasAttribute("rows"))return null;const s=parseInt(t.getAttribute("rows"),10);if(!(s>0))return null;const n=rt(o.lineHeight)||De(t,o);return n>0?s*n+vo(o):null}const Rt=["fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","lineHeight","letterSpacing"],Gs=new WeakMap;function De(t,o){const s=t.ownerDocument,n=s&&(s.body||s.documentElement);if(!n||!s.createElement)return null;let e=Gs.get(s);e||(e=new Map,Gs.set(s,e));const c=Rt.map(f=>o[f]||"").join("|");if(e.has(c))return e.get(c);const a=s.createElement("textarea");a.rows=1,a.setAttribute("aria-hidden","true"),a.tabIndex=-1;const r=a.style;r.position="absolute",r.visibility="hidden",r.top="0",r.left="-9999px",r.height="auto",r.minHeight="0",r.maxHeight="none",r.padding="0",r.border="0",r.boxSizing="content-box",r.overflow="hidden";for(let f=0;f<Rt.length;f++)o[Rt[f]]&&(r[Rt[f]]=o[Rt[f]]);let i=0;try{n.appendChild(a),i=a.clientHeight}catch{i=0}finally{a.parentNode&&a.parentNode.removeChild(a)}return i>0?(e.set(c,i),i):null}function Le(t,o){return o?o.boxSizing==="border-box"?t+Vs(o):o.boxSizing==="content-box"?Math.max(0,t-vo(o)):t:t}function Re(t){if(!t)return null;const o=rt(t.maxHeight);if(o==null||!(o>0))return null;const s=vo(t),n=Vs(t),e=t.boxSizing==="border-box"?o-n:o+s,c=rt(t.lineHeight);if(!(c>0))return e;const a=Math.floor((e-s)/c+1e-6);return a>=1?a*c+s:e}function Ks(t,o,s){s?o.appliedScroll||(t.style.overflowY="auto",o.appliedScroll=!0):o.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),o.appliedScroll=!1)}const Ws=["srcObject","muted"],Me=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function Ne(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let n=0;n<Ws.length;n++){const e=Ws[n],c=t[e];if(c===void 0||!(e in o))continue;const a=r=>{const i=Me(e,r);if(o[e]!==i)try{o[e]=i}catch(f){L(s,e,f)}};if(typeof c=="function"){const r=T(t,t[e+"Deps"],c),i=j(()=>{try{a(r(t,t.state,t.context))}catch(f){L(s,e,f)}},{depth:s.path.length,label:v(s,e)});s.__effects.push(i),s.__exec[e]=c}else a(c);e==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Fe(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,n=t.autoGrow,e=typeof n=="function"?T(t,t.autoGrowDeps,n):null,c=j(()=>{const a=t.autoGrow;let r=a;if(typeof a=="function")try{r=(a===n&&e?e:a)(t,t.state,t.context)}catch{r=null}ve(t,r)},{depth:s.path.length,label:v(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(c),e&&(s.__exec.autoGrow=n)}const zs=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Ys(t,o){for(const s of Object.keys(t)){if(!Z(s)||zs.has(s))continue;const n=fn(s);if(n){cn(n,t,t[s]);continue}let e=t[s],c=null;if(e&&typeof e=="object"&&!Array.isArray(e)&&(c=e,e=c.handler),typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const r=e;e=function(f){return t.call(r,f)}}if(typeof e!="function")continue;const a=Pn(s);en.has(a)||rn(On(a),t,e,c)}$e(t)}function $e(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let n=!1;for(const l of zs){const g=t[l];typeof g=="function"&&(s[l]=g,n=!0)}if(!n)return;const e=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,c=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,r=0,i=0,f=!1;const d=l=>{const g=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];g&&(a=g.clientX,r=g.clientY,i=Date.now(),f=!0)},u=l=>{if(!f)return;f=!1;const g=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!g)return;const x=g.clientX-a,p=g.clientY-r,h=Date.now()-i;if(h>c)return;const _=Math.abs(x),w=Math.abs(p);if(Math.max(_,w)<e)return;let y;if(_>w*1.2)y=x<0?"left":"right";else if(w>_*1.2)y=p<0?"up":"down";else return;const b="onSwipe"+y.charAt(0).toUpperCase()+y.slice(1),A=s[b],S=s.onSwipe;A&&A.call(t,l,t,t.state,t.context),S&&S.call(t,{direction:y,dx:x,dy:p,dt:h,event:l},t,t.state,t.context)};o.addEventListener("touchstart",d,{passive:!0}),o.addEventListener("touchend",u,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",d)}catch{}try{o.removeEventListener("touchend",u)}catch{}})}function it(t,o){const s={...t};for(const n in o){const e=s[n],c=o[n];e&&c&&typeof e=="object"&&typeof c=="object"&&!Array.isArray(e)&&!Array.isArray(c)&&typeof e!="function"&&typeof c!="function"?s[n]=it(e,c):s[n]=c}return s}function Eo(t,o,s,n,e){if(!o||!t.node)return;const c=t.childExtends,a=pt(t,"childProps");if(Array.isArray(o)){const r=t.tag==="fragment",i=t.context?.document||globalThis.document,f=r?null:i?.createDocumentFragment();if(!r&&!f)return;const d=t.childProps,u=t.childrenAs,l=y=>{let b=o[y];const A=b;(typeof b=="string"||typeof b=="number")&&(b={text:b});let S=d;if(typeof d=="function")try{S=d(t,b)}catch{S=null}let C=typeof d=="function"?jt(S):a;if(e&&u!=="state"&&(C=Et(C,jt(A))),u==="state"){let E=A;(typeof A=="string"||typeof A=="number")&&(E={value:A,text:A}),b=S?{...S,state:E}:{state:E}}else S&&(b=it(S,b));if(c&&!b.ignoreChildExtends)if(b.extends){const E=Array.isArray(b.extends)?b.extends:[b.extends],V=Array.isArray(c)?c:[c];b={...b,extends:[...V,...E]}}else b={...b,extends:c};const k=Qo(b?.key,A,y,t);try{return m(Pt(b,C),t,k,s)}catch(E){if(typeof console<"u"&&console.error){const V=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${k}" failed to construct at ${V} (initial render, skipping this row):`,E?.message||E)}return null}},g=t.__ref;if(!(n===!0&&!r&&!!g&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let y=0;y<o.length;y++){const b=l(y);!r&&b?.node&&f.appendChild(b.node)}return r||t.node.appendChild(f),!0}const p=g.__childrenChunkGen=(g.__childrenChunkGen||0)+1;Ro();const h=Fo();let _=null;const w=y=>{if(g.__disposed||g.__childrenChunkGen!==p){_&&_.parentNode&&_.remove();return}for(let b=y;b<o.length;b++){h.begin();const A=l(b);A?.node&&(_?t.node.insertBefore(A.node,_):f.appendChild(A.node));const S=h.end();if(b+1<o.length&&Lo(S)){_||(_=i.createComment("smbls-mount"),f.appendChild(_),t.node.appendChild(f));const C=b+1;No(()=>w(C));return}}_?(_.remove(),t.node.tagName==="SELECT"&&Zt(t,!0)):t.node.appendChild(f)};return w(0),Mo(),!0}if(typeof o=="string"){const r=ss(o,t);if(Array.isArray(r))return Eo(t,r,s,n,!0)}if(typeof o=="object")for(const r in o){if(H.has(r))continue;let i=o[r];if(i==null||i===!1)continue;const f=e?Et(a,jt(i)):a;if((typeof i=="string"||typeof i=="number")&&(i={text:i}),t.childProps&&(i=it(t.childProps,i)),c&&!i.ignoreChildExtends)if(i.extends){const d=Array.isArray(i.extends)?i.extends:[i.extends],u=Array.isArray(c)?c:[c];i={...i,extends:[...u,...d]}}else i={...i,extends:c};m(Pt(i,f),t,Vt(t,r),s)}}function Zt(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const n=s.options;if(!n||!n.length)return;const e=t.__ref,c=e&&e.__exec&&e.__exec.value,a=typeof c=="function",r=t.value!=null&&typeof t.value!="function";if(a||r){let d;if(a)try{d=c(t,t.state,t.context)}catch{return}else d=t.value,typeof d=="string"&&d.includes("{{")&&(d=$.call(t,d,t.state));const u=d==null?"":String(d);s.value!==u&&(s.value=u);return}const i=o||!(e&&e.__selectSynced);if(e&&(e.__selectSynced=!0),!i)return;let f=-1;for(let d=0;d<n.length;d++)n[d].defaultSelected&&(f=d);f>=0&&s.selectedIndex!==f&&(s.selectedIndex=f)}function qs(t,o){let{children:s,content:n}=t;const e=t.childExtends,c=typeof s=="function"||us(t,"children");if(typeof s=="function"){const p=s;try{s=p(t,t.state,t.context)}catch(b){if(s=void 0,typeof console<"u"&&console.error){const A=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${A} (initial run, treating as empty):`,b?.message||b)}}ds(t,s),t.children=s;const h=t.__ref;let _=!1;const w=T(t,t.childrenDeps,p),y=j(()=>{const b=_;_=!0;let A;try{A=w(t,t.state,t.context)}catch(R){if(typeof console<"u"&&console.error){const N=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${N}${b?"":" (initial tracking run)"}:`,R?.message||R)}return}if(!b||A===t.children)return;ds(t,A),t.children=A,h.__childrenChunkGen!=null&&h.__childrenChunkGen++;const S=typeof t.onContentUpdate=="function",C=S?[]:null,k=S?[]:null,E=S?[]:null;if(Array.isArray(A)&&t.childrenAs==="state"){const R=t.childProps,N=[],Oo=new Map;for(let P=0;P<A.length;P++){const G=A[P];let O=R;if(typeof R=="function")try{O=R(t,G)}catch{O=null}const z=Qo(O&&O.key,G,P,t);N.push(z),Oo.set(z,{rawChild:G,childProps:O})}const Qs=new Set(N),Xs=h.__children.slice();for(const P of Xs)if(!Qs.has(P)){const G=t[P];G?.remove&&G.remove(),delete t[P],k&&k.push(P)}const _t=t.childExtends,Mt=t.tag==="fragment",Js=t.context?.document||globalThis.document,gt=Mt?null:Js?.createDocumentFragment(),Xt=new Set;for(const P of N){const G=Oo.get(P),O=G.rawChild,z=t[P];if(z&&z.state){if(O&&typeof O=="object"){const F=z.state,ft=F.$replace||F.replace,To=F.$update||F.update;try{if(typeof ft=="function")ft.call(F,O);else if(typeof To=="function"){for(const B in F)if(!(B==="__element"||B==="root"||B==="parent"||B==="update")&&!Object.prototype.hasOwnProperty.call(O,B))try{F[B]=void 0}catch{}To.call(F,O)}else for(const B in O)F[B]=O[B]}catch(B){if(typeof console<"u"&&console.error){const tn=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${P}" failed to patch at ${tn} (reconcile, keeping its previous data for this pass):`,B?.message||B)}}}E&&E.push(P);continue}let Jt=O;(typeof O=="string"||typeof O=="number")&&(Jt={value:O,text:O});const mt=G.childProps;let K=mt?{...mt,state:Jt}:{state:Jt};const ms=typeof R=="function"?jt(mt):pt(t,"childProps");if(_t&&!K.ignoreChildExtends)if(K.extends){const F=Array.isArray(K.extends)?K.extends:[K.extends],ft=Array.isArray(_t)?_t:[_t];K={...K,extends:[...ft,...F]}}else K={...K,extends:_t};let to;try{to=m(Pt(K,ms),t,P,o)}catch(F){if(typeof console<"u"&&console.error){const ft=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${P}" failed to construct at ${ft} (reconcile, skipping this row):`,F?.message||F)}Xt.add(P);continue}!Mt&&to?.node&>&>.appendChild(to.node),C&&C.push(P)}if(!Mt&>&>.childNodes.length&&t.node&&t.node.appendChild(gt),!Mt&&t.node){let P=null;for(const G of N){const O=t[G]?.node;if(!O)continue;const z=P?P.nextSibling:t.node.firstChild;O!==z&&t.node.insertBefore(O,z),P=O}}h.__children=Xt.size?N.filter(P=>!Xt.has(P)):N,S&&(C.length||k.length)&&Zo(t,{added:C,removed:k,kept:E}),Zt(t,!1);return}const M=S?[...h.__children]:null;for(const R of[...h.__children]){const N=t[R];N?.remove&&N.remove(),delete t[R]}h.__children=[],Eo(t,A,o,!1,!0),Zt(t,!1),S&&Zo(t,{added:[...h.__children],removed:M,kept:[]})},{depth:h.path.length,label:v(h,"children")});h.__effects.push(y)}const a=Eo(t,s,o,!0,c);if(n!=null&&!(n&&n.__ref)){let p=n;if(typeof p=="string"||typeof p=="number"?p={text:p}:typeof p!="object"&&(p={}),t.childProps&&(p=it(t.childProps,p)),e&&!p.ignoreChildExtends)if(p.extends){const _=Array.isArray(p.extends)?p.extends:[p.extends],w=Array.isArray(e)?e:[e];p={...p,extends:[...w,..._]}}else p={...p,extends:e};const h=Et(pt(t,"childProps"),pt(t,"content"));m(Pt(p,h),t,"content",o)}if(s&&!a)return;const r=t.context?.components||{},i=t.__ref&&t.__ref.__runtimeSource,f=i?{}:null;{const p=Object.keys(t);for(let h=0;h<p.length;h++){const _=p[h];if(!_.endsWith("Extends")||typeof t[_]!="string")continue;const w=_.slice(0,-7);if(!w||w.charCodeAt(0)<65||w.charCodeAt(0)>90)continue;const y={extends:t[_]};delete t[_];for(let b=h+1;b<p.length;b++){const A=p[b],S=A.charCodeAt(0);if(S>=65&&S<=90||H.has(A)||typeof t[A]=="function"&&(A.startsWith("on")||A.startsWith(".")))break;const C=t[A];C!==void 0&&(y[A]=C,delete t[A],f&&vt(i,A)&&(f[w]||(f[w]={}),f[w][A]=i[A]))}t[w]&&typeof t[w]=="object"?t[w]={...y,...t[w]}:t[w]=y}}const d=o?.mountYield===!0||t.yieldChildren===!0,u=Object.keys(t),l=p=>{if(H.has(p)||typeof t[p]!="object"||t[p]===null)return;const h=p.charCodeAt(0);if(h<65||h>90)return;let _=t[p];if(_.__ref)return;if(!_.extends&&!_.extend){const y=r[p]||r[`smbls.${p}`];y&&(_={..._,extends:y})}if(t.childProps&&(_=it(t.childProps,_)),e&&!_.ignoreChildExtends)if(_.extends){const y=Array.isArray(_.extends)?_.extends:[_.extends],b=Array.isArray(e)?e:[e];_={..._,extends:[...b,...y]}}else _={..._,extends:e};const w=i?Et(pt(t,"childProps"),Et(f[p]||null,pt(t,p))):null;m(Pt(_,w),t,p,o)};if(!d){for(const p of u)l(p);return}Ro();const g=Fo(),x=p=>{for(let h=p;h<u.length;h++){g.begin(),l(u[h]);const _=g.end();if(h+1<u.length&&Lo(_)){const w=h+1;No(()=>x(w));return}}};x(0),Mo()}function Zs(t,o,s){const{node:n}=t;if(!n)return;n.ref=t;const e=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(e){const a=e.parentNode;if(a){if(s?.position==="before"&&s.node)a.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const r=s.node.nextSibling;a.insertBefore(n,r||e)}else a.insertBefore(n,e);return}}const c=o?.node||(o?.nodeType?o:null);if(c)if(s?.position==="before"&&s.node)c.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;a?c.insertBefore(n,a):c.appendChild(n)}else c.appendChild(n)}const Po=3;function Ie(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Po?!1:(t.__inBeforeUpdate=!0,!0)}function Qt(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Po&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Po}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function D(t,o,s){const n=t.charAt(0).toLowerCase()+t.slice(1);bt(n,o,s);const e="on"+t,c=o[e];if(typeof c=="function"){const i=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(i){if(o.__ref[i])return!0;o.__ref[i]=!0}const f=o.context?.designSystem;f&&Y(f);let d=!!i;try{const u=c(o,o.state,o.context,s);if(u&&typeof u.then=="function"){const l=o.__ref;return u.catch(g=>{$t(o,e,g)}).finally(()=>{i&&l&&(l[i]=!1)}),d=!1,!0}if(u===!1)return!1}catch(u){if($t(o,e,u),o.context?.strictMode)throw u}finally{f&&q(),d&&o.__ref&&(o.__ref[i]=!1)}}return!0}var yr=m;export{Po as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,Ie as acquireBeforeUpdateGuard,m as create,yr as default,ro as flushMounts,lr as isStaticCssProp,pr as recompileStaticCss,hr as reconcileAttrProp,Qt as releaseBeforeUpdateGuard,qt as resolveStyleBlock,Kt as writeAttr,Gt as writeElementText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from"@symbo.ls/css";if(!e.CSS_SHORTHAND_LONGHANDS||!e.CSS_LONGHAND_SHORTHANDS)throw new Error("@symbo.ls/element: the installed @symbo.ls/css does not export CSS_SHORTHAND_LONGHANDS / CSS_LONGHAND_SHORTHANDS (the CSS shorthand family table, packages/css/src/cssLonghands.js). This element needs the @symbo.ls/css published in the same release \u2014 update @symbo.ls/css.");const a=e.CSS_SHORTHAND_LONGHANDS,N=e.CSS_LONGHAND_SHORTHANDS,r=e.cssShorthandStatesLonghand||(()=>!1),S=s=>s.charCodeAt(0)===45&&s.charCodeAt(1)===45,c=e.cssPropName||(s=>S(s)?s:s.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())),H=e.cssCamelName||(s=>S(s)?s:s.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()));export{N as CSS_LONGHAND_SHORTHANDS,a as CSS_SHORTHAND_LONGHANDS,H as cssCamelName,c as cssPropName,r as cssShorthandStatesLonghand};
|
package/dist/esm/src/dispose.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getObserver as
|
|
1
|
+
import{getObserver as n}from"@symbo.ls/signal";import{untrack as s}from"./runContext.js";import{destroyBridge as c}from"./bridge.js";function t(r){if(!r)return;const o=r.__ref;if(!o)return;if(n())return s(()=>t(r));o.__disposed=!0;try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(e){console.error("[smbls] onBeforeRemove error:",e)}if(o.__bridge&&c(r),o.__effects){for(let e=0;e<o.__effects.length;e++)o.__effects[e].dispose();o.__effects.length=0}if(typeof o.__releaseMedia=="function"&&(o.__releaseMedia(),o.__releaseMedia=null),o.__eventCleanup){for(let e=0;e<o.__eventCleanup.length;e++)o.__eventCleanup[e]();o.__eventCleanup.length=0}if(o.__children){const e=o.__children.slice();o.__children.length=0;for(let _=0;_<e.length;_++){const f=r[e[_]];f&&f.__ref&&t(f)}}r.node?.parentNode?r.node.remove():r.tag==="fragment"&&o.__fragmentAnchor?.parentNode&&o.__fragmentAnchor.remove();const i=r.state?.$destroy||r.state?.destroy;if(typeof i=="function"&&r.state.__element===r&&i.call(r.state),r.parent?.__ref?.__children){const e=r.parent.__ref.__children.indexOf(r.key);e!==-1&&r.parent.__ref.__children.splice(e,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(e){console.error("[smbls] onRemove error:",e)}r.node=null,r.parent=null,r.__ref=null}function u(){t(this)}export{t as dispose,u as remove};
|