@wcstack/state 4.0.0-rc.4 → 4.0.0-rc.5
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/README.ja.md +68 -9
- package/README.md +69 -10
- package/dist/auto.min.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1 -1
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.esm.js +15 -2
- package/dist/parser.esm.js +3 -1
- package/dist/split/auto.js +1 -1
- package/dist/split/chunks/{chunk-SEPY6OHJ.js → chunk-5MLEMVL3.js} +1 -1
- package/dist/split/chunks/{chunk-5LIOXC7W.js → chunk-ACYOJ3NW.js} +1 -1
- package/dist/split/chunks/{chunk-HSOCDTWX.js → chunk-C3UYMJRT.js} +1 -1
- package/dist/split/chunks/{chunk-372Y2FIC.js → chunk-COJU24UI.js} +1 -1
- package/dist/split/chunks/{chunk-7644KQ3T.js → chunk-FVHQWDF4.js} +1 -1
- package/dist/split/chunks/{chunk-ROX5KEJX.js → chunk-FZJY4CF3.js} +1 -1
- package/dist/split/chunks/chunk-HSMALJSW.js +1 -0
- package/dist/split/chunks/{chunk-6GES2BK3.js → chunk-L2BZD5DU.js} +1 -1
- package/dist/split/chunks/chunk-VY2XLPFM.js +1 -0
- package/dist/split/core.js +1 -1
- package/dist/split/features/devtools.js +1 -1
- package/dist/split/features/diagnostics.js +1 -1
- package/dist/split/features/formats.js +1 -1
- package/dist/split/features/list-keys.js +1 -1
- package/dist/split/features/native-commands.d.ts +31 -0
- package/dist/split/features/native-commands.js +1 -0
- package/dist/split/features/recursion.js +1 -1
- package/dist/split/features/scopes.js +1 -1
- package/dist/split/features/ssr.js +1 -1
- package/dist/split/features/temporal.js +1 -1
- package/dist/wcs-manifest.json +56 -2
- package/package.json +1 -1
- package/dist/split/chunks/chunk-Z7B3ZZE4.js +0 -1
- package/dist/split/chunks/chunk-ZOINIOIM.js +0 -1
- /package/dist/split/chunks/{chunk-G2ZO6SXV.js → chunk-SA2LYPN7.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,b as t,d as n}from"../chunks/chunk-6GES2BK3.js";import{b as o,n as l,o as r,p as i}from"../chunks/chunk-Z7B3ZZE4.js";import"../chunks/chunk-SEPY6OHJ.js";import{e as a,f as s}from"../chunks/chunk-372Y2FIC.js";import{a as u}from"../chunks/chunk-HSOCDTWX.js";import"../chunks/chunk-5D34CGCF.js";import"../chunks/chunk-5LIOXC7W.js";import"../chunks/chunk-ROX5KEJX.js";import{a as c,b as d,c as f,d as h,f as m,h as p,j as g}from"../chunks/chunk-G2ZO6SXV.js";var $=new WeakMap,b=new WeakMap,y="will not graft: the root state failed to initialize.",w=new WeakSet,v=new WeakMap,k=["$stream","$streams","$scan","$recursion","$watch","$listKeys","$renderedCallback","$updatedCallback","$behavior","$features"],N=["$commandTokens","$eventTokens","$on","$errorCallback"],j=e=>`[@wcstack/state] <${u.tagNames.state} mount="${e}">`,O=new Set(["$getAll","$setAll","$resolve","$postUpdate","$dependOn","$eq","$eqIndex"]),C=e=>e?.element?.isConnected?e:void 0;function P(e){let t=b.get(e);return void 0!==t&&!Array.isArray(t)&&t.isConnected}function A(e,t){let n=b.get(t);if(b.delete(t),Array.isArray(n))for(let t of n)W(t,e)}function M(e){let t=$.get(e.root);t?.get(e.t)===e&&t.delete(e.t)}function x(e,t){console.error(`${j(e.t)} ${t}`),M(e),e.Ge?.(),e.Ge=null}function S(e,t){let n=e.state?.[t];if("function"==typeof n)try{let t=n.call(e.chroot);null!==t&&"object"==typeof t&&"function"==typeof t.then&&t.then(void 0,e=>console.error(e))}catch(e){console.error(e)}}function W(e,t){if(w.has(t))return x(e,"will not graft: its component is wired to its host.");let n=e.state,o=t.target,l=e.t.split("."),r=o;for(let e of l)r=r?.[e];if(void 0!==r&&!0!==t.hydrated)return x(e,`will not graft: the root state already has "${e.t}".`);let i=function(e,t){let n=e=>`${t}.${e}`;return new Proxy({},{get(t,o){if("symbol"==typeof o)return;if(36!==o.charCodeAt(0))return e.proxy[n(o)];let l=e.proxy[o];return"$eqPath"===o?(e,t)=>l(n(e),n(t)):O.has(o)&&"function"==typeof l?(e,...t)=>l(n(e),...t):l},set:(t,o,l)=>"symbol"!=typeof o&&(e.proxy[n(o)]=l,!0)})}(t,e.t);e.chroot=i;let a={},s={},u=new Set;for(let t=n;null!==t&&t!==Object.prototype;t=Object.getPrototypeOf(t))for(let n of Object.getOwnPropertyNames(t)){if(u.has(n)||"constructor"===n)continue;u.add(n);let{get:o,set:l,value:r}=Object.getOwnPropertyDescriptor(t,n);if(void 0!==o||void 0!==l)s[`${e.t}.${n}`]={get:o&&function(){return o.call(i)},set:l&&function(e){l.call(i,e)}};else{if("$"===n[0])continue;if("function"==typeof r){let t=r.bind(i);s[`${e.t}.${n}`]={get:()=>t}}else a[n]=r}}if(void 0===r){for(let e=1;e<l.length;e++){let n=t.o(l.slice(0,e).join("."));null==t.bt(n,null)&&t.P(n,null,{})}t.P(t.o(e.t),null,a)}t.Xn(Object.defineProperties({},s));for(let e in s)t.We(t.o(e),null);e.engine=t;let c=v.get(t);void 0===c&&v.set(t,c=[]),c.push(e),e.el.isConnected&&S(e,"$connectedCallback"),e.Ge?.(),e.Ge=null}function E(e,t){let n=b.get(e);if(Array.isArray(n))for(let e of n)x(e,y);b.set(e,t)}var R=new WeakMap;function D(e,t){let n=e.getAttribute("mount");if(null===n)return null;let o={el:e,root:t,t:n,state:null,engine:null,chroot:null,Ge:null},r=null;if(function(e){return""!==e&&e.split(".").every(e=>""!==e&&!/[*$#@\s]/.test(e))}(n))if(e.hasAttribute(u.bindAttributeName))r='injections (data-wcs="state.<key>: …") are not supported — read the root path in a root getter.';else{let e=$.get(t);void 0===e&&$.set(t,e=new Map);let l=e.get(n);if(void 0!==l&&l!==o&&(null===l.engine?l.el.isConnected:C(l.engine)))r=`will not graft: another volume already holds "${n}".`;else{if(null===l?.engine){let e=b.get(t);Array.isArray(e)&&b.set(t,e.filter(e=>e!==l)),l.Ge?.(),l.Ge=null}e.set(n,o)}}else r='has an invalid mount path: it must be a static path (no "*", "$", "#", "@").';return{vo:!0,start(e){if(null!==r)return x(o,r);if($.get(t).get(n)===o){for(let t of k)if(void 0!==e[t])return x(o,`${t} is not run in a volume — declare it on the root state.`);for(let t of N)void 0!==e[t]&&console.warn(`${j(n)} ${t} is not run in a volume (it belongs to the root).`);return o.state=e,new Promise(e=>{o.Ge=e;let n=C(l.get(t)),r=b.get(t);void 0!==n?W(o,n):P(t)?x(o,y):b.set(t,[...Array.isArray(r)?r:[],o])})}},Ye(){null!==o.engine&&S(o,"$connectedCallback")},On(){null!==o.engine&&S(o,"$disconnectedCallback")},reset(){g(`re-setting a volume is not supported: its data was copied into the root tree at "${n}" — write the paths under it on the root instead.`)}}}var G=new WeakMap,q=new WeakMap;function z(e,t){let n=e[t];if(void 0===n)return[];Array.isArray(n)||g(`${t} must be an array of state member names.`);let o=new Set;for(let e of n)("string"!=typeof e||""===e)&&g(`${t} entries must be non-empty strings.`),"$"===e[0]&&g(`${t} entry "${e}": internal ($) members are never exposed.`),o.has(e)&&g(`${t} entry "${e}" is duplicated.`),o.add(e);return n}function X(e,t){let n=t.host;if(void 0===n||!n.hasAttribute("data-wc-definition"))return null;let o=document.createDocumentFragment();for(let e of[...t.childNodes])o.appendChild(e.cloneNode(!0));let l=t.mode;return{start(t){e.hasAttribute("bind-component")&&g("DCC: a <wcs-state bind-component> cannot define a component (use one mechanism)."),function(e,t,n,o){e.includes("-")||g(`DCC: <${e} data-wc-definition> is not a valid custom element name.`),void 0!==customElements.get(e)&&g(`DCC: <${e}> is already defined.`);let l=function(e){let t=new Map;for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let e of Object.getOwnPropertyNames(n))"constructor"===e||"$"===e[0]||t.has(e)||t.set(e,Object.getOwnPropertyDescriptor(n,e));let n=e.$stream;if(null!==n&&"object"==typeof n)for(let e of Object.keys(n))t.has(e)||t.set(e,{value:void 0});return t}(o),r=z(o,"$bindables"),i=z(o,"$commands");for(let e of r){let t=l.get(e);void 0===t&&g(`$bindables entry "${e}" does not exist on the state.`),"function"==typeof t.value&&g(`$bindables entry "${e}" is a method: list it in $commands.`)}for(let e of i){let t=l.get(e);void 0===t&&g(`$commands entry "${e}" does not exist on the state.`),"function"!=typeof t.value&&g(`$commands entry "${e}" is not a method: list it in $bindables.`)}let a={tag:e,bindables:r},s=new WeakMap,c=new WeakMap,d=o=>{if(s.has(o))return s.get(o);if(o.hasAttribute("data-wc-definition"))return null;let l=o.attachShadow({mode:n});l.appendChild(t.cloneNode(!0));let i=l.querySelector(u.tagNames.state);return s.set(o,i),G.set(o,a),null===i&&r.length>0&&console.warn(`[@wcstack/state] DCC: <${e}> declares $bindables but its content has no <${u.tagNames.state}>: no change events.`),i},f=e=>d(e)?.engine??null,h=e=>Promise.resolve(d(e)?.initializePromise).then(()=>{let t=c.get(e);c.delete(e);let n=f(e);if(void 0!==t&&null!==n)for(let[e,o]of t)n.proxy[e]=o});class m extends HTMLElement{static{this.wcBindable=0===r.length&&0===i.length?null:{protocol:"wc-bindable",version:1,properties:r.map(t=>({name:t,event:`${e}:${t}-changed`,getter:e=>e.target[t]})),inputs:r.map(e=>({name:e})),...0===i.length?{}:{commands:i.map(e=>({name:e,async:!0}))}}}connectedCallback(){null!==d(this)&&h(this)}get stateElement(){return d(this)}}for(let[e,t]of l)"function"==typeof t.value?Object.defineProperty(m.prototype,e,{configurable:!0,value(...t){return h(this).then(()=>{let n=f(this);return null===n?void 0:n.proxy[e].apply(n.proxy,t)})}}):Object.defineProperty(m.prototype,e,{configurable:!0,get(){return f(this)?.proxy[e]},set(t){let n=f(this);if(null!==n)n.proxy[e]=t;else{let n=c.get(this);void 0===n&&c.set(this,n=[]),n.push([e,t])}}});customElements.define(e,m)}(n.localName,o,l,t)},Ye(){},On(){},reset(){g("re-setting a DCC definition is not supported: each instance loads its own state.")}}}var T=new WeakMap,F=new WeakSet,Y=new WeakMap,L=new WeakMap,Z="data-wcs-wired",_=new WeakMap,B=new WeakMap,H=new WeakMap,I=0,J=new Set,K={},U=["$watch","$stream","$renderedCallback"],Q=e=>e.split(".",1)[0];function V(e,t){let n=0;return e.split(".").map(e=>"*"===e?String(t[n++]):e).join(".")}function ee(e,t){let n=e.a,o=Q(e.name);if(!0!==document.documentElement?.hasAttribute("data-wcs-server"))n.removeAttribute(Z);else if(!ne(n,o)){let e=n.getAttribute(Z)?.split(" ")??[];e.includes(o)||n.setAttribute(Z,[...e,o].join(" "))}_.get(n)?.ce===o&&g(`<${n.localName}>.${o} has loaded its state: the wiring "${e.name}" added afterwards cannot reach it — bind the host's wiring before the component loads.`);let l=T.get(n);void 0===l&&T.set(n,l=[]),l.push(e),t&&F.add(e);let r=Y.get(n);return void 0===r&&Y.set(n,r=new Map),r.has(o)||r.set(o,n[o]),L.get(n)?.(),!1}function te(e){return e.localName.includes("-")&&null!==e.querySelector(`:scope > ${u.tagNames.state}[bind-component]`)}function ne(e,t){let n=e.getAttribute(u.bindAttributeName);return null!==n&&new RegExp(`(^|;)\\s*${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*[.#:]`).test(n)}function oe(t){let n=t.parentElement;for(;null!==n&&!te(n);)n=n.parentElement;let o=l.get(n??t.getRootNode()),r=o?.element;(r?.isConnected?r.W:null===n)&&(null===n?e(t):i(o,t))}var le=new Set;function re(e,t){le.has(e)||(le.add(e),console.warn(`[@wcstack/state] ${t}`))}var ie=(e,t)=>t in e.state;function ae(e,t){let n=se(e.state,t);return void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)}function se(e,t){for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(void 0!==e)return e}}function ue(e,t,n){if(null!==n.getter)return;let o,l=e.host,r=l.engine,i=Q(n.t),s=l.entries.find(e=>e.$===n.t);if(void 0===s&&null!==n.d)return function(e,t){let n,o=t.d;for(;null!==o&&void 0===(n=e.ct.get(o));)o=o.d;if(null===o||void 0===n)return;let l=e.N,r=e.host.engine,i=r.o(n.p.t+t.t.slice(o.t.length));if(null===i.getter)return;let s=n,u=()=>{let n=ce(e,s.r);return 0===t.n?n:(r.resolve(V(i.t,[...r._(n),...l._(a(l.c,t.n))]),null),r.rr)};t.getter=()=>{let e=u();return i.n>0&&null===e?void 0:r.v(i,e)},null!==i.oe&&(t.oe=n=>{let o=u();de(e,s.e,()=>r.P(i,o,n)),e.cn=t}),t.n>0&&(t.F=l.Oe++),e.ct.set(t,{e:s.e,p:i,r:s.r})}(e,n);if(0!==n.n)return;if(void 0!==s){if(s.$!==i?ie(l,i):ae(l,i))return;o=s.ue}else{if(null===t||null!==n.d||"$"===i[0]||ie(l,i))return;s=t,o=r.o(`${t.ue.t}.${i}`)}let u=s.r,c=s;n.getter=()=>r.v(o,ce(e,u)),n.oe=t=>{de(e,c,()=>r.P(o,u,t)),e.cn=n},e.ct.set(n,{e:s,p:o,r:u})}function ce(e,t){return null!==t&&!t.y&&g(`The host row of <${e.host.el.localName}> was removed.`),t}function de(e,t,n){let o=J.has(e.N);J.add(e.N),e.from=t;try{n()}finally{o||J.delete(e.N),e.from=null}}var fe=(e,t)=>t||!J.has(e.m.N)||null!==e.m.from&&e.m.from!==e.e;function he(e,t){if(e.un===t||null===e.host.engine)return;e.un=t,I+=t?1:-1;let n=e.host.engine,o=H.get(n);void 0===o&&H.set(n,o=new Map);for(let n of e.ae){let e=o.get(n.e.ue);void 0===e&&o.set(n.e.ue,e=new Map);let l=e.get(n.e.r);void 0===l&&e.set(n.e.r,l=new Set),t?l.add(n):(l.delete(n),0===l.size&&e.delete(n.e.r))}let l=e.host.entries.find(e=>""===e.$);if(void 0!==l){null===e.te&&function(e,t){let n=e.host,o=n.engine;e.te=new Map;let l=new Set;for(let r=n.state;null!==r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let i of Object.getOwnPropertyNames(r)){if(l.has(i))continue;l.add(i);let a=Object.getOwnPropertyDescriptor(r,i);if(void 0===a.get&&void 0===a.set||"$"===i[0]||i.includes("*"))continue;let s=Q(i);if(i!==s&&!ie(n,s))continue;let u=o.o(`${t.ue.t}.${i}`);if(null===u.getter)ge(o,u,t.ue);else if(!me.has(u.getter))continue;e.te.set(u,e.N.o(i))}}(e,l);for(let o of e.te.keys())t&&null===o.getter&&ge(n,o,l.ue),n.R.me(n,o,l.r);e.te.size>0&&n.Re(),t&&function(e,t){let n=e.host.engine;for(let[o,l]of e.te){let r=n.v(o.d,t.r);if(null===r||"object"!=typeof r||!(o.s in r))continue;let i=e.host.el.localName;re(`${i}|${o.t}`,`[wcs/mount-export-shadowed] <${i}>.${e.host.ce}.${l.t} is exported at "${o.t}" but the tree already has that key, so readers outside the component get the tree value. Remove the tree key or rename the accessor. See docs/state-overlay-export-design.md X1.`)}}(e,l)}}var me=new WeakSet;function pe(e,t,n,o){let l=H.get(e)?.get(t)?.get(n);if(void 0===l)return null;let r=null;for(let e of l)""!==e.e.$||!0!==e.m.te?.has(o)||e.m===r||(null!==r&&g(`[wcs/mount-export-ambiguous] "${o.t}" is exported by two mounted components on the same instance: <${r.host.el.localName}> and <${e.m.host.el.localName}>. Mount only one of them there, or rename one accessor. See docs/state-overlay-export-design.md X4.`),r=e.m);return r}function ge(e,t,n){let o=t.d,l=t.s,r=()=>{let t=e.read(o,e.c);return null!==t&&"object"==typeof t&&l in t?t:null};t.getter=()=>{let o=r();if(null!==o)return o[l];let i=pe(e,n,e.c,t);return null===i?void 0:i.N.read(i.te.get(t),null)},me.add(t.getter),t.oe=i=>{let a=null===r()?pe(e,n,e.c,t):null;if(null===a){let t=e.read(o,e.c);return void(null!==t&&"object"==typeof t&&(t[l]=i))}let s=a.te.get(t);void 0===se(a.host.state,s.t)?.set&&g(`Cannot write to "${s.t}" on mounted <${a.host.el.localName}>: the accessor has no setter. Add a setter or write to the underlying state paths instead.`),a.N.P(s,null,i)},t.n>0&&(t.F=e.Oe++)}function $e(e,t,n,o,l,r){if(null!==t.getter)return e.R.me(e,t,n),void e.Re();if("*"===t.s){if(null===n)return;if(n.T=n.l.C[n.b],e.R.qt(n),null!==n.h)for(let t of n.h.values())e.z(t)}else e.wn(t,n);c.he?.(e,t,n,o,l,r),e.We(t,n)}function be(e){let t=e.m.N;for(let[n,o]of e.m.ct)o.e===e.e&&(0===n.n?t.R.me(t,n,null):t.Zt(n.f[n.n],e=>t.R.me(t,n,e)));t.Re()}function ye(e,t,n,o,l,r,i){let s=n.t.slice(t.t.length);if(""===s)return be(e);let u,c=e.m,d=c.N;if(""===e.e.$){u=s.slice(1);let e=Q(u);if("$"===e[0]||ie(c.host,e)||c.host.entries.some(e=>""!==e.$&&(u===e.$||u.startsWith(`${e.$}.`))))return}else u=e.e.$+s;let f=[];for(let e=t.n+1;e<=n.n;e++)f.push(a(o,e).b);d.resolve(V(u,f),null);let h=d.rp,m=d.rr;h.n>0&&null===m||$e(d,h,m,l,r,i)}function we(e,t,n,o,l,r,i){if(0===I)return;let s=J.has(e);J.add(e);try{let s=B.get(e);!i&&void 0!==s&&s.un&&!J.has(s.host.engine)&&function(e,t,n,o,l,r){let i,a=t;for(;null!==a&&void 0===(i=e.ct.get(a));)a=a.d;if(null===a||void 0===i)return;let s=e.host.engine;if(a===t&&e.cn===t)return void(e.cn=null);if(null!==i.r&&!i.r.y)return;let u=[...s._(i.r),...e.N._(n)];s.resolve(V(i.p.t+t.t.slice(a.t.length),u),null);let c=s.rp,d=s.rr;c.n>0&&null===d||de(e,i.e,()=>$e(s,c,d,o,l,r))}(s,t,n,o,l,r),i&&void 0!==s&&s.un&&null!==s.te&&function(e,t){let n=e.host.entries.find(e=>""===e.$),o=e.host.engine;for(let[l,r]of e.te)r===t&&(o.R.me(o,l,n.r),o.Re())}(s,t);let u=H.get(e);if(void 0===u)return;for(let[e,s]of u)if(t.Q(e)){let u=s.get(0===e.n?null:a(n,e.n));if(void 0!==u)for(let a of[...u])fe(a,i)&&ye(a,e,t,n,o,l,r)}else if(e.Q(t))for(let[e,o]of[...s])if(0===t.n||a(e,t.n)===n)for(let e of[...o])fe(e,i)&&be(e)}finally{s||J.delete(e)}}async function ve(e,o,l,i,a){if(i===K)return;let d=p(i);d&&await d;let f=_.get(o);f.engine&&i.$recursion&&g(`[wcs/mount-dollar-declaration] <${o.localName}>: $recursion is not run in a mounted component — declare it on the root state.`);let h=f.O;if(null!==h&&h.el!==e&&h.el.isConnected&&g(`<${o.localName}> already has a connected <${u.tagNames.state} bind-component="${f.ce}">.`),null!==h&&he(h,!1),null!==h&&function(e,t,n){let o=e.N,l=`[${u.bindAttributeName}]`,r=e=>1===e.nodeType&&(e.matches(l)||null!==e.querySelector(l)),i=new Set,a=e=>{for(;null!==e&&e.parentNode!==n;)e=e.parentNode;null!==e&&i.add(e)},s=(e,t)=>{for(let n=e.Pn(t);null!==n&&n!==t;n=n.nextSibling)a(n);a(t)};for(let e of o.ie.values())for(let t of e)if(null===t.M)a(t.a);else for(let e of t.M.Y)s(t.M,e.S);for(let e of o.ee.values())for(let t of[e.E,...e.D??[]])null!==t&&s(t,t.S);for(let t of e.j)t.parentNode===n&&r(t)&&i.add(t);if(0===i.size)return!1;let c=[...n.childNodes].filter(n=>n!==t&&!i.has(n)&&!e.j.includes(n)&&(r(n)||o.Lt&&n.textContent.includes("{{")));return c.length>0&&console.warn(`[@wcstack/state] <${e.host.el.localName}>: ${c.length} node(s) added beside the content taken over are not bound.`),!0}(h,e,l))return async function(e,t,n,o){e.el.engine=null,e.el=t,e.N.element=t,t.engine=e.N,e.j=e.j.filter(e=>e.parentNode===n),t.isConnected?await ke(e,o):o()}(h,e,l,a);let m=new s(i,new n);m.element=e,e.engine=m,function(e,t){let n=new Map;for(let e=t;null!==e&&e!==Object.prototype;e=Object.getPrototypeOf(e))for(let t of Object.getOwnPropertyNames(e)){let o=Object.getOwnPropertyDescriptor(e,t).value;"function"==typeof o&&"constructor"!==t&&n.set(o,null)}let o=(t,n,o)=>Reflect.apply(t,e.proxy,o);e.W=e=>{let t=n.get(e);return null===t&&n.set(e,t=new Proxy(e,{apply:o})),t}}(m,i);let $={el:e,j:[],N:m,host:f,ae:[],ct:new Map,un:!1,cn:null,from:null,te:null};for(let e of f.entries)$.ae.push({m:$,e});f.O=$,B.set(m,$);let b=null===f.engine;b?c.element?.(m,"mounting"):(function(e){let t=e.N,n=e.host,o=n.engine,l=n.el.localName,r=n.entries.find(e=>""===e.$)??null;for(let e of n.entries){if(""===e.$)continue;let t=Q(e.$);ie(n,t)&&(e.$!==t||ae(n,t))&&re(`${l}.${e.$}`,`[wcs/mount-own-key-shadow] <${l}>: "${n.ce}.${e.$}" is hidden by the component's own "${t}"; rename one side.`)}if(null!==r){let e=o.v(r.ue,r.r);if(null!==e&&"object"==typeof e)for(let t of Object.keys(n.state))"$"!==t[0]&&t in e&&!n.entries.some(e=>e.$===t)&&re(`${l}.${t}`,`[wcs/mount-own-key-shadow] <${l}>: its own "${t}" hides "${r.ue.t}.${t}" — remove the default to read the tree, or rename it to keep it private.`)}let i=U.filter(e=>void 0!==n.state[e]);i.length>0&&re(`${l}.${n.ce}$`,`[wcs/mount-dollar-declaration] <${l}>: ${i.join(", ")} ${1===i.length?"is":"are"} not run in a mounted component — declare it on the root state.`);let a=t.et;t.et=n=>{ue(e,r,n),a.call(t,n)};let s=[...t.L.all()];for(let t of s)ue(e,r,t);for(let e of s)a.call(t,e);let u=n.entries.filter(e=>null!==e.r);if(u.length>0){let e=t.Ut;t.Ut=()=>{u.every(e=>e.r.y)&&e.call(t)}}}($),he($,!0),w.add(m),A(m,l));let y=c.ir?.(l);r(m,l),y?.(),$.j=[...l.childNodes],t(),b&&m.bn(),Object.defineProperty(o,f.ce,{configurable:!0,enumerable:!0,get:()=>m.proxy});let v=o.$stateReadyCallback;if("function"==typeof v)try{let e=v.call(o,f.ce);null!==e&&"object"==typeof e&&"function"==typeof e.then&&e.then(void 0,e=>console.error(e))}catch(e){console.error(e)}a(),e.isConnected?(await m.we("$connectedCallback"),b&&e.isConnected&&c.element?.(m,"connected")):he($,!1)}async function ke(e,t){he(e,!0);for(let t of e.ae)be(t);t?.(),!e.broken&&(await e.N.we("$connectedCallback"),null===e.host.engine&&e.el.isConnected&&c.element?.(e.N,"connected"))}function Ne(e,t){let n=e.getAttribute("bind-component");if(null===n)return function(e,t){return e.connectedCallbackPromise.catch(()=>{let n=l.get(t)?.element;if(!(e.W||void 0!==n&&n!==e&&n.isConnected)){E(t,e);for(let e of R.get(t)??[])e()}}),null}(e,t);let r=e.parentNode,i=r instanceof ShadowRoot,a=i?r.host:r instanceof Element?r:null,s=()=>{let t=null===a?void 0:_.get(a)?.O;return t?.el===e?t:null},d=t=>{throw i&&E(r,e),t},f=!1;return{pt:()=>(null!==a&&a.localName.includes("-")?async function(e,t,n,l){let r=n.localName;(["state","src","json"].some(t=>e.hasAttribute(t))||null!==e.querySelector('script[type="module"]'))&&g(`<${u.tagNames.state} bind-component> takes its state from <${r}>.${t}: it cannot also load one (state / src / json / an inline script).`),await o(n).whenDefined(r);let i=_.get(n);if(void 0!==i)return i.ce!==t&&g(`<${r}> already has a <${u.tagNames.state} bind-component="${i.ce}">.`),i.state;let a=()=>(T.get(n)??[]).filter(e=>Q(e.name)===t),s=ne(n,t);if(s&&0===a().length&&oe(n),0===a().length&&(s||((e,t)=>!0===e.getAttribute(Z)?.split(" ").includes(t))(n,t))){let e;await new Promise((o,l)=>{L.set(n,o),e=function(e,t){P(e)&&t();let n=R.get(e)??new Set;return R.set(e,n.add(t)),()=>n.delete(t)}(n.getRootNode(),()=>l(new Error(`[@wcstack/state] <${r}>.${t} will not mount: the root state failed to initialize.`)))}).finally(()=>e())}L.delete(n);let c=a(),d=Y.get(n),f=void 0!==d&&d.has(t)?d.get(t):n[t];if((null===f||"object"!=typeof f)&&g(`"bind-component": <${r}>.${t} must be an object (the component's state), got ${null===f?"null":typeof f}.`),0===c.length&&l){let e=new Error(`[@wcstack/state] A plain (unwired) Light DOM "bind-component" is not supported. Attach a shadow root to <${r}>, or mount it from the host (${u.bindAttributeName}="${t}: path").`);return queueMicrotask(()=>{throw e}),K}let h=[];for(let e of c){let o=e.name===t?"":e.name.slice(t.length+1);h.some(e=>e.$===o)&&g(`<${r}> maps "${e.name}" twice.`);let l=o.split(".").indexOf("*");if(l>=0){let n=o.split(".").slice(0,l).join(".");g(`<${r}> maps "${e.name}": the component-side path of a mount cannot contain "*"${""===n?"":` — map the list itself ("${t}.${n}: <the host's list>")`}.`)}h.push({$:o,ue:e.o,r:e.r,ro:F.has(e)}),e.engine.kn(e),""!==o&&delete n[e.name]}let m=0===c.length?function(e){let t=Object.getOwnPropertyDescriptors(e),n=Object.isFrozen(e);for(let e of Object.values(t))"value"in e&&!1===e.writable&&(e.writable=!0,n=!0);return n?Object.create(Object.getPrototypeOf(e),t):e}(f):f;return _.set(n,i={el:n,ce:t,state:m,engine:0===c.length?null:c[0].engine,entries:h,O:null}),m}(e,n,a,!i):Promise.reject(new Error(`[@wcstack/state] "bind-component" requires <${u.tagNames.state}> to be a direct child of a custom element.`))).catch(d),async start(t,n){await ve(e,a,i?r:a,t,()=>{f=!0,n()}).catch(e=>{let t=s();return!f&&null!==t&&(t.broken=!0),d(e)})},Ye(){let t=s();null!==t?ke(t).catch(e=>console.error(e)):f?Promise.resolve().then(()=>{if(e.parentNode===r)return ve(e,a,i?r:a,_.get(a).state,()=>{})}).catch(e=>console.error(e)):L.has(a)&&oe(a)},On(){let e=s();null!==e&&(he(e,!1),!e.broken&&(e.N.we("$disconnectedCallback"),null===e.host.engine&&c.element?.(e.N,"disconnected")))},reset(){g(`re-setting a component's state is not supported: write <${a?.localName}>.${n} instead.`)}}}var je={name:"scopes",install(){c.it=f(m,c.it,D),c.it=f(m,c.it,X),c.it=f(m,c.it,Ne),c.Jo=ee,c.yo=te,c.element=d(c.element,(e,t)=>{if("mounting"!==t)return function(e,t){let n=v.get(e)??[];if("disconnected"===t)for(let e of n)M(e);else if("reset"!==t&&C(l.get(e.root))===e){A(e,e.root);for(let e of n)$.get(e.root).has(e.t)||$.get(e.root).set(e.t,e)}}(e,t);let n=e.element.getRootNode();A(e,n),function(e,t){let n=t.host,o=void 0===n?void 0:G.get(n);void 0!==o&&q.set(e,{host:n,def:o})}(e,n)}),c.he=d(c.he,(e,t,n,o,l,r)=>{(function(e,t,n,o){let l=q.get(e);if(void 0===l)return;let r=t.t.split(".",1)[0];if(!l.def.bindables.includes(r))return;let i=o&&t.t===r;l.host.dispatchEvent(new CustomEvent(`${l.def.tag}:${r}-changed`,{detail:i?n:void 0,bubbles:!0}))})(e,t,l,r),we(e,t,n,o,l,r,!1)}),c.ye=d(c.ye,(e,t,n)=>we(e,t,n,void 0,void 0,!1,!0)),c.Pe=f(h,c.Pe,(e,t,n,o,l)=>(function(e,t){let n=v.get(e);if(void 0!==n&&0===t.n)for(let{t:e}of n)e.startsWith(`${t.t}.`)&&g(`writing "${t.t}" would replace the volume grafted at "${e}"; write the paths under it instead.`)}(e,t),function(e,t,n){let o,l=B.get(e);if(void 0===l)return!1;for(let e=t;null!==e&&void 0===o;e=e.d)o=l.ct.get(e);if(void 0===o)return!1;let r=o.e;return!((null===r.r||r.r.y)&&!r.ro)&&(!!n||(ce(l,r.r),void g(`[wcs/mount-readonly] <${l.host.el.localName}> cannot write "${t.t}": it is mounted read-only ("${l.host.ce}${""===r.$?"":`.${r.$}`}#ro: ${r.ue.t}"). Write it on the host, or drop #ro from the mount.`)))}(e,t,l)));let e=c.se;c.se=(t,n)=>{let o=v.get(t);void 0!==o&&o.length>0&&g(`re-setting a root state with grafted volumes (${o.map(e=>e.t).join(", ")}) is not supported: their data is part of the tree.`),function(e){let t=H.get(e);if(void 0===t)return!1;for(let e of t.values())if(e.size>0)return!0;return!1}(t)&&g("re-setting a root state with mounted components is not supported: they read its data."),e?.(t,n)}}},Oe=je;export{Oe as default,je as scopes};
|
|
1
|
+
import{a as e,b as t,d as n}from"../chunks/chunk-L2BZD5DU.js";import{b as o,n as l,o as r,p as i}from"../chunks/chunk-HSMALJSW.js";import"../chunks/chunk-5MLEMVL3.js";import{e as a,f as s}from"../chunks/chunk-COJU24UI.js";import{a as u}from"../chunks/chunk-C3UYMJRT.js";import"../chunks/chunk-5D34CGCF.js";import"../chunks/chunk-ACYOJ3NW.js";import"../chunks/chunk-FZJY4CF3.js";import{a as c,b as d,c as f,d as h,f as m,h as p,j as g}from"../chunks/chunk-SA2LYPN7.js";var $=new WeakMap,b=new WeakMap,y="will not graft: the root state failed to initialize.",w=new WeakSet,v=new WeakMap,k=["$stream","$streams","$scan","$recursion","$watch","$listKeys","$renderedCallback","$updatedCallback","$behavior","$features"],N=["$commandTokens","$eventTokens","$on","$errorCallback"],j=e=>`[@wcstack/state] <${u.tagNames.state} mount="${e}">`,O=new Set(["$getAll","$setAll","$resolve","$postUpdate","$dependOn","$eq","$eqIndex"]),C=e=>e?.element?.isConnected?e:void 0;function P(e){let t=b.get(e);return void 0!==t&&!Array.isArray(t)&&t.isConnected}function A(e,t){let n=b.get(t);if(b.delete(t),Array.isArray(n))for(let t of n)W(t,e)}function M(e){let t=$.get(e.root);t?.get(e.t)===e&&t.delete(e.t)}function x(e,t){console.error(`${j(e.t)} ${t}`),M(e),e.Ge?.(),e.Ge=null}function S(e,t){let n=e.state?.[t];if("function"==typeof n)try{let t=n.call(e.chroot);null!==t&&"object"==typeof t&&"function"==typeof t.then&&t.then(void 0,e=>console.error(e))}catch(e){console.error(e)}}function W(e,t){if(w.has(t))return x(e,"will not graft: its component is wired to its host.");let n=e.state,o=t.target,l=e.t.split("."),r=o;for(let e of l)r=r?.[e];if(void 0!==r&&!0!==t.hydrated)return x(e,`will not graft: the root state already has "${e.t}".`);let i=function(e,t){let n=e=>`${t}.${e}`;return new Proxy({},{get(t,o){if("symbol"==typeof o)return;if(36!==o.charCodeAt(0))return e.proxy[n(o)];let l=e.proxy[o];return"$eqPath"===o?(e,t)=>l(n(e),n(t)):O.has(o)&&"function"==typeof l?(e,...t)=>l(n(e),...t):l},set:(t,o,l)=>"symbol"!=typeof o&&(e.proxy[n(o)]=l,!0)})}(t,e.t);e.chroot=i;let a={},s={},u=new Set;for(let t=n;null!==t&&t!==Object.prototype;t=Object.getPrototypeOf(t))for(let n of Object.getOwnPropertyNames(t)){if(u.has(n)||"constructor"===n)continue;u.add(n);let{get:o,set:l,value:r}=Object.getOwnPropertyDescriptor(t,n);if(void 0!==o||void 0!==l)s[`${e.t}.${n}`]={get:o&&function(){return o.call(i)},set:l&&function(e){l.call(i,e)}};else{if("$"===n[0])continue;if("function"==typeof r){let t=r.bind(i);s[`${e.t}.${n}`]={get:()=>t}}else a[n]=r}}if(void 0===r){for(let e=1;e<l.length;e++){let n=t.o(l.slice(0,e).join("."));null==t.bt(n,null)&&t.P(n,null,{})}t.P(t.o(e.t),null,a)}t.Xn(Object.defineProperties({},s));for(let e in s)t.We(t.o(e),null);e.engine=t;let c=v.get(t);void 0===c&&v.set(t,c=[]),c.push(e),e.el.isConnected&&S(e,"$connectedCallback"),e.Ge?.(),e.Ge=null}function R(e,t){let n=b.get(e);if(Array.isArray(n))for(let e of n)x(e,y);b.set(e,t)}var D=new WeakMap;function E(e,t){let n=e.getAttribute("mount");if(null===n)return null;let o={el:e,root:t,t:n,state:null,engine:null,chroot:null,Ge:null},r=null;if(function(e){return""!==e&&e.split(".").every(e=>""!==e&&!/[*$#@\s]/.test(e))}(n))if(e.hasAttribute(u.bindAttributeName))r='injections (data-wcs="state.<key>: …") are not supported — read the root path in a root getter.';else{let e=$.get(t);void 0===e&&$.set(t,e=new Map);let l=e.get(n);if(void 0!==l&&l!==o&&(null===l.engine?l.el.isConnected:C(l.engine)))r=`will not graft: another volume already holds "${n}".`;else{if(null===l?.engine){let e=b.get(t);Array.isArray(e)&&b.set(t,e.filter(e=>e!==l)),l.Ge?.(),l.Ge=null}e.set(n,o)}}else r='has an invalid mount path: it must be a static path (no "*", "$", "#", "@").';return{vo:!0,start(e){if(null!==r)return x(o,r);if($.get(t).get(n)===o){for(let t of k)if(void 0!==e[t])return x(o,`${t} is not run in a volume — declare it on the root state.`);for(let t of N)void 0!==e[t]&&console.warn(`${j(n)} ${t} is not run in a volume (it belongs to the root).`);return o.state=e,new Promise(e=>{o.Ge=e;let n=C(l.get(t)),r=b.get(t);void 0!==n?W(o,n):P(t)?x(o,y):b.set(t,[...Array.isArray(r)?r:[],o])})}},Ye(){null!==o.engine&&S(o,"$connectedCallback")},On(){null!==o.engine&&S(o,"$disconnectedCallback")},reset(){g(`re-setting a volume is not supported: its data was copied into the root tree at "${n}" — write the paths under it on the root instead.`)}}}var q=new WeakMap,z=new WeakMap;function G(e,t){let n=e[t];if(void 0===n)return[];Array.isArray(n)||g(`${t} must be an array of state member names.`);let o=new Set;for(let e of n)("string"!=typeof e||""===e)&&g(`${t} entries must be non-empty strings.`),"$"===e[0]&&g(`${t} entry "${e}": internal ($) members are never exposed.`),o.has(e)&&g(`${t} entry "${e}" is duplicated.`),o.add(e);return n}function L(e,t){let n=t.host;if(void 0===n||!n.hasAttribute("data-wc-definition"))return null;let o=document.createDocumentFragment();for(let e of[...t.childNodes])o.appendChild(e.cloneNode(!0));let l=t.mode;return{start(t){e.hasAttribute("bind-component")&&g("DCC: a <wcs-state bind-component> cannot define a component (use one mechanism)."),function(e,t,n,o){e.includes("-")||g(`DCC: <${e} data-wc-definition> is not a valid custom element name.`),void 0!==customElements.get(e)&&g(`DCC: <${e}> is already defined.`);let l=function(e){let t=new Map;for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let e of Object.getOwnPropertyNames(n))"constructor"===e||"$"===e[0]||t.has(e)||t.set(e,Object.getOwnPropertyDescriptor(n,e));let n=e.$stream;if(null!==n&&"object"==typeof n)for(let e of Object.keys(n))t.has(e)||t.set(e,{value:void 0});return t}(o),r=G(o,"$bindables"),i=G(o,"$commands");for(let e of r){let t=l.get(e);void 0===t&&g(`$bindables entry "${e}" does not exist on the state.`),"function"==typeof t.value&&g(`$bindables entry "${e}" is a method: list it in $commands.`)}for(let e of i){let t=l.get(e);void 0===t&&g(`$commands entry "${e}" does not exist on the state.`),"function"!=typeof t.value&&g(`$commands entry "${e}" is not a method: list it in $bindables.`)}let a={tag:e,bindables:r},s=new WeakMap,c=new WeakMap,d=o=>{if(s.has(o))return s.get(o);if(o.hasAttribute("data-wc-definition"))return null;let l=o.attachShadow({mode:n});l.appendChild(t.cloneNode(!0));let i=l.querySelector(u.tagNames.state);return s.set(o,i),q.set(o,a),null===i&&r.length>0&&console.warn(`[@wcstack/state] DCC: <${e}> declares $bindables but its content has no <${u.tagNames.state}>: no change events.`),i},f=e=>d(e)?.engine??null,h=e=>Promise.resolve(d(e)?.initializePromise).then(()=>{let t=c.get(e);c.delete(e);let n=f(e);if(void 0!==t&&null!==n)for(let[e,o]of t)n.proxy[e]=o});class m extends HTMLElement{static{this.wcBindable=0===r.length&&0===i.length?null:{protocol:"wc-bindable",version:1,properties:r.map(t=>({name:t,event:`${e}:${t}-changed`,getter:e=>e.target[t]})),inputs:r.map(e=>({name:e})),...0===i.length?{}:{commands:i.map(e=>({name:e,async:!0}))}}}connectedCallback(){null!==d(this)&&h(this)}get stateElement(){return d(this)}}for(let[e,t]of l)"function"==typeof t.value?Object.defineProperty(m.prototype,e,{configurable:!0,value(...t){return h(this).then(()=>{let n=f(this);return null===n?void 0:n.proxy[e].apply(n.proxy,t)})}}):Object.defineProperty(m.prototype,e,{configurable:!0,get(){return f(this)?.proxy[e]},set(t){let n=f(this);if(null!==n)n.proxy[e]=t;else{let n=c.get(this);void 0===n&&c.set(this,n=[]),n.push([e,t])}}});customElements.define(e,m)}(n.localName,o,l,t)},Ye(){},On(){},reset(){g("re-setting a DCC definition is not supported: each instance loads its own state.")}}}var Y=new WeakMap,F=new WeakSet,T=new WeakMap,U=new WeakMap,J="data-wcs-wired",_=new WeakMap,Q=new WeakMap,X=new WeakMap,Z=0,B=new Set,H={},I=["$watch","$stream","$renderedCallback"],K=e=>e.split(".",1)[0];function V(e,t){let n=0;return e.split(".").map(e=>"*"===e?String(t[n++]):e).join(".")}function ee(e,t){let n=e.a,o=K(e.name);if(!0!==document.documentElement?.hasAttribute("data-wcs-server"))n.removeAttribute(J);else if(!ne(n,o)){let e=n.getAttribute(J)?.split(" ")??[];e.includes(o)||n.setAttribute(J,[...e,o].join(" "))}_.get(n)?.ce===o&&g(`<${n.localName}>.${o} has loaded its state: the wiring "${e.name}" added afterwards cannot reach it — bind the host's wiring before the component loads.`);let l=Y.get(n);void 0===l&&Y.set(n,l=[]),l.push(e),t&&F.add(e);let r=T.get(n);return void 0===r&&T.set(n,r=new Map),r.has(o)||r.set(o,n[o]),U.get(n)?.(),!1}function te(e){return e.localName.includes("-")&&null!==e.querySelector(`:scope > ${u.tagNames.state}[bind-component]`)}function ne(e,t){let n=e.getAttribute(u.bindAttributeName);return null!==n&&new RegExp(`(^|;)\\s*${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*[.#:]`).test(n)}function oe(t){let n=t.parentElement;for(;null!==n&&!te(n);)n=n.parentElement;let o=l.get(n??t.getRootNode()),r=o?.element;(r?.isConnected?r.W:null===n)&&(null===n?e(t):i(o,t))}var le=new Set;function re(e,t){le.has(e)||(le.add(e),console.warn(`[@wcstack/state] ${t}`))}var ie=(e,t)=>t in e.state;function ae(e,t){let n=se(e.state,t);return void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)}function se(e,t){for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(void 0!==e)return e}}function ue(e,t,n){if(null!==n.getter)return;let o,l=e.host,r=l.engine,i=K(n.t),s=l.entries.find(e=>e.$===n.t);if(void 0===s&&null!==n.d)return function(e,t){let n,o=t.d;for(;null!==o&&void 0===(n=e.ct.get(o));)o=o.d;if(null===o||void 0===n)return;let l=e.N,r=e.host.engine,i=r.o(n.p.t+t.t.slice(o.t.length));if(null===i.getter)return;let s=n,u=()=>{let n=ce(e,s.r);return 0===t.n?n:(r.resolve(V(i.t,[...r._(n),...l._(a(l.c,t.n))]),null),r.rr)};t.getter=()=>{let e=u();return i.n>0&&null===e?void 0:r.v(i,e)},null!==i.oe&&(t.oe=n=>{let o=u();de(e,s.e,()=>r.P(i,o,n)),e.cn=t}),t.n>0&&(t.F=l.Oe++),e.ct.set(t,{e:s.e,p:i,r:s.r})}(e,n);if(0!==n.n)return;if(void 0!==s){if(s.$!==i?ie(l,i):ae(l,i))return;o=s.ue}else{if(null===t||null!==n.d||"$"===i[0]||ie(l,i))return;s=t,o=r.o(`${t.ue.t}.${i}`)}let u=s.r,c=s;n.getter=()=>r.v(o,ce(e,u)),n.oe=t=>{de(e,c,()=>r.P(o,u,t)),e.cn=n},e.ct.set(n,{e:s,p:o,r:u})}function ce(e,t){return null!==t&&!t.y&&g(`The host row of <${e.host.el.localName}> was removed.`),t}function de(e,t,n){let o=B.has(e.N);B.add(e.N),e.from=t;try{n()}finally{o||B.delete(e.N),e.from=null}}var fe=(e,t)=>t||!B.has(e.m.N)||null!==e.m.from&&e.m.from!==e.e;function he(e,t){if(e.un===t||null===e.host.engine)return;e.un=t,Z+=t?1:-1;let n=e.host.engine,o=X.get(n);void 0===o&&X.set(n,o=new Map);for(let n of e.ae){let e=o.get(n.e.ue);void 0===e&&o.set(n.e.ue,e=new Map);let l=e.get(n.e.r);void 0===l&&e.set(n.e.r,l=new Set),t?l.add(n):(l.delete(n),0===l.size&&e.delete(n.e.r))}let l=e.host.entries.find(e=>""===e.$);if(void 0!==l){null===e.te&&function(e,t){let n=e.host,o=n.engine;e.te=new Map;let l=new Set;for(let r=n.state;null!==r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let i of Object.getOwnPropertyNames(r)){if(l.has(i))continue;l.add(i);let a=Object.getOwnPropertyDescriptor(r,i);if(void 0===a.get&&void 0===a.set||"$"===i[0]||i.includes("*"))continue;let s=K(i);if(i!==s&&!ie(n,s))continue;let u=o.o(`${t.ue.t}.${i}`);if(null===u.getter)ge(o,u,t.ue);else if(!me.has(u.getter))continue;e.te.set(u,e.N.o(i))}}(e,l);for(let o of e.te.keys())t&&null===o.getter&&ge(n,o,l.ue),n.R.me(n,o,l.r);e.te.size>0&&n.Re(),t&&function(e,t){let n=e.host.engine;for(let[o,l]of e.te){let r=n.v(o.d,t.r);if(null===r||"object"!=typeof r||!(o.s in r))continue;let i=e.host.el.localName;re(`${i}|${o.t}`,`[wcs/mount-export-shadowed] <${i}>.${e.host.ce}.${l.t} is exported at "${o.t}" but the tree already has that key, so readers outside the component get the tree value. Remove the tree key or rename the accessor. See docs/state-overlay-export-design.md X1.`)}}(e,l)}}var me=new WeakSet;function pe(e,t,n,o){let l=X.get(e)?.get(t)?.get(n);if(void 0===l)return null;let r=null;for(let e of l)""!==e.e.$||!0!==e.m.te?.has(o)||e.m===r||(null!==r&&g(`[wcs/mount-export-ambiguous] "${o.t}" is exported by two mounted components on the same instance: <${r.host.el.localName}> and <${e.m.host.el.localName}>. Mount only one of them there, or rename one accessor. See docs/state-overlay-export-design.md X4.`),r=e.m);return r}function ge(e,t,n){let o=t.d,l=t.s,r=()=>{let t=e.read(o,e.c);return null!==t&&"object"==typeof t&&l in t?t:null};t.getter=()=>{let o=r();if(null!==o)return o[l];let i=pe(e,n,e.c,t);return null===i?void 0:i.N.read(i.te.get(t),null)},me.add(t.getter),t.oe=i=>{let a=null===r()?pe(e,n,e.c,t):null;if(null===a){let t=e.read(o,e.c);return void(null!==t&&"object"==typeof t&&(t[l]=i))}let s=a.te.get(t);void 0===se(a.host.state,s.t)?.set&&g(`Cannot write to "${s.t}" on mounted <${a.host.el.localName}>: the accessor has no setter. Add a setter or write to the underlying state paths instead.`),a.N.P(s,null,i)},t.n>0&&(t.F=e.Oe++)}function $e(e,t,n,o,l,r){if(null!==t.getter)return e.R.me(e,t,n),void e.Re();if("*"===t.s){if(null===n)return;if(n.T=n.l.C[n.b],e.R.qt(n),null!==n.h)for(let t of n.h.values())e.z(t)}else e.wn(t,n);c.he?.(e,t,n,o,l,r),e.We(t,n)}function be(e){let t=e.m.N;for(let[n,o]of e.m.ct)o.e===e.e&&(0===n.n?t.R.me(t,n,null):t.Zt(n.f[n.n],e=>t.R.me(t,n,e)));t.Re()}function ye(e,t,n,o,l,r,i){let s=n.t.slice(t.t.length);if(""===s)return be(e);let u,c=e.m,d=c.N;if(""===e.e.$){u=s.slice(1);let e=K(u);if("$"===e[0]||ie(c.host,e)||c.host.entries.some(e=>""!==e.$&&(u===e.$||u.startsWith(`${e.$}.`))))return}else u=e.e.$+s;let f=[];for(let e=t.n+1;e<=n.n;e++)f.push(a(o,e).b);d.resolve(V(u,f),null);let h=d.rp,m=d.rr;h.n>0&&null===m||$e(d,h,m,l,r,i)}function we(e,t,n,o,l,r,i){if(0===Z)return;let s=B.has(e);B.add(e);try{let s=Q.get(e);!i&&void 0!==s&&s.un&&!B.has(s.host.engine)&&function(e,t,n,o,l,r){let i,a=t;for(;null!==a&&void 0===(i=e.ct.get(a));)a=a.d;if(null===a||void 0===i)return;let s=e.host.engine;if(a===t&&e.cn===t)return void(e.cn=null);if(null!==i.r&&!i.r.y)return;let u=[...s._(i.r),...e.N._(n)];s.resolve(V(i.p.t+t.t.slice(a.t.length),u),null);let c=s.rp,d=s.rr;c.n>0&&null===d||de(e,i.e,()=>$e(s,c,d,o,l,r))}(s,t,n,o,l,r),i&&void 0!==s&&s.un&&null!==s.te&&function(e,t){let n=e.host.entries.find(e=>""===e.$),o=e.host.engine;for(let[l,r]of e.te)r===t&&(o.R.me(o,l,n.r),o.Re())}(s,t);let u=X.get(e);if(void 0===u)return;for(let[e,s]of u)if(t.Q(e)){let u=s.get(0===e.n?null:a(n,e.n));if(void 0!==u)for(let a of[...u])fe(a,i)&&ye(a,e,t,n,o,l,r)}else if(e.Q(t))for(let[e,o]of[...s])if(0===t.n||a(e,t.n)===n)for(let e of[...o])fe(e,i)&&be(e)}finally{s||B.delete(e)}}async function ve(e,o,l,i,a){if(i===H)return;let d=p(i);d&&await d;let f=_.get(o);f.engine&&i.$recursion&&g(`[wcs/mount-dollar-declaration] <${o.localName}>: $recursion is not run in a mounted component — declare it on the root state.`);let h=f.O;if(null!==h&&h.el!==e&&h.el.isConnected&&g(`<${o.localName}> already has a connected <${u.tagNames.state} bind-component="${f.ce}">.`),null!==h&&he(h,!1),null!==h&&function(e,t,n){let o=e.N,l=`[${u.bindAttributeName}]`,r=e=>1===e.nodeType&&(e.matches(l)||null!==e.querySelector(l)),i=new Set,a=e=>{for(;null!==e&&e.parentNode!==n;)e=e.parentNode;null!==e&&i.add(e)},s=(e,t)=>{for(let n=e.Pn(t);null!==n&&n!==t;n=n.nextSibling)a(n);a(t)};for(let e of o.ie.values())for(let t of e)if(null===t.M)a(t.a);else for(let e of t.M.Y)s(t.M,e.S);for(let e of o.ee.values())for(let t of[e.E,...e.D??[]])null!==t&&s(t,t.S);for(let t of e.j)t.parentNode===n&&r(t)&&i.add(t);if(0===i.size)return!1;let c=[...n.childNodes].filter(n=>n!==t&&!i.has(n)&&!e.j.includes(n)&&(r(n)||o.Lt&&n.textContent.includes("{{")));return c.length>0&&console.warn(`[@wcstack/state] <${e.host.el.localName}>: ${c.length} node(s) added beside the content taken over are not bound.`),!0}(h,e,l))return async function(e,t,n,o){e.el.engine=null,e.el=t,e.N.element=t,t.engine=e.N,e.j=e.j.filter(e=>e.parentNode===n),t.isConnected?await ke(e,o):o()}(h,e,l,a);let m=new s(i,new n);m.element=e,e.engine=m,function(e,t){let n=new Map;for(let e=t;null!==e&&e!==Object.prototype;e=Object.getPrototypeOf(e))for(let t of Object.getOwnPropertyNames(e)){let o=Object.getOwnPropertyDescriptor(e,t).value;"function"==typeof o&&"constructor"!==t&&n.set(o,null)}let o=(t,n,o)=>Reflect.apply(t,e.proxy,o);e.W=e=>{let t=n.get(e);return null===t&&n.set(e,t=new Proxy(e,{apply:o})),t}}(m,i);let $={el:e,j:[],N:m,host:f,ae:[],ct:new Map,un:!1,cn:null,from:null,te:null};for(let e of f.entries)$.ae.push({m:$,e});f.O=$,Q.set(m,$);let b=null===f.engine;b?c.element?.(m,"mounting"):(function(e){let t=e.N,n=e.host,o=n.engine,l=n.el.localName,r=n.entries.find(e=>""===e.$)??null;for(let e of n.entries){if(""===e.$)continue;let t=K(e.$);ie(n,t)&&(e.$!==t||ae(n,t))&&re(`${l}.${e.$}`,`[wcs/mount-own-key-shadow] <${l}>: "${n.ce}.${e.$}" is hidden by the component's own "${t}"; rename one side.`)}if(null!==r){let e=o.v(r.ue,r.r);if(null!==e&&"object"==typeof e)for(let t of Object.keys(n.state))"$"!==t[0]&&t in e&&!n.entries.some(e=>e.$===t)&&re(`${l}.${t}`,`[wcs/mount-own-key-shadow] <${l}>: its own "${t}" hides "${r.ue.t}.${t}" — remove the default to read the tree, or rename it to keep it private.`)}let i=I.filter(e=>void 0!==n.state[e]);i.length>0&&re(`${l}.${n.ce}$`,`[wcs/mount-dollar-declaration] <${l}>: ${i.join(", ")} ${1===i.length?"is":"are"} not run in a mounted component — declare it on the root state.`);let a=t.et;t.et=n=>{ue(e,r,n),a.call(t,n)};let s=[...t.L.all()];for(let t of s)ue(e,r,t);for(let e of s)a.call(t,e);let u=n.entries.filter(e=>null!==e.r);if(u.length>0){let e=t.Ut;t.Ut=()=>{u.every(e=>e.r.y)&&e.call(t)}}}($),he($,!0),w.add(m),A(m,l));let y=c.sr?.(l);r(m,l),y?.(),$.j=[...l.childNodes],t(),b&&m.bn(),Object.defineProperty(o,f.ce,{configurable:!0,enumerable:!0,get:()=>m.proxy});let v=o.$stateReadyCallback;if("function"==typeof v)try{let e=v.call(o,f.ce);null!==e&&"object"==typeof e&&"function"==typeof e.then&&e.then(void 0,e=>console.error(e))}catch(e){console.error(e)}a(),e.isConnected?(await m.we("$connectedCallback"),b&&e.isConnected&&c.element?.(m,"connected")):he($,!1)}async function ke(e,t){he(e,!0);for(let t of e.ae)be(t);t?.(),!e.broken&&(await e.N.we("$connectedCallback"),null===e.host.engine&&e.el.isConnected&&c.element?.(e.N,"connected"))}function Ne(e,t){let n=e.getAttribute("bind-component");if(null===n)return function(e,t){return e.connectedCallbackPromise.catch(()=>{let n=l.get(t)?.element;if(!(e.W||void 0!==n&&n!==e&&n.isConnected)){R(t,e);for(let e of D.get(t)??[])e()}}),null}(e,t);let r=e.parentNode,i=r instanceof ShadowRoot,a=i?r.host:r instanceof Element?r:null,s=()=>{let t=null===a?void 0:_.get(a)?.O;return t?.el===e?t:null},d=t=>{throw i&&R(r,e),t},f=!1;return{pt:()=>(null!==a&&a.localName.includes("-")?async function(e,t,n,l){let r=n.localName;(["state","src","json"].some(t=>e.hasAttribute(t))||null!==e.querySelector('script[type="module"]'))&&g(`<${u.tagNames.state} bind-component> takes its state from <${r}>.${t}: it cannot also load one (state / src / json / an inline script).`),await o(n).whenDefined(r);let i=_.get(n);if(void 0!==i)return i.ce!==t&&g(`<${r}> already has a <${u.tagNames.state} bind-component="${i.ce}">.`),i.state;let a=()=>(Y.get(n)??[]).filter(e=>K(e.name)===t),s=ne(n,t);if(s&&0===a().length&&oe(n),0===a().length&&(s||((e,t)=>!0===e.getAttribute(J)?.split(" ").includes(t))(n,t))){let e;await new Promise((o,l)=>{U.set(n,o),e=function(e,t){P(e)&&t();let n=D.get(e)??new Set;return D.set(e,n.add(t)),()=>n.delete(t)}(n.getRootNode(),()=>l(new Error(`[@wcstack/state] <${r}>.${t} will not mount: the root state failed to initialize.`)))}).finally(()=>e())}U.delete(n);let c=a(),d=T.get(n),f=void 0!==d&&d.has(t)?d.get(t):n[t];if((null===f||"object"!=typeof f)&&g(`"bind-component": <${r}>.${t} must be an object (the component's state), got ${null===f?"null":typeof f}.`),0===c.length&&l){let e=new Error(`[@wcstack/state] A plain (unwired) Light DOM "bind-component" is not supported. Attach a shadow root to <${r}>, or mount it from the host (${u.bindAttributeName}="${t}: path").`);return queueMicrotask(()=>{throw e}),H}let h=[];for(let e of c){let o=e.name===t?"":e.name.slice(t.length+1);h.some(e=>e.$===o)&&g(`<${r}> maps "${e.name}" twice.`);let l=o.split(".").indexOf("*");if(l>=0){let n=o.split(".").slice(0,l).join(".");g(`<${r}> maps "${e.name}": the component-side path of a mount cannot contain "*"${""===n?"":` — map the list itself ("${t}.${n}: <the host's list>")`}.`)}h.push({$:o,ue:e.o,r:e.r,ro:F.has(e)}),e.engine.kn(e),""!==o&&delete n[e.name]}let m=0===c.length?function(e){let t=Object.getOwnPropertyDescriptors(e),n=Object.isFrozen(e);for(let e of Object.values(t))"value"in e&&!1===e.writable&&(e.writable=!0,n=!0);return n?Object.create(Object.getPrototypeOf(e),t):e}(f):f;return _.set(n,i={el:n,ce:t,state:m,engine:0===c.length?null:c[0].engine,entries:h,O:null}),m}(e,n,a,!i):Promise.reject(new Error(`[@wcstack/state] "bind-component" requires <${u.tagNames.state}> to be a direct child of a custom element.`))).catch(d),async start(t,n){await ve(e,a,i?r:a,t,()=>{f=!0,n()}).catch(e=>{let t=s();return!f&&null!==t&&(t.broken=!0),d(e)})},Ye(){let t=s();null!==t?ke(t).catch(e=>console.error(e)):f?Promise.resolve().then(()=>{if(e.parentNode===r)return ve(e,a,i?r:a,_.get(a).state,()=>{})}).catch(e=>console.error(e)):U.has(a)&&oe(a)},On(){let e=s();null!==e&&(he(e,!1),!e.broken&&(e.N.we("$disconnectedCallback"),null===e.host.engine&&c.element?.(e.N,"disconnected")))},reset(){g(`re-setting a component's state is not supported: write <${a?.localName}>.${n} instead.`)}}}var je={name:"scopes",install(){c.it=f(m,c.it,E),c.it=f(m,c.it,L),c.it=f(m,c.it,Ne),c.Qo=ee,c.yo=te,c.element=d(c.element,(e,t)=>{if("mounting"!==t)return function(e,t){let n=v.get(e)??[];if("disconnected"===t)for(let e of n)M(e);else if("reset"!==t&&C(l.get(e.root))===e){A(e,e.root);for(let e of n)$.get(e.root).has(e.t)||$.get(e.root).set(e.t,e)}}(e,t);let n=e.element.getRootNode();A(e,n),function(e,t){let n=t.host,o=void 0===n?void 0:q.get(n);void 0!==o&&z.set(e,{host:n,def:o})}(e,n)}),c.he=d(c.he,(e,t,n,o,l,r)=>{(function(e,t,n,o){let l=z.get(e);if(void 0===l)return;let r=t.t.split(".",1)[0];if(!l.def.bindables.includes(r))return;let i=o&&t.t===r;l.host.dispatchEvent(new CustomEvent(`${l.def.tag}:${r}-changed`,{detail:i?n:void 0,bubbles:!0}))})(e,t,l,r),we(e,t,n,o,l,r,!1)}),c.ye=d(c.ye,(e,t,n)=>we(e,t,n,void 0,void 0,!1,!0)),c.Pe=f(h,c.Pe,(e,t,n,o,l)=>(function(e,t){let n=v.get(e);if(void 0!==n&&0===t.n)for(let{t:e}of n)e.startsWith(`${t.t}.`)&&g(`writing "${t.t}" would replace the volume grafted at "${e}"; write the paths under it instead.`)}(e,t),function(e,t,n){let o,l=Q.get(e);if(void 0===l)return!1;for(let e=t;null!==e&&void 0===o;e=e.d)o=l.ct.get(e);if(void 0===o)return!1;let r=o.e;return!((null===r.r||r.r.y)&&!r.ro)&&(!!n||(ce(l,r.r),void g(`[wcs/mount-readonly] <${l.host.el.localName}> cannot write "${t.t}": it is mounted read-only ("${l.host.ce}${""===r.$?"":`.${r.$}`}#ro: ${r.ue.t}"). Write it on the host, or drop #ro from the mount.`)))}(e,t,l)));let e=c.se;c.se=(t,n)=>{let o=v.get(t);void 0!==o&&o.length>0&&g(`re-setting a root state with grafted volumes (${o.map(e=>e.t).join(", ")}) is not supported: their data is part of the tree.`),function(e){let t=X.get(e);if(void 0===t)return!1;for(let e of t.values())if(e.size>0)return!0;return!1}(t)&&g("re-setting a root state with mounted components is not supported: they read its data."),e?.(t,n)}}},Oe=je;export{Oe as default,je as scopes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"../chunks/chunk-ZOINIOIM.js";import{b as t,c as l}from"../chunks/chunk-7644KQ3T.js";import"../chunks/chunk-6GES2BK3.js";import{a as n,i as r,j as o,k as i,l as s,m as a}from"../chunks/chunk-Z7B3ZZE4.js";import"../chunks/chunk-SEPY6OHJ.js";import"../chunks/chunk-372Y2FIC.js";import{a as u}from"../chunks/chunk-HSOCDTWX.js";import"../chunks/chunk-5D34CGCF.js";import"../chunks/chunk-5LIOXC7W.js";import"../chunks/chunk-ROX5KEJX.js";import{a as c,b as f}from"../chunks/chunk-G2ZO6SXV.js";var d=e=>e.split(".").slice(0,2).join("."),p=class extends t{static find(e){return e.querySelector?.(u.tagNames.ssr)??null}get version(){return this.getAttribute("version")??""}get stateData(){let e=this.querySelector('script[type="application/json"]');return null===e?{}:JSON.parse(e.textContent||"{}")}get templates(){let e=new Map;for(let t of Array.from(this.children))"template"===t.localName&&e.set(t.id,t);return e}get hydrateProps(){return{}}getTemplate(e){return this.templates.get(e)??null}verifyVersion(){return d(this.version)===d(e)}};function m(e){let t=u.tagNames.ssr;void 0===e.get(t)&&e.define(t,class extends p{})}var h=()=>u.tagNames.ssr,g=Symbol.for("wcstack.ssr.snapshotBuilder"),b=()=>!0===document.documentElement?.hasAttribute("data-wcs-server"),v=e=>document.createComment(e),y=(e,t)=>null!==e&&8===e.nodeType&&e.data===t,w=(e,t)=>null!==e&&8===e.nodeType&&e.data.startsWith(t),S=new WeakMap,N=new WeakMap,A=new WeakMap,x=new WeakSet,k=new WeakMap;function $(e,t){let l=[];for(let n=e;null!==n&&(l.push(n),n!==t);n=n.nextSibling);return l}function T(e,t,...l){for(let l of Array.from(e.attributes))t.setAttribute(l.name,l.value);return(t.content??t).append(...l),t}var j=e=>null===e.j?e.Ke:e.j[e.j.length-1];function C(e,t,l){let n=[v(null===l?"wcs-[":`wcs-[:${l}`)];for(let e of t)null===l&&n.push(v("wcs-|")),n.push(...$(e.Ke,j(e)));n.push(v("wcs-]")),e.after(...n);for(let e of n)x.add(e)}function W(e){if(e instanceof r){C(e.S,e.$e,null);for(let t of e.$e)E(t);return}let t=e.O;null!==t&&(C(e.Y[e.Y.length-1].S,[t],e.b),E(t))}function E(e){if(null!==e.h)for(let t of e.h)W(t)}var O=new Set(["script","style","template","textarea","title"]),M="data-wcs-raw",q=e=>O.has(e.localName)||e.localName===h();function I(e){for(let t of Array.from(e.childNodes))3===t.nodeType?""===t.data?t.replaceWith(v("wcs-e")):null!==t.nextSibling&&3===t.nextSibling.nodeType&&t.after(v("wcs-s")):1===t.nodeType&&!q(t)&&I(t)}var K=0;function R(t,l){let n=t.getRootNode(),r=[l];for(let e of N.get(n)??[])e!==l&&!0===e.element?.hasAttribute("bind-component")&&r.push(e);let o=new Map;for(let e of r){let t=S.get(e);if(void 0===t)continue;let l=new Map;for(let t of e.ee.values())if(null!==t.E&&l.set(t.E.S,t.E),null!==t.D)for(let e of t.D)l.set(e.S,e);for(let t of e.ie.values())for(let e of t)if(null!==e.M)for(let t of e.M.Y)l.set(t.S,e.M);let n=new Set;for(let[e,r]of t){o.set(e,r);let t=l.get(e);void 0!==t&&!n.has(t)&&e.isConnected&&(n.add(t),W(t))}}for(let e of Array.from(n.querySelectorAll("*"))){let t=A.get(e);if(void 0!==t){let l=document.createTreeWalker(e,133,{acceptNode:e=>x.has(e)||1===e.nodeType&&t.has(e)&&X(e)?2:1}),n=[];for(let e=l.nextNode();null!==e;e=l.nextNode()){let l=e.previousSibling;(3===e.nodeType?e.data.includes("{{")&&!(q(e.parentNode)?k.has(e):t.has(l)&&w(l,"wcs-t:"))&&(k.has(e)||t.get(e)!==e.data):!t.has(e))&&n.push(e)}for(let e of n)e.remove()}let l=Array.from(e.childNodes);q(e)&&l.some(e=>k.has(e))&&e.setAttribute(M,l.map(e=>k.has(e)?`{{ ${k.get(e)} }}`:8===e.nodeType?`\x3c!--${e.data}--\x3e`:e.textContent).join(""))}I(9===n.nodeType?n.body:n);let i=document.createElement(h());i.setAttribute("version",e);let s=document.createElement("script");s.type="application/json",s.textContent=function(e){return JSON.stringify(e).replace(/[<>&\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(function(e){let t={};for(let l of Object.keys(e)){if("$"===l[0])continue;let n=Object.getOwnPropertyDescriptor(e,l);void 0!==n.get||void 0!==n.set||"function"==typeof n.value||(t[l]=n.value)}return t}(l.target)),i.append(s);for(let[e,t]of o){if(!e.isConnected)continue;let l=e.parentNode;for(;null!==l&&"svg"!==l.localName&&"foreignObject"!==l.localName;)l=l.parentElement;let n="svg"===l?.localName,r=`wcs-${n?"s":"t"}${K++}`;e.replaceWith(v(`wcs-p:${r}`));let o=document.importNode(a(t),!0);for(let e of Array.from(o.querySelectorAll("template")))"http://www.w3.org/2000/svg"===e.namespaceURI&&e.replaceWith(T(e,document.createElement("template"),...e.childNodes));if(n){let e=document.createElementNS(l.namespaceURI,"svg");e.append(o),o=e}let s=document.createElement("template");s.id=r,i.append(T(t,s,o))}t.before(i)}function P(e){!function(e){if(null!==e.querySelector(u.tagNames.state))for(let t of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===t.localName){let e=Array.from(t.options);if(t.multiple||e.some(e=>e.hasAttribute("selected"))||e[t.selectedIndex]!==e.find(e=>!e.disabled))for(let t of e)t.toggleAttribute("selected",t.selected)}else"textarea"===t.localName?t.value!==t.defaultValue&&!t.value.includes("{{")&&!Array.from(t.childNodes).some(e=>k.has(e))&&(t.textContent=t.value):"checkbox"===t.type||"radio"===t.type?t.toggleAttribute("checked",t.checked):"password"!==t.type&&t.value!==t.defaultValue&&t.setAttribute("value",t.value)}(e);for(let t of Array.from(e.querySelectorAll(`${u.tagNames.state}[enable-ssr]`))){if(t.hasAttribute("mount")||t.hasAttribute("bind-component")||t.previousElementSibling?.localName===h())continue;let e=t.engine;null!=e&&R(t,e)}}var D=Symbol.for("wcstack.state.ssr.impl"),J=new Map,U=new WeakMap,X=e=>!0===c.yo?.(e),Y=e=>1===e.nodeType&&!q(e)&&!X(e),Z=e=>e.u.flat().concat(e.K??[]),V=e=>{for(let t of Z(e))t.remove()};function B(e,t,l){let n=/^wcs-\[(?::(\d+))?/.exec(e.data),r=e.previousSibling,o=e.parentNode,i=[],a=e.nextSibling;for(e.remove();null!==a&&!y(a,"wcs-]");){let e=a.nextSibling;if(y(a,"wcs-|"))i.push([]),a.remove();else{0===i.length&&i.push([]);let l=i[i.length-1];w(a,"wcs-[")?e=B(a,t,l):(l.push(a),Y(a)&&G(a,t))}a=e}let u={branch:void 0===n[1]?null:Number(n[1]),u:i,K:a??o.appendChild(v("wcs-]"))},c=Z(u);a=u.K.nextSibling;for(let e of c)l?.push(e),t&&s.add(e);return t&&null!==r?J.set(r,u):V(u),a}function G(e,t){for(let l=e.firstChild;null!==l;)w(l,"wcs-[")?l=B(l,t):(Y(l)&&G(l,t),l=l.nextSibling)}function z(e,t,l){let n=e=>{for(let r of Array.from(e.childNodes))if(r.parentNode===e)if(8===r.nodeType){let e=r.data;try{if("wcs-s"===e)r.remove();else if("wcs-e"===e)r.replaceWith("");else if(e.startsWith("wcs-t:")){let t=v(`@@:${decodeURIComponent(e.slice(6))}`),l=r.nextSibling;for(;null!==l&&!y(l,"wcs-/t");){let e=l.nextSibling;l.remove(),l=e}l?.remove(),r.replaceWith(t)}else if(e.startsWith("wcs-p:")){let l=t.querySelector(`template[id="${e.slice(6)}"]`);if(null!==l){let t=r.parentNode,n="s"===e[10]?T(l,document.createElementNS(t.namespaceURI,"template"),...document.importNode(l.content.firstChild,!0).childNodes):document.importNode(l,!0);n.removeAttribute("id"),t.replaceChild(n,r)}}}catch{}}else 1===r.nodeType&&!q(r)&&(X(r)?U.set(r,{ssr:t,Ae:l}):n(r))};n(e),function(e){for(let t of Array.from(e.querySelectorAll("table > tbody"))){let e=[];for(let l=t.previousSibling;null!==l&&(8===l.nodeType||te(l)||"template"===l.localName);l=l.previousSibling)e.unshift(l);let l=0,n=0;if(e.forEach((e,t)=>{w(e,"wcs-[")?n++:y(e,"wcs-]")&&--n<0&&(n=0,l=t+1)}),0===n)continue;let r=0;for(let n=t.firstChild;null!==n;n=n.nextSibling)if(w(n,"wcs-["))r++;else if(y(n,"wcs-]")&&0===r--){t.prepend(...e.slice(l));break}}}(e),G(e,l)}function F(e){let t=U.get(e);if(void 0===t||(U.delete(e),z(e,t.ssr,t.Ae),!t.Ae))return null;let l=c.Ae;return c.Ae=re,()=>{c.Ae=l,H()}}function H(){for(let e of J.values())V(e);J.clear()}function L(e){let t=[];for(let l=document.createTreeWalker(e,128);l.nextNode();)t.push(l.currentNode);return t}function Q(e,t,l,n){let r=null;for(let n of e){let e=n[l];null!==e&&(""===e||t===e||t.startsWith(`${e}.`))&&(null===r||e.length>r[l].length)&&(r=n)}let o=r?.[n];if(null==o)return null;let i=r[l],s=""===i?t:t.slice(i.length+1);return""===o?s:""===s?o:`${o}.${s}`}function _(e,t,l){if(b()){if(l instanceof Array){for(let e=l.length;e-- >0;)o(l[e])&&l.splice(e,1);let e=t;if(l.some(i))x.add(e);else if(e.localName.includes("-")&&!X(e)){let t=new Map;for(let l=document.createTreeWalker(e,133);l.nextNode();)t.set(l.currentNode,l.currentNode.data);A.set(e,t)}return}if("string"==typeof l){if(k.set(t,l),q(t.parentNode))return;let e=v(`wcs-t:${encodeURIComponent(l)}`),n=v("wcs-/t");return t.before(e),void t.after(n)}let n=S.get(e);void 0===n&&S.set(e,n=new Map),n.set(t,l);let r=t.getRootNode(),s=N.get(r);return void 0===s&&N.set(r,s=new Set),void s.add(e)}if("string"!=typeof l&&J.size>0){let e=J.get(l);void 0!==e&&(J.delete(l),J.set(t,e))}}var ee=e=>null!==e&&8===e.nodeType&&[u.commentIfPrefix,u.commentElseIfPrefix,u.commentElsePrefix].includes(e.data),te=e=>3===e.nodeType&&""===e.data.trim(),le=e=>(J.get(e)?.K??e).nextSibling;function ne(e,t){if(t.length!==e.on.childNodes.length)return!1;let l=e.Rn;for(let n=0;n<l.length;n++){let r=l[n],o=e.on,i=t[r[0]];for(let e=0;;){if(o=o.childNodes[r[e]],i?.nodeName!==o.nodeName)return!1;if(++e===r.length)break;i=i.firstChild;for(let t=r[e];t>0&&null!==i;t--)i=le(i)}e.mo[n]=i}return!0}function re(e,t,l){if(0===J.size)return null;let n=t,r=0;if(!l){let e=u.commentIfPrefix;if(!y(t,e))for(let l=t.previousSibling;null!==l&&1!==l.nodeType&&(ee(l)&&r++,!y(l,e));l=l.previousSibling);for(let l=t.nextSibling;!J.has(n)&&null!==l&&!y(l,e)&&1!==l.nodeType;l=l.nextSibling)ee(l)&&(n=l)}let o=J.get(n);if(void 0===o)return null;if(!l&&o.branch!==r)return J.delete(n),V(o),null;let i=o.u.shift();if(0===o.u.length&&J.delete(n),o.K?.replaceWith(...$(t,n)),o.K=null,void 0===i)return null;let s=[];for(let e=0;e<i.length;e++){let t=J.get(i[e]);if(s.push(i[e]),void 0!==t)for(;e<i.length&&i[e]!==t.K;)e++}if(!ne(e,s)){let l=(e.Tn?e.root:e.on).cloneNode(!0);s=e.Tn?[l]:[...l.childNodes],ne(e,s),(i[0]??o.u.find(e=>e.length>0)?.[0]??t).before(l);for(let e of i)e.remove()}return s}var oe={name:"ssr",install(){c.An=_,c.ir=F;let t=c.element;c.element=(l,r)=>{"mounting"===r&&function(t){let l=t.element;if(!l.hasAttribute("enable-ssr")||b())return;let r=l.previousElementSibling,o=r?.localName===h(),i=o?r.getAttribute("version"):null,s=null===i||d(i)===d(e);if(s){let e=t,l=e.we;e.we=(e,n)=>"$connectedCallback"===e?void 0:l.call(t,e,n)}if(!o)return;let a=!s&&parseInt(i)<4,f=/^3\.(\d+)\.(\d+)$/.exec(i),p=null!==f&&(+f[1]-5||+f[2]-3)>=0;s||console.warn(`[@wcstack/state] <${h()} version="${i}"> does not match ${e}: its snapshot is discarded, and the page renders on the client from its own state.${a&&!p?" 3.x output keeps only the path of a text binding outside a template, so such a binding loses its filters: deploy @wcstack/server 4.0 with this client.":""}`);let m=s?r.querySelector('script[type="application/json"]'):null;if(null!==m){let e=JSON.parse(m.textContent||"{}"),l=t.target;for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(l,t);void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)||(l[t]=e[t])}t.hydrated=!0}let g=l.getRootNode();for(let e of Array.from(g.querySelectorAll(`[${M}]`)))e.textContent=e.getAttribute(M),e.removeAttribute(M);let w=9===g.nodeType?g.body:g;a?function(e,t,l){let r=new Map,o=e=>{let t=e.parentElement;for(;null!==t&&!X(t);)t=t.parentElement;if(null===t)return null;let l=r.get(t);if(void 0===l){let e=o(t),i=t.querySelector(`:scope > ${u.tagNames.state}[bind-component]`).getAttribute("bind-component");r.set(t,l=[]);for(let r of n(t.getAttribute(u.bindAttributeName)??"")){let t=r.Je;r.ve[0]===i&&l.push([e?Q(e,t,1,0):t,r.ve.slice(1).join("."),e&&t])}}return l},i=(e,t,l)=>{let n=o(e);if(null===n)return t;let r=/^([^|]*)#m\d+\.([^|]*)$/.exec(t);if(null===r)return l?t:Q(n,t,0,1)??t;let i=r[1].replace(/#m\d+\./g,"").slice(0,-1);return n.some(e=>""===e[1]&&(e[0]===i||e[2]===i))?r[2]:Q(n,r[2],2,1)??r[2]};for(let t of L(e).reverse()){let e=/^@@wcs-(\w+)-start:([\s\S]*)/.exec(t.data);if(null===e)continue;let n=t.nextSibling;for(;null!==n&&!y(n,`@@wcs-${e[1]}-end:${e[2]}`);)n=n.nextSibling;if(null!==n){for(;t.nextSibling!==n;)t.nextSibling.remove();n.remove(),t.replaceWith(..."text"===e[1]?[v(`@@:${i(t,e[2],l)}`)]:[])}}let s=(e,l)=>{for(let n of L(e)){let e=/^@@wcs-(?:for|if|elseif|else):(\S+)$/.exec(n.data)?.[1],r=Array.from(t.querySelectorAll("template")).find(t=>t.id===e);if(void 0===r)continue;let o=document.importNode(r,!0),a=u.bindAttributeName;o.removeAttribute("id"),o.setAttribute(a,o.getAttribute(a).replace(/^(\s*\w+\s*:\s*)([^\s|]+)/,(e,t,r)=>t+i(l??n,r))),s(o.content,l??n);let c=o.content.firstChild;n.replaceWith(.../^\s*elseif\s*:/.test(c?.getAttribute?.(a)??"")?o.content.childNodes:[o])}};s(e);for(let t of Array.from(e.querySelectorAll("[data-wcs-ssr-id]")))t.removeAttribute("data-wcs-ssr-id")}(w,r,p):z(w,r,s),r.remove(),s&&(c.Ae=re,queueMicrotask(()=>{H(),c.Ae=null}))}(l),t?.(l,r)},function(){let e=globalThis;e[D]={build:P,reset(){K=0}},void 0===e[g]&&(e[g]={protocol:"wcs-ssr-snapshot",version:1,build:t=>e[D].build(t),reset:()=>e[D].reset()})}(),c.$o=f(c.$o,m);for(let e of l())m(e)}},ie=oe;export{ie as default,oe as ssr};
|
|
1
|
+
import{a as e}from"../chunks/chunk-VY2XLPFM.js";import{b as t,c as l}from"../chunks/chunk-FVHQWDF4.js";import"../chunks/chunk-L2BZD5DU.js";import{a as n,i as r,j as o,k as i,l as s,m as a}from"../chunks/chunk-HSMALJSW.js";import"../chunks/chunk-5MLEMVL3.js";import"../chunks/chunk-COJU24UI.js";import{a as u}from"../chunks/chunk-C3UYMJRT.js";import"../chunks/chunk-5D34CGCF.js";import"../chunks/chunk-ACYOJ3NW.js";import"../chunks/chunk-FZJY4CF3.js";import{a as c,b as f}from"../chunks/chunk-SA2LYPN7.js";var d=e=>e.split(".").slice(0,2).join("."),p=class extends t{static find(e){return e.querySelector?.(u.tagNames.ssr)??null}get version(){return this.getAttribute("version")??""}get stateData(){let e=this.querySelector('script[type="application/json"]');return null===e?{}:JSON.parse(e.textContent||"{}")}get templates(){let e=new Map;for(let t of Array.from(this.children))"template"===t.localName&&e.set(t.id,t);return e}get hydrateProps(){return{}}getTemplate(e){return this.templates.get(e)??null}verifyVersion(){return d(this.version)===d(e)}};function m(e){let t=u.tagNames.ssr;void 0===e.get(t)&&e.define(t,class extends p{})}var h=()=>u.tagNames.ssr,g=Symbol.for("wcstack.ssr.snapshotBuilder"),b=()=>!0===document.documentElement?.hasAttribute("data-wcs-server"),v=e=>document.createComment(e),y=(e,t)=>null!==e&&8===e.nodeType&&e.data===t,w=(e,t)=>null!==e&&8===e.nodeType&&e.data.startsWith(t),A=new WeakMap,N=new WeakMap,S=new WeakMap,x=new WeakSet,k=new WeakMap;function $(e,t){let l=[];for(let n=e;null!==n&&(l.push(n),n!==t);n=n.nextSibling);return l}function j(e,t,...l){for(let l of Array.from(e.attributes))t.setAttribute(l.name,l.value);return(t.content??t).append(...l),t}var C=e=>null===e.j?e.Ke:e.j[e.j.length-1];function T(e,t,l){let n=[v(null===l?"wcs-[":`wcs-[:${l}`)];for(let e of t)null===l&&n.push(v("wcs-|")),n.push(...$(e.Ke,C(e)));n.push(v("wcs-]")),e.after(...n);for(let e of n)x.add(e)}function W(e){if(e instanceof r){T(e.S,e.$e,null);for(let t of e.$e)M(t);return}let t=e.O;null!==t&&(T(e.Y[e.Y.length-1].S,[t],e.b),M(t))}function M(e){if(null!==e.h)for(let t of e.h)W(t)}var E=new Set(["script","style","template","textarea","title"]),q="data-wcs-raw",O=e=>E.has(e.localName)||e.localName===h();function I(e){for(let t of Array.from(e.childNodes))3===t.nodeType?""===t.data?t.replaceWith(v("wcs-e")):null!==t.nextSibling&&3===t.nextSibling.nodeType&&t.after(v("wcs-s")):1===t.nodeType&&!O(t)&&I(t)}var R=0;function D(t,l){let n=t.getRootNode(),r=[l];for(let e of N.get(n)??[])e!==l&&!0===e.element?.hasAttribute("bind-component")&&r.push(e);let o=new Map;for(let e of r){let t=A.get(e);if(void 0===t)continue;let l=new Map;for(let t of e.ee.values())if(null!==t.E&&l.set(t.E.S,t.E),null!==t.D)for(let e of t.D)l.set(e.S,e);for(let t of e.ie.values())for(let e of t)if(null!==e.M)for(let t of e.M.Y)l.set(t.S,e.M);let n=new Set;for(let[e,r]of t){o.set(e,r);let t=l.get(e);void 0!==t&&!n.has(t)&&e.isConnected&&(n.add(t),W(t))}}for(let e of Array.from(n.querySelectorAll("*"))){let t=S.get(e);if(void 0!==t){let l=document.createTreeWalker(e,133,{acceptNode:e=>x.has(e)||1===e.nodeType&&t.has(e)&&Y(e)?2:1}),n=[];for(let e=l.nextNode();null!==e;e=l.nextNode()){let l=e.previousSibling;(3===e.nodeType?e.data.includes("{{")&&!(O(e.parentNode)?k.has(e):t.has(l)&&w(l,"wcs-t:"))&&(k.has(e)||t.get(e)!==e.data):!t.has(e))&&n.push(e)}for(let e of n)e.remove()}let l=Array.from(e.childNodes);O(e)&&l.some(e=>k.has(e))&&e.setAttribute(q,l.map(e=>k.has(e)?`{{ ${k.get(e)} }}`:8===e.nodeType?`\x3c!--${e.data}--\x3e`:e.textContent).join(""))}I(9===n.nodeType?n.body:n);let i=document.createElement(h());i.setAttribute("version",e);let s=document.createElement("script");s.type="application/json",s.textContent=function(e){return JSON.stringify(e).replace(/[<>&\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(function(e){let t={};for(let l of Object.keys(e)){if("$"===l[0])continue;let n=Object.getOwnPropertyDescriptor(e,l);void 0!==n.get||void 0!==n.set||"function"==typeof n.value||(t[l]=n.value)}return t}(l.target)),i.append(s);for(let[e,t]of o){if(!e.isConnected)continue;let l=e.parentNode;for(;null!==l&&"svg"!==l.localName&&"foreignObject"!==l.localName;)l=l.parentElement;let n="svg"===l?.localName,r=`wcs-${n?"s":"t"}${R++}`;e.replaceWith(v(`wcs-p:${r}`));let o=document.importNode(a(t),!0);for(let e of Array.from(o.querySelectorAll("template")))"http://www.w3.org/2000/svg"===e.namespaceURI&&e.replaceWith(j(e,document.createElement("template"),...e.childNodes));if(n){let e=document.createElementNS(l.namespaceURI,"svg");e.append(o),o=e}let s=document.createElement("template");s.id=r,i.append(j(t,s,o))}t.before(i)}function J(e){!function(e){if(null!==e.querySelector(u.tagNames.state))for(let t of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===t.localName){let e=Array.from(t.options);if(t.multiple||e.some(e=>e.hasAttribute("selected"))||e[t.selectedIndex]!==e.find(e=>!e.disabled))for(let t of e)t.toggleAttribute("selected",t.selected)}else"textarea"===t.localName?t.value!==t.defaultValue&&!t.value.includes("{{")&&!Array.from(t.childNodes).some(e=>k.has(e))&&(t.textContent=t.value):"checkbox"===t.type||"radio"===t.type?t.toggleAttribute("checked",t.checked):"password"!==t.type&&t.value!==t.defaultValue&&t.setAttribute("value",t.value)}(e);for(let t of Array.from(e.querySelectorAll(`${u.tagNames.state}[enable-ssr]`))){if(t.hasAttribute("mount")||t.hasAttribute("bind-component")||t.previousElementSibling?.localName===h())continue;let e=t.engine;null!=e&&D(t,e)}}var K=Symbol.for("wcstack.state.ssr.impl"),P=new Map,U=new WeakMap,Y=e=>!0===c.yo?.(e),F=e=>1===e.nodeType&&!O(e)&&!Y(e),L=e=>e.u.flat().concat(e.K??[]),V=e=>{for(let t of L(e))t.remove()};function z(e,t,l){let n=/^wcs-\[(?::(\d+))?/.exec(e.data),r=e.previousSibling,o=e.parentNode,i=[],a=e.nextSibling;for(e.remove();null!==a&&!y(a,"wcs-]");){let e=a.nextSibling;if(y(a,"wcs-|"))i.push([]),a.remove();else{0===i.length&&i.push([]);let l=i[i.length-1];w(a,"wcs-[")?e=z(a,t,l):(l.push(a),F(a)&&B(a,t))}a=e}let u={branch:void 0===n[1]?null:Number(n[1]),u:i,K:a??o.appendChild(v("wcs-]"))},c=L(u);a=u.K.nextSibling;for(let e of c)l?.push(e),t&&s.add(e);return t&&null!==r?P.set(r,u):V(u),a}function B(e,t){for(let l=e.firstChild;null!==l;)w(l,"wcs-[")?l=z(l,t):(F(l)&&B(l,t),l=l.nextSibling)}function H(e,t,l){let n=e=>{for(let r of Array.from(e.childNodes))if(r.parentNode===e)if(8===r.nodeType){let e=r.data;try{if("wcs-s"===e)r.remove();else if("wcs-e"===e)r.replaceWith("");else if(e.startsWith("wcs-t:")){let t=v(`@@:${decodeURIComponent(e.slice(6))}`),l=r.nextSibling;for(;null!==l&&!y(l,"wcs-/t");){let e=l.nextSibling;l.remove(),l=e}l?.remove(),r.replaceWith(t)}else if(e.startsWith("wcs-p:")){let l=t.querySelector(`template[id="${e.slice(6)}"]`);if(null!==l){let t=r.parentNode,n="s"===e[10]?j(l,document.createElementNS(t.namespaceURI,"template"),...document.importNode(l.content.firstChild,!0).childNodes):document.importNode(l,!0);n.removeAttribute("id"),t.replaceChild(n,r)}}}catch{}}else 1===r.nodeType&&!O(r)&&(Y(r)?U.set(r,{ssr:t,Ae:l}):n(r))};n(e),function(e){for(let t of Array.from(e.querySelectorAll("table > tbody"))){let e=[];for(let l=t.previousSibling;null!==l&&(8===l.nodeType||te(l)||"template"===l.localName);l=l.previousSibling)e.unshift(l);let l=0,n=0;if(e.forEach((e,t)=>{w(e,"wcs-[")?n++:y(e,"wcs-]")&&--n<0&&(n=0,l=t+1)}),0===n)continue;let r=0;for(let n=t.firstChild;null!==n;n=n.nextSibling)if(w(n,"wcs-["))r++;else if(y(n,"wcs-]")&&0===r--){t.prepend(...e.slice(l));break}}}(e),B(e,l)}function Z(e){let t=U.get(e);if(void 0===t||(U.delete(e),H(e,t.ssr,t.Ae),!t.Ae))return null;let l=c.Ae;return c.Ae=re,()=>{c.Ae=l,G()}}function G(){for(let e of P.values())V(e);P.clear()}function Q(e){let t=[];for(let l=document.createTreeWalker(e,128);l.nextNode();)t.push(l.currentNode);return t}function X(e,t,l,n){let r=null;for(let n of e){let e=n[l];null!==e&&(""===e||t===e||t.startsWith(`${e}.`))&&(null===r||e.length>r[l].length)&&(r=n)}let o=r?.[n];if(null==o)return null;let i=r[l],s=""===i?t:t.slice(i.length+1);return""===o?s:""===s?o:`${o}.${s}`}function _(e,t,l){if(b()){if(l instanceof Array){for(let e=l.length;e-- >0;)o(l[e])&&l.splice(e,1);let e=t;if(l.some(i))x.add(e);else if(e.localName.includes("-")&&!Y(e)){let t=new Map;for(let l=document.createTreeWalker(e,133);l.nextNode();)t.set(l.currentNode,l.currentNode.data);S.set(e,t)}return}if("string"==typeof l){if(k.set(t,l),O(t.parentNode))return;let e=v(`wcs-t:${encodeURIComponent(l)}`),n=v("wcs-/t");return t.before(e),void t.after(n)}let n=A.get(e);void 0===n&&A.set(e,n=new Map),n.set(t,l);let r=t.getRootNode(),s=N.get(r);return void 0===s&&N.set(r,s=new Set),void s.add(e)}if("string"!=typeof l&&P.size>0){let e=P.get(l);void 0!==e&&(P.delete(l),P.set(t,e))}}var ee=e=>null!==e&&8===e.nodeType&&[u.commentIfPrefix,u.commentElseIfPrefix,u.commentElsePrefix].includes(e.data),te=e=>3===e.nodeType&&""===e.data.trim(),le=e=>(P.get(e)?.K??e).nextSibling;function ne(e,t){if(t.length!==e.on.childNodes.length)return!1;let l=e.Rn;for(let n=0;n<l.length;n++){let r=l[n],o=e.on,i=t[r[0]];for(let e=0;;){if(o=o.childNodes[r[e]],i?.nodeName!==o.nodeName)return!1;if(++e===r.length)break;i=i.firstChild;for(let t=r[e];t>0&&null!==i;t--)i=le(i)}e.mo[n]=i}return!0}function re(e,t,l){if(0===P.size)return null;let n=t,r=0;if(!l){let e=u.commentIfPrefix;if(!y(t,e))for(let l=t.previousSibling;null!==l&&1!==l.nodeType&&(ee(l)&&r++,!y(l,e));l=l.previousSibling);for(let l=t.nextSibling;!P.has(n)&&null!==l&&!y(l,e)&&1!==l.nodeType;l=l.nextSibling)ee(l)&&(n=l)}let o=P.get(n);if(void 0===o)return null;if(!l&&o.branch!==r)return P.delete(n),V(o),null;let i=o.u.shift();if(0===o.u.length&&P.delete(n),o.K?.replaceWith(...$(t,n)),o.K=null,void 0===i)return null;let s=[];for(let e=0;e<i.length;e++){let t=P.get(i[e]);if(s.push(i[e]),void 0!==t)for(;e<i.length&&i[e]!==t.K;)e++}if(!ne(e,s)){let l=(e.Tn?e.root:e.on).cloneNode(!0);s=e.Tn?[l]:[...l.childNodes],ne(e,s),(i[0]??o.u.find(e=>e.length>0)?.[0]??t).before(l);for(let e of i)e.remove()}return s}var oe={name:"ssr",install(){c.An=_,c.sr=Z;let t=c.element;c.element=(l,r)=>{"mounting"===r&&function(t){let l=t.element;if(!l.hasAttribute("enable-ssr")||b())return;let r=l.previousElementSibling,o=r?.localName===h(),i=o?r.getAttribute("version"):null,s=null===i||d(i)===d(e);if(s){let e=t,l=e.we;e.we=(e,n)=>"$connectedCallback"===e?void 0:l.call(t,e,n)}if(!o)return;let a=!s&&parseInt(i)<4,f=/^3\.(\d+)\.(\d+)$/.exec(i),p=null!==f&&(+f[1]-5||+f[2]-3)>=0;s||console.warn(`[@wcstack/state] <${h()} version="${i}"> does not match ${e}: its snapshot is discarded, and the page renders on the client from its own state.${a&&!p?" 3.x output keeps only the path of a text binding outside a template, so such a binding loses its filters: deploy @wcstack/server 4.0 with this client.":""}`);let m=s?r.querySelector('script[type="application/json"]'):null;if(null!==m){let e=JSON.parse(m.textContent||"{}"),l=t.target;for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(l,t);void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)||(l[t]=e[t])}t.hydrated=!0}let g=l.getRootNode();for(let e of Array.from(g.querySelectorAll(`[${q}]`)))e.textContent=e.getAttribute(q),e.removeAttribute(q);let w=9===g.nodeType?g.body:g;a?function(e,t,l){let r=new Map,o=e=>{let t=e.parentElement;for(;null!==t&&!Y(t);)t=t.parentElement;if(null===t)return null;let l=r.get(t);if(void 0===l){let e=o(t),i=t.querySelector(`:scope > ${u.tagNames.state}[bind-component]`).getAttribute("bind-component");r.set(t,l=[]);for(let r of n(t.getAttribute(u.bindAttributeName)??"")){let t=r.Je;r.ve[0]===i&&l.push([e?X(e,t,1,0):t,r.ve.slice(1).join("."),e&&t])}}return l},i=(e,t,l)=>{let n=o(e);if(null===n)return t;let r=/^([^|]*)#m\d+\.([^|]*)$/.exec(t);if(null===r)return l?t:X(n,t,0,1)??t;let i=r[1].replace(/#m\d+\./g,"").slice(0,-1);return n.some(e=>""===e[1]&&(e[0]===i||e[2]===i))?r[2]:X(n,r[2],2,1)??r[2]};for(let t of Q(e).reverse()){let e=/^@@wcs-(\w+)-start:([\s\S]*)/.exec(t.data);if(null===e)continue;let n=t.nextSibling;for(;null!==n&&!y(n,`@@wcs-${e[1]}-end:${e[2]}`);)n=n.nextSibling;if(null!==n){for(;t.nextSibling!==n;)t.nextSibling.remove();n.remove(),t.replaceWith(..."text"===e[1]?[v(`@@:${i(t,e[2],l)}`)]:[])}}let s=(e,l)=>{for(let n of Q(e)){let e=/^@@wcs-(?:for|if|elseif|else):(\S+)$/.exec(n.data)?.[1],r=Array.from(t.querySelectorAll("template")).find(t=>t.id===e);if(void 0===r)continue;let o=document.importNode(r,!0),a=u.bindAttributeName;o.removeAttribute("id"),o.setAttribute(a,o.getAttribute(a).replace(/^(\s*\w+\s*:\s*)([^\s|]+)/,(e,t,r)=>t+i(l??n,r))),s(o.content,l??n);let c=o.content.firstChild;n.replaceWith(.../^\s*elseif\s*:/.test(c?.getAttribute?.(a)??"")?o.content.childNodes:[o])}};s(e);for(let t of Array.from(e.querySelectorAll("[data-wcs-ssr-id]")))t.removeAttribute("data-wcs-ssr-id")}(w,r,p):H(w,r,s),r.remove(),s&&(c.Ae=re,queueMicrotask(()=>{G(),c.Ae=null}))}(l),t?.(l,r)},function(){let e=globalThis;e[K]={build:J,reset(){R=0}},void 0===e[g]&&(e[g]={protocol:"wcs-ssr-snapshot",version:1,build:t=>e[K].build(t),reset:()=>e[K].reset()})}(),c.$o=f(c.$o,m);for(let e of l())m(e)}},ie=oe;export{ie as default,oe as ssr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,c as e}from"../chunks/chunk-5D34CGCF.js";import{a as n,b as r,c as s,d as i,e as o,j as a}from"../chunks/chunk-
|
|
1
|
+
import{a as t,c as e}from"../chunks/chunk-5D34CGCF.js";import{a as n,b as r,c as s,d as i,e as o,j as a}from"../chunks/chunk-SA2LYPN7.js";var l={},h=/\.\d/,u=new Set(Object.getOwnPropertyNames(Object.prototype)),f=0,c=!1,p=null,d=()=>{c=!1,f++};function g(){if(null===p)if("function"==typeof MessageChannel){let t=new MessageChannel;t.port1.onmessage=d,t.port1.unref?.(),p=()=>t.port2.postMessage(0)}else p=()=>setTimeout(d,0);return c||(c=!0,p()),f}function m(t,e){let n=new Set,r=[t];for(;r.length>0;){let t=r.pop();if(!n.has(t)){n.add(t);for(let n of t.Ee){for(let r of e)if(n.Q(r)&&(n.n===r.n||!(r.n<t.n&&t.f[r.n+1].Q(r))))return!0;null!==n.getter&&r.push(n)}}}return!1}var y=class{constructor(t,e){this.active=!1,this.Xe=new Map,this.n=0,this.Eo=-1,this.Cn=new Set,this.We=null,this.engine=t,this.st=e}er(){let t=this.engine;this.Xe.clear();for(let e of this.st)e.getter=null!==e.p.getter||e.p.de,e.s=new WeakMap,this.prime(e,()=>{0===e.p.n?e.getter&&e.s.set(l,t.v(e.p,null)):this.In(e.p,1,null,n=>{e.getter&&this.prime(e,()=>e.s.set(n,t.v(e.p,n)))})});this.active=!0}prime(t,e){try{e()}catch(e){console.error(`[@wcstack/state] $watch initial evaluation of "${t.t}" threw.`,e),n.ot?.(this.engine,{type:"state:watch-error",phase:"prime",path:t.t,error:e})}}xo(){this.active=!1,this.Xe.clear()}In(t,e,n,r){let s=this.engine.Be(n,t.f[e]);for(let n of s.u)e===t.n?r(n):this.In(t,e+1,n,r)}an(t,e,n,r){let s=this.Xe.get(t);void 0===s&&this.Xe.set(t,s=new Map);let i=s.get(e);void 0===i?s.set(e,[n,this.n,r]):(i[1]<this.n&&(i[1]=this.n),i[2]||=r)}he(t,e,n,r,s){if(this.active){(this.We??=new Set).add(t);for(let i of this.st){let o=i.p;o.n!==t.n||!o.Q(t)||this.an(i,e,i.getter?i.s.get(e??l):o===t&&s&&this.engine.Bt&&(null===r||"object"!=typeof r&&"function"!=typeof r)?n:void 0,!0)}}}ye(t,e){if(this.active)for(let n of this.st)(n.getter||=null!==n.p.getter||n.p.de)&&n.p.n===t.n&&n.p.Q(t)&&this.an(n,e,n.s.get(e??l),!1)}Xt(t,e){if(!this.active)return;let n=null;for(let r of this.st){let s=r.p;if(!(s.n<t.n||s.f[t.n]!==t.o)){n??=new Set(e);for(let e of t.u)n.has(e)||(s.n===t.n?this.an(r,e,void 0,!0):this.In(s,t.n+1,e,t=>this.an(r,t,void 0,!0)))}}}Te(){let t=this.We;if(this.We=null,!this.active||0===this.Xe.size)return;let e=this.Xe;this.Xe=new Map;let r=this.engine,s=[];for(let i of this.st){let o=e.get(i);if(void 0===o)continue;let a,u=[...o].filter(([t])=>null===t||t.y);u.length>1&&u.sort((t,e)=>v(t[0],e[0]));for(let[e,[o,f,c]]of u){let u,p="evaluate",d=r.c;this.n=f+1,r.Ne++;try{if(u=r.v(i.p,e),i.getter&&(i.s.set(e??l,u),Object.is(u,o)&&(h.test(i.t)||null!==e&&!c&&!(a??=null!==t&&m($(i.p),t)))))continue;if(f>32){s.includes(i.t)||s.push(i.t);continue}r.c=e,n.ot?.(r,{type:"state:watch-fired",path:i.t}),p="handler",i.handler.call(r.proxy,u,o,...r._(e))}catch(t){console.error(`[@wcstack/state] $watch "${i.t}" failed; the other watches still run.`,t),n.ot?.(r,{type:"state:watch-error",phase:p,path:i.t,error:t})}finally{r.c=d,this.n=0,r.Ne--}}}s.length>0&&this.No(s)}No(t){let e=g();e!==this.Eo&&(this.Eo=e,this.Cn.clear());let r=t.filter(t=>!this.Cn.has(t));if(0!==r.length){for(let t of r)this.Cn.add(t);console.error("[@wcstack/state] $watch handlers / $stream restarts kept writing for 32 batches; the chain is cut (nothing is rolled back)."),n.ot?.(this.engine,{type:"state:watch-chain-limit",maxDepth:32,paths:r})}}};function $(t){for(;null===t.getter&&null!==t.d;)t=t.d;return t}function v(t,e){let n=[],r=[];for(let e=t;null!==e;e=e.l.re)n.unshift(e.b);for(let t=e;null!==t;t=t.l.re)r.unshift(t.b);for(let t=0;t<n.length&&t<r.length;t++)if(n[t]!==r[t])return n[t]-r[t];return n.length-r.length}var w="$streamStatus",b="$streamError",X=new Set(Object.getOwnPropertyNames(Object.prototype)),j=!1;function k(t,e){for(let n=t;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n)){let t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return void 0!==t.get||void 0!==t.set||"function"==typeof t.value}return!1}var B=class{constructor(t,e,n){this.engine=t,this.entries=e,this.B=n}set(t,e,n){j=!0;try{this.engine.P(this.engine.o(`${t}.${e}`),null,n)}finally{j=!1}}tr(){for(let t of this.entries)this.start(t,!0)}nr(){for(let t of this.entries)t.at=!1,t.X?.abort(),t.X=null}or(){for(let t of this.entries)t.at=!1,null!==t.X&&(t.X.abort(),t.X=null),this.set(w,t.name,"idle")}ye(t){let e=this.B.n;for(let n of this.entries)n.g===t&&(n.n=n.at?Math.max(n.n,e):e,n.at=!0)}Te(){let t=this.engine,n=this.B,r=[];for(let s of this.entries){if(!s.at)continue;let i=s.n;if(s.at=!1,i>32)r.push(s.name),s.g.J=e;else{n.n=i+1,t.Ne++;try{this.start(s,!1)}finally{t.Ne--,n.n=0}}}r.length>0&&n.No(r)}start(t,n){let r,s=this.engine;if(null!==t.X&&t.X.abort(),t.X=null,null!==t.g){let i=t.g;i.getter=t.args;let o=i.Ee.slice();O(i);try{r=s.read(i,null),function(t,e,n){null!==n&&"function"==typeof n?.then&&a(`$stream "${t}": args must be synchronous (it returned a Promise).`);for(let n of e.Ee)n.n>0&&a(`$stream "${t}": args must not read a wildcard path ("${n.t}").`),(n.t===t||n.t===`${w}.${t}`||n.t===`${b}.${t}`)&&a(`$stream "${t}": args must not read the stream itself ("${n.t}").`)}(t.name,i,r)}catch(r){O(i);for(let t of o)t.jn(i);if(i.J=e,n)throw r;return this.set(b,t.name,r),void this.set(w,t.name,"error")}}let i=new AbortController;t.X=i,s.P(s.o(t.name),null,t.H),this.set(b,t.name,null),this.set(w,t.name,"active"),this.ir(t,i,r)}async ir(t,e,n){let r=this.engine,s=e.signal,i=()=>!s.aborted&&t.X===e,o=r.o(t.name),a=this.B.n,l=g(),h=t=>{g()===l&&(this.B.n=a);try{t()}finally{this.B.n=0}},u=t.H;try{let e=await t.source(n,s);if(!i())return;let a=e=>{u=void 0!==t.Ro?t.Ro(u,e):e,h(()=>r.P(o,null,u))};if(null!==e&&"function"==typeof e?.getReader){let t=e.getReader();for(s.addEventListener("abort",()=>{t.cancel().catch(()=>{})});;){let e=await t.read();if(!i())return;if(e.done)break;a(e.value)}}else{if(null===e||"function"!=typeof e?.[Symbol.asyncIterator])throw new TypeError(`$stream "${t.name}": source must return an async iterable or a ReadableStream`);{let t=e[Symbol.asyncIterator]();for(s.addEventListener("abort",()=>{t.return?.()});;){let e=await t.next();if(!i())return;if(e.done)break;a(e.value)}}}if(!i())return;t.X=null,h(()=>this.set(w,t.name,"done"))}catch(n){if(!i())return;t.X=null,e.abort(),h(()=>{this.set(b,t.name,n),this.set(w,t.name,"error")})}}};function O(e){for(let t of e.Ee){let n=t.G.indexOf(e);n>=0&&t.G.splice(n,1),t.Ot.delete(e)}e.Ee.length=0,e.J=t}var E=new WeakMap;function T(t){let e=E.get(t);return e?.target===t.target?e:void 0}function S(t,e){let r=new y(t,function(t,e){if(void 0===e)return[];(null===e||"object"!=typeof e)&&a("$watch must be an object mapping paths to handler functions.");let r=[];for(let s of Object.keys(e)){let i=e[s];(""===s||"$"===s[0]||s.includes("@")||u.has(s))&&a(`$watch path "${s}" is not a path of the state tree.`),"function"!=typeof i&&a(`$watch entry "${s}" must be a function.`);let o=t.o(s);n.go?.(t,o,!0),r.push({t:s,p:o,handler:i,getter:!1,s:new WeakMap})}return r}(t,e.$watch)),s=new B(t,function(t,e){let n=e.$stream;if(void 0===n)return[];(null===n||"object"!=typeof n)&&a("$stream must be an object mapping stream names to definitions.");let r=[],s={},i={};for(let o of Object.keys(n)){let l=n[o];(""===o||"$"===o[0]||/[.*]/.test(o)||X.has(o))&&a(`$stream entry "${o}" must be a flat property name.`),(null===l||"object"!=typeof l)&&a(`$stream entry "${o}" must be an object.`);let h=l.source,u=l.fold,f=l.args,c=l.initial;"function"!=typeof h&&a(`$stream entry "${o}" needs a source function.`),void 0!==u&&"function"!=typeof u&&a(`$stream entry "${o}": fold must be a function.`),void 0!==u&&!("initial"in l)&&a(`$stream entry "${o}": fold needs an initial value.`),void 0!==f&&"function"!=typeof f&&a(`$stream entry "${o}": args must be a function.`),k(e,o)&&a(`$stream entry "${o}" collides with a getter, setter or method of the state.`),void 0===e[o]&&(e[o]=c),s[o]="idle",i[o]=null,r.push({name:o,source:h,Ro:u,H:c,X:null,at:!1,n:0,g:void 0===f?null:t.o(`$streamArgs.${o}`),args:void 0===f?null:function(){return f(this)}})}return e[w]=s,e[b]=i,r}(t,e),r),i=E.get(t);void 0!==i&&(i.B.xo(),i.Tt.nr()),E.set(t,{B:r,Tt:s,Ye:i?.Ye??!1,target:e})}function P(t,e){let n=E.get(t);if(void 0!==n&&"mounting"!==e&&!document.documentElement?.hasAttribute("data-wcs-server")&&("reset"!==e&&(n.Ye="connected"===e),n.target===t.target)){if("disconnected"===e)return n.B.xo(),void n.Tt.or();n.Ye&&(n.B.er(),n.Tt.tr())}}var C=["$streamStatus","$streamError"],M={name:"temporal",install(){n.se=r(n.se,S),n.element=r(n.element,P),n.he=r(n.he,(t,e,n,r,s,i)=>T(t)?.B.he(e,n,r,s,i)),n.ye=r(n.ye,(t,e,n)=>{let r=T(t);void 0!==r&&(r.B.ye(e,n),r.Tt.ye(e))}),n.Xt=r(n.Xt,(t,e,n)=>T(t)?.B.Xt(e,n)),n.Te=r(n.Te,t=>{let e=T(t);void 0!==e&&(e.B.Te(),e.Tt.Te())}),n.tt=s(o,n.tt,(t,e)=>{let n=e.split(".",1)[0];if(C.includes(n))return n===e?t.target[e]:t.read(t.o(e),null)}),n.Pe=s(i,n.Pe,(t,e)=>(!j&&36===e.t.charCodeAt(0)&&C.includes(e.t.split(".",1)[0])&&a(`"${e.t}" is read-only (the stream runtime owns it).`),!1))}},N=M;export{N as default,M as temporal};
|
package/dist/wcs-manifest.json
CHANGED
|
@@ -695,6 +695,60 @@
|
|
|
695
695
|
"scopes",
|
|
696
696
|
"recursion",
|
|
697
697
|
"ssr",
|
|
698
|
-
"devtools"
|
|
699
|
-
|
|
698
|
+
"devtools",
|
|
699
|
+
"native-commands"
|
|
700
|
+
],
|
|
701
|
+
"nativeCommands": {
|
|
702
|
+
"*": [
|
|
703
|
+
"focus",
|
|
704
|
+
"blur",
|
|
705
|
+
"click",
|
|
706
|
+
"scrollIntoView",
|
|
707
|
+
"showPopover",
|
|
708
|
+
"hidePopover",
|
|
709
|
+
"togglePopover"
|
|
710
|
+
],
|
|
711
|
+
"dialog": [
|
|
712
|
+
"show",
|
|
713
|
+
"showModal",
|
|
714
|
+
"close",
|
|
715
|
+
"requestClose"
|
|
716
|
+
],
|
|
717
|
+
"form": [
|
|
718
|
+
"requestSubmit",
|
|
719
|
+
"checkValidity",
|
|
720
|
+
"reportValidity"
|
|
721
|
+
],
|
|
722
|
+
"input": [
|
|
723
|
+
"select",
|
|
724
|
+
"setSelectionRange",
|
|
725
|
+
"showPicker",
|
|
726
|
+
"setCustomValidity",
|
|
727
|
+
"checkValidity",
|
|
728
|
+
"reportValidity"
|
|
729
|
+
],
|
|
730
|
+
"textarea": [
|
|
731
|
+
"select",
|
|
732
|
+
"setSelectionRange",
|
|
733
|
+
"setCustomValidity",
|
|
734
|
+
"checkValidity",
|
|
735
|
+
"reportValidity"
|
|
736
|
+
],
|
|
737
|
+
"select": [
|
|
738
|
+
"showPicker",
|
|
739
|
+
"setCustomValidity",
|
|
740
|
+
"checkValidity",
|
|
741
|
+
"reportValidity"
|
|
742
|
+
],
|
|
743
|
+
"audio": [
|
|
744
|
+
"play",
|
|
745
|
+
"pause",
|
|
746
|
+
"load"
|
|
747
|
+
],
|
|
748
|
+
"video": [
|
|
749
|
+
"play",
|
|
750
|
+
"pause",
|
|
751
|
+
"load"
|
|
752
|
+
]
|
|
753
|
+
}
|
|
700
754
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./chunk-SEPY6OHJ.js";import{a as t,d as n,e as l,j as i,k as r}from"./chunk-372Y2FIC.js";import{a as o,g as s}from"./chunk-HSOCDTWX.js";import{a as u}from"./chunk-5D34CGCF.js";import{a,b as h,c,d as f,e as d,f as m,g as p,h as v,i as g,j as b,k as w,l as y,n as x}from"./chunk-5LIOXC7W.js";import{a as S,b as k}from"./chunk-ROX5KEJX.js";import{a as N}from"./chunk-G2ZO6SXV.js";var A=new Map,E=new Set(["if","elseif","else","for"]),$=new Set([a,"if","elseif","for","..."]),I=new Set([d,m,p,f,h,c]);function T(e){let t=function(e){return w(e,";")}(e).map(g).filter(e=>e.length>0).map(e=>{let t=b(e,":");-1===t&&k(101,[e]);let n=e.slice(0,t).trim(),l=e.slice(t+1).trim(),i=n.split("#")[0].split("|")[0].trim();if($.has(i)){let t;return i!==n&&k(102,[e,i]),i===a?(l.length>0&&k(103,[e]),t={Je:"#else",Qe:[]}):"..."===i?(0===l.length&&k(104,[e]),t=x(l),t.Qe.length>0&&k(105,[e])):(t=x(l),"for"===i&&t.Qe.length>0&&k(121,[e])),{be:i,ve:[i],tn:[],I:[],...t,w:"..."===i?"spread":i}}let r=x(l),o=function(e){let[t,n]=y(e,"input",A),l=t.split("#").map(g);l.length>2&&k(115,[t]);let[i,r]=l,o=i.split(".").map(g);return!(o.length>1&&""===o[0])&&(0===i.length||o.some(e=>0===e.length))&&k(116,[e]),{be:i,ve:o,tn:r?r.split(",").map(g):[],I:n}}(n),[s]=o.ve;if(""===s&&o.ve.length>1){let e=o.ve.slice(1);return(e.includes("")||I.has(e[0]))&&k(106,[n]),{...o,be:e.join("."),ve:e,...r,w:"prop"}}return{...o,...r,w:"radio"===i||"checkbox"===i?i:s===h||s.startsWith("on")?"event":"prop"}});return t.length>1&&t.some(e=>E.has(e.w))&&k(201,[e]),t}function j(e,t){if(null!==e)for(let n=0;n<e.length;n++)t=e[n](t);return t}function P(t){return 0===t.length?null:(e(),t.map(e=>s(e.Ln,e.args,e.literals)))}var C=Symbol.for("wcstack.state.view-transition-naming"),O=new WeakSet;function L(){let e=t("state");return null!==e&&"auto"===e.naming?e.namingLimit:-1}var V=new Set(["click","dblclick","input","change","submit","keydown","keyup","mousedown","mouseup","pointerdown","pointerup"]),M=0,R=2,W=3,D=4,Y=5,H=["text","prop","prop","prop","prop","event","for","if","prop","radio","checkbox","prop","prop","event","spread"],B=(e,t,n,l)=>e.Yt(t,n.o?.t??n.Et,l,H[n.i]),Q=Symbol();function U(e,t,n){let l=t.V;return null===l||"state"===l||"auto"===l&&void 0!==e.v(t.o,n)?t.H:Q}var q=class{constructor(e,t,n,l,i,r,o,s,u,a=null){this.Z=!1,this.I=null,this.attribute=null,this.En=!1,this.engine=e,this.i=t,this.a=n,this.name=l,this.o=i,this.r=r,this.$n=o,this.x=s,this.value=u,this.M=a}en(){return H[this.i]}apply(){if(null!==this.M)return void this.M.kt();let e=j(this.x,this.engine.read(this.o,this.r));if(e===this.value&&("object"!=typeof e||null===e||11===this.i||8===this.i||i(this.name)))return;if(this.value===Q)return void(this.value=e);let t=this.a;if(11!==this.i)9===this.i?t.checked=void 0!==e&&this.nn()===e:10===this.i?t.checked=Array.isArray(e)&&e.includes(this.nn()):z(this.i,t,this.name,e),this.value=e;else{if(void 0===e)return void(this.value=e);this.value=e,this.En=!0;try{t[this.name]!==e&&(t[this.name]=e)}finally{this.En=!1}null!==this.attribute&&function(e,t,n){try{if(null==n)e.removeAttribute(t);else{let l=n;if("object"==typeof n)try{l=JSON.stringify(n)}catch{}e.setAttribute(t,String(l))}}catch{}}(t,this.attribute,e)}}nn(){return j(this.I,this.a.value)}Yo(){let e,t=this.a,n=this.engine;if(9===this.i){if(!t.checked)return;e=this.nn()}else if(10===this.i){let l=this.nn(),i=n.v(this.o,this.r),r=Array.isArray(i)?i:[],o=r.includes(l);if(t.checked?o:!o)return;e=o?r.filter(e=>e!==l):[...r,l]}else e=j(this.I,t[this.name]);n.P(this.o,this.r,e,!1,!0)}},J=e=>"textContent"===e||"innerText"===e||"innerHTML"===e;function z(e,t,n,l){switch(e){case 0:return void(t.data=null==l?"":String(l));case 1:return void(J(n)?t[n]="innerHTML"===n?r(l):null==l?"":String(l):i(n)?null==l&&"srcdoc"===n?t.removeAttribute(n):void 0!==l&&(t[n]=r(l)):void 0!==l&&(t[n]!==l&&!("value"===n&&t.value===String(l))&&(t[n]=l),("value"===n||"selectedIndex"===n)&&"select"===t.localName&&(t[F]=[n,l])));case 8:return void(t.innerHTML=r(l));case 2:return null!=l&&"boolean"!=typeof l&&k(401,[n,typeof l]),void t.classList.toggle(n,!0===l);case 3:return void(null==l?t.removeAttribute(n):t.setAttribute(n,String(l)));case 4:return void(null==l?t.style.removeProperty(n):t.style.setProperty(n,String(l)))}}var F=Symbol();function K(e){let t="optgroup"===e.localName?e.parentNode:e,n=t?.[F];void 0!==n&&(t[n[0]]=n[1])}var X=class{constructor(e,t,n,l){this.y=!0,this.fe=null,this.h=null,this.$t=null,this.Nn=null,this.r=e,this.Ke=t,this.j=n,this.A=l}Ho(e,t){let n=t.target,l=this.A,i=[],r=null;for(let t of l.xe){if(t.name!==e)continue;let o=l.Rn[t.a],s=ue(null===this.j?this.Ke:this.j[o[0]],o,1);s.contains(n)&&(s!==r&&i.unshift([]),i[0].push(t),r=s)}for(let e of i){for(let n of e)n.xn(t,this.r);if(t.cancelBubble)return!0}return!1}get s(){return null===this.j?this.Ke:this.j[this.j.length-1]}Ue(){let e=this.Nn;return(null===e?null:e.Pn(this.Ke))??this.Ke}insertBefore(e,t){let n=this.s;for(let l=this.Ue();;){let i=l.nextSibling;if(e.insertBefore(l,t),l===n)return;l=i}}uo(){null===this.j?this.Ke.remove():ae(this.Ue(),this.s)}Se(e){if(this.y=!1,null!==this.$t)for(let e of this.$t)e();let t=this.fe;if(null!==t)for(let n=0;n<t.length;n++)e.kn(t[n]);if(null!==this.h)for(let e of this.h)e.Se()}},Z=class extends X{constructor(e,t,n,l){super(e,t,n,l),this.fo=0,this.W=null,this.ae=0===l.qe.length?null:new Array(2*l.qe.length)}po(e,t){let n=this.W??=new Array(this.A.qe.length),l=n[t];if(void 0===l){let i=this.A.qe[t],r=this.ae;l=n[t]=new q(e,i.i,r[2*t],i.name,i.o,this.r,this,i.x,r[2*t+1])}return l}no(e,t){let n=this.A.qe;for(let l=0;l<n.length;l++)n[l].o.Q(t)&&e.Qt(this.po(e,l))}Se(e){let t=this.r;t.E===this&&(t.E=null),super.Se(e)}};function _(e,t,n,i){let r=l(n,t.n);try{return e.Be(r,t)}catch(n){return e.Yt(n,t.t,i,"for"),null===r?e.ee.get(t):r.h.get(t)}}function G(e,t,n){n&&e.zo(t);let l=t.$n;null!==l&&(l.fe??=[]).push(t)}var ee=null;function te(){let e=ee;return ee=null,e}var ne=-1;function le(e,t,n,l,i=null){let r,o=t.Rn,s=t.build,u=t.mo,a=null,h=N.Ae?.(t,null===l?i:l.S,null!==l),c=!h&&t.Tn,f=h?document.createDocumentFragment():(c?t.root:t.on).cloneNode(!0);if(!h)for(let e=0;e<s.length;e++){let t=s[e];u[t]=ue(f,o[t],c?1:0)}c?r=f:(a=h||[...f.childNodes],r=a[0]);let d,m=null;if(null!==l?(d=m=new Z(n,r,a,t),null===l.map?n.E=m:l.map.set(n,m)):d=new X(n,r,a,t),ne>=0&&function(e,t,n,l){let i=null;if(null===t)i=1===e.nodeType?e:null;else for(let e=0;e<t.length&&null===i;e++)1===t[e].nodeType&&(i=t[e]);let r=i?.style;if(null===i||void 0===r||O.has(i))return;let o=globalThis[C]??={counter:0,assigned:0,warned:!1};o.assigned>=l?o.warned||(o.warned=!0,console.warn(`[@wcstack/state] ${S(25,[l])}`)):(O.add(i),o.assigned++,r.setProperty("view-transition-name",`wcs-${n}-${++o.counter}`),r.setProperty("view-transition-class",`wcs-${n}`))}(r,a,null!==l?"row":"branch",ne),t.xe.length>0){let t=e.Bn;if(null===a)r[t]=d;else for(let e of a)1===e.nodeType&&(e[t]=d)}let p=t.Xo,v=e.Ie,g=t.Go?u.slice(0,o.length):u,b=null===m?null:m.ae;if(null!==b){let e=t.qe;for(let t=0;t<e.length;t++)b[2*t]=g[e[t].a],b[2*t+1]=e[t].H}for(let t=0;t<p.length;t++){let l=p[t],i=g[l.a],o=l.F;if(o>=0&&null!==b){let t=m.W?.[o];if(void 0!==t){t.Z=!1,e._e(t);continue}try{let t=j(l.x,e.read(l.o,n));t!==l.H&&(z(l.i,i,l.name,t),b[2*o+1]=t),null!==v&&e.io(l.o,n)}catch(t){e.St(t,m.po(e,o))}continue}switch(l.i){case 6:{let t=new se(e,l.A,_(e,l.o,n,i),i);(d.h??=[]).push(t),i===r&&(d.Nn=t),t.kt();break}case 7:{let t=re(e,l.Y.map(e=>({A:e.A,o:e.o,x:e.x,S:g[e.a]})),n,d);(d.h??=[]).push(t),i===r&&(d.Nn=t);break}default:try{ie(e,l,i,n,d)}catch(t){B(e,t,l,i)}}}return ee=d,f}function ie(e,t,n,i,r){let o=n;switch(t.i){case 5:return void function(e,t,n,l,i){let r=n.xn,o=e=>r(e,l);if(n.Ze){let l=e.eo(n.name),i=t[l];t[l]=void 0===i?o:e=>{i(e),o(e)},n.ke&&t.addEventListener(n.name,e=>e.bubbles||o(e))}else t.addEventListener(n.name,o),n.co&&null!==i&&(i.$t??=[]).push(()=>t.removeEventListener(n.name,o))}(e,n,t,i,r);case 12:return void fe(e,t,o,r,n=>function(e,t,n,l,i){let r=t.name,o=e.command(t.Et.slice(9));null===i&&me(1202,n,`command.${r}`),i.commands.has(r)||k(1203,[n.localName,r]);let s=new WeakRef(n),u=o.subscribe((...e)=>{let t=s.deref();if(void 0!==t)return t.isConnected?t[r](...e):void 0;u()});null!==l&&(l.$t??=[]).push(u)}(e,t,o,r,n));case 13:return void fe(e,t,o,r,n=>function(e,t,n,l,i){let r=t.name;null===i&&me(1202,n,`eventToken.${r}`);let o=i.properties.get(r);void 0===o&&k(1204,[n.localName,r]);let s=t.Et;n.addEventListener(o.event,n=>{t.xt&&n.preventDefault(),t.Nt&&n.stopPropagation();try{e.Ko(s,n,l)}catch(e){console.error(e)}})}(e,t,o,i,n))}let s=t.o,u=l(i,s.n);if(14===t.i)return void fe(e,t,o,r,n=>function(e,t,n,l,i,r){null===r&&me(1501,n,`"...: ${t.o.t}"`);let o=new Set([...r.properties.keys(),...r.inputs.keys()]);for(let s of o){if(t.ao?.includes(s))continue;let o=e.o(`${t.o.t}.${s}`),u=0===o.n?null:l;de(e,{...t,V:null,z:null},n,s,o,u,i,r)}}(e,t,o,u,r,n));if(t.ke&&1===t.i)return void fe(e,t,o,r,n=>function(e,t,n,l,i,r){if(null!==r)return void de(e,t,n,t.name,t.o,l,i,r);let o=new q(e,1,n,t.name,t.o,l,i,t.x,U(e,t,l));o.I=t.I,!N.Jo?.(o,t.ro)&&(G(e,o,!0),e._e(o))}(e,t,o,u,r,n));let a=new q(e,t.i,n,t.name,s,u,r,t.x,U(e,t,u));a.I=t.I,G(e,a,!0),e._e(a),null!==t.Rt&&n.addEventListener(t.Rt,()=>a.Yo())}function re(e,t,n,i){let r=new oe(e,t,n),o=null;for(let s of t){if(null===s.o)continue;let t=s.o,u=new q(e,7,s.S,"if",t,l(n,t.n),i,null,void 0,r);G(e,u,!0),null===i&&r.ie.push(u),o??=u}return e._e(o),r}var oe=class{constructor(e,t,n){this.y=!0,this.O=null,this.b=-1,this.ie=[],this.engine=e,this.Y=t,this.r=n}Pn(e){return null!==this.O&&this.Y[this.b].S===e?this.O.Ue():null}kt(){let e=this.engine,t=-1;for(let n=0;n<this.Y.length;n++){let i=this.Y[n];if(null===i.o||j(i.x,e.read(i.o,l(this.r,i.o.n)))){t=n;break}}if(t!==this.b&&(ne=L(),null!==this.O&&(this.O.uo(),this.O.Se(e),this.O=null),this.b=t,t>=0)){let n=this.Y[t],l=le(e,n.A,this.r,null,n.S);this.O=te();let i=n.S.parentNode;i.insertBefore(l,n.S),K(i)}}Se(){this.y=!1;for(let e of this.ie)this.engine.kn(e);null!==this.O&&this.O.Se(this.engine)}},se=class{constructor(e,t,n,l){this.y=!0,this.$e=[],this.engine=e,this.A=t,this.l=n,this.S=l,null===n.E?(n.E=this,this.map=null):((n.D??=[]).push(this),this.map=new Map)}Pn(e){return 0===this.$e.length?null:this.$e[0].Ue()}Pt(e){return null===this.map?e.E:this.map.get(e)??null}ho(e){let t=this.map;null!==t&&t.get(e.r)===e&&t.delete(e.r),e.Se(this.engine)}kt(){let e=this.engine,t=this.l.u,n=this.$e;ne=L();let l=t.length,i=n.length,r=this.S,o=r.parentNode;if(0===l){if(i>0){ae(n[0].Ue(),n[i-1].s);for(let e=0;e<i;e++)this.ho(n[e])}return void(this.$e=[])}let s=new Array(l),u=0;for(;u<l&&u<i&&this.Pt(t[u])===n[u];)s[u]=n[u],u++;let a=i-1,h=l-1;for(;a>=u&&h>=u&&this.Pt(t[h])===n[a];)s[h]=n[a],a--,h--;for(let e=u;e<=a;e++){let t=n[e],l=t.r;l.y&&this.Pt(l)===t?t.fo=e:(t.uo(),this.ho(t))}if(u<=h){let n=h-u+1,a=new Int32Array(n),c=!1;if(i>0)for(let e=0;e<n;e++){let n=this.Pt(t[u+e]);null!==n&&n.y?(a[e]=n.fo,c=!0):a[e]=-1}let f=h+1<l?s[h+1].Ue():r;if(c){let l=function(e){let t=e.length,n=new Uint8Array(t),l=new Int32Array(t).fill(-1),i=[];for(let n=0;n<t;n++){let t=e[n];if(t<0)continue;let r=0,o=i.length;for(;r<o;){let n=r+o>>1;e[i[n]]<t?r=n+1:o=n}r>0&&(l[n]=i[r-1]),i[r]=n}let r=i.length>0?i[i.length-1]:-1;for(;r>=0;)n[r]=1,r=l[r];return n}(a),i=f;for(let r=n-1;r>=0;r--){let n=t[u+r],a=this.Pt(n);null!==a&&a.y?0===l[r]&&a.insertBefore(o,i):(o.insertBefore(le(e,this.A,n,this),i),a=te()),s[u+r]=a,i=a.Ue()}}else{let n=document.createDocumentFragment();for(let l=u;l<=h;l++)n.appendChild(le(e,this.A,t[l],this)),s[l]=te();o.insertBefore(n,f)}}this.$e=s,K(o)}Se(){this.y=!1;let e=this.l;if(e.E===this)e.E=null;else if(null!==e.D){let t=e.D.indexOf(this);t>=0&&e.D.splice(t,1),0===e.D.length&&(e.D=null)}for(let e of this.$e)e.Se(this.engine);this.map?.clear()}};function ue(e,t,n){for(;n<t.length;n++){e=e.firstChild;for(let l=t[n];l>0;l--)e=e.nextSibling}return e}function ae(e,t){let n=document.createRange();n.setStartBefore(e),n.setEndAfter(t),n.deleteContents()}var he=new WeakMap,ce=e=>e.customElementRegistry??customElements;function fe(e,t,n,l,i,r=!1){let o=n.localName;if(!o.includes("-"))return i(null);let s=ce(n);if(!r&&!n.isConnected&&void 0===s.get(o)&&"customElementRegistry"in n)return void queueMicrotask(()=>fe(e,t,n,l,i,!0));let u=()=>{let e=s.get(o);s.upgrade(n),i(e?function(e){if(he.has(e))return he.get(e);let t=e.wcBindable,n=null;if(null!==t&&"object"==typeof t&&"wc-bindable"===t.protocol&&Number.isInteger(t.version)&&t.version>=1){n={properties:new Map,inputs:new Map,commands:new Set};for(let e of t.properties??[])n.properties.set(e.name,{event:e.event,getter:"function"==typeof e.getter?e.getter:null,lo:"event"===e.semantics});for(let e of t.inputs??[])n.inputs.set(e.name,{attribute:"string"==typeof e.attribute?e.attribute:null});for(let e of t.commands??[])null!==e&&"object"==typeof e&&"string"==typeof e.name&&n.commands.add(e.name)}return he.set(e,n),n}(e):null)};if(!r&&void 0!==s.get(o))return u();null!==l&&!l.y||function(e,t,n){let l=n;null!==t&&(t.$t??=[]).push(()=>{l=null}),e.then(()=>l?.())}(s.whenDefined(o),l,()=>{try{u()}catch(l){B(e,l,t,n)}e.Re()})}function de(e,t,n,l,i=t.o,r,o,s){let u=s.properties.get(l)??null,a=s.inputs.get(l),h=e.Mt;h&&null===u&&void 0===a&&k(38,[l]);let c=t.V;(null===u?"element"===c||"auto"===c:void 0===a&&("state"===c||"auto"===c))&&k(39,[c,l]),"connect"===t.z&&null===u&&k(40,[l]);let f=h&&null!==u&&void 0===a,d=new q(e,11,n,l,i,r,o,t.x,void 0);d.I=t.I,d.attribute=a?.attribute??null,G(e,d,!f),null!==u&&!t.ro&&n.addEventListener(u.event,t=>{let i;null!==u.getter?i=u.getter(t):(i=t.detail,u.lo||N.detail?.(n,l,i)),(!d.En||!Object.is(i,d.value))&&(i=j(d.I,i),null===d.x&&(d.value=i),e.P(d.o,d.r,i,u.lo,!0))});let m=c??(f?"element":"state");if("state"===m)f||e._e(d);else if("element"===m||"auto"===m){let i=()=>{if(null!==o&&!o.y)return;if("auto"===m&&void 0!==e.v(d.o,d.r))return void(f||e._e(d));let t=n[l];null===d.x&&(d.value=t),e.P(d.o,d.r,t,!1,!0)};"connect"!==t.z||n.isConnected?i():Promise.resolve().then(i)}return d}function me(e,t,n){k(e,[t.localName,n])}var pe=()=>o.bindAttributeName;function ve(){return{a:0,i:1,name:"",o:null,x:null,H:u,xn:null,A:null,Y:null,I:null,Rt:null,ke:!1,V:null,z:null,ro:!1,xt:!1,Nt:!1,Et:null,ao:null,F:-1,Ze:!1,co:!1}}var ge=["state","element","auto","none"],be=["call","connect"],we="$command.";function ye(e,t,n){v.test(t)&&(null===n&&k(1401,[t,Number(t.slice(1))]),t=`${n.t}.*.${t}`);let l=e.o(function(e,t){return 46!==e.charCodeAt(0)?e:(null===t&&k(1402,[e]),"."===e?`${t.t}.*`:`${t.t}.*${e}`)}(t,n)),i=null===n?0:n.n+1;l.n>i&&k(1401,[l.t,l.n,i]);for(let e=1;e<=l.n;e++){let t=e===i?n:n.f[e];l.f[e]!==t&&k(1403,[l.t,l.f[e].t,t.t])}return N.go?.(e,l),l}var xe=e=>1===e.i&&("outerHTML"===e.name||"outerText"===e.name),Se=e=>8===e.i||xe(e)||1===e.i&&J(e.name);function ke(e){k(202,[e])}function Ne(e,t,l,r,o){let s=T(t).map(t=>function(e,t,l,r,o){let s=function(e,t){let n=t.find(e=>e.startsWith("on")),l=null,i=null;for(let n of t){let t=n.indexOf("=");if(t<0)continue;e.Mt||k(31);let r=n.slice(0,t).trim(),o=n.slice(t+1).trim(),s="init"===r;!s&&"sync"!==r&&k(33,[r,n]),null!==(s?l:i)&&k(34,[r]),(s?ge:be).includes(o)||k(35,[r,o]),s?l=o:i=o}return{ro:t.includes("ro"),xt:t.includes("prevent"),Nt:t.includes("stop"),event:n?n.slice(2):null,V:l,z:i}}(e,t.tn),u=r.localName.includes("-"),a=t.ve,h=t.Je;if("event"===t.w){if(null!==s.V&&"none"!==s.V&&k(36),"eventToken"===a[0])return{...ve(),a:o,i:13,name:a.slice(1).join("."),Et:h,ke:u,xt:s.xt,Nt:s.Nt};let l=h.startsWith(we)?h.slice(9):null,{xt:i,Nt:r}=s,c=t.be.slice(2),f=t.tn.includes("direct"),d=!f&&V.has(c);return d&&e.eo(c),{...ve(),a:o,i:5,name:c,Ze:d,ke:u,co:f,xn(t,o){i&&t.preventDefault(),r&&t.stopPropagation();try{if(null!==l)e.Uo(l,t,o);else{let l=e.qo(h,t,o);n(l)&&l.then(void 0,e=>console.error(e))}}catch(e){console.error(e)}}}}if("spread"===t.w)return{...ve(),a:o,i:14,o:ye(e,h,l),ke:u};if("command"===a[0]&&a.length>1)return h.startsWith(we)||k(1201,[t.be,h]),{...ve(),a:o,i:12,name:a.slice(1).join("."),Et:h,ke:u};let c=ye(e,h,l),f={...ve(),a:o,i:1,name:t.be,o:c,x:P(t.Qe),I:P(t.I),ro:s.ro,V:s.V,z:s.z};if("radio"===t.w||"checkbox"===t.w)return("element"===s.V||"auto"===s.V)&&k(37,[t.w,s.V]),f.i="radio"===t.w?9:10,s.ro||(f.Rt=s.event??"input"),f;if(a.length>1){let e=a.slice(1).join("."),t=a[0];if("class"===t||"attr"===t||"style"===t)return f.V=null,f.name=e,"class"===t?(f.i=2,f.H=r.classList.contains(e)):f.i="attr"===t?"srcdoc"===e&&"iframe"===r.localName?1:3:4,f}return"html"===t.be?(f.i=8,f):(f.name="text"===t.be?"textContent":t.be,f.ke=u&&!i(f.name),!u&&!s.ro&&function(e,t){let n=e.localName;if("input"===n){let n=(e.getAttribute("type")||"text").toLowerCase();return"button"!==n&&(("radio"===n||"checkbox"===n)&&"checked"===t||"value"===t||"valueAsNumber"===t||"valueAsDate"===t)}return("select"===n||"textarea"===n)&&"value"===t}(r,f.name)&&(f.Rt=s.event??("select"===r.localName?"change":"input")),f)}(e,t,l,r,o));for(let e=0;e<s.length;e++)14===s[e].i&&(s[e].ao=s.slice(e+1).filter(e=>1===e.i).map(e=>e.name));return s}var Ae=/\{\{([\s\S]+?)\}\}/g;function Ee(e){let t=e.data,n=[],l=0;Ae.lastIndex=0;for(let i=Ae.exec(t);null!==i;i=Ae.exec(t)){let r=Ae.lastIndex-i[0].length;r>l&&e.before(t.slice(l,r));let o=e.ownerDocument.createTextNode("");e.before(o),n.push({a:o,Qo:i[1].trim()}),l=Ae.lastIndex}return 0===n.length||(l<t.length&&e.before(t.slice(l)),e.remove()),n}function $e(e,t,n,l){let i=function(e){return{be:"textContent",ve:["textContent"],tn:[],I:[],...x(e),w:"text"}}(t);return{...ve(),a:l,i:0,o:ye(e,i.Je,n),x:P(i.Qe),H:""}}function Ie(e){let t=e.getAttribute(pe());if(null===t)return null;let n=T(t)[0];return void 0===n||"for"!==n.w&&"if"!==n.w&&"elseif"!==n.w&&"else"!==n.w?null:n}var Te=(e,t)=>0===e?o.commentIfPrefix:null===t.o?o.commentElsePrefix:o.commentElseIfPrefix;function je(e,t,n){let l=(t,l)=>({el:t,o:"else"===l.w?null:ye(e,l.Je,n),x:"else"===l.w?null:P(l.Qe)}),i=[l(t,Ie(t))];for(let e=t.nextSibling;null!==e;e=e.nextSibling){if(3===e.nodeType&&""===e.data.trim()||8===e.nodeType)continue;if(1!==e.nodeType||"template"!==e.localName)break;let t=Ie(e);if(null===t||"elseif"!==t.w&&"else"!==t.w||(i.push(l(e,t)),"else"===t.w))break}return i}var Pe=new WeakSet;function Ce(e,t,n,l,i,r,s,u){let a=(t,n)=>{let i=document.createComment(n);return t.replaceWith(i),l&&N.An?.(e,i,t),i},h=t=>{for(let c=0;c<t.length;c++){let f=t[c];if(null!==f.parentNode)if(1===f.nodeType){let t=f,u=t.localName;if(l){if("script"===u||"style"===u||Pe.has(t))continue;if(Pe.add(t),u===o.tagNames.state){h([...t.childNodes]);continue}}let c="template"===u?Ie(t):null;if(null!==c){if("for"===c.w){let l=ye(e,c.Je,n),r=Ve(e,t,l,!0);i(a(t,o.commentForPrefix),l,r)}else"if"===c.w?r(je(e,t,n).map((t,l)=>({A:Ve(e,t.el,n,!1),o:t.o,x:t.x,S:a(t.el,Te(l,t))}))):ke(c.w);continue}let d=t.getAttribute(pe()),m=null===d?null:Ne(e,d,n,t,0),p="noscript"!==u&&"iframe"!==u&&!m?.some(Se)&&!N.yo?.(t);try{l&&p&&h([...t.childNodes])}finally{null!==m&&s(t,m)}!l&&p&&h([...t.childNodes])}else if(3===f.nodeType&&e.Lt&&f.data.includes("{{")&&!Pe.has(f))for(let{a:e,Qo:t}of Ee(f))u(e,t);else if(8===f.nodeType){let e=Oe.exec(f.data),t=e&&f.parentNode.localName;if(null!==t&&"textarea"!==t&&"title"!==t){let t=document.createTextNode("");f.replaceWith(t),u(t,e[1])}}}};h(t)}var Oe=/^\s*@@\s*(?:wcs-text)?\s*:\s*([\s\S]+?)\s*$/,Le=e=>{let t=document.createRange();return t.selectNodeContents(e),e.content??t.cloneContents()};function Ve(e,t,n,l){let i=document.importNode(Le(t),!0),r=[],o=[],s=e=>r.push(e)-1;Ce(e,[...i.childNodes],n,!1,(e,t,n)=>{o.push({...ve(),a:s(e),i:6,o:t,A:n})},e=>{let t=e.map(e=>({a:s(e.S),A:e.A,o:e.o,x:e.x}));o.push({...ve(),a:t[0].a,i:7,Y:t})},(e,t)=>{let n=s(e);for(let e of t)xe(e)&&k(203,[e.name]),e.a=n;o.push(...t),e.removeAttribute(pe())},(t,l)=>{o.push($e(e,l,n,s(t)))}),De(i,new Set(r),!0);let u=r.map(e=>function(e,t){let n=[];for(let l=t;l!==e;l=l.parentNode){let e=0;for(let t=l.previousSibling;null!==t;t=t.previousSibling)e++;n.unshift(e)}return n}(i,e)),a=1===i.childNodes.length&&8!==i.firstChild.nodeType,h=o.some(e=>6===e.i||7===e.i),c=[],f=new Set,d=[],m=[],p=l?n.n+1:-1;for(let e of o){if(5===e.i&&e.Ze&&!e.ke&&!Me(r[e.a],i)){d.push(e);continue}m.push(e);let t=e.o;if(null!==t&&t.n===p&&t.f[p]===n&&Re(e)&&(e.F=c.push(e)-1),7===e.i)for(let t of e.Y)f.add(t.a);else f.add(e.a)}let v=[...f].sort((e,t)=>e-t);return{on:i,root:a?i.firstChild:null,Rn:u,build:v,xe:d,Xo:m,Tn:a,Go:h,mo:[],qe:c}}function Me(e,t){for(;e.parentNode!==t;e=e.parentNode){if(e.parentNode.localName.includes("-"))return!0;for(let t=e.previousSibling;t;t=t.previousSibling)if(8===t.nodeType)return!0}return!1}function Re(e){if(null!==e.V)return!1;switch(e.i){case 0:case 2:case 3:case 4:case 8:return!0;case 1:return!e.ke&&null===e.Rt;default:return!1}}var We=new Set(["table","thead","tbody","tfoot","tr","colgroup","select","optgroup","datalist"]);function De(e,t,n){for(let l=e.firstChild;null!==l;){let e=l.nextSibling;3===l.nodeType?n&&!t.has(l)&&""===l.data.trim()&&l.remove():1===l.nodeType&&De(l,t,We.has(l.localName)),l=e}}var Ye=new WeakMap;function He(e,t){let n=9===t.nodeType?t.body:t;e.root=t,Ye.set(t,e),Qe(e,[...n.childNodes]),e.Ve()}function Be(e,t,n){try{let l="template"===t.localName?Ie(t):null;null!==l&&!n&&k(204,[l.w]),Qe(e,[t])}catch(e){console.error(e)}e.Ve()}function Qe(e,t){Ce(e,t,null,!0,(t,n,l)=>{new se(e,l,_(e,n,null,t),t).kt()},t=>{re(e,t,null,null)},(t,n)=>{N.An?.(e,t,n);for(let l of n)ie(e,l,t,null,null)},(t,n)=>{N.An?.(e,t,n),ie(e,$e(e,n,null,0),t,null,null)})}export{T as a,ce as b,M as c,R as d,W as e,D as f,Y as g,Z as h,se as i,xe as j,Se as k,Pe as l,Le as m,Ye as n,He as o,Be as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a="4.0.0-rc.4";export{a};
|
|
File without changes
|