@symbo.ls/element 3.14.797 → 3.14.799
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 +42 -0
- package/dist/cjs/src/attributeFirst.js +1 -1
- package/dist/cjs/src/bridge.js +1 -0
- package/dist/cjs/src/create.js +5 -5
- package/dist/cjs/src/cssLonghands.js +1 -1
- package/dist/cjs/src/delegate.js +1 -1
- package/dist/cjs/src/dispose.js +1 -1
- package/dist/cjs/src/extends.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/src/inertOutside.js +1 -0
- package/dist/cjs/src/registry.js +1 -1
- package/dist/cjs/src/update.js +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/attributeFirst.js +1 -1
- package/dist/esm/src/bridge.js +1 -0
- package/dist/esm/src/create.js +5 -5
- package/dist/esm/src/cssLonghands.js +1 -1
- package/dist/esm/src/delegate.js +1 -1
- package/dist/esm/src/dispose.js +1 -1
- package/dist/esm/src/extends.js +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/inertOutside.js +1 -0
- package/dist/esm/src/registry.js +1 -1
- package/dist/esm/src/update.js +1 -1
- package/dist/esm/src/version.js +1 -1
- package/package.json +8 -8
package/dist/cjs/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i=Object.create;var p=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var G=(e,o)=>{for(var a in o)p(e,a,{get:o[a],enumerable:!0})},n=(e,o,a,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of v(o))!u.call(e,f)&&f!==a&&p(e,f,{get:()=>o[f],enumerable:!(m=N(o,f))||m.enumerable});return e};var I=(e,o,a)=>(a=e!=null?i(S(e)):{},n(o||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),c=e=>n(p({},"__esModule",{value:!0}),e);var L={};G(L,{DELEGATED_EVENTS:()=>r.DELEGATED_EVENTS,LIFECYCLE_EVENTS:()=>r.LIFECYCLE_EVENTS,MIXINS:()=>r.MIXINS,NON_BUBBLING_EVENTS:()=>r.NON_BUBBLING_EVENTS,REGISTRY:()=>r.REGISTRY,SVG_TAGS:()=>t.SVG_TAGS,addDelegatedEvent:()=>E.addDelegatedEvent,addMethods:()=>l.addMethods,applyExtends:()=>g.applyExtends,cacheNode:()=>t.cacheNode,create:()=>d.create,createHTMLNode:()=>t.createHTMLNode,default:()=>d.default,detectTag:()=>t.detectTag,dispose:()=>s.dispose,flushMounts:()=>d.flushMounts,globalEventKeyInfo:()=>E.globalEventKeyInfo,inertOutsidePlugin:()=>T.inertOutsidePlugin,isSvgTag:()=>t.isSvgTag,isValidTag:()=>t.isValidTag,refreshContextProto:()=>l.refreshContextProto,registerEvent:()=>E.registerEvent,registerGlobalEvent:()=>E.registerGlobalEvent,remove:()=>s.remove,removeDelegatedEvent:()=>E.removeDelegatedEvent,update:()=>x.update});module.exports=c(L);var d=I(require("./create.js"),1),x=require("./update.js"),s=require("./dispose.js"),r=require("./registry.js"),E=require("./delegate.js"),t=require("./cache.js"),g=require("./extends.js"),l=require("./methods.js"),T=require("./inertOutside.js");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},P=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N(t))!R.call(e,o)&&o!==n&&h(e,o,{get:()=>t[o],enumerable:!(r=M(t,o))||r.enumerable});return e};var L=e=>P(h({},"__esModule",{value:!0}),e);var U={};x(U,{inertOutsidePlugin:()=>K});module.exports=L(U);var a=require("@symbo.ls/signal");const d="inertOutside",k=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT","BASE","TITLE"]),D='a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable="false"])',q={attributes:!0,attributeFilter:["inert"]},g=new WeakMap,O=new WeakMap,p=new Set,_=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function f(e){const t=(0,a.getObserver)();t&&(0,a.setObserver)(null);try{return e()}catch(n){console.error("[smbls] inertOutside:",n)}finally{t&&(0,a.setObserver)(t)}}function S(e){const t=()=>f(e);typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function W(e){if(!e||!e.defaultView||!("activeElement"in e))return null;let t=g.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(()=>E(t,r))),g.set(e,t),t)}function T(e,t){const n=e.element.node;return!!n&&n.nodeType===1&&n.isConnected&&n.ownerDocument===t}function B(e){const t=e.activeElement;return t&&t!==e.body&&t!==e.documentElement?t:null}const A=e=>!!(e.closest&&e.closest("[inert]"));function V(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 l=c.firstElementChild;l;l=l.nextElementSibling)l!==o&&!k.has(l.tagName)&&n.add(l)}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 E(e,t){const{doc:n,held:r,observer:o}=e;t&&m(e,t),m(e,o.takeRecords());const c=e.top,l=[];for(const s of e.layers){const b=T(s,n);b&&!s.live&&(l.push(s),s.returnFocus=B(n)),s.live=b}l.length&&(e.layers=e.layers.filter(s=>!l.includes(s)).concat(l));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:v,parents:y}=i?V(i.element.node):{outside:new Set,parents:[]};for(const[s,b]of r)v.has(s)||(b&&s.removeAttribute("inert"),r.delete(s));for(const s of v)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 y)o.observe(s,{childList:!0});for(const s of r.keys())o.observe(s,q);if(e.layers.some(s=>!s.live)?p.add(e):p.delete(e),i===c)return;const u=c&&!(c.declared&&c.live)?c:null;if(i&&l.includes(i))u&&u.returnFocus&&(i.returnFocus=u.returnFocus),S(()=>C(e,i));else if(u){const s=u.returnFocus;S(()=>j(e,u,s))}u&&(u.returnFocus=null)}function C(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,l=(i,v)=>{if(c.has(i)||(c.add(i),i.matches(":disabled")))return!1;const y=v&&i.getAttribute("tabindex");return y&&parseInt(y,10)<0?!1:(i.focus(),r.activeElement===i)};for(const i of n.querySelectorAll("[autofocus]"))if(l(i,!1))return;for(const i of n.querySelectorAll(D))if(l(i,!0))return;o&&o!==r.body&&typeof o.blur=="function"&&o.blur()}function j(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)||A(o))&&(n&&n.isConnected&&n.ownerDocument===r&&!A(n)&&(n.focus({preventScroll:!0}),r.activeElement===n)||e.top&&C(e,e.top))}function w(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)}E(n)}function I(e){let t=e[d];if(typeof t=="function")try{t=t(e,e.state,e.context)}catch{t=!1}return!!t}function F(e){let t=O.get(e);if(t)return t;const n=e.__ref,r=e.node;if(!n||!r||r.nodeType!==1)return null;const o=W(r.ownerDocument);if(!o)return null;t={element:e,manager:o,declared:!1,live:!1,returnFocus:null},O.set(e,t);const c=(0,a.createEffect)(()=>{const l=I(e);f(()=>w(t,l))},{depth:n.path.length,label:()=>n.path.join(".")+"::"+d});return n.__effects||(n.__effects=[]),n.__effects.push(c),n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>f(()=>w(t,!1))),t}function z(){for(const e of p){if(!e.doc.defaultView){p.delete(e);continue}e.layers.some(t=>!t.live&&T(t,e.doc))&&E(e)}}const K={name:d,create(e){_(e,d)&&f(()=>F(e))},render(){p.size&&f(z)},update(e){_(e,d)&&f(()=>{const t=F(e);t&&w(t,I(e))})}};
|
package/dist/cjs/src/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},l=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!c.call(t,o)&&o!==a&&r(t,o,{get:()=>e[o],enumerable:!(s=n(e,o))||s.enumerable});return t};var i=t=>l(r({},"__esModule",{value:!0}),t);var b={};p(b,{DELEGATED_EVENTS:()=>E,LIFECYCLE_EVENTS:()=>h,MIXINS:()=>m,NON_BUBBLING_EVENTS:()=>g,PASSIVE_EVENTS:()=>v,REGISTRY:()=>u});module.exports=i(b);const u=new Set(["extends","children","content","childrenAs","childExtends","childExtendsRecursive","childProps","inheritParentProps","state","if","define","deps","tag","attr","style","text","html","value","data","classlist","class","vars","scope","root","context","$router","routes","fetch","variables","query","key","component","preventContentUpdate","preventContentRecreate","subscribeTo","autoGrow","srcObject","allowRuntimeTemplates","__name","__ref","__hash","__text","parent","node"]),m={text:"text",html:"html",style:"style",attr:"attr",data:"data",classlist:"classlist",state:"state",scope:"scope"},h=new Set(["start","init","complete","attachNode","stateInit","stateCreated","beforeUpdate","update","afterUpdate","beforeClassAssign","lazyLoad","render","renderRouter","done","create","frame","mounted","contentUpdate","startUpdate","stateUpdate","beforeStateUpdate","initInspect","initSync","beforeRemove","remove","bridgeMount","bridgeUpdate","bridgeDestroy"]),g=new Set(["load","error","abort","scroll","canplay","canplaythrough","ended","pause","play","playing","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","durationchange","loadeddata","loadedmetadata","progress","emptied","resize"]),v=new Set(["wheel","mousewheel","touchstart","touchmove","touchend","touchcancel"]),E=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointerover","pointerout","touchstart","touchend","touchmove","keydown","keyup","keypress","input","change","submit","reset","focus","blur","focusin","focusout","wheel","contextmenu","drag","dragstart","dragend","dragenter","dragleave","dragover","drop"]);
|
package/dist/cjs/src/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var y=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var j=(o,f)=>{for(var e in f)y(o,e,{get:f[e],enumerable:!0})},U=(o,f,e,r)=>{if(f&&typeof f=="object"||typeof f=="function")for(let c of A(f))!P.call(o,c)&&c!==e&&y(o,c,{get:()=>f[c],enumerable:!(r=g(f,c))||r.enumerable});return o};var B=o=>U(y({},"__esModule",{value:!0}),o);var k={};j(k,{default:()=>S,update:()=>p});module.exports=B(k);var u=require("@symbo.ls/signal"),v=require("./registry.js"),i=require("./create.js"),h=require("@symbo.ls/utils/function.js"),a=require("attrs-in-props");function p(o={},f={}){const e=this,r=e.__ref;if(!r)return;if((typeof o=="string"||typeof o=="number")&&(o={text:o}),!f.preventListeners&&typeof e.onBeforeUpdate=="function"&&(0,i.acquireBeforeUpdateGuard)(r))try{const t=e.onBeforeUpdate(e,e.state,e.context,f);if(t&&typeof t.then=="function")t.then(()=>(0,i.releaseBeforeUpdateGuard)(r,!1),n=>{(0,i.releaseBeforeUpdateGuard)(r,!0),e.context?.plugins?.length&&(0,h.runPluginHook)("error",e,{hook:"onBeforeUpdate",error:n})||console.error("[DOMQL] onBeforeUpdate error:",n)});else if((0,i.releaseBeforeUpdateGuard)(r,!1),t===!1)return e}catch(t){throw(0,i.releaseBeforeUpdateGuard)(r,!0),t}const c=!o||Object.keys(o).length===0,l=[];let _=!1;(0,u.batch)(()=>{if(o.state&&(0,u.isStore)(e.state)&&e.state.$update(o.state),o.text!==void 0&&(e.text=o.text,!r.__exec.text&&e.node&&(0,i.writeElementText)(e,o.text??"")),o.html!==void 0&&(e.html=o.html,!r.__exec.html&&e.node&&(e.node.innerHTML=o.html)),o.style&&e.node?.style){if(!r.__exec.style){const t=(0,i.resolveStyleBlock)(e,o.style);for(const n in t){const s=t[n];if(s==null)continue;const d=n.replace(/[A-Z]/g,b=>"-"+b.toLowerCase()),x=String(s).replace(/\s*!important\s*$/,"");e.node.style.setProperty(d,x,"important")}}e.style||(e.style={}),Object.assign(e.style,o.style)}if(o.attr&&e.node?.setAttribute){for(const t in o.attr){const n=o.attr[t];n==null||n===!1&&!(0,a.isEnumeratedTrueFalseAttr)(t)?e.node.removeAttribute(t):typeof n!="function"&&typeof n!="object"&&e.node.setAttribute(t,(0,a.serializeAttrValue)(t,n))}e.attr||(e.attr={}),Object.assign(e.attr,o.attr)}if(o.data&&e.node?.dataset){for(const t in o.data)e.node.dataset[t]=o.data[t];e.data||(e.data={}),Object.assign(e.data,o.data)}if(o.vars&&typeof o.vars=="object"&&!Array.isArray(o.vars)){const t=e.vars&&typeof e.vars=="object"&&!Array.isArray(e.vars)?e.vars:null;e.vars={...t,...o.vars},_=!0}for(const t in o){if(v.REGISTRY.has(t)||t==="state")continue;const n=o[t],s=e[t];if(s&&s.__ref&&typeof s.update=="function")s.update(n,f);else if(typeof n=="object"&&n!==null){const d=t.charCodeAt(0);d>=65&&d<=90&&(0,i.create)(n,e,t,f)}else t!=="text"&&t!=="html"&&t!=="style"&&t!=="attr"&&t!=="data"&&(e[t]=n,typeof n!="function"&&l.push(t))}});for(let t=0;t<l.length;t++)(0,i.reconcileAttrProp)(e,l[t]);if(e.node){let t=_;for(let n=0;!t&&n<l.length;n++)(0,i.isStaticCssProp)(l[n])&&(t=!0);t&&(0,i.recompileStaticCss)(e)}if(e.node&&c&&r.__effects&&r.__effects.length)for(let t=0;t<r.__effects.length;t++){const n=r.__effects[t];n&&!n._disposed&&!n._isSubscribeToEffect&&typeof n._execute=="function"&&n._execute()}else if(e.node&&r.__conditionalRunners)for(const t of r.__conditionalRunners)t();return(0,h.runPluginHook)("update",e),!f.preventListeners&&typeof e.onUpdate=="function"&&e.onUpdate(e,e.state,e.context,f),e}var S=p;
|
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.799";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{checkAttributeByTagName as s}from"attrs-in-props";import{CSS_PROPS_REGISTRY as S,DEFAULT_CSS_PROPERTIES_LIST as r}from"css-in-props";const
|
|
1
|
+
import{checkAttributeByTagName as s}from"attrs-in-props";import{CSS_PROPS_REGISTRY as S,DEFAULT_CSS_PROPERTIES_LIST as r}from"css-in-props";const e=new Set(["rows","cols","wrap","fill","stroke"]),i=(o,t)=>e.has(t)&&s(o,t),p=(o,t)=>!!(S[t]||r&&r.has(t))&&!i(o,t);export{e as ATTRIBUTE_FIRST_KEYS,i as isAttributeFirst,p as isCssProp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createEffect as l,getObserver as y,setObserver as f}from"@symbo.ls/signal";import{pushConfig as c,popConfig as d}from"@symbo.ls/scratch";import{runPluginHook as g}from"@symbo.ls/utils/function.js";import{isLoudDevRuntime as _}from"./devRuntime.js";const B=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);function s(t,r,n){t.context?.plugins?.length&&g("error",t,{hook:r,error:n})||console.error(`[DOMQL] Lifecycle "${r}" error:`,n)}function u(t,r,n){const o=y();o&&f(null);const i=t.context?.designSystem;i&&c(i);try{return r.call(t,n,t,t.state,t.context)}finally{i&&d(),o&&f(o)}}function b(t,r){if(!_())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,b(t,r);let i;try{i=u(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=>a(t,o,e),e=>{o.failed=!0,s(t,"onBridgeMount",e)});return}a(t,o,i)}function a(t,r,n){if(r.settled=!0,r.instance=n,r.disposed){p(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=l(()=>{if(r.disposed)return;const i=t.context?.designSystem;i&&c(i);try{const e=t.onBridgeUpdate.call(t,r.instance,t,t.state,t.context);e&&typeof e.then=="function"&&e.catch(h=>s(t,"onBridgeUpdate",h))}catch(e){s(t,"onBridgeUpdate",e)}finally{i&&d()}},{depth:o.path.length,label:()=>o.path.join(".")+"::onBridgeUpdate"}),o.__effects.push(r.effect)}function L(t){const r=t.__ref?.__bridge;!r||r.disposed||(r.disposed=!0,r.effect&&r.effect.dispose(),r.settled&&p(t,r))}function p(t,r){if(r.destroyed)return;r.destroyed=!0;const n=r.instance;if(r.instance=void 0,B(t,"bridge")&&(t.bridge=void 0),typeof t.onBridgeDestroy=="function")try{const o=u(t,t.onBridgeDestroy,n);o&&typeof o.then=="function"&&o.catch(i=>s(t,"onBridgeDestroy",i))}catch(o){s(t,"onBridgeDestroy",o)}}export{L 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 Qt,createScopeStore as $s,isStore as Y}from"@symbo.ls/signal";import{createEffect as j,getObserver as ko,setObserver as Nt}from"@symbo.ls/signal";import{cacheNode as Xt,detectTag as jo}from"./cache.js";import{REGISTRY as G,LIFECYCLE_EVENTS as Is}from"./registry.js";import{registerEvent as Us,registerGlobalEvent as Hs,globalEventKeyInfo as Vs}from"./delegate.js";import{mountBridge as Bs}from"./bridge.js";import{applyExtends as Gs,openMergeLayer as Ks}from"./extends.js";import{addMethods as Ws}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as ft}from"./devRuntime.js";import{mountBudgetExhausted as Eo,openMountBudget as Po,closeMountBudget as Oo,enqueueMountWork as To}from"./mountScheduler.js";import{replaceLiteralsWithObjectFields as I,isPolyglotWritableKey as zs,markPolyglotSeeded as Ys}from"@symbo.ls/utils";import*as Ft from"@symbo.ls/utils";import{runPluginHook as q}from"@symbo.ls/utils/function.js";import{applyStateMethods as xt}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as U,DEFAULT_CSS_PROPERTIES_LIST as V,pushStaticCssPass as Lo,popStaticCssPass as Do,resolveStyleBlockTokens as qs}from"css-in-props";import{css as wt,wrapHoverRule as Mo}from"@symbo.ls/css";import{pushConfig as L,popConfig as D}from"@symbo.ls/scratch";import{checkAttributeByTagName as St,applyAttrTransforms as Zs,ATTR_TRANSFORMS as Jt,camelToAttr as Ct,serializeAttrValue as K,isEnumeratedTrueFalseAttr as at,extractConditionalAttrs as Qs}from"attrs-in-props";import{resolveElementIdEngine as Xs}from"./engineRegistry.js";import{CSS_LONGHAND_SHORTHANDS as $t,CSS_SHORTHAND_LONGHANDS as Js,cssShorthandStatesLonghand as Ro}from"./cssLonghands.js";import{isAttributeFirst as No,isCssProp as st}from"./attributeFirst.js";import{VERSION as ms}from"./version.js";const Fo=Xs({uniqId:1,scopedStyleId:0},ms),vt=[],nt=new Set;let mt=!1,$o=0,ut=null,kt=null;function dt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function Io(){return typeof document<"u"&&document.visibilityState==="hidden"}const tn=250,on=1e3;function sn(){return kt&&(kt!==(typeof requestAnimationFrame=="function"?requestAnimationFrame:null)||Io())?!0:dt()-$o>=on}function nn(){if(mt=!0,$o=dt(),kt=null,typeof requestAnimationFrame!="function"){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(to,0);ut=t?()=>t(o):null;return}if(Io()){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(to,tn);ut=t?()=>t(o):null}else{const t=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:null;kt=requestAnimationFrame;const o=requestAnimationFrame(to);ut=t?()=>t(o):null}}function It(){if(mt){if(!sn())return;const t=ut;if(ut=null,t)try{t()}catch{}}nn()}const Uo=300,Ho=15e4;function to(){if(mt=!1,ut=null,kt=null,nt.size&&Kn(),!vt.length)return;const t=vt.splice(0,vt.length);for(let o=0;o<t.length;o++){const s=t[o];if(s.node){if(!s.node.isConnected){const e=s.__ref||(s.__ref={});e.__mountAttempts=(e.__mountAttempts||0)+1,e.__mountFirstAttemptAt==null&&(e.__mountFirstAttemptAt=dt());const r=dt()-e.__mountFirstAttemptAt;e.__mountAttempts<=Uo&&r<Ho?(vt.push(s),It()):console.warn("[DOMQL] onMounted dropped after",e.__mountAttempts,"attempts /",r,"ms \u2014 node never connected:",s.key||s.tag||s);continue}typeof s.onBridgeMount=="function"&&Bs(s),typeof s.onMounted=="function"&&R("Mounted",s,s.__ref?.__mountOptions||{})}}}function oo(t,o){const s=t.__ref?.__autoGrow;s&&s.active&&Dt(t,!0),!(typeof t.onMounted!="function"&&typeof t.onBridgeMount!="function")&&(t.__ref.__mountOptions=o,vt.push(t),It())}function Vo(t,o){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&q("contentUpdate",t,o);const s=t.context?.designSystem;s&&L(s);try{t.onContentUpdate(t,t.state,t.context,o)}catch(e){if(t.context?.plugins?.length&&q("error",t,{hook:"onContentUpdate",error:e})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',e),t.context?.strictMode)throw e}finally{s&&D()}}function Z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function en(t){return t.charAt(2).toLowerCase()+t.slice(3)}function rn(t){return t.toLowerCase()}function so(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function jt(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=jt(r,i):s[e]=i}return s}function Ut(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function Bo(t,o,s){return Ut(t)||(o&&typeof o=="object"?Ut(o.key):void 0)||String(s)}function J(t,o,s,e={},r){const i=ko();if(i){Nt(null);try{return J(t,o,s,e,r)}finally{Nt(i)}}if(t==null||t===!1)return null;const a=bn(t);(typeof t=="string"||typeof t=="number")&&(t={text:t}),s=Ut(s);const f=Ut(t.key),n=Object.create(null);n.key=s||f||`_${Fo.uniqId++}`,n.parent=o||null,n.context=t.context||o?.context||e.context||{},n.context.__create||(n.context.__create=J);const c=n.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||n,path:o?.__ref?.path?[...o.__ref.path,n.key]:[n.key],origin:t};a&&(c.__runtimeSource=a);const l=t;if(t=Go(n,t,s,f,o,e),n.if!=null){let d;if(typeof n.if=="function")try{d=n.if(n,n.state,n.context)}catch(h){if(d=!1,c.__ifError=h,typeof console<"u"&&console.warn){const y=n.key||n.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${y} \u2014 treating as false:`,h?.message||h)}}else d=n.if;c.__if=!!d}if(c.__if)typeof n.if=="function"&&(c.__ifInitialized=!0);else{o&&(o[n.key]=n);const d=an(t,s,n.context?.components);return d.length&&(c.__ifLateMerge={definition:l,key:s,ownKey:f,names:d,options:e}),typeof n.if=="function"&&Jo(n,c,n.if),n}n.tag||(n.tag=jo(n)),R("Init",n,e);const u=n.node=Xt(n);if(!u)return n;if(n.tag==="fragment"){const h=(n.context?.document||globalThis.document).createComment("");u.appendChild(h),c.__fragmentAnchor=h}R("AttachNode",n,e),u.setAttribute&&n.key&&u.setAttribute("data-key",n.key),o&&(o[n.key]=n,o.__ref?.__children&&(o.__ref.__children.includes(n.key)||o.__ref.__children.push(n.key))),u.setAttribute&&n.context?.scopeSelector&&n.context.scopeSelector!==":root"&&n.context.key&&n.key===n.context.key&&u.setAttribute("data-smbls-app",n.context.key),n.id&&u.setAttribute&&(u.id=n.id),Os(n,e),Qo(n),fo(n),xs(n),_o(n),Es(n),mn(n);try{Ts(n,e)}catch(d){if(typeof console<"u"&&console.error){const h=n.__ref?.path?.join(".")||n.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,d?.message||d,d?.stack?`
|
|
2
|
+
`+d.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Ft(e,!0),is(e,s,r),typeof e.html=="function"&&e.node&&!e.node.innerHTML){const _=e.context?.designSystem;_&&M(_);try{const b=e.html(e,e.state,e.context);b!=null&&typeof b!="function"&&(e.node.innerHTML=b)}catch{}finally{_&&N()}}if(F("Create",e,n),F("Complete",e,n),F("Render",e,n),F("RenderRouter",e,n),Yt(e,n),typeof e.onFrame=="function"){const _=e.onFrame,b=e.context?.designSystem,w=()=>{if(e.node){if(e.node.isConnected){b&&M(b);try{_(e,e.state,e.context)}catch(S){console.error("[DOMQL] onFrame error:",S)}finally{b&&N()}}requestAnimationFrame(w)}};requestAnimationFrame(w)}return e}function Ls(t,s,o){const n=!s,r=o.state&&typeof o.state=="object"&&!Array.isArray(o.state)&&Object.keys(o.state).length===0,i=n&&r&&t.context?.state,a=o.state!==void 0&&!i?o.state:t.state&&!Q(t.state)?t.state:void 0;if(a==null){if(s?.state)t.state=s.state,ut(t,t.state);else if(t.context?.state){const f=t.context.state,e={...f},u=t.context?.polyglot;if(u?.translations){const h=t.context,p=f.lang||u.defaultLang||"en",y=new Set,g=(d,A)=>{y.has(d)||xs(h,d,e)&&(e[d]=A,y.add(d),ws(h,d,A))},c=u.translations[p];if(c&&typeof c=="object")for(const d in c)g(d,c[d]);const l=new Set(u.languages||[]);for(const d in u.translations)l.has(d)||g(d,u.translations[d])}t.state=Q(e)?e:Gt(e),t.state.__element=t,t.state.root=t.state,ut(t,t.state),jt.promoteActiveRootState?.(f,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ut(t,t.state);return}if(typeof a=="string"){if(t.state=Po(a,s),t.state&&typeof t.state=="object"&&!Q(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}ut(t,t.state);return}if(typeof a=="function"){const f=a(t,s?.state);t.state=Q(f)?f:Gt(f||{})}else Q(a)?t.state=a:t.state=Gt({...a});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,ut(t,t.state),jt.promoteActiveRootState?.(a,t.state)}function Zt(t,s){if(!s)return t;const o=s.split("/");let n=t;for(const r of o){if(n==null)return{};n=n[r]}return n??{}}function Po(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?Zt(s.state,r):s.state??{}}if(t.startsWith("~/")){const r=s.state?.root||s.state,i=t.slice(2);return i?Zt(r,i):r??{}}if(s.state?.[t]!==void 0)return s.state[t];const o=Zt(s.state,t);if(o!=null&&Object.keys(o).length>0)return o;const n=s.context?.polyglot;if(n?.translations){const r=s.state?.root?.lang||n.defaultLang||"en",i=n.translations[r];if(i?.[t]!==void 0)return i[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}const Ds=new Set(["s","state","ctx","context"]);function Rs(t){try{const o=(typeof jt.getFunctionSource=="function"?jt.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return o?o[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Ms(t){if(typeof t!="function"||t.length!==2)return!1;const s=Rs(t);if(s.length<2)return!1;const o=s[1].replace(/[{}[\]]/g,"").trim();return o.length>0&&!Ds.has(o)}function Ns(t){const s=t.__ref,o=t.tag||"div",n=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||K.has(f))continue;const e=f.charCodeAt(0);e>=65&&e<=90||Z(f)||D[f]||R&&R.has(f)||dt(o,f)||(et()&&Ms(t[f])&&console.warn(`[smbls] custom prop "${f}"${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('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]}))}for(let a=0;a<r.length;a++){const{prop:f,fn:e}=r[a];s.__exec[f]=e,Object.defineProperty(t,f,{get(){n&&M(n);try{return e(t,t.state,t.context)}catch{return}finally{n&&N()}},set(u){delete s.__exec[f],Object.defineProperty(t,f,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Fs(t,s){if(!(!Array.isArray(s)||s.length===0))for(let o=0;o<s.length;o++){const n=s[o];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function P(t,s,o){return!Array.isArray(s)||s.length===0?o:function(...n){return Fs(t,s),o.apply(this,n)}}function At(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function k(t,s){return()=>t.path.join(".")+"::"+s}const Oo=new Set;function O(t,s,o){if(!et())return;const n=k(t,s)();Oo.has(n)||(Oo.add(n),console.warn(`[smbls] "${s}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,o?.message||o))}const Lo=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,$s=(t,s)=>{let o;try{o=String(t)}catch{return}if(!o.includes("{{"))return;Lo.lastIndex=0;let n;for(;(n=Lo.exec(o))!==null;)n[2].includes("{{")&&s.add(n[2])},Is=(t,s)=>!Z(t)&&!yt(s,t),Do=(t,s,o,n,r)=>{if(typeof s=="string"){!r&&s.includes("{{")&&o.add(s);return}typeof s=="function"&&Is(t,n)&&$s(s,o)},Qt=new WeakMap,xt=(t,s)=>Object.prototype.hasOwnProperty.call(t,s),wt=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const s=t.props;return s&&typeof s=="object"&&!Array.isArray(s)?tt(t,s):t},St=(t,s)=>t&&s?tt(t,s):t||s||null,Ro=(t,s)=>{const o=t.__ref&&t.__ref.__runtimeSource;return!!o&&xt(o,s)},it=(t,s)=>Ro(t,s)?wt(t.__ref.__runtimeSource[s]):null,Ct=(t,s)=>(s&&t&&typeof t=="object"&&Qt.set(t,s),t),Us=t=>{if(!t||typeof t!="object")return;const s=Qt.get(t);return s&&Qt.delete(t),s},Xt=(t,s,o)=>{if(typeof t=="string"){t.includes("{{")&&s.add(t);return}if(!(!t||typeof t!="object"||o.has(t))){if(o.add(t),Array.isArray(t)){for(let n=0;n<t.length;n++)Xt(t[n],s,o);return}if(!t.__ref)for(const n of Object.keys(t)){if(n==="state")continue;const r=Object.getOwnPropertyDescriptor(t,n);r&&"value"in r&&Xt(r.value,s,o)}}},Vs=(t,s)=>{let o=null;for(const n of Object.keys(t)){if(K.has(n)||s&&xt(s,n))continue;const r=Object.getOwnPropertyDescriptor(t,n),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;Xt(i,a,new Set),a.size&&(o||(o=new Map),o.set(i,a))}return o},Mo=(t,s)=>{if(Array.isArray(s))for(let o=t;o;o=o.parent){const n=o.__ref&&o.__ref.__declaredArrays,r=n&&n.get(s);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Bs=["attr","aria","data","metadata"],Gs=t=>{if(Bs.includes(t))return!0;const s=t.charCodeAt(0);return s===46||s===33||s===64},Hs=(t,s)=>{const o=new Set,n=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!s&&xt(s,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Gs(r))continue;const e=f?s[r]:null,u=e&&typeof e=="object"?e:null;for(const h in a){const p=f&&(!u||xt(u,h));Do(h,a[h],o,n,p)}continue}Do(r,a,o,n,f)}return o};function No(t,s){const o=t.__ref,n=!!(s&&s.skipIfEffect),r=Hs(t,o.__runtimeSource);if(o.__authoredTemplates)for(const e of r)o.__authoredTemplates.add(e);else o.__authoredTemplates=r;if(Ns(t),typeof t.text=="function"){const e=t.text,u=P(t,t.textDeps,e),h=v(()=>{if(!o.contentManaged)try{let p=u(t,t.state,t.context);t.node&&p!=null&&typeof p!="function"&&typeof p!="object"&&(typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Pt(t,p))}catch(p){O(o,"text",p)}},{depth:o.path.length,label:k(o,"text")});o.__effects.push(h),o.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,u=v(()=>{if(o.contentManaged)return;const h=I.call(t,e,t.state);h!=null&&(t.text=h),t.node&&Pt(t,h??"")},{depth:o.path.length,label:k(o,"text")});o.__effects.push(u),o.__exec.text=e}const i=t.tag||"div";for(const e of Object.keys(t))if(typeof t[e]=="function"&&!K.has(e)&&!Z(e)&&!o.__exec[e]&&!wo(i,e)){if(D[e]){const u=t[e],h=P(t,t[e+"Deps"],u),p=e;let y,g=null,c=null,l;const d=v(()=>{const A=t.context?.designSystem;A&&M(A);try{const x=h(t,t.state,t.context);go();let _;try{_=D[p](x,t,t.state,t.context)}finally{bo()}if(Array.isArray(_)){const w={};for(const S of _)if(S)for(const C in S)w[C]=S[C];_=w}const b=p==="show"||p==="hide";if(_&&t.node&&Ks(_)){const w=Ot(_);if(w===null||w!==l){l=w;const S=lt(_,null,t.context?.cssPrefix),C=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(c)for(const j of c)t.node.classList.remove(j);if(C&&C.length)for(const j of C)t.node.classList.add(j);c=C}}y=void 0,g=null}else if(_&&t.node){if(c){for(const S of c)t.node.classList.remove(S);c=null,l=void 0}const w=Ot(_);if(w===null||w!==y||!Rt(t.node,g)){y=w;const S=Bo(t,_);g=Lt(t.node,S)}}else t.node&&b&&(y=void 0,g=null,t.node.style.display="")}finally{A&&N()}},{depth:o.path.length,label:k(o,p)});o.__effects.push(d),o.__exec[e]=u}else if(R&&R.has(e)){const u=t[e],h=P(t,t[e+"Deps"],u),p=e;let y,g=null;const c=v(()=>{const l=t.context?.designSystem;l&&M(l);try{const d=h(t,t.state,t.context);if(t.node)if(d!=null){const A=p+":"+String(d);if(A!==y||!Rt(t.node,g)){y=A;const x={[p]:d},_=Bo(t,x);g=Lt(t.node,_)}}else y=void 0,g=null,t.node.style[p]=""}finally{l&&N()}},{depth:o.path.length,label:k(o,p)});o.__effects.push(c),o.__exec[e]=u}}if(typeof t.html=="function"){const e=t.html,u=P(t,t.htmlDeps,e),h=v(()=>{const p=t.context?.designSystem;p&&M(p);try{const y=u(t,t.state,t.context);t.node&&y!=null&&typeof y!="function"&&(t.node.innerHTML=y)}finally{p&&N()}},{depth:o.path.length,label:k(o,"html")});o.__effects.push(h),o.__exec.html=e}if(typeof t.value=="function"){const e=t.value,u=P(t,t.valueDeps,e),h=v(()=>{try{let p=u(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Io(t,p)}catch(p){O(o,"value",p)}},{depth:o.path.length,label:k(o,"value")});o.__effects.push(h),o.__exec.value=e}else if(typeof t.value=="string"&&t.value.includes("{{")){const e=t.value,u=v(()=>{try{Io(t,I.call(t,e,t.state))}catch(h){O(o,"value",h)}},{depth:o.path.length,label:k(o,"value")});o.__effects.push(u),o.__exec.value=e}if(typeof t.style=="function"){const e=t.style,u=P(t,t.styleDeps,e);let h,p=null;const y=v(()=>{const g=u(t,t.state,t.context),c=Ot(g);(c===null||c!==h||!Rt(t.node,p))&&(h=c,Ws(t.node,p,g),m(t.node,g),p=Lt(t.node,g))},{depth:o.path.length,label:k(o,"style")});o.__effects.push(y),o.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const u=t.style[e];if(typeof u!="function")continue;const h=P(t,At(t.styleDeps,e),u);let p,y=null;const g=v(()=>{try{const c=h(t,t.state,t.context);if(t.node){const l=e+":"+String(c);if(l!==p||!Rt(t.node,y)){p=l;const d={[e]:c};m(t.node,d),y=Lt(t.node,d)}}}catch(c){O(o,"style."+e,c)}},{depth:o.path.length,label:k(o,"style."+e)});o.__effects.push(g)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const u=P(t,At(t.attrDeps,e),t.attr[e]),h=e,p=v(()=>{try{let y=u(t,t.state,t.context);typeof y=="string"&&y.includes("{{")&&(y=I.call(t,y,t.state)),t.node?.setAttribute&&(y==null||y===!1&&!ht(h)?t.node.removeAttribute(h):typeof y!="function"&&typeof y!="object"&&t.node.setAttribute(h,W(h,y)))}catch(y){O(o,"attr."+h,y)}},{depth:o.path.length,label:k(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}else if(typeof t.attr[e]=="string"&&t.attr[e].includes("{{")){const u=t.attr[e],h=e,p=v(()=>{try{const y=I.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(h,W(h,y??""))}catch(y){O(o,"attr."+h,y)}},{depth:o.path.length,label:k(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const u=t.aria[e];if(typeof u=="string"&&u.includes("{{")){const g=u,c="aria-"+e.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),l=v(()=>{try{const d=I.call(t,g,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(c,W(c,d??""))}catch(d){O(o,"aria."+e,d)}},{depth:o.path.length,label:k(o,"aria."+e)});l._attrName=c,o.__effects.push(l);continue}if(typeof u!="function")continue;const h=P(t,At(t.ariaDeps,e),t.aria[e]),p="aria-"+e.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),y=v(()=>{try{const g=h(t,t.state,t.context);if(!t.node?.setAttribute)return;g==null?t.node.removeAttribute(p):typeof g!="function"&&typeof g!="object"&&t.node.setAttribute(p,W(p,g))}catch(g){O(o,"aria."+e,g)}},{depth:o.path.length,label:k(o,"aria."+e)});y._attrName=p,o.__effects.push(y)}if(t.data&&typeof t.data=="object")for(const e in t.data){const u=t.data[e];if(typeof u=="string"&&u.includes("{{")){const c=u,l="data-"+e.replace(/[A-Z]/g,A=>"-"+A.toLowerCase()),d=v(()=>{try{const A=I.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,A??"")}catch(A){O(o,"data."+e,A)}},{depth:o.path.length,label:k(o,"data."+e)});d._attrName=l,o.__effects.push(d);continue}if(typeof u!="function")continue;const h=P(t,At(t.dataDeps,e),t.data[e]),y="data-"+e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),g=v(()=>{try{const c=h(t,t.state,t.context);if(!t.node?.setAttribute)return;c==null||c===!1?t.node.removeAttribute(y):typeof c!="function"&&typeof c!="object"&&t.node.setAttribute(y,c===!0?"":c)}catch(c){O(o,"data."+e,c)}},{depth:o.path.length,label:k(o,"data."+e)});g._attrName=y,o.__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 e in a){if(typeof a[e]!="function")continue;const u=P(t,At(t.classDeps,e),a[e]),h=v(()=>{try{const p=u(t,t.state,t.context);if(!t.node?.classList)return;typeof p=="string"?t.node.classList.add(p):p?t.node.classList.add(e):t.node.classList.remove(e)}catch(p){O(o,"class."+e,p)}},{depth:o.path.length,label:k(o,"class."+e)});o.__effects.push(h)}!n&&typeof t.if=="function"&&$o(t,o,t.if);for(const e of Object.keys(t)){if(K.has(e)||typeof t[e]!="function")continue;const u=e.charCodeAt(0);if(u>=65&&u<=90||Z(e))continue;const h=t[e];o.__exec[e]=h;const p=t.tag||"div";if(dt(p,e)&&!yt(p,e)){const y=pt(e)||e,g=P(t,t[e+"Deps"],h),c=v(()=>{try{let l=g(t,t.state,t.context);typeof l=="string"&&l.includes("{{")&&(l=I.call(t,l,t.state)),t.node?.setAttribute&&(l==null||l===!1&&!ht(y)?t.node.removeAttribute(y):typeof l!="function"&&typeof l!="object"&&(y==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(y,W(y,l))))}catch(l){O(o,e,l)}},{depth:o.path.length,label:k(o,e)});c._attrName=y.toLowerCase(),o.__effects.push(c)}}const f=t.tag||"div";for(const e of Object.keys(t)){if(K.has(e))continue;const u=t[e];if(typeof u!="string"||!u.includes("{{"))continue;const h=e.charCodeAt(0);if(h>=65&&h<=90||Z(e)||yt(f,e)||Kt[e]||!dt(f,e))continue;const p=pt(e)||e,y=v(()=>{try{const g=I.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,W(p,g??""))}catch(g){O(o,e,g)}},{depth:o.path.length,label:k(o,e)});y._attrName=p.toLowerCase(),o.__effects.push(y)}if(Xs(t),oe(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,u=t.stateDeps;let h=!1,p=[];const y=v(()=>{const g=[];for(let A=0;A<u.length;A++){const x=u[A];try{g[A]=typeof x=="function"?x(t,t.state,t.context):t.state?.[x]}catch{g[A]=void 0}}if(!h){h=!0,p=g;return}let c=g.length!==p.length;for(let A=0;!c&&A<g.length;A++)g[A]!==p[A]&&(c=!0);const l=p;if(p=g,!c)return;const d=t.context?.designSystem;d&&M(d);try{e(t,t.state,t.context,{prev:l,next:g})}catch(A){if(t.context?.plugins?.length&&q("error",t,{hook:"onStateUpdate",error:A})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',A),t.context?.strictMode)throw A}finally{d&&N()}},{depth:o.path.length,label:k(o,"onStateUpdate")});o.__effects.push(y)}te(t)}function Fo(t){const s=t.parent,o=s?.node;if(!o||!t.node){is(t,t.parent);return}let n=null;const r=Object.keys(s),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=s[r[a]];if(f?.node?.parentNode===o){n=f.node;break}}n?o.insertBefore(t.node,n):o.appendChild(t.node)}function $o(t,s,o){const n=P(t,t.ifDeps,o),r=v(()=>{let i;try{i=n(t,t.state,t.context)}catch(f){if(i=!1,s.__ifError=f,typeof console<"u"&&console.warn){const e=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${e} \u2014 treating as false:`,f?.message||f)}return}const a=s.__if;if(s.__if=!!i,a&&!s.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(f){console.error("[smbls] onRemove error:",f)}}else if(!a&&s.__if)if(s.__ifInitialized)t.node||(t.node=Ht(t)),t.node&&(t.node.ref=t),Fo(t),Jt(t),F("Render",t,{}),Yt(t,{});else{if(s.__ifInitialized=!0,t.tag||(t.tag=lo(t)),F("Init",t,{}),t.node||(t.node=Ht(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"&&!s.__fragmentAnchor){const e=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(e),s.__fragmentAnchor=e}F("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),ns(t,{}),No(t,{skipIfEffect:!0}),Jt(t),Xo(t),ss(t),rs(t,{}),Fo(t),F("Create",t,{}),F("Complete",t,{}),F("Render",t,{}),F("RenderRouter",t,{}),Yt(t,{})}},{depth:s.path.length,label:k(s,"if")});s.__effects.push(r)}function Pt(t,s){const o=t.node;if(!o)return;const n=s==null||typeof s=="object"?"":String(s);if(t.tag==="string"){o.nodeValue!==n&&(o.nodeValue=n);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==o&&(i=null),!i){const a=o.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==n&&(i.nodeValue=n):o.firstChild?(i=(o.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),o.insertBefore(i,o.firstChild)):(o.textContent=n,i=o.firstChild&&o.firstChild.nodeType===3?o.firstChild:null),r&&(r.__textNode=i||null)}function Io(t,s){const o=t.node;if(!o||!("value"in o))return;const n=s==null?"":String(s);if(o.value===n)return;const r=typeof document<"u"&&document.activeElement===o,i=r&&typeof o.selectionStart=="number"?o.selectionStart:null,a=r&&typeof o.selectionEnd=="number"?o.selectionEnd:null;if(o.value=n,r&&i!=null&&a!=null)try{o.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function Jt(t){const{node:s}=t;if(s){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Pt(t,t.text),Qo(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in s){const o=String(t.value);s.value!==o&&(s.value=o)}if(t.style&&typeof t.style=="object"){let o=t.style;for(const n in t.style)if(typeof t.style[n]=="function"){o={};for(const r in t.style)typeof t.style[r]!="function"&&(o[r]=t.style[r]);break}m(s,o)}if(t.attr&&typeof t.attr=="object")for(const o in t.attr){const n=t.attr[o];typeof n=="function"||typeof n=="object"||n!=null&&(typeof n=="string"&&n.includes("{{")||n===!1&&!ht(o)||s.setAttribute&&s.setAttribute(o,W(o,n)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&s.setAttribute&&s.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const o in t.data){const n=t.data[o];typeof n=="function"||typeof n=="object"||n==null||n===!1||typeof n=="string"&&n.includes("{{")||s.dataset&&(s.dataset[o]=n===!0?"":n)}if(t.classlist||t.class){const o=t.classlist||t.class;if(typeof o=="string")o.split(" ").forEach(n=>n&&s.classList.add(n));else if(typeof o=="object")for(const n in o){const r=typeof o[n]=="function"?o[n](t,t.state,t.context):o[n];r&&s.classList.add(typeof r=="string"?r:n)}}}}function Ot(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Ks(t){if(!t||typeof t!="object")return!1;for(const s in t){const o=t[s];if(o&&typeof o=="object"&&!Array.isArray(o))return!0}return!1}function Lt(t,s){if(!t||!t.style||!s)return null;const o=t.style,n=[];for(const r in s){if(s[r]==null||r.charAt(0)==="&")continue;const a=Dt(r);n.push(a,mt(o,a),Uo(o,a))}return n}function mt(t,s){return typeof t.getPropertyValue=="function"?t.getPropertyValue(s):""}function Uo(t,s){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(s):""}function Dt(t){return Mt(t)?t:t.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())}function Ws(t,s,o){if(!t||!t.style||!s||!s.length)return;const n=t.style,r=new Set;if(o&&typeof o=="object")for(const i in o)o[i]==null||i.charAt(0)==="&"||r.add(Dt(i));for(let i=0;i<s.length;i+=3){const a=s[i];r.has(a)||mt(n,a)===s[i+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function Rt(t,s){if(!s||!t||!t.style)return!1;const o=t.style;for(let n=0;n<s.length;n+=3)if(mt(o,s[n])!==s[n+1]||Uo(o,s[n])!==s[n+2])return!1;return!0}const Mt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function zs(t){let s=null;for(const o in t)t[o]!=null&&o.charAt(0)!=="&"&&(s||(s=new Set),s.add(Dt(o)));return s}function Ys(t,s,o,n){const r=t.__ref;if(!r)return;let i=null;if(o)for(const a of o){if(n&&n.has(a))continue;const f=s[a];if(f==null||typeof f=="object")continue;const e=Dt(a);xo[e]&&(i||(i={}),i[e]=f)}r.__declaredLonghands=i}function Vo(t,s){const o=t.__ref,n=o&&o.__declaredLonghands;if(!n||!s)return null;let r=null;for(const i in n){if(s.has(i))continue;const a=xo[i];let f=!1;for(let e=0;e<a.length;e++)if(s.has(a[e])){f=!0;break}f&&(r||(r={}),r[i]=n[i])}return r}function Bo(t,s){const o=t.node;m(o,s);const n=zs(s);if(!n)return s;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of n)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(n);const i=Vo(t,n);return i?(m(o,i),Object.assign({},s,i)):s}function qs(t){const s=t.__ref;if(!s||!s.__inlineCssKeys||!s.__declaredLonghands)return;const o=Vo(t,s.__inlineCssKeys);o&&m(t.node,o)}function m(t,s){if(!t||!s||!t.style)return;let o=null;for(const n in s){const r=s[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){o||(o={}),o[n]=r;continue}try{const i=String(r),a=Mt(n)?n:n.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),f=i.trim(),e=/\s*!important\s*$/.test(f),u=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,u,e?"important":"")}catch{}}}o&&Zs(t,o)}function Zs(t,s){const o=`_ds${So.scopedStyleId++}`;t.classList.add(o);const n=t.ownerDocument;let r=n.querySelector("style[data-smbls-scoped]");r||(r=n.createElement("style"),r.setAttribute("data-smbls-scoped",""),n.head.appendChild(r));let i="";for(const a in s){const f="."+o,e=a.replace(/&/g,f).split(",").map(h=>{const p=h.trim();return p.includes(f)?p:f+p}).join(", "),u=s[a];if(typeof u=="object"){let h="",p="";for(const y in u){const g=u[y];if(typeof g=="object"){const c=y.includes("&")?e.split(", ").map(d=>y.replace(/&/g,d)).join(", "):e.split(", ").map(d=>`${d} ${y}`).join(", ");let l="";for(const d in g)l+=`${d.replace(/[A-Z]/g,A=>"-"+A.toLowerCase())}: ${g[d]};`;p+=Ao(`${c} { ${l} }`,c)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),p&&(i+=p)}}i&&(r.textContent+=i)}const Go=new Set;function Ho(t){if(!Array.isArray(t))return"";const s=[];for(let o=0;o<t.length;o++)typeof t[o]=="string"&&t[o].length&&s.push(t[o]);return s.sort(),s.join("|")}function Qs(t,s,o){const n=Ho(o);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=s(t,t.state,t.context)}catch{return}if(Ho(r)===n)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";Go.has(i)||(Go.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${o.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Xs(t){const s=t.subscribeTo,o=typeof s=="function";let n=s;if(o)try{n=s(t,t.state,t.context)}catch{n=null}if(o&&et()&&Qs(t,s,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let i=0;i<n.length;i++){const a=n[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),e=f[0],u=f.slice(1),h={value:!1},p=v(()=>{const y=t.state&&(Q(t.state)?t.state.root:null);if(!y||!Q(y))return;let g=y;g=g[e];for(let l=0;l<u.length&&!(g==null||typeof g!="object");l++)if(Q(g))g=g[u[l]];else break;if(!h.value)return;let c=!1;if(typeof t.onBeforeUpdate=="function"){const l=t.context?.designSystem;l&&M(l);try{if(ue(r)){const d=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});d&&typeof d.then=="function"?d.then(()=>$t(r,!1),A=>{$t(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:A})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",A)}):($t(r,!1),d===!1&&(c=!0))}}catch(d){$t(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:d})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",d)}finally{l&&N()}}if(!c&&t.node&&r.__effects)for(let l=0;l<r.__effects.length;l++){const d=r.__effects[l];d&&d!==p&&!d._disposed&&!d._isSubscribeToEffect&&typeof d._execute=="function"&&d._execute()}if(!c&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&M(l);try{t.onUpdate(t,t.state,t.context)}catch(d){t.context?.plugins?.length&&q("error",t,{hook:"onUpdate",error:d})||console.error("[DOMQL] subscribeTo onUpdate error:",d)}finally{l&&N()}}},{depth:r.path.length,label:k(r,"subscribeTo("+a+")")});h.value=!0,p._isSubscribeToEffect=!0,r.__effects.push(p)}}function to(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function oo(t,s){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const o=s.context?.designSystem?.media?.[t.slice(1)];return o?/^@(media|supports|container)\b/.test(o)?o:`@media ${o}`:t}const Ko=new Set;function Js(t,s){const o=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",n=o+"::"+t;Ko.has(n)||(Ko.add(n),console.warn(`[smbls/css] "${t}" at ${o} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function ct(t,s,o,n){const r={},i=new Set,a=(f,e,u)=>{const h=u?new Set(Object.keys(r)):null;if(D[f]){const p=D[f](e,s,s.state,s.context);if(p){const y=Array.isArray(p)?p:[p];for(const g of y)g&&Object.assign(r,g)}}else r[f]=e;if(u)for(const p in r)h.has(p)||i.add(p)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let e=t[f];if(typeof e=="function"&&(e=e(s,s.state,s.context)),e==null||typeof e=="function")continue;if(typeof e=="object"&&!Array.isArray(e)){if(f==="style"){for(const g in e){let c=e[g];if(typeof c=="function"&&(c=c(s,s.state,s.context)),c==null||typeof c=="function")continue;const l=typeof s[g]=="function"&&(D[g]||R&&R.has(g))||!!(n&&n.has(g));a(g,c,l)}continue}if(to(f,s)){const g=ct(e,s,!1,n);Object.keys(g).length&&(r[`[data-theme="${f.slice(1)}"] &`]=g);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){et()&&Js(f,s);continue}const p=oo(f,s),y=ct(e,s,!1,n);Object.keys(y).length&&(r[p]=y);continue}const u=typeof s[f]=="function"&&(D[f]||R&&R.has(f)),h=!!(n&&n.has(f));a(f,e,u||h)}if(o)for(const f in r)i.add(f);for(const f of i){const e=r[f];typeof e=="string"&&!e.includes("!important")&&(r[f]=e+" !important")}return r}const Nt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Wo(t,s){for(const o in s){const n=s[o];t[o]=Nt(n)?Wo(Nt(t[o])?t[o]:{},n):n}return t}function ms(t,s){if(!Nt(s))return;let o;for(const n of t.split(" ")){const r=n?s[n]:null;Nt(r)&&(o=Wo(o||{},r))}return o}function so(t,s){if(s===void 0&&(s=0),s>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&so(t[o],s+1))return!0}return!1}function zo(t,s,o){if(!s||typeof s!="object"||Array.isArray(s))return null;if(to(t,o)){const i=ct(s,o,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const n=oo(t,o),r=ct(s,o,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function te(t){const s=t.__ref;for(const o of Object.keys(t)){if(!qt(o))continue;const n=t[o];if(!n||typeof n!="object"||Array.isArray(n)||!so(n))continue;let r=null,i;const a=v(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&M(f);let e,u=!1;try{const h=zo(o,n,t),p=h?Ot(h.block)+"::"+h.cssProp:null;if(p!==null&&p===i)u=!0;else if(i=p,h){const y=lt({[h.cssProp]:h.block},null,t.context?.cssPrefix);e=y?y.split(" ").filter(Boolean):null}else e=null}finally{f&&N()}if(!(u||!t.node.classList)){if(r)for(const h of r)t.node.classList.remove(h);if(e&&e.length)for(const h of e)t.node.classList.add(h);r=e}},{depth:s.path.length,label:k(s,"cssBlock("+o+")")});s.__effects.push(a)}}function oe(t){const s=t.__ref;s.__conditionalRunners=[];const o=new Map;for(const n of Object.keys(t)){const r=n.charAt(0);if(r!=="."&&r!=="!")continue;const i=n.slice(1);if(!i)continue;if(/[:@\s>~+[\]]/.test(i)){if(typeof console<"u"&&console.warn){const c=i.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${c}: { '${i.slice(c.length)}': {...} }\`.`)}continue}const a=t[n];if(!a||typeof a!="object")continue;const f=r==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=new Set;for(const c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;const l=c.charAt(0),d=a[c];(l===":"||l==="@"||l==="&"||l==="[")&&d&&typeof d=="object"&&!Array.isArray(d)||u.add(c)}const h=()=>{let c;const l=t[i];if(l===void 0){const x=!!t.state&&i in t.state,_=t.state?t.state[i]:void 0;if(x||_!==void 0)c=_;else{const b=t.context?.cases?.[i];if(b===void 0)return;try{c=typeof b=="function"?b.call(t,t):b}catch(w){c=!1,s.__conditionalError=w,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,w?.message||w)}}}else if(typeof l=="function")try{c=l(t,t.state,t.context)}catch(x){c=!1,s.__conditionalError=x,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,x?.message||x)}else c=l;const d=f?!c:!!c;if(!t.node||d===e.lastMatch)return;e.lastMatch=d;const A=t.context?.designSystem;A&&M(A);try{if(d){const x={},_={};let b=!1;for(const S in a){if(!Object.prototype.hasOwnProperty.call(a,S))continue;const C=a[S],j=S.charAt(0);if((j===":"||j==="@"||j==="&"||j==="[")&&C&&typeof C=="object"&&!Array.isArray(C)){if(to(S,t)){const G=ct(C,t,!1,u);Object.keys(G).length&&(_[`[data-theme="${S.slice(1)}"] &`]=G,b=!0)}else{const G=oo(S,t),ot=ct(C,t,!1,u);Object.keys(ot).length&&(_[G]=ot,b=!0)}continue}const z=typeof C=="function"?C(t,t.state,t.context):C;if(z!=null)if(D[S]){const G=D[S](z,t,t.state,t.context);if(G){const ot=Array.isArray(G)?G:[G];for(const $ of ot)$&&Object.assign(x,$)}}else(R&&R.has(S)||Mt(S))&&(x[S]=z)}const w=Object.keys(x);if(w.length){m(t.node,x);for(const S of w)o.set(S,n);e.appliedKeys=w}else e.appliedKeys=null;if(b){const S=lt(_,null,t.context?.cssPrefix,{state:!0}),C=S?S.split(" ").filter(Boolean):[];if(C.length&&t.node.classList){for(const j of C)t.node.classList.add(j);e.appliedClasses=C}else e.appliedClasses=null}else if(e.appliedClasses){for(const S of e.appliedClasses)t.node.classList.remove(S);e.appliedClasses=null}}else{if(e.appliedKeys){for(const x of e.appliedKeys)o.get(x)===n&&(Mt(x)?t.node.style.removeProperty(x):t.node.style[x]="",o.delete(x));e.appliedKeys=null}if(e.appliedClasses){for(const x of e.appliedClasses)t.node.classList.remove(x);e.appliedClasses=null}}}finally{A&&N()}};s.__conditionalRunners.push(h);const p=P(t,t[i+"Deps"],h),y=v(p,{depth:s.path.length,label:k(s,"conditional("+n+")")}),g=s.__exec&&s.__exec[i]||t[i];y._sources.size===0&&typeof g=="function"&&et()&&console.warn(`[smbls] conditional \`${n}\` 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 \`${i}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),s.__effects.push(y)}}const eo=new WeakSet;function se(t){const s=t.ownerDocument;!s||eo.has(s)||(eo.add(s),queueMicrotask(()=>{eo.delete(s);const o=s.body||s.documentElement;o&&o.offsetWidth}))}const no=new WeakSet;let Yo=!1;function qo(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function ro(t,s){const o={...t};for(const n in s){const r=s[n],i=o[n];o[n]=r&&typeof r=="object"&&i&&typeof i=="object"?ro(i,r):r}return o}function Zo(t,s){const o={};for(const n in t){const r=t[n];if(r&&typeof r=="object"){const i=Zo(r,s);Object.keys(i).length&&(o[n]=i)}else s.has(n)||(o[n]=r)}return o}function Qo(t){const{node:s}=t;if(!s)return;if(Yo||(Yo=!0,lt({display:"none"})),no.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}no.add(t);const o=t.context?.designSystem;o&&M(o),go();try{const n={};let r=!1,i=[],a=null,f=null,e=null;const u=(c,l)=>{if(l&&typeof l=="object"&&qo(c)){f||(f={});const d=f[c];d&&(l=ro(d,l)),f[c]=l}else(l===null||typeof l!="object")&&(e||(e=new Set),e.add(c));n[c]=l};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&D.theme){const c=D.theme(t.theme,t,t.state,t.context);if(c){const l=d=>{for(const A in d){const x=d[A];x&&typeof x=="object"&&qo(A)&&(a||(a={}),a[A]=x),n[A]=x}};if(Array.isArray(c))for(const d of c)d&&l(d);else l(c);r=!0}}const h=(c,l)=>{if(D[c]){const d=D[c](l,t,t.state,t.context);if(d){if(Array.isArray(d)){for(const A of d)if(A)for(const x in A)u(x,A[x])}else for(const A in d)u(A,d[A]);r=!0}}else if(R&&R.has(c))l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if(c.charCodeAt(0)===45)l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if((c.charAt(0)==="&"||c.charAt(0)==="@"||c.charAt(0)===":"||c.charAt(0)==="[")&&l&&typeof l=="object"&&!Array.isArray(l)){if(so(l))return;const d=zo(c,l,t);d&&(u(d.cssProp,d.block),r=!0)}};if(typeof t.class=="string"){const c=ms(t.class,t.context?.designSystem?.class);if(c)for(const l in c)h(l,c[l])}const p=e?new Set(e):null,y=t.tag||"div";for(const c of Object.keys(t)){if(typeof t[c]=="function"||K.has(c)||c==="theme")continue;const l=c.charCodeAt(0);l>=65&&l<=90||Z(c)||wo(y,c)||h(c,t[c])}if(a)for(const c in a){let l=e?Zo(a[c],e):a[c];f&&f[c]&&(l=ro(l,f[c])),Object.keys(l).length?n[c]=l:delete n[c]}if(Ys(t,n,e,p),r){n.display&&String(n.display).includes("!important")&&(s.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const c=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof c=="string"&&c!==""&&n.display&&n.display!==c&&(n.display=c);const l=lt(n,null,t.context?.cssPrefix);if(i=l?l.split(" ").filter(Boolean):[],l&&s.classList){const d=i;let A=!1;for(const x of d)s.classList.add(x),A||(x.charCodeAt(0)===95&&x.charCodeAt(1)===99||x.charCodeAt(0)===95&&x.indexOf("_c",1)!==-1)&&(A=!0);A&&se(s)}}const g=t.__ref;if(g){const c=g.__staticCssClasses;if(c&&s.classList){const l=new Set(i);for(const d of c)l.has(d)||s.classList.remove(d)}g.__staticCssClasses=i}qs(t)}finally{bo(),o&&N(),no.delete(t)}}const Fe=t=>!!D[t]||!!(R&&R.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function $e(t){t&&t.node&&Qo(t)}function Xo(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(a,W(a,i))}const o=Ss(t);for(const r in o){const i=o[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&s.setAttribute(r,i===!0?"":i)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||K.has(r)||r==="on"||o[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!yt(n,r)&&dt(n,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!Kt[r])continue;a=I.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!ht(pt(r)||r))continue;const f=pt(r)||r;s.setAttribute(f,W(f,a))}}}function Ie(t,s){const{node:o}=t;if(!o||!o.setAttribute)return;const n=s.charCodeAt(0);if(n>=65&&n<=90||Z(s))return;const r=t.tag||"div";if(yt(r,s)||!dt(r,s))return;const i=pt(s)||s,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let e=!1;if(f)for(let p=0;p<f.length;p++){const y=f[p];y&&y._attrName===a&&!y._disposed&&typeof y._execute=="function"&&(e=!0,y._execute())}if(e)return;let u=t[s];const h=Kt[s];if(h&&u!=null){const p=h(t);p!==void 0&&(u=p)}typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),u==null||u===!1&&!ht(i)?o.removeAttribute(i):typeof u!="function"&&typeof u!="object"&&o.setAttribute(i,W(i,u))}function ee(t,s){const o=t.node,n=t.__ref;let r=n.__autoGrow;if(!s){if(r&&r.active){try{o.removeEventListener("input",r.resize)}catch{}mo(r),J.delete(t),o.style.height="",r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""),ts(o,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!o.isConnected){kt(t,!0);return}if(!(o.scrollHeight>0)){r.awaitingLayout=!0,Jo(t,r);return}r.awaitingLayout=!1;const a=o.style.height;o.style.height="0px";const f=o.scrollHeight;if(!(f>0)){o.style.height=a;return}const e=ie(o),u=e!=null&&f>e;o.style.height=(u?e:f)+"px",ts(o,r,u),r.lastMeasure=f,r.lastWidth=o.clientWidth,Jo(t,r)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{o.removeEventListener("input",r.resize)}catch{}mo(r),J.delete(t)})),r.active||(o.addEventListener("input",r.resize),r.active=!0,re(t,r));const i=typeof s=="object"&&s.max!=null?String(s.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""):o.style.maxHeight=i,r.appliedMax=i),r.resize()}function kt(t,s){const o=t.__ref?.__autoGrow;o&&(s&&(o.attachAttempts=0,o.firstAttemptAt=null),J.add(t),Et())}function ne(){const t=Array.from(J);J.clear();for(let s=0;s<t.length;s++){const o=t[s],n=o.node,r=o.__ref?.__autoGrow;if(!(!n||!r||!r.active)){if(!n.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=rt()),r.attachAttempts+=1,r.attachAttempts<=vo&&rt()-r.firstAttemptAt<jo&&(J.add(o),Et());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function Jo(t,s){if(s.watch)return;const o=t.node;if(!o)return;const n=o.ownerDocument&&o.ownerDocument.defaultView,r=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!s.active||!o.isConnected||!(o.scrollHeight>0))return;if(s.awaitingLayout){s.awaitingLayout=!1,kt(t,!0);return}const f=o.clientWidth;s.lastWidth!=null&&Math.abs(f-s.lastWidth)<.5||(s.lastWidth=f,kt(t,!0))};let a;try{a=new r(i),a.observe(o)}catch{return}s.watch=a}function mo(t){const s=t.watch;if(s){t.watch=null;try{s.disconnect()}catch{}}}function re(t,s){if(s.fontsHooked)return;s.fontsHooked=!0;const o=t.node&&t.node.ownerDocument,n=o&&o.fonts&&o.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{s.active&&t.node&&kt(t,!0)},()=>{})}function ie(t){const s=t.ownerDocument&&t.ownerDocument.defaultView;let o;try{o=s&&s.getComputedStyle?s.getComputedStyle(t):null}catch{o=null}if(!o)return null;const n=h=>typeof h=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(h)?parseFloat(h):null,r=n(o.maxHeight);if(r==null||!(r>0))return null;const i=(n(o.paddingTop)||0)+(n(o.paddingBottom)||0),a=(n(o.borderTopWidth)||0)+(n(o.borderBottomWidth)||0),f=o.boxSizing==="border-box"?r-a:r+i,e=n(o.lineHeight);if(!(e>0))return f;const u=Math.floor((f-i)/e+1e-6);return u>=1?u*e+i:f}function ts(t,s,o){o?s.appliedScroll||(t.style.overflowY="auto",s.appliedScroll=!0):s.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),s.appliedScroll=!1)}const os=["srcObject","muted"],ce=(t,s)=>t==="muted"?s===!0||s===""||s==="true"||s==="muted":s??null;function fe(t){const s=t.node,o=t.__ref;if(!(!s||!o))for(let n=0;n<os.length;n++){const r=os[n],i=t[r];if(i===void 0||!(r in s))continue;const a=f=>{const e=ce(r,f);if(s[r]!==e)try{s[r]=e}catch(u){O(o,r,u)}};if(typeof i=="function"){const f=P(t,t[r+"Deps"],i),e=v(()=>{try{a(f(t,t.state,t.context))}catch(u){O(o,r,u)}},{depth:o.path.length,label:k(o,r)});o.__effects.push(e),o.__exec[r]=i}else a(i);r==="srcObject"&&(o.__releaseMedia=()=>{try{s.srcObject!=null&&(s.srcObject=null)}catch{}})}}function ss(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const o=t.__ref,n=t.autoGrow,r=typeof n=="function"?P(t,t.autoGrowDeps,n):null,i=v(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===n&&r?r:a)(t,t.state,t.context)}catch{f=null}ee(t,f)},{depth:o.path.length,label:k(o,"autoGrow")});o.__effects||(o.__effects=[]),o.__effects.push(i),r&&(o.__exec.autoGrow=n)}const es=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function ns(t,s){for(const o of Object.keys(t)){if(!Z(o)||es.has(o))continue;const n=gs(o);if(n){_s(n,t,t[o]);continue}let r=t[o];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const a=r;r=function(e){return t.call(a,e)}}if(typeof r!="function")continue;const i=Ps(o);hs.has(i)||ys(Os(i),t,r)}ae(t)}function ae(t){const s=t.node;if(!s||!s.addEventListener)return;const o={};let n=!1;for(const y of es){const g=t[y];typeof g=="function"&&(o[y]=g,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,e=0,u=!1;const h=y=>{const g=y.touches&&y.touches[0]||y.changedTouches&&y.changedTouches[0];g&&(a=g.clientX,f=g.clientY,e=Date.now(),u=!0)},p=y=>{if(!u)return;u=!1;const g=y.changedTouches&&y.changedTouches[0]||y.touches&&y.touches[0];if(!g)return;const c=g.clientX-a,l=g.clientY-f,d=Date.now()-e;if(d>i)return;const A=Math.abs(c),x=Math.abs(l);if(Math.max(A,x)<r)return;let _;if(A>x*1.2)_=c<0?"left":"right";else if(x>A*1.2)_=l<0?"up":"down";else return;const b="onSwipe"+_.charAt(0).toUpperCase()+_.slice(1),w=o[b],S=o.onSwipe;w&&w.call(t,y,t,t.state,t.context),S&&S.call(t,{direction:_,dx:c,dy:l,dt:d,event:y},t,t.state,t.context)};s.addEventListener("touchstart",h,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",h)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function tt(t,s){const o={...t};for(const n in s){const r=o[n],i=s[n];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?o[n]=tt(r,i):o[n]=i}return o}function io(t,s,o,n,r){if(!s||!t.node)return;const i=t.childExtends,a=it(t,"childProps");if(Array.isArray(s)){const f=t.tag==="fragment",e=t.context?.document||globalThis.document,u=f?null:e?.createDocumentFragment();if(!f&&!u)return;const h=t.childProps,p=t.childrenAs,y=x=>{let _=s[x];const b=_;(typeof _=="string"||typeof _=="number")&&(_={text:_});let w=h;if(typeof h=="function")try{w=h(t,_)}catch{w=null}let S=typeof h=="function"?wt(w):a;if(r&&p!=="state"&&(S=St(S,wt(b))),p==="state"){let j=b;(typeof b=="string"||typeof b=="number")&&(j={value:b,text:b}),_=w?{...w,state:j}:{state:j}}else w&&(_=tt(w,_));if(i&&!_.ignoreChildExtends)if(_.extends){const j=Array.isArray(_.extends)?_.extends:[_.extends],z=Array.isArray(i)?i:[i];_={..._,extends:[...z,...j]}}else _={..._,extends:i};const C=To(_?.key,b,x);try{return X(Ct(_,S),t,C,o)}catch(j){if(typeof console<"u"&&console.error){const z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${z} (initial render, skipping this row):`,j?.message||j)}return null}},g=t.__ref;if(!(n===!0&&!f&&!!g&&(o?.mountYield===!0||t.yieldChildren===!0))){for(let x=0;x<s.length;x++){const _=y(x);!f&&_?.node&&u.appendChild(_.node)}return f||t.node.appendChild(u),!0}const l=g.__childrenChunkGen=(g.__childrenChunkGen||0)+1;ho();let d=null;const A=x=>{if(g.__disposed||g.__childrenChunkGen!==l){d&&d.parentNode&&d.remove();return}for(let _=x;_<s.length;_++){const b=y(_);if(b?.node&&(d?t.node.insertBefore(b.node,d):u.appendChild(b.node)),_+1<s.length&&po()){d||(d=e.createComment("smbls-mount"),u.appendChild(d),t.node.appendChild(u));const w=_+1;_o(()=>A(w));return}}d?(d.remove(),t.node.tagName==="SELECT"&&Ft(t,!0)):t.node.appendChild(u)};return A(0),yo(),!0}if(typeof s=="string"){const f=Po(s,t);if(Array.isArray(f))return io(t,f,o,n,!0)}if(typeof s=="object")for(const f in s){if(K.has(f))continue;let e=s[f];if(e==null||e===!1)continue;const u=r?St(a,wt(e)):a;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),t.childProps&&(e=tt(t.childProps,e)),i&&!e.ignoreChildExtends)if(e.extends){const h=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(i)?i:[i];e={...e,extends:[...p,...h]}}else e={...e,extends:i};X(Ct(e,u),t,f,o)}}function Ft(t,s){const o=t.node;if(!o||o.tagName!=="SELECT")return;const n=o.options;if(!n||!n.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){let h;if(a)try{h=i(t,t.state,t.context)}catch{return}else h=t.value,typeof h=="string"&&h.includes("{{")&&(h=I.call(t,h,t.state));const p=h==null?"":String(h);o.value!==p&&(o.value=p);return}const e=s||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!e)return;let u=-1;for(let h=0;h<n.length;h++)n[h].defaultSelected&&(u=h);u>=0&&o.selectedIndex!==u&&(o.selectedIndex=u)}function rs(t,s){let{children:o,content:n}=t;const r=t.childExtends,i=typeof o=="function"||Ro(t,"children");if(typeof o=="function"){const c=o;try{o=c(t,t.state,t.context)}catch(_){if(o=void 0,typeof console<"u"&&console.error){const b=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${b} (initial run, treating as empty):`,_?.message||_)}}Mo(t,o),t.children=o;const l=t.__ref;let d=!1;const A=P(t,t.childrenDeps,c),x=v(()=>{const _=d;d=!0;let b;try{b=A(t,t.state,t.context)}catch($){if(typeof console<"u"&&console.error){const V=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${V}${_?"":" (initial tracking run)"}:`,$?.message||$)}return}if(!_||b===t.children)return;Mo(t,b),t.children=b,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const w=typeof t.onContentUpdate=="function",S=w?[]:null,C=w?[]:null,j=w?[]:null;if(Array.isArray(b)&&t.childrenAs==="state"){const $=t.childProps,V=[],fo=new Map;for(let E=0;E<b.length;E++){const B=b[E];let T=$;if(typeof $=="function")try{T=$(t,B)}catch{T=null}const Y=To(T&&T.key,B,E);V.push(Y),fo.set(Y,{rawChild:B,childProps:T})}const cs=new Set(V),fs=l.__children.slice();for(const E of fs)if(!cs.has(E)){const B=t[E];B?.remove&&B.remove(),delete t[E],C&&C.push(E)}const ft=t.childExtends,vt=t.tag==="fragment",as=t.context?.document||globalThis.document,at=vt?null:as?.createDocumentFragment(),It=new Set;for(const E of V){const B=fo.get(E),T=B.rawChild,Y=t[E];if(Y&&Y.state){if(T&&typeof T=="object"){const L=Y.state,st=L.$replace||L.replace,ao=L.$update||L.update;try{if(typeof st=="function")st.call(L,T);else if(typeof ao=="function"){for(const U in L)if(!(U==="__element"||U==="root"||U==="parent"||U==="update")&&!Object.prototype.hasOwnProperty.call(T,U))try{L[U]=void 0}catch{}ao.call(L,T)}else for(const U in T)L[U]=T[U]}catch(U){if(typeof console<"u"&&console.error){const ls=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to patch at ${ls} (reconcile, keeping its previous data for this pass):`,U?.message||U)}}}j&&j.push(E);continue}let Ut=T;(typeof T=="string"||typeof T=="number")&&(Ut={value:T,text:T});const Vt=B.childProps;let H=Vt?{...Vt,state:Ut}:{state:Ut};const us=typeof $=="function"?wt(Vt):it(t,"childProps");if(ft&&!H.ignoreChildExtends)if(H.extends){const L=Array.isArray(H.extends)?H.extends:[H.extends],st=Array.isArray(ft)?ft:[ft];H={...H,extends:[...st,...L]}}else H={...H,extends:ft};let Bt;try{Bt=X(Ct(H,us),t,E,s)}catch(L){if(typeof console<"u"&&console.error){const st=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${st} (reconcile, skipping this row):`,L?.message||L)}It.add(E);continue}!vt&&Bt?.node&&at&&at.appendChild(Bt.node),S&&S.push(E)}if(!vt&&at&&at.childNodes.length&&t.node&&t.node.appendChild(at),!vt&&t.node){let E=null;for(const B of V){const T=t[B]?.node;if(!T)continue;const Y=E?E.nextSibling:t.node.firstChild;T!==Y&&t.node.insertBefore(T,Y),E=T}}l.__children=It.size?V.filter(E=>!It.has(E)):V,w&&(S.length||C.length)&&Eo(t,{added:S,removed:C,kept:j}),Ft(t,!1);return}const ot=w?[...l.__children]:null;for(const $ of[...l.__children]){const V=t[$];V?.remove&&V.remove(),delete t[$]}l.__children=[],io(t,b,s,!1,!0),Ft(t,!1),w&&Eo(t,{added:[...l.__children],removed:ot,kept:[]})},{depth:l.path.length,label:k(l,"children")});l.__effects.push(x)}const a=io(t,o,s,!0,i);if(n!=null&&!(n&&n.__ref)){let c=n;if(typeof c=="string"||typeof c=="number"?c={text:c}:typeof c!="object"&&(c={}),t.childProps&&(c=tt(t.childProps,c)),r&&!c.ignoreChildExtends)if(c.extends){const d=Array.isArray(c.extends)?c.extends:[c.extends],A=Array.isArray(r)?r:[r];c={...c,extends:[...A,...d]}}else c={...c,extends:r};const l=St(it(t,"childProps"),it(t,"content"));X(Ct(c,l),t,"content",s)}if(o&&!a)return;const f=t.context?.components||{},e=t.__ref&&t.__ref.__runtimeSource,u=e?{}:null;{const c=Object.keys(t);for(let l=0;l<c.length;l++){const d=c[l];if(!d.endsWith("Extends")||typeof t[d]!="string")continue;const A=d.slice(0,-7);if(!A||A.charCodeAt(0)<65||A.charCodeAt(0)>90)continue;const x={extends:t[d]};delete t[d];for(let _=l+1;_<c.length;_++){const b=c[_],w=b.charCodeAt(0);if(w>=65&&w<=90||K.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const S=t[b];S!==void 0&&(x[b]=S,delete t[b],u&&xt(e,b)&&(u[A]||(u[A]={}),u[A][b]=e[b]))}t[A]&&typeof t[A]=="object"?t[A]={...x,...t[A]}:t[A]=x}}const h=s?.mountYield===!0||t.yieldChildren===!0,p=Object.keys(t),y=c=>{if(K.has(c)||typeof t[c]!="object"||t[c]===null)return;const l=c.charCodeAt(0);if(l<65||l>90)return;let d=t[c];if(d.__ref)return;if(!d.extends&&!d.extend){const x=f[c]||f[`smbls.${c}`];x&&(d={...d,extends:x})}if(t.childProps&&(d=tt(t.childProps,d)),r&&!d.ignoreChildExtends)if(d.extends){const x=Array.isArray(d.extends)?d.extends:[d.extends],_=Array.isArray(r)?r:[r];d={...d,extends:[..._,...x]}}else d={...d,extends:r};const A=e?St(it(t,"childProps"),St(u[c]||null,it(t,c))):null;X(Ct(d,A),t,c,s)};if(!h){for(const c of p)y(c);return}ho();const g=c=>{for(let l=c;l<p.length;l++)if(y(p[l]),l+1<p.length&&po()){const d=l+1;_o(()=>g(d));return}};g(0),yo()}function is(t,s,o){const{node:n}=t;if(!n)return;n.ref=t;const r=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(o?.position==="before"&&o.node)a.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const f=o.node.nextSibling;a.insertBefore(n,f||r)}else a.insertBefore(n,r);return}}const i=s?.node||(s?.nodeType?s:null);if(i)if(o?.position==="before"&&o.node)i.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const a=o.node.nextSibling;a?i.insertBefore(n,a):i.appendChild(n)}else i.appendChild(n)}const co=3;function ue(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=co?!1:(t.__inBeforeUpdate=!0,!0)}function $t(t,s){t&&(t.__inBeforeUpdate=!1,s?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===co&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${co}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function F(t,s,o){const n=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&q(n,s,o);const r="on"+t,i=s[r];if(typeof i=="function"){const e=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(e){if(s.__ref[e])return!0;s.__ref[e]=!0}const u=s.context?.designSystem;u&&M(u);let h=!!e;try{const p=i(s,s.state,s.context,o);if(p&&typeof p.then=="function"){const y=s.__ref;return p.catch(g=>{s.context?.plugins?.length&&q("error",s,{hook:r,error:g})||console.error(`[DOMQL] Lifecycle "${r}" error:`,g)}).finally(()=>{e&&y&&(y[e]=!1)}),h=!1,!0}if(p===!1)return!1}catch(p){if(s.context?.plugins?.length&&q("error",s,{hook:r,error:p})||console.error(`[DOMQL] Lifecycle "${r}" error:`,p),s.context?.strictMode)throw p}finally{u&&N(),h&&s.__ref&&(s.__ref[e]=!1)}}return!0}var Ue=X;export{co as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,ue as acquireBeforeUpdateGuard,X as create,Ue as default,zt as flushMounts,Fe as isStaticCssProp,$e as recompileStaticCss,Ie as reconcileAttrProp,$t as releaseBeforeUpdateGuard,Pt as writeElementText};
|
|
4
|
+
`):"")}}if(Kt(n,!0),Ls(n,o,r),typeof n.html=="function"&&n.node&&!n.node.innerHTML){const d=n.context?.designSystem;d&&L(d);try{const h=n.html(n,n.state,n.context);h!=null&&typeof h!="function"&&(n.node.innerHTML=h)}catch{}finally{d&&D()}}if(R("Create",n,e),R("Complete",n,e),R("Render",n,e),R("RenderRouter",n,e),oo(n,e),typeof n.onFrame=="function"){const d=n.onFrame,h=n.context?.designSystem,y=()=>{if(n.node){if(n.node.isConnected){h&&L(h);try{d(n,n.state,n.context)}catch(A){console.error("[DOMQL] onFrame error:",A)}finally{h&&D()}}requestAnimationFrame(y)}};requestAnimationFrame(y)}return n}function Go(t,o,s,e,r,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&&ft()&&(/^[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),Gs(t,o,i);const a=Ks(t),f=a?a.rank:0,n=new Set(["childProps","attr","style","scope","data","vars"]),c=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"){e&&(t.key=e);continue}const w=o[b];a&&a.set(b,f);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]=jt(p,w):_&&n.has(b)?t[b]={...p,...w}:_&&so(b)?t[b]=jt(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]=jt(_,p):x&&n.has(w)?t[w]={..._,...p}:x&&so(w)?t[w]=jt(_,p):t[w]=p}}if(c&&l(c),o.props&&typeof o.props=="object"&&(l(o.props),a))for(const b in o.props)a.set(b,f);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=r?.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=$s(b,y)}else y&&(t.scope=y);o.if!==void 0&&(t.if=o.if);const A=t.__ref,g=An(t,A&&A.__runtimeSource);return A&&(A.__declaredArrays=g||void 0),Ws(t),un(t,r,o,i),o}const cn=new Set(["key","parent","context","__ref"]);function fn(t,o){for(const r of Object.keys(t))cn.has(r)||delete t[r];const s=ko();s&&Nt(null);let e=o.definition;if(!e.extends&&!e.extend&&typeof o.key=="string"){const r=t.context?.components||{},i=r[o.key]||r["smbls."+o.key];i&&(e={...e,extends:i})}try{Go(t,e,o.key,o.ownKey,t.parent,o.options)}finally{s&&Nt(s)}}function an(t,o,s){const e=s||{},r=f=>!!(e[f]||e["smbls."+f]),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 f of a){if(typeof f!="string")continue;const n=f.includes(">")?f.split(">")[0].trim():f;r(n)||i.push(n)}return i}if(typeof o=="string"&&/^[A-Z]/.test(o)){let f=-1;const n=o.indexOf("_"),c=o.indexOf(".");n>0&&(f=n),c>0&&(f<0||c<f)&&(f=c);const l=f>0?o.substring(0,f):o;r(l)||i.push(l)}return i}function no(t,o,s){if(typeof t.onStateInit!="function"&&!t.context?.plugins?.length)return;const e=t.state;t.state=o;try{R("StateInit",t,s)}finally{t.state=e}}function un(t,o,s,e){const r=!o,i=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,a=r&&i&&t.context?.state,f=s.state!==void 0&&!a?s.state:t.state&&!Y(t.state)?t.state:void 0;if(f==null){if(o?.state)t.state=o.state,xt(t,t.state);else if(t.context?.state){const n=t.context.state,c={...n},l=t.context?.polyglot;if(l?.translations){const u=t.context,d=n.lang||l.defaultLang||"en",h=new Set,y=(b,w)=>{h.has(b)||zs(u,b,c)&&(c[b]=w,h.add(b),Ys(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])}Y(c)||no(t,c,e),t.state=Y(c)?c:Qt(c),t.state.__element=t,t.state.root=t.state,xt(t,t.state),Ft.promoteActiveRootState?.(n,t.state),R("StateCreated",t,e)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),xt(t,t.state);return}if(typeof f=="string"){if(t.state=Ko(f,o),t.state&&typeof t.state=="object"&&!Y(t.state)){const n=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:n,enumerable:!1,configurable:!0,writable:!0})}xt(t,t.state),R("StateCreated",t,e);return}if(typeof f=="function"){const n=f(t,o?.state);if(Y(n))t.state=n;else{const c=n||{};no(t,c,e),t.state=Qt(c)}}else if(Y(f))t.state=f;else{const n={...f};no(t,n,e),t.state=Qt(n)}t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,xt(t,t.state),Ft.promoteActiveRootState?.(f,t.state),R("StateCreated",t,e)}function eo(t,o){if(!o)return t;const s=o.split("/");let e=t;for(const r of s){if(e==null)return{};e=e[r]}return e??{}}function Ko(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?eo(o.state,r):o.state??{}}if(t.startsWith("~/")){const r=o.state?.root||o.state,i=t.slice(2);return i?eo(r,i):r??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=eo(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const e=o.context?.polyglot;if(e?.translations){const r=o.state?.root?.lang||e.defaultLang||"en",i=e.translations[r];if(i?.[t]!==void 0)return i[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}const dn=new Set(["s","state","ctx","context"]);function ln(t){try{const s=(typeof Ft.getFunctionSource=="function"?Ft.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(e=>e.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function pn(t){if(typeof t!="function"||t.length!==2)return!1;const o=ln(t);if(o.length<2)return!1;const s=o[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!dn.has(s)}function hn(t){const o=t.__ref,s=t.tag||"div",e=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||G.has(f))continue;const n=f.charCodeAt(0);n>=65&&n<=90||Z(f)||U[f]||V&&V.has(f)||n!==45&&(St(s,f)||(ft()&&pn(t[f])&&console.warn(`[smbls] custom prop "${f}"${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('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]})))}for(let a=0;a<r.length;a++){const{prop:f,fn:n}=r[a];o.__exec[f]=n,Object.defineProperty(t,f,{get(){e&&L(e);try{return n(t,t.state,t.context)}catch{return}finally{e&&D()}},set(c){delete o.__exec[f],Object.defineProperty(t,f,{value:c,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 e=o[s];try{typeof e=="function"?e(t,t.state,t.context):typeof e=="string"&&t.state?.[e]}catch{}}}function T(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...e){return yn(t,o),s.apply(this,e)}}function lt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function k(t,o){return()=>t.path.join(".")+"::"+o}const Wo=new Set;function M(t,o,s){if(!ft())return;const e=k(t,o)();Wo.has(e)||(Wo.add(e),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const zo=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,_n=(t,o)=>{let s;try{s=String(t)}catch{return}if(!s.includes("{{"))return;zo.lastIndex=0;let e;for(;(e=zo.exec(s))!==null;)e[2].includes("{{")&&o.add(e[2])},gn=(t,o)=>!Z(t)&&!st(o,t),ro=(t,o,s,e,r)=>{if(typeof o=="string"){!r&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&gn(t,e)&&_n(o,s)},io=new WeakMap,Et=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),Pt=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},Ot=(t,o)=>t&&o?it(t,o):t||o||null,Yo=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&Et(s,o)},pt=(t,o)=>Yo(t,o)?Pt(t.__ref.__runtimeSource[o]):null,Tt=(t,o)=>(o&&t&&typeof t=="object"&&io.set(t,o),t),bn=t=>{if(!t||typeof t!="object")return;const o=io.get(t);return o&&io.delete(t),o},co=(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 e=0;e<t.length;e++)co(t[e],o,s);return}if(!t.__ref)for(const e of Object.keys(t)){if(e==="state")continue;const r=Object.getOwnPropertyDescriptor(t,e);r&&"value"in r&&co(r.value,o,s)}}},An=(t,o)=>{let s=null;for(const e of Object.keys(t)){if(G.has(e)||o&&Et(o,e))continue;const r=Object.getOwnPropertyDescriptor(t,e),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;co(i,a,new Set),a.size&&(s||(s=new Map),s.set(i,a))}return s},qo=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const e=s.__ref&&s.__ref.__declaredArrays,r=e&&e.get(o);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Zo=["attr","aria","data","metadata"],xn=t=>{if(Zo.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},wn=(t,o)=>{const s=new Set,e=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!o&&Et(o,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!xn(r))continue;const n=f?o[r]:null,c=n&&typeof n=="object"?n:null,l=r.charCodeAt(0)===46||r.charCodeAt(0)===33;for(const u in a){const d=f&&(!c||Et(c,u)),h=a[u];if(l&&h&&typeof h=="object"&&!Array.isArray(h)&&Zo.includes(u)){for(const y in h)ro(y,h[y],s,e,d);continue}ro(u,h,s,e,d)}continue}ro(r,a,s,e,f)}return s};function Qo(t,o){const s=t.__ref,e=!!(o&&o.skipIfEffect),r=wn(t,s.__runtimeSource);if(s.__authoredTemplates)for(const n of r)s.__authoredTemplates.add(n);else s.__authoredTemplates=r;if(hn(t),typeof t.text=="function"){const n=t.text,c=T(t,t.textDeps,n),l=j(()=>{if(!s.contentManaged)try{let u=c(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)),Ht(t,u))}catch(u){M(s,"text",u)}},{depth:s.path.length,label:k(s,"text")});s.__effects.push(l),s.__exec.text=n}else if(typeof t.text=="string"&&t.text.includes("{{")){const n=t.text,c=j(()=>{if(s.contentManaged)return;const l=I.call(t,n,t.state);l!=null&&(t.text=l),t.node&&Ht(t,l??"")},{depth:s.path.length,label:k(s,"text")});s.__effects.push(c),s.__exec.text=n}const i=t.tag||"div";for(const n of Object.keys(t))if(typeof t[n]=="function"&&!G.has(n)&&!Z(n)&&!s.__exec[n]&&!No(i,n)){if(U[n]){const c=t[n],l=T(t,t[n+"Deps"],c),u=n;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);Lo();let p;try{p=U[u](w,t,t.state,t.context)}finally{Do()}if(Array.isArray(p)){const x={};for(const S of p)if(S)for(const v in S)x[v]=S[v];p=x}const _=u==="show"||u==="hide";if(p&&t.node&&Sn(p)){const x=Lt(p);if(x===null||x!==A){A=x;const S=wt(p,null,t.context?.cssPrefix),v=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(y)for(const C of y)t.node.classList.remove(C);if(v&&v.length)for(const C of v)t.node.classList.add(C);y=v}}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=Lt(p);if(x===null||x!==d||!yt(t.node,h)){d=x;const S=es(t,p);h=ht(t.node,S)}}else t.node&&_&&(d=void 0,h=null,t.node.style.display="")}finally{b&&D()}},{depth:s.path.length,label:k(s,u)});s.__effects.push(g),s.__exec[n]=c}else if(V&&V.has(n)){const c=t[n],l=T(t,t[n+"Deps"],c),u=n;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||!yt(t.node,h)){d=b;const w={[u]:g},p=es(t,w);h=ht(t.node,p)}}else d=void 0,h=null,t.node.style[u]=""}finally{A&&D()}},{depth:s.path.length,label:k(s,u)});s.__effects.push(y),s.__exec[n]=c}else if(n.charCodeAt(0)===45){const c=t[n];ss(t,n,c,t[n+"Deps"],n),s.__exec[n]=c}}if(Cn(t),typeof t.html=="function"){const n=t.html,c=T(t,t.htmlDeps,n),l=j(()=>{const u=t.context?.designSystem;u&&L(u);try{const d=c(t,t.state,t.context);t.node&&d!=null&&typeof d!="function"&&(t.node.innerHTML=d)}finally{u&&D()}},{depth:s.path.length,label:k(s,"html")});s.__effects.push(l),s.__exec.html=n}if(typeof t.value=="function"){const n=t.value,c=T(t,t.valueDeps,n),l=j(()=>{try{let u=c(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),mo(t,u)}catch(u){M(s,"value",u)}},{depth:s.path.length,label:k(s,"value")});s.__effects.push(l),s.__exec.value=n}else if(typeof t.value=="string"&&t.value.includes("{{")){const n=t.value,c=j(()=>{try{mo(t,I.call(t,n,t.state))}catch(l){M(s,"value",l)}},{depth:s.path.length,label:k(s,"value")});s.__effects.push(c),s.__exec.value=n}if(typeof t.style=="function"){const n=t.style,c=T(t,t.styleDeps,n);let l,u=null;const d=j(()=>{const h=lo(t,c(t,t.state,t.context)),y=Lt(h);(y===null||y!==l||!yt(t.node,u))&&(l=y,Vt(t.node,u,h),X(t.node,h),u=ht(t.node,h))},{depth:s.path.length,label:k(s,"style")});s.__effects.push(d),s.__exec.style=n}else if(t.style&&typeof t.style=="object")for(const n in t.style){const c=t.style[n];if(typeof c!="function")continue;const l=T(t,lt(t.styleDeps,n),c);let u,d=null;const h=j(()=>{try{const y=l(t,t.state,t.context);if(t.node){const A=n+":"+String(y);if(A!==u||!yt(t.node,d)){u=A;const g=lo(t,{[n]:y});Vt(t.node,d,Object.assign({},g,{[n]:""})),X(t.node,g),d=ht(t.node,g)}}}catch(y){M(s,"style."+n,y)}},{depth:s.path.length,label:k(s,"style."+n)});s.__effects.push(h)}if(t.attr&&typeof t.attr=="object"){for(const n in t.attr)if(typeof t.attr[n]=="function"){const c=T(t,lt(t.attrDeps,n),t.attr[n]),l=n,u=j(()=>{try{let d=c(t,t.state,t.context);typeof d=="string"&&d.includes("{{")&&(d=I.call(t,d,t.state)),t.node?.setAttribute&&(d==null||d===!1&&!at(l)?t.node.removeAttribute(l):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(l,K(l,d)))}catch(d){M(s,"attr."+l,d)}},{depth:s.path.length,label:k(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}else if(typeof t.attr[n]=="string"&&t.attr[n].includes("{{")){const c=t.attr[n],l=n,u=j(()=>{try{const d=I.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,K(l,d??""))}catch(d){M(s,"attr."+l,d)}},{depth:s.path.length,label:k(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}}if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const c=t.aria[n];if(typeof c=="string"&&c.includes("{{")){const h=c,y="aria-"+n.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,K(y,g??""))}catch(g){M(s,"aria."+n,g)}},{depth:s.path.length,label:k(s,"aria."+n)});A._attrName=y,s.__effects.push(A);continue}if(typeof c!="function")continue;const l=T(t,lt(t.ariaDeps,n),t.aria[n]),u="aria-"+n.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,K(u,h))}catch(h){M(s,"aria."+n,h)}},{depth:s.path.length,label:k(s,"aria."+n)});d._attrName=u,s.__effects.push(d)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];if(typeof c=="string"&&c.includes("{{")){const y=c,A="data-"+n.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){M(s,"data."+n,b)}},{depth:s.path.length,label:k(s,"data."+n)});g._attrName=A,s.__effects.push(g);continue}if(typeof c!="function")continue;const l=T(t,lt(t.dataDeps,n),t.data[n]),d="data-"+n.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){M(s,"data."+n,y)}},{depth:s.path.length,label:k(s,"data."+n)});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 n in a){if(typeof a[n]!="function")continue;const c=T(t,lt(t.classDeps,n),a[n]),l=j(()=>{try{const u=c(t,t.state,t.context);if(!t.node?.classList)return;typeof u=="string"?t.node.classList.add(u):u?t.node.classList.add(n):t.node.classList.remove(n)}catch(u){M(s,"class."+n,u)}},{depth:s.path.length,label:k(s,"class."+n)});s.__effects.push(l)}!e&&typeof t.if=="function"&&Jo(t,s,t.if);for(const n of Object.keys(t)){if(G.has(n)||typeof t[n]!="function")continue;const c=n.charCodeAt(0);if(c>=65&&c<=90||Z(n))continue;const l=t[n];s.__exec[n]=l;const u=t.tag||"div";if(St(u,n)&&!st(u,n)){const d=Ct(n)||n,h=T(t,t[n+"Deps"],l),y=j(()=>{try{let A=h(t,t.state,t.context);typeof A=="string"&&A.includes("{{")&&(A=I.call(t,A,t.state)),t.node?.setAttribute&&(A==null||A===!1&&!at(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,K(d,A))))}catch(A){M(s,n,A)}},{depth:s.path.length,label:k(s,n)});y._attrName=d.toLowerCase(),s.__effects.push(y)}}const f=t.tag||"div";for(const n of Object.keys(t)){if(G.has(n))continue;const c=t[n];if(typeof c!="string"||!c.includes("{{"))continue;const l=n.charCodeAt(0);if(l>=65&&l<=90||Z(n)||st(f,n)||Jt[n]||!St(f,n))continue;const u=Ct(n)||n,d=j(()=>{try{const h=I.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,K(u,h??""))}catch(h){M(s,n,h)}},{depth:s.path.length,label:k(s,n)});d._attrName=u.toLowerCase(),s.__effects.push(d)}if(Tn(t),Un(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const n=t.onStateUpdate,c=t.stateDeps;let l=!1,u=[];const d=j(()=>{const h=[];for(let b=0;b<c.length;b++){const w=c[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{n(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:k(s,"onStateUpdate")});s.__effects.push(d)}Rn(t)}function Xo(t){const o=t.parent,s=o?.node;if(!s||!t.node){Ls(t,t.parent);return}let e=null;const r=Object.keys(o),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=o[r[a]];if(f?.node?.parentNode===s){e=f.node;break}}e?s.insertBefore(t.node,e):s.appendChild(t.node)}function Jo(t,o,s){let e=T(t,t.ifDeps,s);const r=j(()=>{const i=!o.__ifInitialized&&o.__ifLateMerge;if(i){const n=t.context?.components||{};i.names.some(c=>n[c]||n["smbls."+c])&&(o.__ifLateMerge=null,fn(t,i),e=T(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=e(t,t.state,t.context)}catch(n){if(a=!1,o.__ifError=n,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,n?.message||n)}return}const f=o.__if;if(o.__if=!!a,f&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(n){console.error("[smbls] onRemove error:",n)}}else if(!f&&o.__if)if(o.__ifInitialized)t.node||(t.node=Xt(t)),t.node&&(t.node.ref=t),Xo(t),fo(t),_o(t),R("Render",t,{}),oo(t,{});else{if(o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=jo(t)),R("Init",t,{}),t.node||(t.node=Xt(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 c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),o.__fragmentAnchor=c}R("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Os(t,{}),Qo(t,{skipIfEffect:!0}),fo(t),xs(t),_o(t),Es(t),Ts(t,{}),Xo(t),R("Create",t,{}),R("Complete",t,{}),R("Render",t,{}),R("RenderRouter",t,{}),oo(t,{})}},{depth:o.path.length,label:k(o,"if")});o.__effects.push(r)}function Ht(t,o){const s=t.node;if(!s)return;const e=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==e&&(s.nodeValue=e);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==s&&(i=null),!i){const a=s.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==e&&(i.nodeValue=e):s.firstChild?(i=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(e),s.insertBefore(i,s.firstChild)):(s.textContent=e,i=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=i||null)}function mo(t,o){const s=t.node;if(!s||!("value"in s))return;const e=o==null?"":String(o);if(s.value===e)return;const r=typeof document<"u"&&document.activeElement===s,i=r&&typeof s.selectionStart=="number"?s.selectionStart:null,a=r&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=e,r&&i!=null&&a!=null)try{s.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function fo(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Ht(t,t.text),As(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 e in t.style)if(typeof t.style[e]=="function"){s={};for(const r in t.style)typeof t.style[r]!="function"&&(s[r]=t.style[r]);break}X(o,lo(t,s))}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const e=t.attr[s];typeof e=="function"||typeof e=="object"||e!=null&&(typeof e=="string"&&e.includes("{{")||e===!1&&!at(s)||o.setAttribute&&o.setAttribute(s,K(s,e)))}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 e=t.data[s];typeof e=="function"||typeof e=="object"||e==null||e===!1||typeof e=="string"&&e.includes("{{")||o.dataset&&(o.dataset[s]=e===!0?"":e)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(e=>e&&o.classList.add(e));else if(typeof s=="object")for(const e in s){const r=typeof s[e]=="function"?s[e](t,t.state,t.context):s[e];r&&o.classList.add(typeof r=="string"?r:e)}}}}function Lt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Sn(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 ht(t,o){if(!t||!t.style||!o)return null;const s=t.style,e=[];for(const r in o){if(o[r]==null||r.charAt(0)==="&")continue;const a=Q(r);e.push(a,ao(s,a),ts(s,a))}return e}function ao(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function ts(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Q(t){return et(t)?t:t.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())}function Vt(t,o,s){if(!t||!t.style||!o||!o.length)return;const e=t.style,r=new Set;if(s&&typeof s=="object")for(const i in s)s[i]==null||i.charAt(0)==="&"||r.add(Q(i));for(let i=0;i<o.length;i+=3){const a=o[i];r.has(a)||ao(e,a)===o[i+1]&&typeof e.removeProperty=="function"&&e.removeProperty(a)}}function yt(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let e=0;e<o.length;e+=3)if(ao(s,o[e])!==o[e+1]||ts(s,o[e])!==o[e+2])return!1;return!0}const et=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,os=t=>typeof t=="number"||t===!0||typeof t=="string"&&t!=="",Bt=t=>et(t)?t:"--"+t;function Gt(t,o){if(!m(t))return null;let s=null;for(const e of Object.keys(t)){if(!e)continue;let r=t[e];if(typeof r=="function"){if(!o)continue;r=r(o,o.state,o.context)}os(r)&&(s||(s={}),s[Bt(e)]=r)}return s}function ss(t,o,s,e,r){const i=t.__ref,a=T(t,e,s);let f,n=null;const c=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(!os(u)){Vt(d,n,null),f=void 0,n=null;return}const h=String(u);if(h!==f||!yt(d,n)){f=h;const y={[o]:u};X(d,y),n=ht(d,y)}}catch(u){M(i,r,u)}finally{l&&D()}},{depth:i.path.length,label:k(i,r)});i.__effects.push(c)}function Cn(t){const o=t.__ref,s=t.vars;if(typeof s=="function"){vn(t,s),o.__exec.vars=s;return}if(m(s))for(const e of Object.keys(s)){const r=s[e];!e||typeof r!="function"||ss(t,Bt(e),r,lt(t.varsDeps,e),"vars."+e)}}function vn(t,o){const s=t.__ref,e=T(t,t.varsDeps,o);let r,i=null;const a=j(()=>{const f=t.context?.designSystem;f&&L(f);try{const n=Gt(e(t,t.state,t.context)),c=t.node;if(!c||!c.style)return;const l=Lt(n);(l===null||l!==r||!yt(c,i))&&(r=l,Vt(c,i,n),n&&X(c,n),i=n?ht(c,n):null,s.__varsInline=n?new Set(Object.keys(n)):null)}catch(n){M(s,"vars",n)}finally{f&&D()}},{depth:s.path.length,label:k(s,"vars")});s.__effects.push(a)}function uo(t,o){if(typeof t[o]=="function"&&(st(t.tag||"div",o)||o.charCodeAt(0)===45))return!0;if(!et(o))return!1;const s=t.vars;if(typeof s=="function"){const e=t.__ref&&t.__ref.__varsInline;return!!(e&&e.has(o))}if(!m(s))return!1;for(const e of Object.keys(s))if(typeof s[e]=="function"&&Bt(e)===o)return!0;return!1}function kn(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 jn(t,o,s,e){const r=t.__ref;if(!r)return;let i=null;if(s)for(const a of s){if(e&&e.has(a))continue;const f=o[a];if(f==null||typeof f=="object")continue;const n=Q(a);$t[n]&&(i||(i={}),i[n]=f)}r.__declaredLonghands=i}function ns(t,o){const s=t.__ref,e=s&&s.__declaredLonghands;if(!e||!o)return null;let r=null;for(const i in e){if(o.has(i))continue;const a=$t[i];let f=!1;for(let n=0;n<a.length;n++)if(o.has(a[n])){f=!0;break}f&&(r||(r={}),r[i]=e[i])}return r}function es(t,o){const s=t.node;X(s,o);const e=kn(o);if(!e)return o;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of e)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(e);const i=ns(t,e);return i?(X(s,i),Object.assign({},o,i)):o}function En(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=ns(t,o.__inlineCssKeys);s&&X(t.node,s)}function lo(t,o){if(!o||typeof o!="object")return o;const s=t&&t.context&&t.context.designSystem;s&&L(s);try{return qs(o,t)}catch{return o}finally{s&&D()}}function X(t,o){if(!t||!o||!t.style)return;let s=null;for(const e in o){const r=o[e];if(r!=null){if(e.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[e]=r;continue}try{const i=String(r),a=et(e)?e:e.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),f=i.trim(),n=/\s*!important\s*$/.test(f),c=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,c,n?"important":"")}catch{}}}s&&Pn(t,s)}function Pn(t,o){const s=`_ds${Fo.scopedStyleId++}`;t.classList.add(s);const e=t.ownerDocument;let r=e.querySelector("style[data-smbls-scoped]");r||(r=e.createElement("style"),r.setAttribute("data-smbls-scoped",""),e.head.appendChild(r));let i="";for(const a in o){const f="."+s,n=a.replace(/&/g,f).split(",").map(l=>{const u=l.trim();return u.includes(f)?u:f+u}).join(", "),c=o[a];if(typeof c=="object"){let l="",u="";for(const d in c){const h=c[d];if(typeof h=="object"){const y=d.includes("&")?n.split(", ").map(g=>d.replace(/&/g,g)).join(", "):n.split(", ").map(g=>`${g} ${d}`).join(", ");let A="";for(const g in h)A+=`${Q(g)}: ${h[g]};`;u+=Mo(`${y} { ${A} }`,y)+`
|
|
5
|
+
`}else l+=`${Q(d)}: ${h};`}l&&(i+=Mo(`${n} { ${l} }`,n)+`
|
|
6
|
+
`),u&&(i+=u)}}i&&(r.textContent+=i)}const rs=new Set;function is(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 On(t,o,s){const e=is(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=o(t,t.state,t.context)}catch{return}if(is(r)===e)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";rs.has(i)||(rs.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(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Tn(t){const o=t.subscribeTo,s=typeof o=="function";let e=o;if(s)try{e=o(t,t.state,t.context)}catch{e=null}if(s&&ft()&&On(t,o,Array.isArray(e)?e:[]),!Array.isArray(e)||e.length===0)return;const r=t.__ref;for(let i=0;i<e.length;i++){const a=e[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),n=f[0],c=f.slice(1),l={value:!1},u=j(()=>{const d=t.state&&(Y(t.state)?t.state.root:null);if(!d||!Y(d))return;let h=d;h=h[n];for(let A=0;A<c.length&&!(h==null||typeof h!="object");A++)if(Y(h))h=h[c[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(oe(r)){const g=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});g&&typeof g.then=="function"?g.then(()=>Wt(r,!1),b=>{Wt(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:b})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",b)}):(Wt(r,!1),g===!1&&(y=!0))}}catch(g){Wt(r,!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&&r.__effects)for(let A=0;A<r.__effects.length;A++){const g=r.__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:r.path.length,label:k(r,"subscribeTo("+a+")")});l.value=!0,u._isSubscribeToEffect=!0,r.__effects.push(u)}}function po(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 ho(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 cs=new Set;function Ln(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",e=s+"::"+t;cs.has(e)||(cs.add(e),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 fs=new Map;function Dn(t){let o=fs.get(t);if(o)return o;o=[];const s=e=>{if(e)for(const r of e)o.push(r.replace(/-([a-z])/g,(i,a)=>a.toUpperCase()))};return s($t[t]),s(Js[t]),fs.set(t,o),o}function as(t,o,s){if(uo(t,o)||s&&s.has(o))return!0;const e=Dn(Q(o));for(let r=0;r<e.length;r++){const i=e[r];if(uo(t,i)||s&&s.has(i))return!0}return!1}function _t(t,o,s,e){const r={},i=new Set,a=(f,n,c)=>{const l=c?new Set(Object.keys(r)):null;if(U[f]){const u=U[f](n,o,o.state,o.context);if(u){const d=Array.isArray(u)?u:[u];for(const h of d)h&&Object.assign(r,h)}}else r[f]=n;if(c)for(const u in r)l.has(u)||i.add(u)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let n=t[f];if(typeof n=="function"&&(n=n(o,o.state,o.context)),!(n==null||typeof n=="function")){if(typeof n=="object"&&!Array.isArray(n)){if(f==="style"){for(const u in n){let d=n[u];typeof d=="function"&&(d=d(o,o.state,o.context)),!(d==null||typeof d=="function")&&a(u,d,as(o,u,e))}continue}if(f==="vars"){const u=Gt(n,o);if(u)for(const d in u)a(d,u[d],uo(o,d)||!!(e&&e.has(d)));continue}if(po(f,o)){const u=_t(n,o,!1,e);Object.keys(u).length&&(r[`[data-theme="${f.slice(1)}"] &`]=u);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){ft()&&Ln(f,o);continue}const c=ho(f,o),l=_t(n,o,!1,e);Object.keys(l).length&&(r[c]=l);continue}a(f,n,as(o,f,e))}}if(s)for(const f in r)i.add(f);for(const f of i){const n=r[f];typeof n=="string"&&!n.includes("!important")&&(r[f]=n+" !important")}return r}const m=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function us(t,o){for(const s in o){const e=o[s];t[s]=m(e)?us(m(t[s])?t[s]:{},e):e}return t}function Mn(t,o){if(!m(o))return;let s;for(const e of t.split(" ")){const r=e?o[e]:null;m(r)&&(s=us(s||{},r))}return s}function yo(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)&&yo(t[s],o+1))return!0}return!1}function ds(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(po(t,s)){const i=_t(o,s,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const e=ho(t,s),r=_t(o,s,!1);return Object.keys(r).length?{cssProp:e,block:r}:null}function Rn(t){const o=t.__ref;for(const s of Object.keys(t)){if(!so(s))continue;const e=t[s];if(!e||typeof e!="object"||Array.isArray(e)||!yo(e))continue;let r=null,i;const a=j(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&L(f);let n,c=!1;try{const l=ds(s,e,t),u=l?Lt(l.block)+"::"+l.cssProp:null;if(u!==null&&u===i)c=!0;else if(i=u,l){const d=wt({[l.cssProp]:l.block},null,t.context?.cssPrefix);n=d?d.split(" ").filter(Boolean):null}else n=null}finally{f&&D()}if(!(c||!t.node.classList)){if(r)for(const l of r)t.node.classList.remove(l);if(n&&n.length)for(const l of n)t.node.classList.add(l);r=n}},{depth:o.path.length,label:k(o,"cssBlock("+s+")")});o.__effects.push(a)}}const Nn=()=>!0,Fn=(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))||et(t)||t==="vars"};function $n(t,o,s){const e={};let r=!1;for(const f in s)Object.prototype.hasOwnProperty.call(s,f)&&(f!=="data"&&f!=="aria"&&(Fn(f,s[f])||G.has(f))?e[f]=!0:r=!0);if(!r)return null;const i=Qs({[o]:s},t.tag||"div",e,Nn);let a=null;for(const f in i)/^on/i.test(f)||(a||(a={}),a[f]=i[f]);return a}function ls(t,o,s,e,r,i){const a=t.node;let f=null;const n=c=>{(f||(f=[])).push(c)};for(const c in e){const l=o.owners.get(c),u=l===s;if(!i&&l!==void 0&&!u)continue;let d;try{d=e[c](t)}catch(y){M(t.__ref,"conditional("+s+")."+c,y),u&&n(c);continue}if(typeof d=="string"&&d.includes("{{")&&(d=I.call(t,d,t.state)),u&&a.getAttribute(c)!==o.written.get(c)){n(c);continue}if(d==null||typeof d=="object"||typeof d=="function"){u&&ps(a,o,c);continue}const h=d===!1&&!at(c)?null:String(K(c,d));n(c),!(u&&h===o.written.get(c))&&(l===void 0&&o.base.set(c,a.getAttribute(c)),h==null?a.removeAttribute(c):a.setAttribute(c,h),o.owners.set(c,s),o.written.set(c,h))}r.appliedAttrs=f}function ps(t,o,s){if(t.getAttribute(s)===o.written.get(s)){const e=o.base.get(s);e==null?t.removeAttribute(s):t.setAttribute(s,e)}o.owners.delete(s),o.base.delete(s),o.written.delete(s)}function In(t,o,s,e){const r=e.appliedAttrs;if(e.appliedAttrs=null,!!r)for(const i of r)o.owners.get(i)===s&&ps(t.node,o,i)}function _o(t){const o=t.__ref&&t.__ref.__conditionalAttrs,s=t.node;if(!(!o||!o.owners.size||!s||!s.getAttribute))for(const e of o.owners.keys()){const r=o.written.get(e),i=s.getAttribute(e);i!==r&&(o.base.set(e,i),r==null?s.removeAttribute(e):s.setAttribute(e,r))}}function Un(t){const o=t.__ref;o.__conditionalRunners=[];let s=null;const e=new Map;for(const r of Object.keys(t)){const i=r.charAt(0);if(i!=="."&&i!=="!")continue;const a=r.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 \`${r}\` 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 f=t[r];if(!f||typeof f!="object")continue;const n=i==="!",c={lastMatch:!1,appliedKeys:null,appliedClasses:null,appliedAttrs:null},l=$n(t,r,f);l&&!s&&(s=o.__conditionalAttrs={owners:new Map,base:new Map,written:new Map});const u=new Set;for(const g in f){if(!Object.prototype.hasOwnProperty.call(f,g))continue;const b=g.charAt(0),w=f[g];if(!((b===":"||b==="@"||b==="&"||b==="[")&&w&&typeof w=="object"&&!Array.isArray(w))){if(g==="vars"&&m(w)){for(const p of Object.keys(w))p&&u.add(Bt(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(v){g=!1,o.__conditionalError=v,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,v?.message||v)}}}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 \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else g=b;const w=n?!g:!!g;if(!t.node)return;const p=t.context?.designSystem;if(w===c.lastMatch){if(w&&l&&t.node.setAttribute){p&&L(p);try{ls(t,s,r,l,c,!1)}finally{p&&D()}}return}c.lastMatch=w,p&&L(p);try{if(w){const _={},x={};let S=!1;for(const C in f){if(!Object.prototype.hasOwnProperty.call(f,C))continue;const N=f[C],tt=C.charAt(0);if((tt===":"||tt==="@"||tt==="&"||tt==="[")&&N&&typeof N=="object"&&!Array.isArray(N)){if(po(C,t)){const P=_t(N,t,!1,u);Object.keys(P).length&&(x[`[data-theme="${C.slice(1)}"] &`]=P,S=!0)}else{const P=ho(C,t),F=_t(N,t,!1,u);Object.keys(F).length&&(x[P]=F,S=!0)}continue}const ot=typeof N=="function"?N(t,t.state,t.context):N;if(ot!=null){if(U[C]){const P=U[C](ot,t,t.state,t.context);if(P){const F=Array.isArray(P)?P:[P];for(const gt of F)gt&&Object.assign(_,gt)}}else if(V&&V.has(C))_[C]=ot;else if(et(C))_[C]=ot;else if(C==="vars"){const P=Gt(ot,t);P&&Object.assign(_,P)}}}const v=Object.keys(_);if(v.length){X(t.node,_);for(const C of v)e.set(C,r);c.appliedKeys=v}else c.appliedKeys=null;if(S){const C=wt(x,null,t.context?.cssPrefix,{state:!0}),N=C?C.split(" ").filter(Boolean):[];if(N.length&&t.node.classList){for(const tt of N)t.node.classList.add(tt);c.appliedClasses=N}else c.appliedClasses=null}else if(c.appliedClasses){for(const C of c.appliedClasses)t.node.classList.remove(C);c.appliedClasses=null}l&&t.node.setAttribute&&ls(t,s,r,l,c,!0)}else{if(c.appliedAttrs&&In(t,s,r,c),c.appliedKeys){for(const _ of c.appliedKeys)e.get(_)===r&&(et(_)?t.node.style.removeProperty(_):t.node.style[_]="",e.delete(_));c.appliedKeys=null}if(c.appliedClasses){for(const _ of c.appliedClasses)t.node.classList.remove(_);c.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:k(o,"conditional("+r+")")}),A=o.__exec&&o.__exec[a]||t[a];y._sources.size===0&&typeof A=="function"&&ft()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${a}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(y)}}const go=new WeakSet,hs=new WeakSet,ys=new WeakSet;function Hn(t){if(ys.has(t))return!1;if(!hs.has(t)){hs.add(t);const o=t.defaultView,s=()=>{ys.add(t)};o&&typeof o.requestAnimationFrame=="function"?o.requestAnimationFrame(s):setTimeout(s,0)}return!0}function Vn(t){const o=t.ownerDocument;!o||go.has(o)||Hn(o)||(go.add(o),queueMicrotask(()=>{go.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const bo=new WeakSet;let _s=!1;function gs(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Ao(t,o){const s={...t};for(const e in o){const r=o[e],i=s[e];s[e]=r&&typeof r=="object"&&i&&typeof i=="object"?Ao(i,r):r}return s}function bs(t,o){const s={};for(const e in t){const r=t[e];if(r&&typeof r=="object"){const i=bs(r,o);Object.keys(i).length&&(s[e]=i)}else o.has(e)||(s[e]=r)}return s}function Bn(t,o,s){let e=null;for(const[r,i]of o){const a=Q(r),f=$t[a];if(f)for(let n=0;n<f.length;n++){const c=f[n].replace(/-([a-z])/g,(y,A)=>A.toUpperCase()),l=t[c]!=null?o.get(c):void 0,u=s&&s.get(f[n]),d=l!==void 0&&l>i&&Ro(f[n],t[c],a),h=!d&&u!==void 0&&u>i&&Ro(f[n],void 0,a);if(d||h){d&&delete t[r],e||(e=new Set),e.add(r);break}}}return e}function As(t){const{node:o}=t;if(!o)return;if(_s||(_s=!0,wt({display:"none"})),bo.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}bo.add(t);const s=t.context?.designSystem;s&&L(s),Lo();try{const e={};let r=!1,i=[],a=null,f=null,n=null;const c=t.__ref&&t.__ref.__mergeLayer;let l,u=null,d=null;const h=(p,_)=>{if(_&&typeof _=="object"&&gs(p)){f||(f={});const x=f[p];x&&(_=Ao(x,_)),f[p]=_}else(_===null||typeof _!="object")&&(n||(n=new Set),n.add(p),l!==void 0&&(u||(u=new Map),u.set(p,l)));e[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 v=x[S];v&&typeof v=="object"&&gs(S)&&(a||(a={}),a[S]=v),e[S]=v}};if(Array.isArray(p))for(const x of p)x&&_(x);else _(p);r=!0}}const y=(p,_)=>{if(p==="vars"){const x=Gt(_);if(x){for(const S in x)h(S,x[S]);r=!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 v in S)h(v,S[v])}else for(const S in x)h(S,x[S]);r=!0}}else if(V&&V.has(p))_!=null&&typeof _!="object"&&(h(p,_),r=!0);else if(p.charCodeAt(0)===45)_!=null&&typeof _!="object"&&(h(p,_),r=!0);else if((p.charAt(0)==="&"||p.charAt(0)==="@"||p.charAt(0)===":"||p.charAt(0)==="[")&&_&&typeof _=="object"&&!Array.isArray(_)){if(yo(_))return;const x=ds(p,_,t);x&&(h(x.cssProp,x.block),r=!0)}};if(typeof t.class=="string"){const p=Mn(t.class,t.context?.designSystem?.class);if(p)for(const _ in p)y(_,p[_])}const A=n?new Set(n):null,g=t.tag||"div";for(const p of Object.keys(t)){if(typeof t[p]=="function"){const x=c&&c.get(p);x!==void 0&&st(g,p)&&(d||(d=new Map),d.set(Q(p),x));continue}if(l=c?c.get(p):void 0,p==="vars"){y(p,t[p]);continue}if(G.has(p)||p==="theme")continue;const _=p.charCodeAt(0);_>=65&&_<=90||Z(p)||No(g,p)||y(p,t[p])}l=void 0;const b=u?Bn(e,u,d):null;if(a)for(const p in a){let _=n?bs(a[p],n):a[p];f&&f[p]&&(_=Ao(_,f[p])),Object.keys(_).length?e[p]=_:delete e[p]}if(jn(t,e,n,b?new Set([...A||[],...b]):A),r){e.display&&String(e.display).includes("!important")&&(o.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const p=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof p=="string"&&p!==""&&e.display&&e.display!==p&&(e.display=p);const _=wt(e,null,t.context?.cssPrefix);if(i=_?_.split(" ").filter(Boolean):[],_&&o.classList){const x=i;let S=!1;for(const v of x)o.classList.add(v),S||(v.charCodeAt(0)===95&&v.charCodeAt(1)===99||v.charCodeAt(0)===95&&v.indexOf("_c",1)!==-1)&&(S=!0);S&&Vn(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}En(t)}finally{Do(),s&&D(),bo.delete(t)}}const Pe=t=>!!U[t]||!!(V&&V.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Oe(t){t&&t.node&&As(t)}function xs(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());o.setAttribute(a,K(a,i))}const s=Zs(t);for(const r in s){const i=s[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&o.setAttribute(r,i===!0?"":i)}const e=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||G.has(r)||r==="on"||s[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!st(e,r)&&St(e,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!Jt[r])continue;a=I.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!at(Ct(r)||r))continue;const f=Ct(r)||r;o.setAttribute(f,K(f,a))}}}function Te(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const e=o.charCodeAt(0);if(e>=65&&e<=90||Z(o))return;const r=t.tag||"div";if(st(r,o)||!St(r,o))return;const i=Ct(o)||o,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let n=!1;if(f)for(let u=0;u<f.length;u++){const d=f[u];d&&d._attrName===a&&!d._disposed&&typeof d._execute=="function"&&(n=!0,d._execute())}if(n)return;let c=t[o];const l=Jt[o];if(l&&c!=null){const u=l(t);u!==void 0&&(c=u)}typeof c=="string"&&c.includes("{{")&&(c=I.call(t,c,t.state)),c==null||c===!1&&!at(i)?s.removeAttribute(i):typeof c!="function"&&typeof c!="object"&&s.setAttribute(i,K(i,c))}function Gn(t,o){const s=t.node,e=t.__ref;let r=e.__autoGrow;if(!o){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}Ss(r),nt.delete(t),s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),ks(s,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=e.__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){Dt(t,!0);return}if(!(s.scrollHeight>0)){r.awaitingLayout=!0,ws(t,r);return}r.awaitingLayout=!1;const a=zn(s),f=Yn(a),n=s.style.height;s.style.height="0px",f&&wo(s);const c=s.scrollHeight;if(!(c>0)){s.style.height=n,f&&wo(s);return}const l=qn(s,a),u=l!=null&&c<l?l:c,d=Xn(a),h=d!=null&&u>d;s.style.height=Qn(h?d:u,a)+"px",f&&wo(s),ks(s,r,h),r.lastMeasure=c,r.lastWidth=s.clientWidth,ws(t,r)}},e.__eventCleanup||(e.__eventCleanup=[]),e.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}Ss(r),nt.delete(t)})),r.active||(s.addEventListener("input",r.resize),r.active=!0,Wn(t,r));const i=typeof o=="object"&&o.max!=null?String(o.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=i,r.appliedMax=i),r.resize()}function Dt(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),nt.add(t),It())}function Kn(){const t=Array.from(nt);nt.clear();for(let o=0;o<t.length;o++){const s=t[o],e=s.node,r=s.__ref?.__autoGrow;if(!(!e||!r||!r.active)){if(!e.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=dt()),r.attachAttempts+=1,r.attachAttempts<=Uo&&dt()-r.firstAttemptAt<Ho&&(nt.add(s),It());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function ws(t,o){if(o.watch)return;const s=t.node;if(!s)return;const e=s.ownerDocument&&s.ownerDocument.defaultView,r=e&&e.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,Dt(t,!0);return}const f=s.clientWidth;o.lastWidth!=null&&Math.abs(f-o.lastWidth)<.5||(o.lastWidth=f,Dt(t,!0))};let a;try{a=new r(i),a.observe(s)}catch{return}o.watch=a}function Ss(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function Wn(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,e=s&&s.fonts&&s.fonts.ready;!e||typeof e.then!="function"||e.then(()=>{o.active&&t.node&&Dt(t,!0)},()=>{})}function zn(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,xo=t=>(rt(t.paddingTop)||0)+(rt(t.paddingBottom)||0),Cs=t=>(rt(t.borderTopWidth)||0)+(rt(t.borderBottomWidth)||0);function Yn(t){if(!t)return!1;const o=String(t.transitionProperty||"").split(","),s=String(t.transitionDuration||"0s").split(",");for(let e=0;e<o.length;e++){const r=o[e].trim();if(!(r!=="all"&&r!=="height")&&parseFloat(s[e%s.length])>0)return!0}return!1}function wo(t){if(typeof t.getAnimations!="function")return;let o;try{o=t.getAnimations()}catch{return}for(let s=0;s<o.length;s++){const e=o[s];if(e&&e.transitionProperty==="height")try{e.cancel()}catch{}}}function qn(t,o){if(!o||!t.hasAttribute||!t.hasAttribute("rows"))return null;const s=parseInt(t.getAttribute("rows"),10);if(!(s>0))return null;const e=rt(o.lineHeight)||Zn(t,o);return e>0?s*e+xo(o):null}const Mt=["fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","lineHeight","letterSpacing"],vs=new WeakMap;function Zn(t,o){const s=t.ownerDocument,e=s&&(s.body||s.documentElement);if(!e||!s.createElement)return null;let r=vs.get(s);r||(r=new Map,vs.set(s,r));const i=Mt.map(c=>o[c]||"").join("|");if(r.has(i))return r.get(i);const a=s.createElement("textarea");a.rows=1,a.setAttribute("aria-hidden","true"),a.tabIndex=-1;const f=a.style;f.position="absolute",f.visibility="hidden",f.top="0",f.left="-9999px",f.height="auto",f.minHeight="0",f.maxHeight="none",f.padding="0",f.border="0",f.boxSizing="content-box",f.overflow="hidden";for(let c=0;c<Mt.length;c++)o[Mt[c]]&&(f[Mt[c]]=o[Mt[c]]);let n=0;try{e.appendChild(a),n=a.clientHeight}catch{n=0}finally{a.parentNode&&a.parentNode.removeChild(a)}return n>0?(r.set(i,n),n):null}function Qn(t,o){return o?o.boxSizing==="border-box"?t+Cs(o):o.boxSizing==="content-box"?Math.max(0,t-xo(o)):t:t}function Xn(t){if(!t)return null;const o=rt(t.maxHeight);if(o==null||!(o>0))return null;const s=xo(t),e=Cs(t),r=t.boxSizing==="border-box"?o-e:o+s,i=rt(t.lineHeight);if(!(i>0))return r;const a=Math.floor((r-s)/i+1e-6);return a>=1?a*i+s:r}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 js=["srcObject","muted"],Jn=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function mn(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let e=0;e<js.length;e++){const r=js[e],i=t[r];if(i===void 0||!(r in o))continue;const a=f=>{const n=Jn(r,f);if(o[r]!==n)try{o[r]=n}catch(c){M(s,r,c)}};if(typeof i=="function"){const f=T(t,t[r+"Deps"],i),n=j(()=>{try{a(f(t,t.state,t.context))}catch(c){M(s,r,c)}},{depth:s.path.length,label:k(s,r)});s.__effects.push(n),s.__exec[r]=i}else a(i);r==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Es(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,e=t.autoGrow,r=typeof e=="function"?T(t,t.autoGrowDeps,e):null,i=j(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===e&&r?r:a)(t,t.state,t.context)}catch{f=null}Gn(t,f)},{depth:s.path.length,label:k(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(i),r&&(s.__exec.autoGrow=e)}const Ps=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Os(t,o){for(const s of Object.keys(t)){if(!Z(s)||Ps.has(s))continue;const e=Vs(s);if(e){Hs(e,t,t[s]);continue}let r=t[s],i=null;if(r&&typeof r=="object"&&!Array.isArray(r)&&(i=r,r=i.handler),typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const f=r;r=function(c){return t.call(f,c)}}if(typeof r!="function")continue;const a=en(s);Is.has(a)||Us(rn(a),t,r,i)}te(t)}function te(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let e=!1;for(const d of Ps){const h=t[d];typeof h=="function"&&(s[d]=h,e=!0)}if(!e)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,n=0,c=!1;const l=d=>{const h=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];h&&(a=h.clientX,f=h.clientY,n=Date.now(),c=!0)},u=d=>{if(!c)return;c=!1;const h=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!h)return;const y=h.clientX-a,A=h.clientY-f,g=Date.now()-n;if(g>i)return;const b=Math.abs(y),w=Math.abs(A);if(Math.max(b,w)<r)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 it(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=it(r,i):s[e]=i}return s}function So(t,o,s,e,r){if(!o||!t.node)return;const i=t.childExtends,a=pt(t,"childProps");if(Array.isArray(o)){const f=t.tag==="fragment",n=t.context?.document||globalThis.document,c=f?null:n?.createDocumentFragment();if(!f&&!c)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"?Pt(x):a;if(r&&u!=="state"&&(S=Ot(S,Pt(_))),u==="state"){let C=_;(typeof _=="string"||typeof _=="number")&&(C={value:_,text:_}),p=x?{...x,state:C}:{state:C}}else x&&(p=it(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 v=Bo(p?.key,_,w);try{return J(Tt(p,S),t,v,s)}catch(C){if(typeof console<"u"&&console.error){const N=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${v}" failed to construct at ${N} (initial render, skipping this row):`,C?.message||C)}return null}},h=t.__ref;if(!(e===!0&&!f&&!!h&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let w=0;w<o.length;w++){const p=d(w);!f&&p?.node&&c.appendChild(p.node)}return f||t.node.appendChild(c),!0}const A=h.__childrenChunkGen=(h.__childrenChunkGen||0)+1;Po();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):c.appendChild(_.node)),p+1<o.length&&Eo()){g||(g=n.createComment("smbls-mount"),c.appendChild(g),t.node.appendChild(c));const x=p+1;To(()=>b(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&Kt(t,!0)):t.node.appendChild(c)};return b(0),Oo(),!0}if(typeof o=="string"){const f=Ko(o,t);if(Array.isArray(f))return So(t,f,s,e,!0)}if(typeof o=="object")for(const f in o){if(G.has(f))continue;let n=o[f];if(n==null||n===!1)continue;const c=r?Ot(a,Pt(n)):a;if((typeof n=="string"||typeof n=="number")&&(n={text:n}),t.childProps&&(n=it(t.childProps,n)),i&&!n.ignoreChildExtends)if(n.extends){const l=Array.isArray(n.extends)?n.extends:[n.extends],u=Array.isArray(i)?i:[i];n={...n,extends:[...u,...l]}}else n={...n,extends:i};J(Tt(n,c),t,f,s)}}function Kt(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const e=s.options;if(!e||!e.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){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 n=o||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!n)return;let c=-1;for(let l=0;l<e.length;l++)e[l].defaultSelected&&(c=l);c>=0&&s.selectedIndex!==c&&(s.selectedIndex=c)}function Ts(t,o){let{children:s,content:e}=t;const r=t.childExtends,i=typeof s=="function"||Yo(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)}}qo(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;qo(t,_),t.children=_,A.__childrenChunkGen!=null&&A.__childrenChunkGen++;const x=typeof t.onContentUpdate=="function",S=x?[]:null,v=x?[]:null,C=x?[]:null;if(Array.isArray(_)&&t.childrenAs==="state"){const P=t.childProps,F=[],gt=new Map;for(let E=0;E<_.length;E++){const B=_[E];let O=P;if(typeof P=="function")try{O=P(t,B)}catch{O=null}const z=Bo(O&&O.key,B,E);F.push(z),gt.set(z,{rawChild:B,childProps:O})}const Ds=new Set(F),Ms=A.__children.slice();for(const E of Ms)if(!Ds.has(E)){const B=t[E];B?.remove&&B.remove(),delete t[E],v&&v.push(E)}const bt=t.childExtends,Rt=t.tag==="fragment",Rs=t.context?.document||globalThis.document,At=Rt?null:Rs?.createDocumentFragment(),zt=new Set;for(const E of F){const B=gt.get(E),O=B.rawChild,z=t[E];if(z&&z.state){if(O&&typeof O=="object"){const $=z.state,ct=$.$replace||$.replace,vo=$.$update||$.update;try{if(typeof ct=="function")ct.call($,O);else if(typeof vo=="function"){for(const H in $)if(!(H==="__element"||H==="root"||H==="parent"||H==="update")&&!Object.prototype.hasOwnProperty.call(O,H))try{$[H]=void 0}catch{}vo.call($,O)}else for(const H in O)$[H]=O[H]}catch(H){if(typeof console<"u"&&console.error){const Fs=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to patch at ${Fs} (reconcile, keeping its previous data for this pass):`,H?.message||H)}}}C&&C.push(E);continue}let Yt=O;(typeof O=="string"||typeof O=="number")&&(Yt={value:O,text:O});const qt=B.childProps;let W=qt?{...qt,state:Yt}:{state:Yt};const Ns=typeof P=="function"?Pt(qt):pt(t,"childProps");if(bt&&!W.ignoreChildExtends)if(W.extends){const $=Array.isArray(W.extends)?W.extends:[W.extends],ct=Array.isArray(bt)?bt:[bt];W={...W,extends:[...ct,...$]}}else W={...W,extends:bt};let Zt;try{Zt=J(Tt(W,Ns),t,E,o)}catch($){if(typeof console<"u"&&console.error){const ct=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${ct} (reconcile, skipping this row):`,$?.message||$)}zt.add(E);continue}!Rt&&Zt?.node&&At&&At.appendChild(Zt.node),S&&S.push(E)}if(!Rt&&At&&At.childNodes.length&&t.node&&t.node.appendChild(At),!Rt&&t.node){let E=null;for(const B of F){const O=t[B]?.node;if(!O)continue;const z=E?E.nextSibling:t.node.firstChild;O!==z&&t.node.insertBefore(O,z),E=O}}A.__children=zt.size?F.filter(E=>!zt.has(E)):F,x&&(S.length||v.length)&&Vo(t,{added:S,removed:v,kept:C}),Kt(t,!1);return}const ot=x?[...A.__children]:null;for(const P of[...A.__children]){const F=t[P];F?.remove&&F.remove(),delete t[P]}A.__children=[],So(t,_,o,!1,!0),Kt(t,!1),x&&Vo(t,{added:[...A.__children],removed:ot,kept:[]})},{depth:A.path.length,label:k(A,"children")});A.__effects.push(w)}const a=So(t,s,o,!0,i);if(e!=null&&!(e&&e.__ref)){let y=e;if(typeof y=="string"||typeof y=="number"?y={text:y}:typeof y!="object"&&(y={}),t.childProps&&(y=it(t.childProps,y)),r&&!y.ignoreChildExtends)if(y.extends){const g=Array.isArray(y.extends)?y.extends:[y.extends],b=Array.isArray(r)?r:[r];y={...y,extends:[...b,...g]}}else y={...y,extends:r};const A=Ot(pt(t,"childProps"),pt(t,"content"));J(Tt(y,A),t,"content",o)}if(s&&!a)return;const f=t.context?.components||{},n=t.__ref&&t.__ref.__runtimeSource,c=n?{}: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||G.has(_)||typeof t[_]=="function"&&(_.startsWith("on")||_.startsWith(".")))break;const S=t[_];S!==void 0&&(w[_]=S,delete t[_],c&&Et(n,_)&&(c[b]||(c[b]={}),c[b][_]=n[_]))}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(G.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=f[y]||f[`smbls.${y}`];w&&(g={...g,extends:w})}if(t.childProps&&(g=it(t.childProps,g)),r&&!g.ignoreChildExtends)if(g.extends){const w=Array.isArray(g.extends)?g.extends:[g.extends],p=Array.isArray(r)?r:[r];g={...g,extends:[...p,...w]}}else g={...g,extends:r};const b=n?Ot(pt(t,"childProps"),Ot(c[y]||null,pt(t,y))):null;J(Tt(g,b),t,y,o)};if(!l){for(const y of u)d(y);return}Po();const h=y=>{for(let A=y;A<u.length;A++)if(d(u[A]),A+1<u.length&&Eo()){const g=A+1;To(()=>h(g));return}};h(0),Oo()}function Ls(t,o,s){const{node:e}=t;if(!e)return;e.ref=t;const r=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(s?.position==="before"&&s.node)a.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const f=s.node.nextSibling;a.insertBefore(e,f||r)}else a.insertBefore(e,r);return}}const i=o?.node||(o?.nodeType?o:null);if(i)if(s?.position==="before"&&s.node)i.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;a?i.insertBefore(e,a):i.appendChild(e)}else i.appendChild(e)}const Co=3;function oe(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Co?!1:(t.__inBeforeUpdate=!0,!0)}function Wt(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Co&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Co}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function R(t,o,s){const e=t.charAt(0).toLowerCase()+t.slice(1);o.context?.plugins?.length&&q(e,o,s);const r="on"+t,i=o[r];if(typeof i=="function"){const n=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(n){if(o.__ref[n])return!0;o.__ref[n]=!0}const c=o.context?.designSystem;c&&L(c);let l=!!n;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:r,error:h})||console.error(`[DOMQL] Lifecycle "${r}" error:`,h)}).finally(()=>{n&&d&&(d[n]=!1)}),l=!1,!0}if(u===!1)return!1}catch(u){if(o.context?.plugins?.length&&q("error",o,{hook:r,error:u})||console.error(`[DOMQL] Lifecycle "${r}" error:`,u),o.context?.strictMode)throw u}finally{c&&D(),l&&o.__ref&&(o.__ref[n]=!1)}}return!0}var Le=J;export{Co as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,oe as acquireBeforeUpdateGuard,J as create,Le as default,to as flushMounts,Pe as isStaticCssProp,Oe as recompileStaticCss,Te as reconcileAttrProp,Wt as releaseBeforeUpdateGuard,lo as resolveStyleBlock,Ht as writeElementText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import*as s from"@symbo.ls/css";if(!s.CSS_SHORTHAND_LONGHANDS||!s.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 S=s.CSS_SHORTHAND_LONGHANDS,e=s.CSS_LONGHAND_SHORTHANDS,t=s.cssShorthandStatesLonghand||(()=>!1);export{e as CSS_LONGHAND_SHORTHANDS,S as CSS_SHORTHAND_LONGHANDS,t as cssShorthandStatesLonghand};
|
package/dist/esm/src/delegate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DELEGATED_EVENTS as
|
|
1
|
+
import{DELEGATED_EVENTS as C,LIFECYCLE_EVENTS as A,PASSIVE_EVENTS as d,NON_BUBBLING_EVENTS as T}from"./registry.js";import{isLoudDevRuntime as V}from"./devRuntime.js";import{pushConfig as I,popConfig as h}from"@symbo.ls/scratch";const p=new WeakMap,Q={passive:!0},R={passive:!0,capture:!0},y=(e,t)=>d.has(e)?t?R:Q:t||!1;function w(e){let t=p.get(e);return t||(t={handlers:new Map,installed:new Set},p.set(e,t)),t}function x(e,t){const n=w(t);if(n.installed.has(e))return;n.installed.add(e);const r=e==="focus"||e==="blur"||e==="focusin"||e==="focusout"||e==="mouseenter"||e==="mouseleave"||e==="pointerenter"||e==="pointerleave",o=e==="mouseenter"||e==="mouseleave"||e==="pointerenter"||e==="pointerleave";t.addEventListener(e,i=>{if(o){const u=i.target,c=n.handlers.get(e),l=c&&u?c.get(u):null;if(!l||i.relatedTarget&&typeof u.contains=="function"&&u.contains(i.relatedTarget))return;l(i);return}let s=i.target;for(;s&&s!==t;){const u=n.handlers.get(e);if(u){const c=u.get(s);if(c&&(c(i),i.cancelBubble))return}s=s.parentNode}},y(e,r))}function B(e,t,n,r){r||(r=t.ownerDocument?.documentElement||t.getRootNode());const o=w(r);x(e,r),o.handlers.has(e)||o.handlers.set(e,new WeakMap),o.handlers.get(e).set(t,n)}function O(e,t,n){n||(n=t.ownerDocument?.documentElement||t.getRootNode());const r=p.get(n);if(!r)return;const o=r.handlers.get(e);o&&o.delete(t)}function q(e){return C.has(e)&&!A.has(e)}function v(e,t){const{context:n}=e,r=n?.designSystem;return o=>{r&&I(r);try{const i=t.call(e,o,e,e.state,n);if(i&&typeof i.then=="function"){i.catch(s=>{e.error=s,console.error("[DOMQL] Async event error:",s)}).finally(()=>{r&&h()});return}}catch(i){if(e.error=i,console.error("[DOMQL] Event error:",i),n?.strictMode)throw i}r&&h()}}const L=e=>!!e&&(e.capture===!0||typeof e.passive=="boolean"||e.once===!0);function G(e,t){return L(t)?{capture:t.capture===!0,passive:typeof t.passive=="boolean"?t.passive:d.has(e),once:t.once===!0}:y(e,!1)}function P(e,t,n){return r=>{let o=r.target;if(o&&o.nodeType!==1&&(o=o.parentElement),!o||typeof o.closest!="function")return;let i;try{i=o.closest(t)}catch{return}i&&e.contains(i)&&n(r)}}function Z(e,t,n,r){const{node:o,context:i}=t;if(!o)return;let s=v(t,n);const u=r&&typeof r.selector=="string"&&r.selector;u&&(s=P(o,u,s));const l=!T.has(e)&&q(e)&&!L(r),a=l?null:G(e,r);if(l){const f=i?.rootNode||o.ownerDocument?.documentElement;B(e,o,s,f)}else o.addEventListener(e,s,a);t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{if(l){const f=i?.rootNode||o.ownerDocument?.documentElement;O(e,o,f)}else o.removeEventListener(e,s,a)})}const g=[["onDocument","document"],["onWindow","window"],["onVisualViewport","visualViewport"],["onMediaQuery","mediaQuery"]];function J(e){if(typeof e!="string")return null;for(let t=0;t<g.length;t++){const n=g[t][0];if(e.length<=n.length||!e.startsWith(n))continue;const r=e.charCodeAt(n.length);if(!(r<65||r>90))return{target:g[t][1],eventName:e.slice(n.length).toLowerCase()}}return null}const W=/^[A-Za-z_$][\w$]*$/;function $(e,t,n){let r=t,o=!1,i,s=!1,u=null;if(t&&typeof t=="object"&&typeof t!="function"&&(r=t.handler,o=!!t.capture,s=!!t.once,typeof t.passive=="boolean"&&(i=t.passive),typeof t.query=="string"&&(u=t.query)),typeof r=="string"&&W.test(r)){const c=r;r=function(a){return e.call(c,a)}}return typeof r!="function"?null:(i===void 0&&(i=d.has(n)),{handler:r,capture:o,passive:i,once:s,query:u})}function U(e,t,n){const r=e.node?.ownerDocument||e.context?.document||(typeof document<"u"?document:null);if(!r||typeof r.addEventListener!="function")return null;if(t==="document")return r;const o=r.defaultView||(typeof window<"u"?window:null);if(!o)return null;if(t==="window")return typeof o.addEventListener=="function"?o:null;if(t==="visualViewport"){const i=o.visualViewport;return i&&typeof i.addEventListener=="function"?i:null}if(t==="mediaQuery"){const i=n&&n.query;if(typeof i!="string"||!i.trim()||typeof o.matchMedia!="function")return null;try{return o.matchMedia(i)||null}catch{return null}}return null}const E=/^@media\s+/i,F=/^[@[.#&:>*~+]/,b=new Set;function m(e,t){!V()||b.has(e)||(b.add(e),console.warn(`[smbls] onMediaQueryChange: "${e}" ${t} \u2014 no listener is registered.`))}function H(e,t){if(typeof t!="string")return null;const n=t.trim();if(!n)return null;const r=e.context?.designSystem?.media,o=s=>{const u=r&&typeof r=="object"?r[s]:void 0;return typeof u=="string"&&u.trim()?u.trim():null};let i=n;if(n.charCodeAt(0)===64&&!E.test(n)){if(i=o(n.slice(1)),!i)return m(n,"is not a key of designSystem.media"),null}else i=o(n)||n;return E.test(i)?i.replace(E,"").trim()||null:F.test(i)?(m(n,`names "${i}", which is not a media query`),null):i}function K(e,t,n,r){try{return e.addEventListener(t,n,r),!0}catch{return typeof e.addListener=="function"?(e.addListener(n),!0):!1}}function D(e,t,n,r){try{e.removeEventListener(t,n,r)}catch{typeof e.removeListener=="function"&&e.removeListener(n)}}function j(e){const t=e.node;if(!t)return!1;const n=t.nodeType===11?e.__ref?.__fragmentAnchor:t;return n?n.isConnected!==!1:!1}function N(e,t,n){if(t.__ref){if(Array.isArray(n)){if(e.target!=="mediaQuery")return;for(let o=0;o<n.length;o++)M(e,t,n[o]);return}M(e,t,n)}}function M(e,t,n){const r=t.__ref,o=$(t,n,e.eventName);if(!o||e.target==="mediaQuery"&&e.eventName!=="change"||e.target==="mediaQuery"&&(o.query=H(t,o.query),!o.query))return;const i=U(t,e.target,o);if(!i)return;const s=e.target+":"+(o.query?o.query+":":"")+e.eventName+":"+(o.capture?1:0);if(r.__globalEvents&&r.__globalEvents.has(s))return;const u=v(t,o.handler),c=e.target==="window"&&e.eventName==="load";let l=!1;const a=S=>{if(j(t)){if(c){if(l)return;l=!0}u(S)}},f={capture:o.capture,passive:o.passive,once:o.once};if(!K(i,e.eventName,a,f))return;r.__globalEvents||(r.__globalEvents=new Map);const _={target:i,eventName:e.eventName,listener:a,options:f};r.__globalEvents.set(s,_),r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{D(i,e.eventName,a,f),r.__globalEvents&&r.__globalEvents.delete(s)}),c&&Y(t,s,_,()=>l)}function Y(e,t,n,r){const o=n.target.document;!o||o.readyState!=="complete"||queueMicrotask(()=>{const i=e.__ref;if(r()||!i||!i.__globalEvents||i.__globalEvents.get(t)!==n)return;const s=n.target,u=typeof s.Event=="function"?s.Event:typeof Event=="function"?Event:null;u&&(n.listener(new u("load")),n.options.once&&r()&&D(s,"load",n.listener,n.options))})}export{B as addDelegatedEvent,J as globalEventKeyInfo,q as isDelegatable,Z as registerEvent,N as registerGlobalEvent,O as removeDelegatedEvent};
|
package/dist/esm/src/dispose.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getObserver as c,setObserver as s}from"@symbo.ls/signal";function t(r){if(!r)return;const o=r.__ref;if(!o)return;const i=c();if(i){s(null);try{return t(r)}finally{s(i)}}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.__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 n=r.state?.$destroy||r.state?.destroy;if(typeof n=="function"&&r.state.__element===r&&n.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
|
|
1
|
+
import{getObserver as c,setObserver as s}from"@symbo.ls/signal";import{destroyBridge as a}from"./bridge.js";function t(r){if(!r)return;const o=r.__ref;if(!o)return;const i=c();if(i){s(null);try{return t(r)}finally{s(i)}}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&&a(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 n=r.state?.$destroy||r.state?.destroy;if(typeof n=="function"&&r.state.__element===r&&n.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 l(){t(this)}export{t as dispose,l as remove};
|