@wcstack/state 4.0.0-rc.9 → 4.0.1

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.
Files changed (40) hide show
  1. package/README.ja.md +8 -6
  2. package/README.md +8 -6
  3. package/dist/auto.min.js +1 -1
  4. package/dist/auto.min.js.map +1 -1
  5. package/dist/index.esm.js +1 -1
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/parser.esm.js +4 -0
  8. package/dist/split/auto.js +1 -1
  9. package/dist/split/chunks/{chunk-M5SODAAE.js → chunk-6MACFEK7.js} +2 -2
  10. package/dist/split/chunks/chunk-BMGEWHCR.js +2 -0
  11. package/dist/split/chunks/chunk-BMGEWHCR.js.map +1 -0
  12. package/dist/split/chunks/{chunk-UD3AYVP2.js → chunk-DFXQ7MFW.js} +2 -2
  13. package/dist/split/chunks/{chunk-7AYOQHZH.js → chunk-EM3Y3SJS.js} +2 -2
  14. package/dist/split/chunks/chunk-LAUWEM6K.js +2 -0
  15. package/dist/split/chunks/chunk-LAUWEM6K.js.map +1 -0
  16. package/dist/split/chunks/{chunk-EIMTT5I3.js → chunk-M656SMUU.js} +1 -1
  17. package/dist/split/chunks/{chunk-EIMTT5I3.js.map → chunk-M656SMUU.js.map} +1 -1
  18. package/dist/split/chunks/{chunk-W4KOY6GT.js → chunk-PHAN6L23.js} +2 -2
  19. package/dist/split/chunks/{chunk-NOPTR2L3.js → chunk-TUQ3OPZQ.js} +2 -2
  20. package/dist/split/chunks/{chunk-55J45X6H.js → chunk-V6VVL4F3.js} +2 -2
  21. package/dist/split/core.js +1 -1
  22. package/dist/split/features/devtools.js +1 -1
  23. package/dist/split/features/diagnostics.js +1 -1
  24. package/dist/split/features/diagnostics.js.map +1 -1
  25. package/dist/split/features/formats.js +1 -1
  26. package/dist/split/features/native-commands.js +1 -1
  27. package/dist/split/features/recursion.js +1 -1
  28. package/dist/split/features/scopes.js +1 -1
  29. package/dist/split/features/ssr.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/split/chunks/chunk-L3PFEJP7.js +0 -2
  32. package/dist/split/chunks/chunk-L3PFEJP7.js.map +0 -1
  33. package/dist/split/chunks/chunk-SAUVGHSB.js +0 -2
  34. package/dist/split/chunks/chunk-SAUVGHSB.js.map +0 -1
  35. /package/dist/split/chunks/{chunk-M5SODAAE.js.map → chunk-6MACFEK7.js.map} +0 -0
  36. /package/dist/split/chunks/{chunk-UD3AYVP2.js.map → chunk-DFXQ7MFW.js.map} +0 -0
  37. /package/dist/split/chunks/{chunk-7AYOQHZH.js.map → chunk-EM3Y3SJS.js.map} +0 -0
  38. /package/dist/split/chunks/{chunk-W4KOY6GT.js.map → chunk-PHAN6L23.js.map} +0 -0
  39. /package/dist/split/chunks/{chunk-NOPTR2L3.js.map → chunk-TUQ3OPZQ.js.map} +0 -0
  40. /package/dist/split/chunks/{chunk-55J45X6H.js.map → chunk-V6VVL4F3.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{b as t,d as e,e as i}from"./chunk-ZN52NEIB.js";import{h as s,m as l}from"./chunk-NOPTR2L3.js";import{a as n,b as r}from"./chunk-EIMTT5I3.js";import{a as h,i as o}from"./chunk-4NJBYXIT.js";var u=Symbol.for("wcstack.trustedTypes.policy");function f(){let t=globalThis[u];return null!==t&&"object"==typeof t?t:null}function a(t){globalThis[u]=t}function c(t){return"innerHTML"===t||"outerHTML"===t||"srcdoc"===t}function d(t){if(globalThis.trustedTypes?.isHTML(t))return t;let e=null==t?"":String(t),i=f(),s=i?.createHTML;return"function"==typeof s?s.call(i,e):e}var g=class{constructor(t,e,i){this.ht=null,this.E=null,this.he=null,this.W=null,this.c=null,this.y=!0,this.l=t,this.b=e,this.R=i}},p=class{constructor(t,e){this.C=null,this.f=[],this.E=null,this.L=null,this.te=!1,this.Lt=!1,this.yt=!1,this.o=t,this.ae=e,this.n=t.n+1}},y=[],v=class{constructor(t){this.bt=new Set,this.name=t}get size(){return this.bt.size}subscribe(t){return this.bt.add(t),()=>{this.bt.delete(t)}}unsubscribe(t){return this.bt.delete(t)}emit(...t){let e=[];for(let i of this.bt)try{e.push(i(...t))}catch(t){e.push(void 0),console.error(`[@wcstack/state] ${n(17,[this.name])}`,t)}return e}};function b(t,e,i){if(void 0===t)return[];Array.isArray(t)||r(18,[e]);let s=new Set;for(let l of t)("string"!=typeof l||""===l)&&r(19,[e]),l===i&&r(20,[e,l,i]),s.has(l)&&r(21,[e,l]),s.add(l);return t}var m=Symbol.for("wcstack.transition-runner");function w(t){let e=globalThis[m];return null==e||"wcs-transition-runner"!==e.protocol||"number"!=typeof e.version||e.version<1||"function"!=typeof e.run||"function"!=typeof e.accepts||!e.accepts(t)?null:e}function $(t,e,i){let s=w(t);if(null!==s)return s.run(e,{source:t,types:i});e()}var k=[["$watch","temporal"],["$stream","temporal"],["$listKeys","list-keys"],["$recursion","recursion"]],M=["enableMustache","sameValueGuard","enableDirectionalInitialSync"];function A(t){return t.includes("**")&&l(t),t}var C=0,P=32,T=100;function j(t,e,i){let s=t.get(e);return void 0===s&&t.set(e,s=i()),s}var S=()=>new Set,R=()=>[];function I(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}function O(t,e){return t===e||t!=t&&e!=e}function L(t,e,i){let s=t.W?.get(e);void 0!==s&&s.delete(i)&&0===s.size&&t.W.delete(e)}function x(t,e){for(let i=0;i<e.length;i++){if(null==t)return;t=t[e[i]]}return t}function W(t,e){for(;null!==t&&t.l.n>e;)t=t.l.ae;return null!==t&&t.l.n===e?t:null}function Y(t,e,i){let s=W(t,i);return null!==s&&s.l.o===e.h[i]?s:null}var q=class{constructor(t,i){this.Ie=0,this.u=null,this.je=0,this.vt=new Set,this.et=new Map,this.Kn=Symbol("wcs.block"),this.element=null,this.kt=[],this.De=null,this.Un=[],this.Vt=0,this.Y=null,this.oe=new Map,this.ce=new Map,this.Le=[],this.Be=[],this.Me=[],this.St=!1,this.hn=!1,this.Ht=new WeakMap,this._=0,this.Kt=0,this.gn=!1,this.Ut=!1,this.qt=!1,this.Pe=0,this.qn=()=>{this._=0,this.gn=!1},this.zn=()=>{this.Pe--},this.rp=null,this.rr=null,this.Mo=()=>this.zt(),this.Wo=(t,e)=>t(this.proxy,...e),this.Yn=[],this.tt=[],this._o={$untracked:t=>{let e=this.Y;if(null===e)return t();e.ye++;try{return t()}finally{e.ye--}},$eqIndex:(t,e=1)=>{let i=W(this.u,e);null===i&&r(7,[t]);let s=this.o(t);if(null!==s.getter||s.se)return this.watchIndex(e),i.b===this.read(s,null);let l=this.Y;if(null!==l){let t=l.getter,i=s.Ce??(s.Ce=[]);if(!i.some(i=>i.getter===t&&i.Xn===e)){i.push({getter:t,Xn:e});let l=t.h[e];(l.Ct??(l.Ct=[])).push({source:s,getter:t})}}return i.b===this.v(s,null)},$eq:(t,e)=>this.eq(t,e),$eqPath:(t,e)=>{let i=this.o(e);return this.eq(t,this.v(i,W(this.u,i.n)))},$dependOn:t=>{this.resolve(A(t),this.u),null!==this.Y&&0===this.Y.ye&&this.Gn(this.rp,this.rr,this.Y)},$getAll:(t,e)=>this.getAll(t,e),$setAll:(t,e,i,s)=>this.yn(t,e,i,s),$resolve:(...t)=>{let e=A(t[0]),i=t[1]??[],s=this.o(e,!0);this.wn("$resolve",e,s,i,!0);let l=this.Qn(s,i,null);if(t.length<3)return this.read(s,l);this.T(s,l,t[2])},$postUpdate:t=>{this.resolve(A(t),this.u);let e=this.rp,i=this.rr;"*"===e.s&&null!==i&&(i.R=i.l.C[i.b],this.P.Yt(i)),this.bn(e,i),null!==i&&this.Jn(i,e,void 0,i.R,!1),0===e.n&&this.Zn(e,void 0,void 0,!0),this.Xt(e,i,void 0,void 0,!1)}},this.P=i,this.I=new e(t=>{this.tt.push(t),this.nt(t)}),this.eo(t);let s=this,l={getOwnPropertyDescriptor(t,e){let i=Reflect.getOwnPropertyDescriptor(s.target,e);return i&&(i.configurable=!0),i},get(t,e,i){let l=s.target;if("symbol"==typeof e)return Reflect.get(l,e);if(36===e.charCodeAt(0))return s.ot(e);if(e.indexOf(".")<0){let t=s.I.jt(e);if(void 0===t||null===t.getter){let t=l[e];if("function"==typeof t)return i===s.proxy&&s.V?.(t)||t}if(void 0!==t&&0===t.n)return s.read(t,null)}return s.resolve(e,s.u),s.read(s.rp,s.rr)},set:(t,e,i)=>"symbol"==typeof e?Reflect.set(s.target,e,i):(s.resolve(A(e),s.u),s.T(s.rp,s.rr,i),!0)};for(let t of["has","ownKeys","deleteProperty","defineProperty","getPrototypeOf"])l[t]=(e,...i)=>Reflect[t](s.target,...i);this.proxy=new Proxy({},l)}o(t,e){let i=this.I.get(t);return e||(i.pn=!0),i}to(t){let e=new Set;for(let i=t;null!==i&&i!==Object.prototype;i=Object.getPrototypeOf(i))for(let t of Object.getOwnPropertyNames(i)){if(e.has(t))continue;e.add(t);let s=Object.getOwnPropertyDescriptor(i,t);if(void 0===s.get&&void 0===s.set)continue;let l=this.o(t);l.getter=s.get??null,l.ie=s.set??null,null!==l.getter&&l.n>0&&(l.A=this.Ie++)}for(let t of this.I.all())this.nt(t)}nt(t){t.t.includes("**")&&l(t.t),("__proto__"===t.s||"prototype"===t.s)&&r(120,[t.t]);let e=t.d;t.se=null!==e&&"*"!==t.s&&e.n===t.n&&(null!==e.getter||e.se),null===t.getter&&this.Vo(t)}Vo(t){let e=t.t,i=t.s;if(s.test(i))t.getter=function(){return this[i]};else{let s=e.split("."),l=s.findIndex((t,e)=>e>0&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57);if(l<0||s.indexOf("*",l)>=0)return;t.getter=()=>(this.resolve(e,this.u),this.rp!==t?this.read(this.rp,this.rr):this.read(t.d,this.u)?.[i]),t.ie=s=>{if(this.resolve(e,this.u),this.rp!==t)return this.T(this.rp,this.rr,s);let l=this.read(t.d,this.u);null==l&&r(4,[e,l]),l[i]=s}}t.Wn=!0,t.n>0&&(t.A=this.Ie++)}We(t,e){let i=null===t?this.oe:t.c??=new Map,s=i.get(e);return void 0===s&&i.set(e,s=new p(e,t)),e.pn=!0,this.X(s),s}no(t){try{this.X(t)}catch(e){this.Gt(e,t.o.t,t.E?.S??null,"for")}}X(t){let e=this.v(t.o,t.ae);if(e===t.C)return;this.oo(t);let i=function(t,e,i){let s=Array.isArray(e)?e:y;if(s===t.C)return null;let l=t.f,n=s.length,r=l.length,h=new Array(n),o=0;for(;o<n&&o<r&&l[o].R===s[o];)h[o]=l[o],o++;let u=r-1,f=n-1;for(;u>=o&&f>=o&&l[u].R===s[f];)h[f]=l[u],u--,f--;if(o>u)for(let e=o;e<=f;e++)h[e]=new g(t,e,s[e]);else if(o>f)for(let t=o;t<=u;t++)i.Bt(l[t]);else{let e=u<f?u:f;for(let t=o;t<=e;t++)l[t].R===s[t]&&(h[t]=l[t]);let n=new Map;for(let t=u;t>=o;t--){let i=l[t];if(t<=e&&h[t]===i)continue;let s=n.get(i.R);void 0===s?n.set(i.R,i):Array.isArray(s)?s.push(i):n.set(i.R,[s,i])}for(let e=o;e<=f;e++){if(void 0!==h[e])continue;let i,l=s[e],r=n.get(l);void 0!==r&&(Array.isArray(r)?(i=r.pop(),0===r.length&&n.delete(l)):(i=r,n.delete(l))),h[e]=i??new g(t,e,l)}for(let t of n.values())if(Array.isArray(t))for(let e of t)i.Bt(e);else i.Bt(t)}for(let t=o;t<n;t++){let e=h[t];e.b!==t&&(e.b=t,i.Do(e))}return t.f=h,t.C=s,l}(t,e,this);if(null===i)return;if(t.C===e){let i=j(this.Ht,e,R);if(i.push(t),i.length>1)for(let t of i)t.yt=!0}h.Qt?.(this,t,i),(null!==t.E||null!==t.L)&&!t.te&&(t.te=!0,this.Be.push(t),this.Te());let s=t.o.Ct;if(null!==s)for(let{source:e,getter:l}of s){let s=this.v(e,null),n=i[s],r=t.f[s];n!==r&&(void 0!==n&&n.y&&this.vn(l,n),void 0!==r&&this.vn(l,r))}}Do(t){this.P.Ho(this,t)}Bt(t){t.y=!1;let e=t.W;if(null!==e){for(let t of e)L(t.source,t.key,t.sub);t.W=null}if(null!==t.c)for(let e of t.c.values()){this.oo(e);for(let t of e.f)this.Bt(t)}}oo(t){let e=this.Ht.get(t.C);void 0!==e&&(e.splice(e.indexOf(t)>>>0,1),t.yt=!1,1===e.length&&(e[0].yt=!1))}resolve(t,e){let s=i(t),l=this.rp=this.o(s.o,!0),n=s.indexes;this.rr=0===l.n?null:null===n?Y(e,l,l.n):this.Qn(l,n,e,t)}Qn(t,e,i,s){let l=null;for(let n,r=1,h=0;r<=t.n;r++){let o=t.h[r],u=this.We(l,o),f=e[h++];if(f<0)f=Y(i,t,r)?.b??-1;else if(s&&u.C===y&&Object(n=this.v(o,l))===n){let e=t.t.split("."),i=o.t.split(".").length;e[i]=s.split(".")[i],t=this.o(e.join("."),!0),r--;continue}if(l=u.f[f]??null,null===l)break}return this.rp=t,l}rt(t,e){return 0===t.n?x(this.target,t.q):null===e?void 0:x(e.R,t.q)}read(t,e){let i=this.Y;if(null!==i&&0===i.ye&&this.Gn(t,e,i),null!==t.getter)return this.P.Ko(this,t,e);if(t.se){let i=this.read(t.d,e);return i?.[t.s]}return null===t.d&&!(t.s in this.target)&&!this.vt.has(t.s)&&"then"!==t.s&&"toJSON"!==t.s&&r(301,[t.t],t.s,Object.keys(this.target)),this.rt(t,e)}v(t,e){let i=this.Y;if(null===i)return this.read(t,e);i.ye++;try{return this.read(t,e)}finally{i.ye--}}Gn(t,e,i){let s=i.getter;t._n(s),0===s.n?t.Z!==i.ue&&(t.Z=i.ue,i.kn.push(t)):t.n>0&&W(e,Math.min(t.n,s.n))!==W(i.r,Math.min(t.n,s.n))&&(s.ft??(s.ft=new Set)).add(t)}Uo(t,e){for(let i=0;i<this.Vt;i++){let s=this.Un[i];s.getter===t&&s.r===e&&r(701,[t.t])}this.Vt>=128&&r(801,[t.t]);let i=this.Vt++;this.je++;let s=this.Un[i]??={getter:t,r:e,ye:0,ue:0,kn:[]};s.getter=t,s.r=e,s.ye=0,s.ue=++C,s.kn.length=0;let l=this.Y;this.Y=s;let n=this.u;this.u=e;try{let e=t.getter.call(this.proxy);return 0===t.n&&this.qo(t,s),e}finally{this.je--,this.Vt--,this.Y=l,this.u=n,s.r=null}}qo(t,e){let i=e.ue;for(let t of e.kn)t.Z=i;t.J=t.J.filter(e=>e.Z===i||e.n>0||!e.se&&Array.isArray(null!==e.getter?e.z:this.rt(e,null))||this.io(e,t))}io(t,e){return t.Io(e),this.tt.push(t),!1}zo(){for(let t=this.tt;t.length>0;t=this.tt){this.tt=[];let e=new Set;for(let i of t)if(!(i.pn||i.mn||null===i.d||i.c.length>0||i.M.length>0)&&(null===i.getter||i.Wn&&i.A<0)&&null===i.W){i.mn=!0,this.I.Dt(i),e.add(i.d);for(let t of i.J)this.io(t,i)}for(let t of e)(t.c=t.c.filter(t=>!t.mn)).length||this.tt.push(t)}}watchIndex(t){let e=this.Y;if(null!==e&&0===e.ye){let i=e.getter,s=i.h[t];if(s){let t=s.It??(s.It=[]);t.includes(i)||t.push(i)}}}ot(t){let e=t.charCodeAt(1);if(e>=48&&e<=57){let i=2===t.length?e-48:s.test(t)?+t.slice(1):0;return(i<1||i>128)&&r(1001,[t]),this.watchIndex(i),W(this.u,i)?.b}let i=this._o[t];if(void 0!==i)return i;switch(t){case"$stateElement":return this.element;case"$command":return this.commands}return h.ot?.(this,t)}eq(t,e){this.resolve(t,this.u);let i=this.rp,s=this.rr;if(null!==i.getter||i.se||i.n>0)return O(this.read(i,s),e);let l=this.Y;return null!==l&&0===l.ye&&this.Yo(i,e,l),O(this.v(i,null),e)}Yo(t,e,i){let s=i.getter,l=i.r,n=null===l?this.Yn:l.W??(l.W=[]);for(let l=0;l<n.length;l++){let r=n[l];if(r.sub.getter===s&&r.source===t){if(O(r.key,e))return void(r.ue=i.ue);r.ue!==i.ue&&(L(t,r.key,r.sub),n.splice(l--,1))}}let r={getter:s,r:l};j(t.W??=new Map,e,S).add(r),n.push({source:t,key:e,sub:r,ue:i.ue})}Zn(t,e,i,s){this.Jt(t,l=>{let n=l.W;if(null===n&&null===l.Ce)return;let r=l===t?[]:l.t.slice(t.t.length+1).split("."),h=x(e,r),o=x(i,r);if(null!==l.Ce&&this.Xo(l,h,o,s),null!==n)for(let t of s?n.keys():[h,o]){let e=n.get(t);if(void 0!==e)for(let i of e)null===i.r||i.r.y?this.P.we(this,i.getter,i.r):L(l,t,i)}})}T(t,e,i,s=!1,l=!1){if(this.je>0&&r(8),l||this.Pe>0?this.Ut=!0:this.qt=!0,h.Ae?.(this,t,e,i,l))return;if(null!==t.ie){try{this.Sn(t.ie,e,[i])}finally{this.Xt(t,e,void 0,void 0,!1)}return}null!==t.getter&&r(2,[t.t]),t.n>0&&null===e&&r(3,[t.t]);let n=t.se?this.v(t,e):this.rt(t,e);if(s||!this.Wt||!Object.is(n,i)||Object(i)===i){if("*"===t.s){let t=e;t.l.C[t.b]=i,t.R=i,this.P.Yt(t)}else{let s=1===t.q.length?0===t.n?this.target:e.R:this.v(t.d,e);null==s&&r(4,[t.t,s]),s[t.s]=i}this.$n(t,e),null!==e&&this.Jn(e,t,n,i),0===t.n&&this.Zn(t,n,i),this.Xt(t,e,n,i,!0)}}so(t){return(this.Ht.get(t.C)??[]).filter(e=>e.C===t.C&&(null===e.ae||e.ae.y))}Jn(e,i,s,l,n=!0){let r=e.l;if(!r.yt&&null===r.o.getter&&!r.o.M.length)return;let h=e.R,o=i.t.slice(r.o.t.length+2),u=(t,i)=>{if(void 0===i||i===e)return;let r=this.o(`${t.o.t}.*${o}`,!0);""===o&&(i.R=l,this.P.Yt(i)),n?this.$n(r,i):this.bn(r,i),this.Xt(r,i,s,l,n)};for(let t of this.so(r))u(t,t.f[e.b]);if(""===o)return;let f=new Set([r.C]),a=t=>Array.isArray(t)&&t.includes(h),c=(e,i)=>{if(!f.has(e)&&f.add(e))for(let t of this.Ht.get(e)??[])for(let e of t.f)e.R===h&&u(t,e);for(let s of i){let i=s.z,l=i===t;l&&(i=this.oe.get(s)?.C),(l||a(i))&&!f.has(s.M)&&f.add(s.M)&&(!l&&i!==e&&this.P.we(this,s,null),c(i,s.M))}},d=t=>{for(let e of t.J)if(!f.has(e)&&f.add(e))if(null!==e.getter)d(e);else if(!e.se){let t=this.rt(e,null);a(t)&&c(t,e.M)}};null!==r.o.getter?d(r.o):c(r.C,r.o.M)}bn(t,e){this.Go(t,e,t=>{this.X(t);for(let e of t.yt?this.so(t):[t]){let t=this.o(`${e.o.t}.*`);for(let i of e.f)this.$t(t,i),this.bn(t,i)}})}$n(t,e){let i=null===e?this.oe:e.c;if(null!==i)for(let e of i.values())e.o.ee(t)&&this.X(e)}Go(t,e,i){let s=null===e?this.oe:e.c;if(null!==s)for(let e of s.values())e.o.ee(t)&&i(e)}Xo(t,e,i,s){for(let{getter:l,Xn:n}of t.Ce)this.lo(l.h[n],t=>{for(let n of s?t.f.keys():[e,i]){let e="number"==typeof n?t.f[n]:void 0;void 0!==e&&this.vn(l,e)}})}vn(t,e){e.l.n===t.n?this.P.we(this,t,e):this.Zt(e,t,e=>this.P.we(this,t,e))}Xt(t,e,i,s,l){h.be?.(this,t,e,i,s,l),this._e(t,e)}_e(t,e){this.P.Qo(this,t,e),this.Te()}ao(t){let e=this.et.get(t);if(void 0!==e)return e;let i=Symbol(`wcs.on${t}`);this.et.set(t,i);let s=this.root,l=this.Kn;return s.addEventListener(t,e=>{for(let n=e.target;null!==n&&n!==s;n=n.parentNode){let s=n[i];if(void 0!==s&&(s(e),e.cancelBubble))return;let r=n[l];if(void 0!==r&&r.y&&r.Jo(t,e))return}}),i}reset(t){let e=this.target,i=this.vt;for(let t of this.I.all())null===t.d&&null!==t.getter&&i.add(t.s);this.eo(t);for(let t in e)"$"!==t[0]&&i.add(t);for(let e of i)e in t&&i.delete(e);for(let t of this.ce.values())for(let e of t)this.en(e);for(let t of this.oe.values())this.co(t);this.De=null;try{this.zt()}finally{this.En()}h.element?.(this,"reset")}eo(t){for(let[e,i]of k)void 0!==t[e]&&o(i,e);let e=t.$features;if(void 0!==e){Array.isArray(e)||r(46);for(let t of e)o(t,"$features")}let i=void 0===t.$behavior?{}:t.$behavior;("object"!=typeof i||!i||Array.isArray(i))&&r(44,["state","$behavior"]);for(let t in i)(!M.includes(t)||"boolean"!=typeof i[t])&&r(44,["$behavior",t]);let[s,l,n]=M.map(t=>i[t]??!0);void 0!==this.target&&(s!==this.Mt||l!==this.Wt||n!==this._t)&&r(45);let u=function(t,e){let i={};for(let s of b(t.$commandTokens,"$commandTokens","$command"))i[s]=e?.[s]??new v(s);return Object.freeze(i)}(t,this.commands),f=function(t,e){let i=new Map;for(let e of b(t.$eventTokens,"$eventTokens"))i.set(e,new v(e));let s=t.$on;if(void 0===s)return i;(null===s||"object"!=typeof s)&&r(22);for(let[t,l]of Object.entries(s)){let s=i.get(t);void 0===s&&r(23,[t]),"function"!=typeof l&&r(24,[t]),s.subscribe((...t)=>e(l,t))}return i}(t,this.Wo);this.Mt=s,this.Wt=l,this._t=n,h.de?.(this,t),this.target=t,this.Ie=0;for(let t of this.I.all())t.jo();this.Yn.length=0,this.to(t),this.commands=u,this.Re=f}co(t){this.no(t);let e=this.o(`${t.o.t}.*`);for(let i of t.f)if(i.ht=null,i.W=null,this.$t(e,i),null!==i.c)for(let t of i.c.values())this.co(t)}H(t){let e=[];for(let i=t;null!==i;i=i.l.ae)e.unshift(i.b);return e}Zo(t,e,i){let s=this.Re.get(t);void 0===s&&r(1301,[t],t,this.Re.keys()),s.emit(e,...this.H(i))}command(t){let e=this.commands[t];return void 0===e&&r(1302,[t],t,Object.keys(this.commands)),e}er(t,e,i){this.command(t).emit(e,...this.H(i))}tr(t,e,i){let s=t.includes(".")?this.v(this.o(t),null):this.target[t];return"function"!=typeof s&&r(5,[t]),this.Sn(s,i,[e,...this.H(i)])}Sn(t,e,i){let s=this.u;this.u=e;try{return t.apply(this.proxy,i)}finally{this.u=s}}$t(t,e){if(null!==t.getter){let i=null===e?this.oe:e.c;if(null!==i)for(let e of i.values())!e.Lt&&e.o.ee(t)&&(e.Lt=!0,this.Me.push(e))}if(null===e)return void this.Jt(t,t=>{let e=this.ce.get(t);if(void 0!==e)for(let t of e)this.en(t)});let i=e.he;if(null!==i)for(let e=0;e<i.length;e++)i[e].o.ee(t)&&this.en(i[e]);let s=e.E;null!==s&&null!==s.fe&&s.uo(this,t);let l=e.l.L;if(null!==l)for(let i of l){let s=i.map.get(e);void 0!==s&&null!==s.fe&&s.uo(this,t)}}xn(t,e,i){this.Jt(t,t=>{let s=t.M;for(let l=0;l<s.length;l++){let n=s[l];if(0===n.n)this.it(n,null,i);else if(null===e||0===t.n||n.h[1]!==t.h[1]||null!==n.ft&&n.ft.has(t))this.tn(n.h[n.n],t=>this.it(n,t,i));else if(n.n<=t.n){let t=W(e,n.n);null!==t&&this.it(n,t,i)}else this.Zt(e,n,t=>this.it(n,t,i))}})}it(t,e,i){i(t,e)&&(h.ve?.(this,t,e),this.$t(t,e),this.xn(t,e,i))}Jt(t,e){e(t);let i=t.c;for(let t=0;t<i.length;t++)this.Jt(i[t],e)}tn(t,e){this.lo(t,t=>{for(let i of t.f)e(i)})}lo(t,e){if(0===t.n){let i=this.oe.get(t);return void(void 0!==i&&e(i))}this.tn(t.h[t.n],i=>{let s=i.c?.get(t);void 0!==s&&e(s)})}Zt(t,e,i){if(t.l.n===e.n)return i(t);let s=t.c?.get(e.h[t.l.n+1]);if(void 0!==s)for(let t of s.f)this.Zt(t,e,i)}nr(t){let e=t.r;null===e?j(this.ce,t.o,S).add(t):(e.he??(e.he=[])).push(t)}Nn(t){let e=t.r;if(null===e)return void this.ce.get(t.o)?.delete(t);let i=e.he;e.y&&null!==i&&i.splice(i.indexOf(t)>>>0,1)}en(t){t.te||(t.te=!0,this.Le.push(t),this.Te())}Te(){this.St||(this.St=!0,queueMicrotask(this.Mo))}Rn(){for(let t of this.Le)t.te=!1;for(let t of this.Be)t.te=!1;for(let t of this.Me)t.Lt=!1;this.Le=[],this.Be=[],this.Me=[],this.P.vt(this)}fo(t,e){let i=[...new Set([...this.Le,...this.Be,...this.Me].map(t=>t.o.t))];console.error(`[@wcstack/state] ${n(t)}`,i),h.st?.(this,{type:"state:render-chain-limit",maxDepth:e,paths:i}),this.Rn()}zt(){this.St=!1;let t=this.Kt;this.Kt=0;let e=0;if(!this.Ut||this.qt?this.qn():t>0?e=t:1===(e=++this._)&&setTimeout(this.qn,0),this.Ut=this.qt=!1,e>100)101===e?this.fo(41,100):this.Rn();else{this.hn=!0;try{for(let t=0;this.Le.length>0||this.Be.length>0||this.Me.length>0;t++){if(t>=32){this.gn?this.Rn():this.fo(11,32),this.gn=!0;break}let i=this.Me;if(i.length>0){this.Me=[];for(let t of i)t.Lt=!1,this.no(t)}let s=this.Be,l=this.Le;this.Be=[],this.Le=[];let n=$("state",()=>{for(let t of s){t.te=!1;for(let e of[t.E,...t.L??[]])if(null!==e&&e.y)try{e.Et()}catch(i){this.Gt(i,t.o.t,e.S,"for")}}for(let t=0;t<l.length;t++){let e=l[t];e.te&&(e.te=!1,(null===e.Pn||e.Pn.y)&&this.Ve(e))}this.hn||(this.He(),this.St&&(this.Kt=e+1))});void 0!==n&&n.then(void 0,t=>console.error(t))}}finally{this.hn=!1}this.Ut=this.qt=!1,this.He(),h.Fe?.(this),this.zo(),t>0&&this.St&&(this.Kt=e+1)}}xt(t,e){this.kt.push([t,e])}Gt(t,e,i,s){this.xt(t,{o:{t:e},a:i,nn:()=>s})}Ve(t){try{t.apply()}catch(e){return void this.kt.push([e,t])}null!==this.De&&this.po(t.o,t.r)}po(t,e){let i=j(this.De,t.t,R);null!==e&&i.push(this.H(e))}En(){this.De="function"==typeof this.target.$renderedCallback?new Map:null}He(){let t=this.De;if(null!==t&&t.size>0){this.De=new Map;let e,i=[...t.keys()],s={};for(let[e,i]of t)i.length>0&&(s[e]=i);this.Pe++;try{e=this.ke("$renderedCallback",[i,s])}catch(t){console.error(t)}I(e)?e.then(this.zn,t=>{this.zn(),console.error(t)}):this.Pe--}if(0===this.kt.length)return;let e=this.kt;this.kt=[];let i=this.target.$errorCallback;for(let[t,s]of e){h.Ke?.(this,t,s);let e=s.o.t,l=s.nn();if("function"==typeof i)try{let i=this.ke("$errorCallback",[t,{path:e,bindingType:l,node:s.a}]);I(i)&&i.then(void 0,t=>console.error(t))}catch(t){console.error(t)}else console.error(`[@wcstack/state] ${n(12,[l,e])}`,t)}}ke(t,e=[]){let i=this.target[t];return"function"==typeof i?this.Sn(i,null,e):void 0}mo(t,e,i){if(0===t.n)return void i(null,[]);let s=[],l=(n,r)=>{let h=t.h[n];this.read(h,r);let o=this.We(r,h),u=e=>{s.push(e.b),n===t.n?i(e,s):l(n+1,e),s.pop()};for(let t of n-1<e.length?[o.f[e[n-1]]]:o.f)void 0!==t&&u(t)};l(1,null)}getAll(t,e){let i=this.o(t,!0);void 0!==e&&this.wn("$getAll",t,i,e,!1);let s=e;if(void 0===s){s=[];let e=this.u;if(null!==e&&i.n>0){for(let t=1;t<=i.n;t++){let l=Y(e,i,t);if(null===l)break;s.push(l.b)}0===s.length&&r(6,[t])}}let l=[];return this.mo(i,s,t=>l.push(this.read(i,t))),l}yn(t,e,i,s){Array.isArray(e)||r(9,[t]),this.je>0&&r(8);let l=this.o(t,!0);this.wn("$setAll",t,l,e,!1);let n=[];this.mo(l,e,(t,e)=>n.push([t,e.slice()]));let h=!0===s?.spread;h&&(!Array.isArray(i)||i.length!==n.length)&&r(10,[t,n.length]);let o=0;for(let t=0;t<n.length;t++){let[e,s]=n[t],r="function"==typeof i?i(this.v(l,e),...s):h?i[t]:i;void 0!==r&&(this.T(l,e,r),o++)}return o}wn(t,e,i,s,l){let n=s.length;(n>i.n||l&&n<i.n)&&r(l?901:902,[t,e,i.n,n])}};export{w as a,P as b,T as c,I as d,W as e,q as f,u as g,f as h,a as i,c as j,d as k};
2
- //# sourceMappingURL=chunk-7AYOQHZH.js.map
1
+ import{b as t,d as e,e as i}from"./chunk-ZN52NEIB.js";import{h as s,m as l}from"./chunk-TUQ3OPZQ.js";import{a as n,b as r}from"./chunk-M656SMUU.js";import{a as h,i as o}from"./chunk-4NJBYXIT.js";var u=Symbol.for("wcstack.trustedTypes.policy");function f(){let t=globalThis[u];return null!==t&&"object"==typeof t?t:null}function a(t){globalThis[u]=t}function c(t){return"innerHTML"===t||"outerHTML"===t||"srcdoc"===t}function d(t){if(globalThis.trustedTypes?.isHTML(t))return t;let e=null==t?"":String(t),i=f(),s=i?.createHTML;return"function"==typeof s?s.call(i,e):e}var g=class{constructor(t,e,i){this.ht=null,this.E=null,this.he=null,this.W=null,this.c=null,this.y=!0,this.l=t,this.b=e,this.R=i}},p=class{constructor(t,e){this.C=null,this.f=[],this.E=null,this.L=null,this.te=!1,this.Lt=!1,this.yt=!1,this.o=t,this.ae=e,this.n=t.n+1}},y=[],v=class{constructor(t){this.bt=new Set,this.name=t}get size(){return this.bt.size}subscribe(t){return this.bt.add(t),()=>{this.bt.delete(t)}}unsubscribe(t){return this.bt.delete(t)}emit(...t){let e=[];for(let i of this.bt)try{e.push(i(...t))}catch(t){e.push(void 0),console.error(`[@wcstack/state] ${n(17,[this.name])}`,t)}return e}};function b(t,e,i){if(void 0===t)return[];Array.isArray(t)||r(18,[e]);let s=new Set;for(let l of t)("string"!=typeof l||""===l)&&r(19,[e]),l===i&&r(20,[e,l,i]),s.has(l)&&r(21,[e,l]),s.add(l);return t}var m=Symbol.for("wcstack.transition-runner");function w(t){let e=globalThis[m];return null==e||"wcs-transition-runner"!==e.protocol||"number"!=typeof e.version||e.version<1||"function"!=typeof e.run||"function"!=typeof e.accepts||!e.accepts(t)?null:e}function $(t,e,i){let s=w(t);if(null!==s)return s.run(e,{source:t,types:i});e()}var k=[["$watch","temporal"],["$stream","temporal"],["$listKeys","list-keys"],["$recursion","recursion"]],M=["enableMustache","sameValueGuard","enableDirectionalInitialSync"];function A(t){return t.includes("**")&&l(t),t}var C=0,P=32,S=100;function j(t,e,i){let s=t.get(e);return void 0===s&&t.set(e,s=i()),s}var T=()=>new Set,R=()=>[];function O(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}function I(t,e){return t===e||t!=t&&e!=e}function L(t,e,i){let s=t.W?.get(e);void 0!==s&&s.delete(i)&&0===s.size&&t.W.delete(e)}function W(t,e){for(let i=0;i<e.length;i++){if(null==t)return;t=t[e[i]]}return t}function Y(t,e){for(;null!==t&&t.l.n>e;)t=t.l.ae;return null!==t&&t.l.n===e?t:null}function q(t,e,i){let s=Y(t,i);return null!==s&&s.l.o===e.h[i]?s:null}var x=class{constructor(t,i){this.Ie=0,this.u=null,this.je=0,this.vt=new Set,this.et=new Map,this.Kn=Symbol("wcs.block"),this.element=null,this.kt=[],this.De=null,this.Un=[],this.Vt=0,this.Y=null,this.oe=new Map,this.ce=new Map,this.Le=[],this.Be=[],this.Me=[],this.St=!1,this.hn=!1,this.Ht=new WeakMap,this._=0,this.Kt=0,this.gn=!1,this.Ut=!1,this.qt=!1,this.Pe=0,this.qn=()=>{this._=0,this.gn=!1},this.zn=()=>{this.Pe--},this.rp=null,this.rr=null,this.Mo=()=>this.zt(),this.Wo=(t,e)=>t(this.proxy,...e),this.Yn=[],this.tt=[],this._o={$untracked:t=>{let e=this.Y;if(null===e)return t();e.ye++;try{return t()}finally{e.ye--}},$eqIndex:(t,e=1)=>{let i=Y(this.u,e);null===i&&r(7,[t]);let s=this.o(t);if(null!==s.getter||s.se)return this.watchIndex(e),i.b===this.read(s,null);let l=this.Y;if(null!==l){let t=l.getter,i=s.Ce??(s.Ce=[]);if(!i.some(i=>i.getter===t&&i.Xn===e)){i.push({getter:t,Xn:e});let l=t.h[e];(l.Ct??(l.Ct=[])).push({source:s,getter:t})}}return i.b===this.v(s,null)},$eq:(t,e)=>this.eq(t,e),$eqPath:(t,e)=>{let i=this.o(e);return this.eq(t,this.v(i,Y(this.u,i.n)))},$dependOn:t=>{this.resolve(A(t),this.u),null!==this.Y&&0===this.Y.ye&&this.Gn(this.rp,this.rr,this.Y)},$getAll:(t,e)=>this.getAll(t,e),$setAll:(t,e,i,s)=>this.yn(t,e,i,s),$resolve:(...t)=>{let e=A(t[0]),i=t[1]??[],s=this.o(e,!0);this.wn("$resolve",e,s,i,!0);let l=this.Qn(s,i,null);if(t.length<3)return this.read(s,l);this.T(s,l,t[2])},$postUpdate:t=>{this.resolve(A(t),this.u);let e=this.rp,i=this.rr;"*"===e.s&&null!==i&&(i.R=i.l.C[i.b],this.P.Yt(i)),this.bn(e,i),null!==i&&this.Jn(i,e,void 0,i.R,!1),0===e.n&&this.Zn(e,void 0,void 0,!0),this.Xt(e,i,void 0,void 0,!1)}},this.P=i,this.I=new e(t=>{this.tt.push(t),this.nt(t)}),this.eo(t);let s=this,l={getOwnPropertyDescriptor(t,e){let i=Reflect.getOwnPropertyDescriptor(s.target,e);return i&&(i.configurable=!0),i},get(t,e,i){let l=s.target;if("symbol"==typeof e)return Reflect.get(l,e);if(36===e.charCodeAt(0))return s.ot(e);if(e.indexOf(".")<0){let t=s.I.jt(e);if(void 0===t||null===t.getter){let t=l[e];if("function"==typeof t)return i===s.proxy&&s.V?.(t)||t}if(void 0!==t&&0===t.n)return s.read(t,null)}return s.resolve(e,s.u),s.read(s.rp,s.rr)},set:(t,e,i)=>"symbol"==typeof e?Reflect.set(s.target,e,i):(s.resolve(A(e),s.u),s.T(s.rp,s.rr,i),!0)};for(let t of["has","ownKeys","deleteProperty","defineProperty","getPrototypeOf"])l[t]=(e,...i)=>Reflect[t](s.target,...i);this.proxy=new Proxy({},l)}o(t,e){let i=this.I.get(t);return e||(i.pn=!0),i}to(t){let e=new Set;for(let i=t;null!==i&&i!==Object.prototype;i=Object.getPrototypeOf(i))for(let t of Object.getOwnPropertyNames(i)){if(e.has(t))continue;e.add(t);let s=Object.getOwnPropertyDescriptor(i,t);if(void 0===s.get&&void 0===s.set)continue;let l=this.o(t);l.getter=s.get??null,l.ie=s.set??null,null!==l.getter&&l.n>0&&(l.A=this.Ie++)}for(let t of this.I.all())this.nt(t)}nt(t){t.t.includes("**")&&l(t.t),("__proto__"===t.s||"prototype"===t.s)&&r(120,[t.t]);let e=t.d;t.se=null!==e&&"*"!==t.s&&e.n===t.n&&(null!==e.getter||e.se),null===t.getter&&this.Vo(t)}Vo(t){let e=t.t,i=t.s;if(s.test(i))t.getter=function(){return this[i]};else{let s=e.split("."),l=s.findIndex((t,e)=>e>0&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57);if(l<0||s.indexOf("*",l)>=0)return;t.getter=()=>(this.resolve(e,this.u),this.rp!==t?this.read(this.rp,this.rr):this.read(t.d,this.u)?.[i]),t.ie=s=>{if(this.resolve(e,this.u),this.rp!==t)return this.T(this.rp,this.rr,s);let l=this.read(t.d,this.u);null==l&&r(4,[e,l]),l[i]=s}}t.Wn=!0,t.n>0&&(t.A=this.Ie++)}We(t,e){let i=null===t?this.oe:t.c??=new Map,s=i.get(e);return void 0===s&&i.set(e,s=new p(e,t)),e.pn=!0,this.X(s),s}no(t){try{this.X(t)}catch(e){this.Gt(e,t.o.t,t.E?.S??null,"for")}}X(t){let e=this.v(t.o,t.ae);if(e===t.C)return;this.oo(t);let i=function(t,e,i){let s=Array.isArray(e)?e:y;if(s===t.C)return null;let l=t.f,n=s.length,r=l.length,h=new Array(n),o=0;for(;o<n&&o<r&&l[o].R===s[o];)h[o]=l[o],o++;let u=r-1,f=n-1;for(;u>=o&&f>=o&&l[u].R===s[f];)h[f]=l[u],u--,f--;if(o>u)for(let e=o;e<=f;e++)h[e]=new g(t,e,s[e]);else if(o>f)for(let t=o;t<=u;t++)i.Bt(l[t]);else{let e=u<f?u:f;for(let t=o;t<=e;t++)l[t].R===s[t]&&(h[t]=l[t]);let n=new Map;for(let t=u;t>=o;t--){let i=l[t];if(t<=e&&h[t]===i)continue;let s=n.get(i.R);void 0===s?n.set(i.R,i):Array.isArray(s)?s.push(i):n.set(i.R,[s,i])}for(let e=o;e<=f;e++){if(void 0!==h[e])continue;let i,l=s[e],r=n.get(l);void 0!==r&&(Array.isArray(r)?(i=r.pop(),0===r.length&&n.delete(l)):(i=r,n.delete(l))),h[e]=i??new g(t,e,l)}for(let t of n.values())if(Array.isArray(t))for(let e of t)i.Bt(e);else i.Bt(t)}for(let t=o;t<n;t++){let e=h[t];e.b!==t&&(e.b=t,i.Do(e))}return t.f=h,t.C=s,l}(t,e,this);if(null===i)return;if(t.C===e){let i=j(this.Ht,e,R);if(i.push(t),i.length>1)for(let t of i)t.yt=!0}h.Qt?.(this,t,i),(null!==t.E||null!==t.L)&&!t.te&&(t.te=!0,this.Be.push(t),this.Te());let s=t.o.Ct;if(null!==s)for(let{source:e,getter:l}of s){let s=this.v(e,null),n=i[s],r=t.f[s];n!==r&&(void 0!==n&&n.y&&this.vn(l,n),void 0!==r&&this.vn(l,r))}}Do(t){this.P.Ho(this,t)}Bt(t){t.y=!1;let e=t.W;if(null!==e){for(let t of e)L(t.source,t.key,t.sub);t.W=null}if(null!==t.c)for(let e of t.c.values()){this.oo(e);for(let t of e.f)this.Bt(t)}}oo(t){let e=this.Ht.get(t.C);void 0!==e&&(e.splice(e.indexOf(t)>>>0,1),t.yt=!1,1===e.length&&(e[0].yt=!1))}resolve(t,e){let s=i(t),l=this.rp=this.o(s.o,!0),n=s.indexes;this.rr=0===l.n?null:null===n?q(e,l,l.n):this.Qn(l,n,e,t)}Qn(t,e,i,s){let l=null;for(let n,r=1,h=0;r<=t.n;r++){let o=t.h[r],u=this.We(l,o),f=e[h++];if(f<0)f=q(i,t,r)?.b??-1;else if(s&&u.C===y&&Object(n=this.v(o,l))===n){let e=t.t.split("."),i=o.t.split(".").length;e[i]=s.split(".")[i],t=this.o(e.join("."),!0),r--;continue}if(l=u.f[f]??null,null===l)break}return this.rp=t,l}rt(t,e){return 0===t.n?W(this.target,t.q):null===e?void 0:W(e.R,t.q)}read(t,e){let i=this.Y;if(null!==i&&0===i.ye&&this.Gn(t,e,i),null!==t.getter)return this.P.Ko(this,t,e);if(t.se){let i=this.read(t.d,e);return i?.[t.s]}return null===t.d&&!(t.s in this.target)&&!this.vt.has(t.s)&&"then"!==t.s&&"toJSON"!==t.s&&r(301,[t.t],t.s,Object.keys(this.target)),this.rt(t,e)}v(t,e){let i=this.Y;if(null===i)return this.read(t,e);i.ye++;try{return this.read(t,e)}finally{i.ye--}}Gn(t,e,i){let s=i.getter;t._n(s),0===s.n?t.Z!==i.ue&&(t.Z=i.ue,i.kn.push(t)):t.n>0&&Y(e,Math.min(t.n,s.n))!==Y(i.r,Math.min(t.n,s.n))&&(s.ft??(s.ft=new Set)).add(t)}Uo(t,e){for(let i=0;i<this.Vt;i++){let s=this.Un[i];s.getter===t&&s.r===e&&r(701,[t.t])}this.Vt>=128&&r(801,[t.t]);let i=this.Vt++;this.je++;let s=this.Un[i]??={getter:t,r:e,ye:0,ue:0,kn:[]};s.getter=t,s.r=e,s.ye=0,s.ue=++C,s.kn.length=0;let l=this.Y;this.Y=s;let n=this.u;this.u=e;try{let e=t.getter.call(this.proxy);return 0===t.n&&this.qo(t,s),e}finally{this.je--,this.Vt--,this.Y=l,this.u=n,s.r=null}}qo(t,e){let i=e.ue;for(let t of e.kn)t.Z=i;t.J=t.J.filter(e=>e.Z===i||e.n>0||!e.se&&Array.isArray(null!==e.getter?e.z:this.rt(e,null))||this.io(e,t))}io(t,e){return t.Io(e),this.tt.push(t),!1}zo(){for(let t=this.tt;t.length>0;t=this.tt){this.tt=[];let e=new Set;for(let i of t)if(!(i.pn||i.mn||null===i.d||i.c.length>0||i.M.length>0)&&(null===i.getter||i.Wn&&i.A<0)&&null===i.W){i.mn=!0,this.I.Dt(i),e.add(i.d);for(let t of i.J)this.io(t,i)}for(let t of e)(t.c=t.c.filter(t=>!t.mn)).length||this.tt.push(t)}}watchIndex(t){let e=this.Y;if(null!==e&&0===e.ye){let i=e.getter,s=i.h[t];if(s){let t=s.It??(s.It=[]);t.includes(i)||t.push(i)}}}ot(t){let e=t.charCodeAt(1);if(e>=48&&e<=57){let i=2===t.length?e-48:s.test(t)?+t.slice(1):0;return(i<1||i>128)&&r(1001,[t]),this.watchIndex(i),Y(this.u,i)?.b}let i=this._o[t];if(void 0!==i)return i;switch(t){case"$stateElement":return this.element;case"$command":return this.commands}return h.ot?.(this,t)}eq(t,e){this.resolve(t,this.u);let i=this.rp,s=this.rr;if(null!==i.getter||i.se||i.n>0)return I(this.read(i,s),e);let l=this.Y;return null!==l&&0===l.ye&&this.Yo(i,e,l),I(this.v(i,null),e)}Yo(t,e,i){let s=i.getter,l=i.r,n=null===l?this.Yn:l.W??(l.W=[]);for(let l=0;l<n.length;l++){let r=n[l];if(r.sub.getter===s&&r.source===t){if(I(r.key,e))return void(r.ue=i.ue);r.ue!==i.ue&&(L(t,r.key,r.sub),n.splice(l--,1))}}let r={getter:s,r:l};j(t.W??=new Map,e,T).add(r),n.push({source:t,key:e,sub:r,ue:i.ue})}Zn(t,e,i,s){this.Jt(t,l=>{let n=l.W;if(null===n&&null===l.Ce)return;let r=l===t?[]:l.t.slice(t.t.length+1).split("."),h=W(e,r),o=W(i,r);if(null!==l.Ce&&this.Xo(l,h,o,s),null!==n)for(let t of s?n.keys():[h,o]){let e=n.get(t);if(void 0!==e)for(let i of e)null===i.r||i.r.y?this.P.we(this,i.getter,i.r):L(l,t,i)}})}T(t,e,i,s=!1,l=!1){if(this.je>0&&r(8),l||this.Pe>0?this.Ut=!0:this.qt=!0,h.Ae?.(this,t,e,i,l))return;if(null!==t.ie){try{this.Sn(t.ie,e,[i])}finally{this.Xt(t,e,void 0,void 0,!1)}return}null!==t.getter&&r(2,[t.t]),t.n>0&&null===e&&r(3,[t.t]);let n=t.se?this.v(t,e):this.rt(t,e);if(s||!this.Wt||!Object.is(n,i)||Object(i)===i){if("*"===t.s){let t=e;t.l.C[t.b]=i,t.R=i,this.P.Yt(t)}else{let s=1===t.q.length?0===t.n?this.target:e.R:this.v(t.d,e);null==s&&r(4,[t.t,s]),s[t.s]=i}this.$n(t,e),null!==e&&this.Jn(e,t,n,i),0===t.n&&this.Zn(t,n,i),this.Xt(t,e,n,i,!0)}}so(t){return(this.Ht.get(t.C)??[]).filter(e=>e.C===t.C&&(null===e.ae||e.ae.y))}Jn(e,i,s,l,n=!0){let r=e.l;if(!r.yt&&null===r.o.getter&&!r.o.M.length)return;let h=e.R,o=i.t.slice(r.o.t.length+2),u=(t,i)=>{if(void 0===i||i===e)return;let r=this.o(`${t.o.t}.*${o}`,!0);""===o&&(i.R=l,this.P.Yt(i)),n?this.$n(r,i):this.bn(r,i),this.Xt(r,i,s,l,n)};for(let t of this.so(r))u(t,t.f[e.b]);if(""===o)return;let f=new Set([r.C]),a=t=>Array.isArray(t)&&t.includes(h),c=(e,i)=>{if(!f.has(e)&&f.add(e))for(let t of this.Ht.get(e)??[])for(let e of t.f)e.R===h&&u(t,e);for(let s of i){let i=s.z,l=i===t;l&&(i=this.oe.get(s)?.C),(l||a(i))&&!f.has(s.M)&&f.add(s.M)&&(!l&&i!==e&&this.P.we(this,s,null),c(i,s.M))}},d=t=>{for(let e of t.J)if(!f.has(e)&&f.add(e))if(null!==e.getter)d(e);else if(!e.se){let t=this.rt(e,null);a(t)&&c(t,e.M)}};null!==r.o.getter?d(r.o):c(r.C,r.o.M)}bn(t,e){this.Go(t,e,t=>{this.X(t);for(let e of t.yt?this.so(t):[t]){let t=this.o(`${e.o.t}.*`);for(let i of e.f)this.$t(t,i),this.bn(t,i)}})}$n(t,e){let i=null===e?this.oe:e.c;if(null!==i)for(let e of i.values())e.o.ee(t)&&this.X(e)}Go(t,e,i){let s=null===e?this.oe:e.c;if(null!==s)for(let e of s.values())e.o.ee(t)&&i(e)}Xo(t,e,i,s){for(let{getter:l,Xn:n}of t.Ce)this.lo(l.h[n],t=>{for(let n of s?t.f.keys():[e,i]){let e="number"==typeof n?t.f[n]:void 0;void 0!==e&&this.vn(l,e)}})}vn(t,e){e.l.n===t.n?this.P.we(this,t,e):this.Zt(e,t,e=>this.P.we(this,t,e))}Xt(t,e,i,s,l){h.be?.(this,t,e,i,s,l),this._e(t,e)}_e(t,e){this.P.Qo(this,t,e),this.Te()}ao(t){let e=this.et.get(t);if(void 0!==e)return e;let i=Symbol(`wcs.on${t}`);this.et.set(t,i);let s=this.root,l=this.Kn;return s.addEventListener(t,e=>{for(let n=e.target;null!==n&&n!==s;n=n.parentNode){let s=n[i];if(void 0!==s&&(s(e),e.cancelBubble))return;let r=n[l];if(void 0!==r&&r.y&&r.Jo(t,e))return}}),i}reset(t){let e=this.target,i=this.vt;for(let t of this.I.all())null===t.d&&null!==t.getter&&i.add(t.s);this.eo(t);for(let t in e)"$"!==t[0]&&i.add(t);for(let e of i)e in t&&i.delete(e);for(let t of this.ce.values())for(let e of t)this.en(e);for(let t of this.oe.values())this.co(t);this.De=null;try{this.zt()}finally{this.En()}h.element?.(this,"reset")}eo(t){for(let[e,i]of k)void 0!==t[e]&&o(i,e);let e=t.$features;if(void 0!==e){Array.isArray(e)||r(46);for(let t of e)o(t,"$features")}let i=void 0===t.$behavior?{}:t.$behavior;("object"!=typeof i||!i||Array.isArray(i))&&r(44,["state","$behavior"]);for(let t in i)(!M.includes(t)||"boolean"!=typeof i[t])&&r(44,["$behavior",t]);let[s,l,n]=M.map(t=>i[t]??!0);void 0!==this.target&&(s!==this.Mt||l!==this.Wt||n!==this._t)&&r(45);let u=function(t,e){let i={};for(let s of b(t.$commandTokens,"$commandTokens","$command"))i[s]=e?.[s]??new v(s);return Object.freeze(i)}(t,this.commands),f=function(t,e){let i=new Map;for(let e of b(t.$eventTokens,"$eventTokens"))i.set(e,new v(e));let s=t.$on;if(void 0===s)return i;(null===s||"object"!=typeof s)&&r(22);for(let[t,l]of Object.entries(s)){let s=i.get(t);void 0===s&&r(23,[t]),"function"!=typeof l&&r(24,[t]),s.subscribe((...t)=>e(l,t))}return i}(t,this.Wo);this.Mt=s,this.Wt=l,this._t=n,h.de?.(this,t),this.target=t,this.Ie=0;for(let t of this.I.all())t.jo();this.Yn.length=0,this.to(t),this.commands=u,this.Re=f}co(t){this.no(t);let e=this.o(`${t.o.t}.*`);for(let i of t.f)if(i.ht=null,i.W=null,this.$t(e,i),null!==i.c)for(let t of i.c.values())this.co(t)}H(t){let e=[];for(let i=t;null!==i;i=i.l.ae)e.unshift(i.b);return e}Zo(t,e,i){let s=this.Re.get(t);void 0===s&&r(1301,[t],t,this.Re.keys()),s.emit(e,...this.H(i))}command(t){let e=this.commands[t];return void 0===e&&r(1302,[t],t,Object.keys(this.commands)),e}er(t,e,i){this.command(t).emit(e,...this.H(i))}tr(t,e,i){let s=t.includes(".")?this.v(this.o(t),null):this.target[t];return"function"!=typeof s&&r(5,[t]),this.Sn(s,i,[e,...this.H(i)])}Sn(t,e,i){let s=this.u;this.u=e;try{return t.apply(this.proxy,i)}finally{this.u=s}}$t(t,e){if(null!==t.getter){let i=null===e?this.oe:e.c;if(null!==i)for(let e of i.values())!e.Lt&&e.o.ee(t)&&(e.Lt=!0,this.Me.push(e))}if(null===e)return void this.Jt(t,t=>{let e=this.ce.get(t);if(void 0!==e)for(let t of e)this.en(t)});let i=e.he;if(null!==i)for(let e=0;e<i.length;e++)i[e].o.ee(t)&&this.en(i[e]);let s=e.E;null!==s&&null!==s.fe&&s.uo(this,t);let l=e.l.L;if(null!==l)for(let i of l){let s=i.map.get(e);void 0!==s&&null!==s.fe&&s.uo(this,t)}}Nn(t,e,i){this.Jt(t,t=>{let s=t.M;for(let l=0;l<s.length;l++){let n=s[l];if(0===n.n)this.it(n,null,i);else if(null===e||0===t.n||n.h[1]!==t.h[1]||null!==n.ft&&n.ft.has(t))this.tn(n.h[n.n],t=>this.it(n,t,i));else if(n.n<=t.n){let t=Y(e,n.n);null!==t&&this.it(n,t,i)}else this.Zt(e,n,t=>this.it(n,t,i))}})}it(t,e,i){i(t,e)&&(h.ve?.(this,t,e),this.$t(t,e),this.Nn(t,e,i))}Jt(t,e){e(t);let i=t.c;for(let t=0;t<i.length;t++)this.Jt(i[t],e)}tn(t,e){this.lo(t,t=>{for(let i of t.f)e(i)})}lo(t,e){if(0===t.n){let i=this.oe.get(t);return void(void 0!==i&&e(i))}this.tn(t.h[t.n],i=>{let s=i.c?.get(t);void 0!==s&&e(s)})}Zt(t,e,i){if(t.l.n===e.n)return i(t);let s=t.c?.get(e.h[t.l.n+1]);if(void 0!==s)for(let t of s.f)this.Zt(t,e,i)}nr(t){let e=t.r;null===e?j(this.ce,t.o,T).add(t):(e.he??(e.he=[])).push(t)}xn(t){let e=t.r;if(null===e)return void this.ce.get(t.o)?.delete(t);let i=e.he;e.y&&null!==i&&i.splice(i.indexOf(t)>>>0,1)}en(t){t.te||(t.te=!0,this.Le.push(t),this.Te())}Te(){this.St||(this.St=!0,queueMicrotask(this.Mo))}Rn(){for(let t of this.Le)t.te=!1;for(let t of this.Be)t.te=!1;for(let t of this.Me)t.Lt=!1;this.Le=[],this.Be=[],this.Me=[],this.P.vt(this)}fo(t,e){let i=[...new Set([...this.Le,...this.Be,...this.Me].map(t=>t.o.t))];console.error(`[@wcstack/state] ${n(t)}`,i),h.st?.(this,{type:"state:render-chain-limit",maxDepth:e,paths:i}),this.Rn()}zt(){this.St=!1;let t=this.Kt;this.Kt=0;let e=0;if(!this.Ut||this.qt?this.qn():t>0?e=t:1===(e=++this._)&&setTimeout(this.qn,0),this.Ut=this.qt=!1,e>100)101===e?this.fo(41,100):this.Rn();else{this.hn=!0;try{for(let t=0;this.Le.length>0||this.Be.length>0||this.Me.length>0;t++){if(t>=32){this.gn?this.Rn():this.fo(11,32),this.gn=!0;break}let i=this.Me;if(i.length>0){this.Me=[];for(let t of i)t.Lt=!1,this.no(t)}let s=this.Be,l=this.Le;this.Be=[],this.Le=[];let n=$("state",()=>{for(let t of s){t.te=!1;for(let e of[t.E,...t.L??[]])if(null!==e&&e.y)try{e.Et()}catch(i){this.Gt(i,t.o.t,e.S,"for")}}for(let t=0;t<l.length;t++){let e=l[t];e.te&&(e.te=!1,(null===e.Pn||e.Pn.y)&&this.Ve(e))}this.hn||(this.He(),this.St&&(this.Kt=e+1))});void 0!==n&&n.then(void 0,t=>console.error(t))}}finally{this.hn=!1}this.Ut=this.qt=!1,this.He(),h.Fe?.(this),this.zo(),t>0&&this.St&&(this.Kt=e+1)}}Nt(t,e){this.kt.push([t,e])}Gt(t,e,i,s){this.Nt(t,{o:{t:e},a:i,nn:()=>s})}Ve(t){try{t.apply()}catch(e){return void this.kt.push([e,t])}null!==this.De&&this.po(t.o,t.r)}po(t,e){let i=j(this.De,t.t,R);null!==e&&i.push(this.H(e))}En(){this.De="function"==typeof this.target.$renderedCallback?new Map:null}He(){let t=this.De;if(null!==t&&t.size>0){this.De=new Map;let e,i=[...t.keys()],s={};for(let[e,i]of t)i.length>0&&(s[e]=i);this.Pe++;try{e=this.ke("$renderedCallback",[i,s])}catch(t){console.error(t)}O(e)?e.then(this.zn,t=>{this.zn(),console.error(t)}):this.Pe--}if(0===this.kt.length)return;let e=this.kt;this.kt=[];let i=this.target.$errorCallback;for(let[t,s]of e){h.Ke?.(this,t,s);let e=s.o.t,l=s.nn();if("function"==typeof i)try{let i=this.ke("$errorCallback",[t,{path:e,bindingType:l,node:s.a}]);O(i)&&i.then(void 0,t=>console.error(t))}catch(t){console.error(t)}else console.error(`[@wcstack/state] ${n(12,[l,e])}`,t)}}ke(t,e=[]){let i=this.target[t];return"function"==typeof i?this.Sn(i,null,e):void 0}mo(t,e,i){if(0===t.n)return void i(null,[]);let s=[],l=(n,r)=>{let h=t.h[n];this.read(h,r);let o=this.We(r,h),u=e=>{s.push(e.b),n===t.n?i(e,s):l(n+1,e),s.pop()};for(let t of n-1<e.length?[o.f[e[n-1]]]:o.f)void 0!==t&&u(t)};l(1,null)}getAll(t,e){let i=this.o(t,!0);void 0!==e&&this.wn("$getAll",t,i,e,!1);let s=e;if(void 0===s){s=[];let e=this.u;if(null!==e&&i.n>0){for(let t=1;t<=i.n;t++){let l=q(e,i,t);if(null===l)break;s.push(l.b)}0===s.length&&r(6,[t])}}let l=[];return this.mo(i,s,t=>l.push(this.read(i,t))),l}yn(t,e,i,s){Array.isArray(e)||r(9,[t]),this.je>0&&r(8);let l=this.o(t,!0);this.wn("$setAll",t,l,e,!1);let n=[];this.mo(l,e,(t,e)=>n.push([t,e.slice()]));let h=!0===s?.spread;h&&(!Array.isArray(i)||i.length!==n.length)&&r(10,[t,n.length]);let o=0;for(let t=0;t<n.length;t++){let[e,s]=n[t],r="function"==typeof i?i(this.v(l,e),...s):h?i[t]:i;void 0!==r&&(this.T(l,e,r),o++)}return o}wn(t,e,i,s,l){let n=s.length;(n>i.n||l&&n<i.n)&&r(l?901:902,[t,e,i.n,n])}};export{w as a,P as b,S as c,O as d,Y as e,x as f,u as g,f as h,a as i,c as j,d as k};
2
+ //# sourceMappingURL=chunk-EM3Y3SJS.js.map
@@ -0,0 +1,2 @@
1
+ var a="4.0.1";export{a};
2
+ //# sourceMappingURL=chunk-LAUWEM6K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["VERSION","r"],"sources":["../../../package.json","../../../src/version.ts"],"sourcesContent":["{\n \"name\": \"@wcstack/state\",\n \"version\": \"4.0.1\",\n \"description\": \"Reactive state management with declarative data binding for Web Components. Zero dependencies, buildless.\",\n \"type\": \"module\",\n \"main\": \"./dist/index.esm.js\",\n \"module\": \"./dist/index.esm.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.esm.js\"\n },\n \"./auto\": \"./dist/auto.min.js\",\n \"./core\": {\n \"types\": \"./dist/split/core.d.ts\",\n \"import\": \"./dist/split/core.js\"\n },\n \"./features/*\": {\n \"types\": \"./dist/split/features/*.d.ts\",\n \"import\": \"./dist/split/features/*.js\"\n },\n \"./define\": {\n \"types\": \"./dist/define.d.ts\",\n \"import\": \"./dist/define.js\"\n },\n \"./manifest\": {\n \"types\": \"./dist/manifest.d.ts\",\n \"import\": \"./dist/manifest.esm.js\"\n },\n \"./parser\": {\n \"types\": \"./dist/parser.d.ts\",\n \"import\": \"./dist/parser.esm.js\"\n },\n \"./wcs-manifest.json\": \"./dist/wcs-manifest.json\"\n },\n \"files\": [\n \"dist\",\n \"!dist/core.min.js\"\n ],\n \"scripts\": {\n \"clean\": \"node -e \\\"require('node:fs').rmSync('dist', { recursive: true, force: true })\\\"\",\n \"build\": \"node build.mjs\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"lint\": \"eslint src\",\n \"typecheck\": \"tsc --noEmit\",\n \"golden\": \"node scripts/golden.mjs\",\n \"version:patch\": \"npm version patch\",\n \"version:minor\": \"npm version minor\",\n \"version:major\": \"npm version major\",\n \"prepublishOnly\": \"npm run build && npm run test:coverage\"\n },\n \"keywords\": [\n \"web-components\",\n \"state-management\",\n \"reactive\",\n \"data-binding\",\n \"proxy\",\n \"custom-elements\",\n \"shadow-dom\",\n \"buildless\",\n \"zero-dependencies\",\n \"declarative\"\n ],\n \"author\": \"mogera551\",\n \"homepage\": \"https://wcstack.github.io\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/wcstack/wcstack.git\",\n \"directory\": \"packages/state\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/wcstack/wcstack/issues\"\n },\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@eslint/js\": \"^9.39.5\",\n \"@vitest/coverage-v8\": \"^4.1.11\",\n \"esbuild\": \"0.27.2\",\n \"eslint\": \"^9.39.5\",\n \"globals\": \"^16.5.0\",\n \"happy-dom\": \"^20.0.11\",\n \"rollup\": \"^4.63.5\",\n \"rollup-plugin-dts\": \"^6.5.1\",\n \"terser\": \"^5.51.2\",\n \"typescript\": \"^5.9.3\",\n \"typescript-eslint\": \"^8.70.1\",\n \"vitest\": \"^4.0.15\"\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\n\n/** The package version: stamped into `<wcs-ssr>`, compared on hydration (major.minor), shown by DevTools. */\nexport const VERSION: string = pkg.version;\n"],"mappings":"AAAA,ICGaA,EDDA,eCCsBC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
1
  import{a as n,j as t}from"./chunk-4NJBYXIT.js";function i(t,i=[]){return n.Bo?.(t,i)??`#${t}${i.map(n=>` ${"string"==typeof n?JSON.stringify(n):String(n)}`).join("")}`}function o(n,o,r,s){t(i(n,o),r,s)}export{i as a,o as b};
2
- //# sourceMappingURL=chunk-EIMTT5I3.js.map
2
+ //# sourceMappingURL=chunk-M656SMUU.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["text","id","args","hooks","render","map","a","JSON","stringify","String","join","raise","subject","candidates","raiseError","s"],"sources":["../../../src/messages.ts"],"sourcesContent":["/**\n * The core's messages, by number. The prose lives in the diagnostics add-on\n * (`src/diagnostics/messages.ts`); without it a message reads `[@wcstack/state] #108 \"a|b(\"` —\n * the message number and the values it would have shown. With it (the full `auto` bundle installs\n * it) the message is the code shared with lint and the VS Code extension and the full sentence\n * (`[wcs/binding-syntax] Invalid filter format: …`), followed by the guidance.\n *\n * The hundreds of a number name its code (the diagnostics add-on's `CODES`, in the core up to\n * 4.0.0-rc.3): 1xx binding-syntax, 2xx template-syntax, …; 1–99 carry no code. Numbers are only\n * ever added, so a number read on a page keeps its meaning across versions. `M` is a const enum:\n * the build inlines the numbers.\n *\n * Kept as full text in the core, not numbered: the barriers a page without add-ons meets on\n * purpose (`[wcs/feature-not-installed]`, a formatting filter without the formats add-on).\n */\nimport { hooks } from \"./hooks\";\nimport { raiseError } from \"./parser/raiseError\";\n\nexport const enum M {\n // no code\n ScanRemoved = 1,\n GetterWithoutSetter = 2,\n NoRow = 3,\n ParentNotObject = 4,\n NotAMethod = 5,\n GetAllNoCommonLevel = 6,\n EqIndexNoRow = 7,\n Readonly = 8,\n SetAllNeedsIndexes = 9,\n SetAllSpreadLength = 10,\n DrainNotSettled = 11,\n BindingFailed = 12,\n LoadFailed = 13,\n ElementFailed = 14,\n NotInitialized = 15,\n NoScript = 16,\n TokenSubscriberThrew = 17,\n TokenListNotArray = 18,\n TokenEntryEmpty = 19,\n TokenEntryReserved = 20,\n TokenEntryDuplicated = 21,\n OnNotObject = 22,\n OnEntryUndeclared = 23,\n OnEntryNotFunction = 24,\n NamingLimit = 25,\n FilterOptionsRequired = 26,\n FilterOptionNotNumber = 27,\n FilterValueNotNumber = 28,\n FilterValueNotDate = 29,\n FilterValueNotArray = 30,\n DirectionalSyncDisabled = 31,\n SelectorRemoved = 32,\n ModifierUnknown = 33,\n ModifierTwice = 34,\n ModifierValue = 35,\n EventInitNone = 36,\n InitUnsupported = 37,\n MemberUndeclared = 38,\n InitIncompatible = 39,\n SyncConnectNeedsOutput = 40,\n RenderChain = 41,\n InlineBlocked = 42,\n InlineFailed = 43,\n OptionInvalid = 44,\n BehaviorChanged = 45,\n FeaturesNotArray = 46,\n SecondRoot = 47,\n LocaleInvalid = 48,\n InitFailed = 49,\n ConnectedFailed = 50,\n DisconnectedFailed = 51,\n // [wcs/binding-syntax]\n BindTextNoColon = 101,\n StructuralTakesNoModifiers = 102,\n ElseTakesNoValue = 103,\n SpreadNoPath = 104,\n SpreadNoFilters = 105,\n LeadingDotNamespace = 106,\n UnterminatedQuote = 107,\n FilterUnclosed = 108,\n FilterUnopened = 109,\n FilterParenOrder = 110,\n FilterTrailing = 111,\n FilterEmpty = 112,\n FilterNameHasModifiersInput = 113,\n FilterNameHasModifiersOutput = 114,\n OneModifierList = 115,\n NoPropertyName = 116,\n TooManySegments = 117,\n EmptySegment = 119,\n UnsafeSegment = 120,\n ForNoFilters = 121,\n // [wcs/template-syntax]\n StructuralNotSingle = 201,\n ElseWithoutIf = 202,\n OuterInTemplate = 203,\n TemplateHandedOver = 204,\n // [wcs/binding-path-missing]\n PathMissing = 301,\n // [wcs/binding-type-expectation]\n ClassNeedsBoolean = 401,\n // [wcs/filter-unknown]\n FilterUnknown = 501,\n // [wcs/filter-arity]\n FilterTooFewArgs = 601,\n FilterTooManyArgs = 602,\n // [wcs/getter-cycle]\n GetterCycle = 701,\n // [wcs/getter-depth-exceeded]\n GetterDepth = 801,\n // [wcs/index-arity]\n IndexArityExact = 901,\n IndexArityAtMost = 902,\n // [wcs/index-param-range]\n IndexParamRange = 1001,\n // [wcs/recursion-unsupported]\n RecursionUnsupported = 1101,\n // [wcs/token-misconfigured]\n CommandRightSide = 1201,\n NoBindable = 1202,\n NoCommand = 1203,\n NoProperty = 1204,\n NativeNoCommand = 1205,\n // [wcs/token-undeclared]\n EventTokenUndeclared = 1301,\n CommandTokenUndeclared = 1302,\n // [wcs/wildcard-rank]\n WildcardNoLoop = 1401,\n WildcardRelative = 1402,\n WildcardOtherList = 1403,\n // [wcs/spread-no-bindable]\n SpreadNoBindable = 1501,\n // [wcs/declaration-alias]\n DeclarationRemoved = 1601,\n // [wcs/name-alias]\n ApiRemoved = 1701,\n}\n\n/** A message without the `[@wcstack/state]` prefix: the code and the full sentence with diagnostics, else the number and the values. */\nexport function text(id: M, args: readonly unknown[] = []): string {\n return hooks.render?.(id, args) ?? `#${id}${args.map((a) => ` ${typeof a === \"string\" ? JSON.stringify(a) : String(a)}`).join(\"\")}`;\n}\n\n/** Throws message `id` (`subject` / `candidates` feed the diagnostics add-on's did-you-mean). */\nexport function raise(id: M, args?: readonly unknown[], subject?: string, candidates?: Iterable<string>): never {\n raiseError(text(id, args), subject, candidates);\n}\n"],"mappings":"+CA2IO,SAASA,EAAKC,EAAOC,EAA2B,IACrD,OAAOC,EAAMC,KAASH,EAAIC,IAAS,IAAID,IAAKC,EAAKG,IAAKC,GAAM,IAAiB,iBAANA,EAAiBC,KAAKC,UAAUF,GAAKG,OAAOH,MAAMI,KAAK,KAChI,CAGO,SAASC,EAAMV,EAAOC,EAA2BU,EAAkBC,GACxEC,EAAWd,EAAKC,EAAIC,GAAOU,EAASC,EACtC,QAAAP,OAAAS","ignoreList":[]}
1
+ {"version":3,"names":["text","id","args","hooks","render","map","a","JSON","stringify","String","join","raise","subject","candidates","raiseError","s"],"sources":["../../../src/messages.ts"],"sourcesContent":["/**\n * The core's messages, by number. The prose lives in the diagnostics add-on\n * (`src/diagnostics/messages.ts`); without it a message reads `[@wcstack/state] #108 \"a|b(\"` —\n * the message number and the values it would have shown. With it (the full `auto` bundle installs\n * it) the message is the code shared with lint and the VS Code extension and the full sentence\n * (`[wcs/binding-syntax] Invalid filter format: …`), followed by the guidance.\n *\n * The hundreds of a number name its code (the diagnostics add-on's `CODES`, in the core up to\n * 4.0.0-rc.3): 1xx binding-syntax, 2xx template-syntax, …; 1–99 carry no code. Numbers are only\n * ever added, so a number read on a page keeps its meaning across versions. `M` is a const enum:\n * the build inlines the numbers.\n *\n * Kept as full text in the core, not numbered: the barriers a page without add-ons meets on\n * purpose (`[wcs/feature-not-installed]`, a formatting filter without the formats add-on).\n */\nimport { hooks } from \"./hooks\";\nimport { raiseError } from \"./parser/raiseError\";\n\nexport const enum M {\n // no code\n ScanRemoved = 1,\n GetterWithoutSetter = 2,\n NoRow = 3,\n ParentNotObject = 4,\n NotAMethod = 5,\n GetAllNoCommonLevel = 6,\n EqIndexNoRow = 7,\n Readonly = 8,\n SetAllNeedsIndexes = 9,\n SetAllSpreadLength = 10,\n DrainNotSettled = 11,\n BindingFailed = 12,\n LoadFailed = 13,\n ElementFailed = 14,\n NotInitialized = 15,\n NoScript = 16,\n TokenSubscriberThrew = 17,\n TokenListNotArray = 18,\n TokenEntryEmpty = 19,\n TokenEntryReserved = 20,\n TokenEntryDuplicated = 21,\n OnNotObject = 22,\n OnEntryUndeclared = 23,\n OnEntryNotFunction = 24,\n NamingLimit = 25,\n FilterOptionsRequired = 26,\n FilterOptionNotNumber = 27,\n FilterValueNotNumber = 28,\n FilterValueNotDate = 29,\n FilterValueNotArray = 30,\n DirectionalSyncDisabled = 31,\n SelectorRemoved = 32,\n ModifierUnknown = 33,\n ModifierTwice = 34,\n ModifierValue = 35,\n EventInitNone = 36,\n InitUnsupported = 37,\n MemberUndeclared = 38,\n InitIncompatible = 39,\n SyncConnectNeedsOutput = 40,\n RenderChain = 41,\n InlineBlocked = 42,\n InlineFailed = 43,\n OptionInvalid = 44,\n BehaviorChanged = 45,\n FeaturesNotArray = 46,\n SecondRoot = 47,\n LocaleInvalid = 48,\n InitFailed = 49,\n ConnectedFailed = 50,\n DisconnectedFailed = 51,\n // [wcs/binding-syntax]\n BindTextNoColon = 101,\n StructuralTakesNoModifiers = 102,\n ElseTakesNoValue = 103,\n SpreadNoPath = 104,\n SpreadNoFilters = 105,\n LeadingDotNamespace = 106,\n UnterminatedQuote = 107,\n FilterUnclosed = 108,\n FilterUnopened = 109,\n FilterParenOrder = 110,\n FilterTrailing = 111,\n FilterEmpty = 112,\n FilterNameHasModifiersInput = 113,\n FilterNameHasModifiersOutput = 114,\n OneModifierList = 115,\n NoPropertyName = 116,\n TooManySegments = 117,\n EmptySegment = 119,\n UnsafeSegment = 120,\n ForNoFilters = 121,\n NamespaceNeedsName = 122,\n // [wcs/template-syntax]\n StructuralNotSingle = 201,\n ElseWithoutIf = 202,\n OuterInTemplate = 203,\n TemplateHandedOver = 204,\n // [wcs/binding-path-missing]\n PathMissing = 301,\n // [wcs/binding-type-expectation]\n ClassNeedsBoolean = 401,\n // [wcs/filter-unknown]\n FilterUnknown = 501,\n // [wcs/filter-arity]\n FilterTooFewArgs = 601,\n FilterTooManyArgs = 602,\n // [wcs/getter-cycle]\n GetterCycle = 701,\n // [wcs/getter-depth-exceeded]\n GetterDepth = 801,\n // [wcs/index-arity]\n IndexArityExact = 901,\n IndexArityAtMost = 902,\n // [wcs/index-param-range]\n IndexParamRange = 1001,\n // [wcs/recursion-unsupported]\n RecursionUnsupported = 1101,\n // [wcs/token-misconfigured]\n CommandRightSide = 1201,\n NoBindable = 1202,\n NoCommand = 1203,\n NoProperty = 1204,\n NativeNoCommand = 1205,\n // [wcs/token-undeclared]\n EventTokenUndeclared = 1301,\n CommandTokenUndeclared = 1302,\n // [wcs/wildcard-rank]\n WildcardNoLoop = 1401,\n WildcardRelative = 1402,\n WildcardOtherList = 1403,\n // [wcs/spread-no-bindable]\n SpreadNoBindable = 1501,\n // [wcs/declaration-alias]\n DeclarationRemoved = 1601,\n // [wcs/name-alias]\n ApiRemoved = 1701,\n}\n\n/** A message without the `[@wcstack/state]` prefix: the code and the full sentence with diagnostics, else the number and the values. */\nexport function text(id: M, args: readonly unknown[] = []): string {\n return hooks.render?.(id, args) ?? `#${id}${args.map((a) => ` ${typeof a === \"string\" ? JSON.stringify(a) : String(a)}`).join(\"\")}`;\n}\n\n/** Throws message `id` (`subject` / `candidates` feed the diagnostics add-on's did-you-mean). */\nexport function raise(id: M, args?: readonly unknown[], subject?: string, candidates?: Iterable<string>): never {\n raiseError(text(id, args), subject, candidates);\n}\n"],"mappings":"+CA4IO,SAASA,EAAKC,EAAOC,EAA2B,IACrD,OAAOC,EAAMC,KAASH,EAAIC,IAAS,IAAID,IAAKC,EAAKG,IAAKC,GAAM,IAAiB,iBAANA,EAAiBC,KAAKC,UAAUF,GAAKG,OAAOH,MAAMI,KAAK,KAChI,CAGO,SAASC,EAAMV,EAAOC,EAA2BU,EAAkBC,GACxEC,EAAWd,EAAKC,EAAIC,GAAOU,EAASC,EACtC,QAAAP,OAAAS","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{e as t}from"./chunk-M5SODAAE.js";import{b as r}from"./chunk-EIMTT5I3.js";function n(t){r(26,[t])}function e(t){r(27,[t])}function o(t){r(28,[t])}function a(t){r(29,[t])}function f(t){r(30,[t])}function u(t){return!(!t||isNaN(Number(t)))}function i(t,r){return u(t)||e(r),Number(t)}function y(t,r,e){return i(t?.[r]??n(e),e)}function c(t,r){return void 0!==r&&r.length>0?r[0]:t}var s=(t,r)=>({factory:n=>{let e=y(n,0,t);return n=>("number"!=typeof n&&o(t),r(n,e))},arity:[1,1]}),m={eq:{factory:(t,r)=>{let o=t?.[0]??n("eq"),a=c(o,r);return t=>"number"==typeof t?"string"!=typeof a?t===a:(u(o)||e("eq"),t===Number(o)):"string"==typeof t?t===o:t===a},arity:[1,1]},ne:{factory:(t,r)=>{let o=t?.[0]??n("ne"),a=c(o,r);return t=>"number"==typeof t?"string"!=typeof a?t!==a:(u(o)||e("ne"),t!==Number(o)):"string"==typeof t?t!==o:t!==a},arity:[1,1]},not:{factory:()=>t=>!t,arity:[0,0]},lt:s("lt",(t,r)=>t<r),le:s("le",(t,r)=>t<=r),gt:s("gt",(t,r)=>t>r),ge:s("ge",(t,r)=>t>=r),falsy:{factory:()=>t=>!t,arity:[0,0]},truthy:{factory:()=>t=>!!t,arity:[0,0]},boolean:{factory:()=>t=>!!t,arity:[0,0]}},b=!1;function g(){b||(b=!0,t(m))}export{n as a,o as b,a as c,f as d,i as e,y as f,c as g,s as h,m as i,g as j};
2
- //# sourceMappingURL=chunk-W4KOY6GT.js.map
1
+ import{e as t}from"./chunk-6MACFEK7.js";import{b as r}from"./chunk-M656SMUU.js";function n(t){r(26,[t])}function e(t){r(27,[t])}function o(t){r(28,[t])}function a(t){r(29,[t])}function f(t){r(30,[t])}function u(t){return!(!t||isNaN(Number(t)))}function i(t,r){return u(t)||e(r),Number(t)}function y(t,r,e){return i(t?.[r]??n(e),e)}function c(t,r){return void 0!==r&&r.length>0?r[0]:t}var s=(t,r)=>({factory:n=>{let e=y(n,0,t);return n=>("number"!=typeof n&&o(t),r(n,e))},arity:[1,1]}),m={eq:{factory:(t,r)=>{let o=t?.[0]??n("eq"),a=c(o,r);return t=>"number"==typeof t?"string"!=typeof a?t===a:(u(o)||e("eq"),t===Number(o)):"string"==typeof t?t===o:t===a},arity:[1,1]},ne:{factory:(t,r)=>{let o=t?.[0]??n("ne"),a=c(o,r);return t=>"number"==typeof t?"string"!=typeof a?t!==a:(u(o)||e("ne"),t!==Number(o)):"string"==typeof t?t!==o:t!==a},arity:[1,1]},not:{factory:()=>t=>!t,arity:[0,0]},lt:s("lt",(t,r)=>t<r),le:s("le",(t,r)=>t<=r),gt:s("gt",(t,r)=>t>r),ge:s("ge",(t,r)=>t>=r),falsy:{factory:()=>t=>!t,arity:[0,0]},truthy:{factory:()=>t=>!!t,arity:[0,0]},boolean:{factory:()=>t=>!!t,arity:[0,0]}},b=!1;function g(){b||(b=!0,t(m))}export{n as a,o as b,a as c,f as d,i as e,y as f,c as g,s as h,m as i,g as j};
2
+ //# sourceMappingURL=chunk-PHAN6L23.js.map
@@ -1,2 +1,2 @@
1
- import{b as t}from"./chunk-EIMTT5I3.js";var e="else",l="eventToken",n="state",s="command",r="class",i="attr",u="style",a=/^\$[1-9]\d{0,2}$/,c=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function o(e){let l=[],n=[],s="",r=null,i=!1,u=-1,a=-1,o=t=>{let e=function(t,e,l){let n=-1===e?t.length:e,s=-1===l?0:l;return t.slice(n-t.slice(0,n).trimStart().length,s+t.slice(s).trimEnd().length)}(s,u,a);(!t||e||i)&&(l.push(e),n.push(function(t,e){return e?t:"true"===t||"false"!==t&&("null"===t?null:c.test(t)?Number(t):t)}(e,i))),s="",i=!1,u=-1,a=-1};for(let t=0;t<e.length;t++){let l=e[t];r?l===r?r=null:(-1===u&&(u=s.length),s+=l,a=s.length):'"'===l||"'"===l?(r=l,i=!0):","===l?o():s+=l}return null!==r&&t(107,[r,e]),o(!0),{args:l,literals:n}}var f=t=>t.trim();function h(t,e){let l=[],n=null;for(let s=0;s<t.length;s++){let r=t[s];null!==n?r===n&&(n=null):"'"===r||'"'===r?n=r:r===e&&l.push(s)}return l}var g=(t,e)=>h(t,e)[0]??-1;function m(t,e){let l=[],n=0;for(let s of h(t,e))l.push(t.slice(n,s)),n=s+1;return l.push(t.slice(n)),l}function p(e,l,n){let s=g(e,"|");if(-1===s)return[e.trim(),[]];let r=e.slice(s+1).trim(),i=n.get(r);return void 0===i&&(i=function(e,l,n){let s=n??e.join("|");return e.map(e=>{let n=g(e,"("),r=(t=>h(t,")").pop()??-1)(e);if(-1===r&&(r=e.lastIndexOf(")")),-1!==n&&-1===r&&t(108,[e]),-1!==r&&-1===n&&t(109,[e]),-1!==r&&r<n&&t(110,[e]),-1!==r&&e.slice(r+1).trim().length>0){let l=e.slice(r+1).trim();t(111,[e,l])}let i=(-1===n?e:e.substring(0,n)).trim();if(0===i.length&&t(112,[s]),i.includes("#")){let[,e]=i.split("#");t("input"===l?113:114,[i,e])}return-1===n?{Hn:i,args:[],literals:[]}:{Hn:i,...o(e.substring(n+1,r))}})}(m(r,"|").map(f),l,e),n.set(r,i)),[e.slice(0,s).trim(),i]}var d=new Map;function v(e){t(1101,[e])}function b(e){let[l,n]=p(e,"output",d);l.includes("@")&&t(32,[l]);let s=l,r=s.startsWith("."),i=r?s.slice(1):s;return(i.length>0&&i.split(".").some(t=>0===t.length)||!r&&0===i.length)&&t(119,[e]),function(e){e.includes("**")&&v(e);let l=e.split(".").length;l>512&&t(117,[e,l])}(s),{Je:s,Ze:n}}export{e as a,l as b,n as c,s as d,r as e,i as f,u as g,a as h,f as i,g as j,m as k,p as l,v as m,b as n};
2
- //# sourceMappingURL=chunk-NOPTR2L3.js.map
1
+ import{b as t}from"./chunk-M656SMUU.js";var e="else",l="eventToken",n="state",s="command",r="class",i="attr",u="style",a=/^\$[1-9]\d{0,2}$/,c=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function o(e){let l=[],n=[],s="",r=null,i=!1,u=-1,a=-1,o=t=>{let e=function(t,e,l){let n=-1===e?t.length:e,s=-1===l?0:l;return t.slice(n-t.slice(0,n).trimStart().length,s+t.slice(s).trimEnd().length)}(s,u,a);(!t||e||i)&&(l.push(e),n.push(function(t,e){return e?t:"true"===t||"false"!==t&&("null"===t?null:c.test(t)?Number(t):t)}(e,i))),s="",i=!1,u=-1,a=-1};for(let t=0;t<e.length;t++){let l=e[t];r?l===r?r=null:(-1===u&&(u=s.length),s+=l,a=s.length):'"'===l||"'"===l?(r=l,i=!0):","===l?o():s+=l}return null!==r&&t(107,[r,e]),o(!0),{args:l,literals:n}}var f=t=>t.trim();function h(t,e){let l=[],n=null;for(let s=0;s<t.length;s++){let r=t[s];null!==n?r===n&&(n=null):"'"===r||'"'===r?n=r:r===e&&l.push(s)}return l}var g=(t,e)=>h(t,e)[0]??-1;function m(t,e){let l=[],n=0;for(let s of h(t,e))l.push(t.slice(n,s)),n=s+1;return l.push(t.slice(n)),l}function p(e,l,n){let s=g(e,"|");if(-1===s)return[e.trim(),[]];let r=e.slice(s+1).trim(),i=n.get(r);return void 0===i&&(i=function(e,l,n){let s=n??e.join("|");return e.map(e=>{let n=g(e,"("),r=(t=>h(t,")").pop()??-1)(e);if(-1===r&&(r=e.lastIndexOf(")")),-1!==n&&-1===r&&t(108,[e]),-1!==r&&-1===n&&t(109,[e]),-1!==r&&r<n&&t(110,[e]),-1!==r&&e.slice(r+1).trim().length>0){let l=e.slice(r+1).trim();t(111,[e,l])}let i=(-1===n?e:e.substring(0,n)).trim();if(0===i.length&&t(112,[s]),i.includes("#")){let[,e]=i.split("#");t("input"===l?113:114,[i,e])}return-1===n?{Hn:i,args:[],literals:[]}:{Hn:i,...o(e.substring(n+1,r))}})}(m(r,"|").map(f),l,e),n.set(r,i)),[e.slice(0,s).trim(),i]}var d=new Map;function v(e){t(1101,[e])}function b(e){let[l,n]=p(e,"output",d);l.includes("@")&&t(32,[l]);let s=l,r=s.startsWith("."),i=r?s.slice(1):s;return(i.length>0&&i.split(".").some(t=>0===t.length)||!r&&0===i.length)&&t(119,[e]),function(e){e.includes("**")&&v(e);let l=e.split(".").length;l>512&&t(117,[e,l])}(s),{Je:s,Ze:n}}export{e as a,l as b,n as c,s as d,r as e,i as f,u as g,a as h,f as i,g as j,m as k,p as l,v as m,b as n};
2
+ //# sourceMappingURL=chunk-TUQ3OPZQ.js.map
@@ -1,2 +1,2 @@
1
- import{n as t,p as n}from"./chunk-L3PFEJP7.js";import{a as l,b as e,c as r}from"./chunk-ZN52NEIB.js";import{a as o}from"./chunk-4NJBYXIT.js";var i=Symbol.for("wcstack.binder"),u=Symbol.for("wcstack.binder.pending"),s=Symbol.for("wcstack.binder.taken");var a=new Map;function f(l,e){if(1!==l.nodeType||!l.isConnected)return;let r=t.get(l.getRootNode());void 0===r||!1===r.element?.isConnected?a.set(l,e):n(r,l,e?.range)}function c(){let t=[...a];a.clear();for(let[n,l]of t)f(n,l);!function(){let t=function(){let t=globalThis[i];return null==t||"wcs-binder"!==t.protocol||"number"!=typeof t.version||t.version<1||"function"!=typeof t.bind?null:t}();if(null===t)return;let n=function(){let t=globalThis,n=t[u];return void 0===n&&(n=[],t[u]=n),n}();if(0===n.length)return;let l=n.splice(0,n.length),e=function(){let t=globalThis,n=t[s];return void 0===n&&(n=new WeakSet,t[s]=n),n}();for(let n of l)e.add(n),t.bind(n)}()}function h(){let t=globalThis;void 0===t[i]&&(t[i]={protocol:"wcs-binder",version:1,bind:f})}var d=class{constructor(){this.name="dirty",this.Z=(t,n)=>{if(0===t.n){let n=t.z;return n!==l&&n!==e&&(t.z=e,!0)}let r=null===n?null:n.ht;if(null===r)return!1;let o=r[t.A];return o!==l&&o!==e&&(r[t.A]=e,!0)}}Qo(t,n,l){null!==n.getter&&this.Z(n,l),t.$t(n,l),t.xn(n,l,this.Z)}Ho(t,n){let l=n.l.o.It;if(null!==l)for(let e of l)e.n===n.l.n?t.it(e,n,this.Z):t.Zt(n,e,n=>t.it(e,n,this.Z))}we(t,n,l){this.Z(n,l),o.ve?.(t,n,l),t.$t(n,l),t.xn(n,l,this.Z)}Ko(t,n,o){let i=0===n.n;if(!i&&null===o)return;let u=i?null:o.ht??=new Array(t.Ie).fill(l),s=null===u?n.z:u[n.A];if(s!==l&&s!==e&&s!==r&&(null===u||n.A in u))return s;s=r;try{return s=t.Uo(n,null===u?null:o)}finally{null===u?n.z=s:u[n.A]=s}}Yt(t){t.ht=null}vt(t){for(let n of t.I.all())null!==n.getter&&(0===n.n?n.z===e&&(n.z=r):t.tn(n.h[n.n],t=>{let l=t.ht;null!==l&&l[n.A]===e&&(l[n.A]=r)}))}};export{f as a,c as b,h as c,d};
2
- //# sourceMappingURL=chunk-55J45X6H.js.map
1
+ import{n as t,p as n}from"./chunk-BMGEWHCR.js";import{a as l,b as e,c as r}from"./chunk-ZN52NEIB.js";import{a as o}from"./chunk-4NJBYXIT.js";var i=Symbol.for("wcstack.binder"),u=Symbol.for("wcstack.binder.pending"),s=Symbol.for("wcstack.binder.taken");var a=new Map;function f(l,e){if(1!==l.nodeType||!l.isConnected)return;let r=t.get(l.getRootNode());void 0===r||!1===r.element?.isConnected?a.set(l,e):n(r,l,e?.range)}function c(){let t=[...a];a.clear();for(let[n,l]of t)f(n,l);!function(){let t=function(){let t=globalThis[i];return null==t||"wcs-binder"!==t.protocol||"number"!=typeof t.version||t.version<1||"function"!=typeof t.bind?null:t}();if(null===t)return;let n=function(){let t=globalThis,n=t[u];return void 0===n&&(n=[],t[u]=n),n}();if(0===n.length)return;let l=n.splice(0,n.length),e=function(){let t=globalThis,n=t[s];return void 0===n&&(n=new WeakSet,t[s]=n),n}();for(let n of l)e.add(n),t.bind(n)}()}function h(){let t=globalThis;void 0===t[i]&&(t[i]={protocol:"wcs-binder",version:1,bind:f})}var d=class{constructor(){this.name="dirty",this.Z=(t,n)=>{if(0===t.n){let n=t.z;return n!==l&&n!==e&&(t.z=e,!0)}let r=null===n?null:n.ht;if(null===r)return!1;let o=r[t.A];return o!==l&&o!==e&&(r[t.A]=e,!0)}}Qo(t,n,l){null!==n.getter&&this.Z(n,l),t.$t(n,l),t.Nn(n,l,this.Z)}Ho(t,n){let l=n.l.o.It;if(null!==l)for(let e of l)e.n===n.l.n?t.it(e,n,this.Z):t.Zt(n,e,n=>t.it(e,n,this.Z))}we(t,n,l){this.Z(n,l),o.ve?.(t,n,l),t.$t(n,l),t.Nn(n,l,this.Z)}Ko(t,n,o){let i=0===n.n;if(!i&&null===o)return;let u=i?null:o.ht??=new Array(t.Ie).fill(l),s=null===u?n.z:u[n.A];if(s!==l&&s!==e&&s!==r&&(null===u||n.A in u))return s;s=r;try{return s=t.Uo(n,null===u?null:o)}finally{null===u?n.z=s:u[n.A]=s}}Yt(t){t.ht=null}vt(t){for(let n of t.I.all())null!==n.getter&&(0===n.n?n.z===e&&(n.z=r):t.tn(n.h[n.n],t=>{let l=t.ht;null!==l&&l[n.A]===e&&(l[n.A]=r)}))}};export{f as a,c as b,h as c,d};
2
+ //# sourceMappingURL=chunk-V6VVL4F3.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunks/chunk-SAUVGHSB.js";import{a as n,d as t,e as u}from"./chunks/chunk-UD3AYVP2.js";import"./chunks/chunk-55J45X6H.js";import"./chunks/chunk-L3PFEJP7.js";import"./chunks/chunk-W4KOY6GT.js";import{g as a,h as c,i as h}from"./chunks/chunk-7AYOQHZH.js";import{c as i}from"./chunks/chunk-M5SODAAE.js";import"./chunks/chunk-ZN52NEIB.js";import"./chunks/chunk-NOPTR2L3.js";import"./chunks/chunk-EIMTT5I3.js";import{g as o}from"./chunks/chunk-4NJBYXIT.js";function r(s){return s}export{a as TRUSTED_TYPES_POLICY_SLOT,s as VERSION,t as bootstrapState,u as buildBindings,r as defineState,n as getBindingsReady,i as getConfig,c as getTrustedTypesPolicy,o as installFeatures,h as setTrustedTypesPolicy};
1
+ import{a as s}from"./chunks/chunk-LAUWEM6K.js";import{a as n,d as t,e as u}from"./chunks/chunk-DFXQ7MFW.js";import"./chunks/chunk-V6VVL4F3.js";import"./chunks/chunk-BMGEWHCR.js";import"./chunks/chunk-PHAN6L23.js";import{g as a,h as c,i as h}from"./chunks/chunk-EM3Y3SJS.js";import{c as i}from"./chunks/chunk-6MACFEK7.js";import"./chunks/chunk-ZN52NEIB.js";import"./chunks/chunk-TUQ3OPZQ.js";import"./chunks/chunk-M656SMUU.js";import{g as o}from"./chunks/chunk-4NJBYXIT.js";function r(s){return s}export{a as TRUSTED_TYPES_POLICY_SLOT,s as VERSION,t as bootstrapState,u as buildBindings,r as defineState,n as getBindingsReady,i as getConfig,c as getTrustedTypesPolicy,o as installFeatures,h as setTrustedTypesPolicy};
2
2
  //# sourceMappingURL=core.js.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"../chunks/chunk-SAUVGHSB.js";import{c as t,d as n,e as l,f as o,g as s,h as r,i as a,n as i}from"../chunks/chunk-L3PFEJP7.js";import"../chunks/chunk-W4KOY6GT.js";import"../chunks/chunk-7AYOQHZH.js";import"../chunks/chunk-M5SODAAE.js";import"../chunks/chunk-ZN52NEIB.js";import"../chunks/chunk-NOPTR2L3.js";import"../chunks/chunk-EIMTT5I3.js";import{a as u,b as d}from"../chunks/chunk-4NJBYXIT.js";var f="__WCSTACK_DEVTOOLS_HOOK__",c=null,m=new Set,p=(e,t,n)=>({absolutePathInfo:{pathInfo:{path:t.t},stateElement:e.element},listIndex:null===n?null:{indexes:e.H(n)}}),h=new WeakMap,k=0;var v=new WeakMap;function g(e){if(null===c)return;let i=v.get(e),u=m.has(e)?function(e,i){let u=new Map,d=new Set,f=(r,a,d,f,c,m)=>{if(r===s)return;let v=function(e,s){return e===t?"textContent":e===n?`class.${s}`:e===l?`attr.${s}`:e===o?`style.${s}`:s}(r,a),g=0===f.n?null:c,w=`${(e=>{let t=h.get(e);return void 0===t&&h.set(e,t=++k),t})(d)}|${v}|${f.t}|${null===g?"":e.H(g).join(",")}`;if(u.has(w))return;let y=i?.get(w);u.set(w,y??{binding:{propName:v,statePathName:f.t,bindingType:m,node:d,replaceNode:d},absoluteAddress:p(e,f,g)})},c=e=>f(e.i,e.name,e.a,e.o,e.r,e.nn()),m=e=>{if(!d.has(e)){if(d.add(e),null!==e.he)for(let t of e.he)c(t);if(e instanceof r&&null!==e.fe){let n=e.F.ze;for(let l=0;l<n.length;l++){let o=e.V?.[l];void 0!==o?c(o):f(n[l].i,n[l].name,e.fe[2*l],n[l].o,e.r,n[l].i===t?"text":"prop")}}if(null!==e.c)for(let t of e.c)v(t)}},v=e=>{if(!d.has(e))if(d.add(e),e instanceof a){f(-1,"for",e.S,e.l.o,e.l.ae,"for");for(let t of e.Ne)m(t)}else null!==e.O&&m(e.O)};for(let t of e.ce.values())for(let e of t)c(e),null!==e._&&v(e._);for(let t of e.oe.values())if(null!==t.E&&v(t.E),null!==t.L)for(let e of t.L)v(e);return u}(e,i):new Map;if(void 0!==i)for(let[e,t]of i)u.has(e)||c({type:"state:binding-removed",...t});for(let[e,t]of u)(void 0===i||!i.has(e))&&c({type:"state:binding-added",...t});v.set(e,u)}function w(e){let t=i.get(e);if(void 0===t)throw new Error("[@wcstack/state] devtools: no state tree on this root");return t}function y(e){let t=new Set,n=new Set,l=new Set,o=new Set;for(let s of e.I.all()){for(let e=1;e<=s.n;e++)t.add(s.h[e].t);"*"===s.s&&n.add(s.t),null!==s.getter&&l.add(s.t),null!==s.ie&&o.add(s.t)}let s=e.target;return{rootNode:e.root,element:e.element,paths:{list:t,element:n,getter:l,setter:o},commandTokenNames:new Set(Object.keys(e.commands)),eventTokenNames:new Set(e.Re.keys()),staticDependency:new Map,dynamicDependency:new Map,watchPaths:null!==s.$watch&&"object"==typeof s.$watch?new Set(Object.keys(s.$watch)):null,keyedListPaths:null!==s.$listKeys&&"object"==typeof s.$listKeys?new Set(Object.keys(s.$listKeys)):null}}var S=new WeakSet,b=new WeakMap;function j(e,t){if(("mounting"===t||"reset"===t)&&function(e){let t=(t,n)=>{if(S.has(t))return;S.add(t);let l=t.emit;t.emit=(...o)=>(null!==c&&c({type:"state:token-emit",kind:n,tokenName:t.name,args:o,subscriberCount:t.size,stateElement:e.element}),l.apply(t,o))};for(let n of Object.values(e.commands))t(n,"command");for(let n of e.Re.values())t(n,"event")}(e),"connected"===t){if(m.has(e))return;m.add(e),c?.({type:"state:element-registered",rootNode:e.root,element:e.element}),g(e)}else"disconnected"===t&&(m.delete(e),g(e),c?.({type:"state:element-unregistered",rootNode:e.root,element:e.element}))}function O(e,t,n,l,o,s){if(null===c)return;let r=p(e,t,0===t.n?null:n),a=b.get(e);void 0===a&&b.set(e,a=new Set),a.add(r),s&&c({type:"state:write",absoluteAddress:r,value:o,oldValue:l,hasOldValue:!0})}function $(e){if(null===c)return;let t=b.get(e);b.delete(e),void 0!==t&&c({type:"state:update-batch",addresses:t}),g(e)}function E(e,t,n){c?.({type:"state:binding-apply-error",path:n.o.t,bindingType:n.nn(),error:t})}var N={name:"devtools",install(){u.element=d(u.element,j),u.be=d(u.be,O),u.Fe=d(u.Fe,$),u.Ke=d(u.Ke,E),function(){if(typeof document>"u"||document.documentElement?.hasAttribute("data-wcs-server"))return;let t=globalThis,n=t[f]??(t[f]=function(){let e=new Map,t=new Set,n=e=>{0===t.size?e._setSink(null):e._setSink(n=>{for(let l of t)l.onEvent?.(e.id,n)})};return{version:2,sources:e,register(l){if(!e.has(l.id)){e.set(l.id,l),n(l);for(let e of t)e.onSourceRegistered?.(l)}},unregister(n){let l=e.get(n);if(void 0!==l){l._setSink(null),e.delete(n);for(let e of t)e.onSourceUnregistered?.(n)}},addListener(l){t.add(l);for(let t of e.values())n(t),l.onSourceRegistered?.(t);return()=>{if(t.delete(l))for(let t of e.values())n(t)}}}}());2!==n.version&&console.warn(`[@wcstack/state] devtools hook registry version ${n.version}, expected 2: keeping the existing one.`),n.register({id:`state:${Math.random().toString(36).slice(2,10)}`,kind:"state",packageVersion:e,getStateElements:()=>[...m].map(y),overlays:()=>[],keyedSubscriptions:e=>function(e){let t=[];for(let n of e.I.all()){let l=n.W,o=n.Ce?.length??0;if((null===l||0===l.size)&&0===o)continue;let s,r=0;if(null!==l)for(let e of l.values())r+=e.size;try{s=0===n.n?e.v(n,null):void 0}catch{s=void 0}t.push({path:n.t,tracked:!1,rows:r,keys:null===l?0:l.size,lists:o,lastValue:s})}return t}(w(e)),keys(e){let t=w(e).target;return Object.keys(t).filter(e=>{if(e.includes("*")||"$"===e[0])return!1;let n=Object.getOwnPropertyDescriptor(t,e);return void 0!==n.get||"function"!=typeof n.value})},read(e,t,n){let l;return w(e).element.createState("readonly",e=>{l=e.$resolve(t,n??[])}),l},write(e,t,n,l){w(e).element.createState("writable",e=>{e.$resolve(t,l??[],n)})},_setSink(e){let t=null===c&&null!==e;c=e,null===e&&(v=new WeakMap),u.st=e&&((e,t)=>c?.({...t,stateElement:e.element})),t&&queueMicrotask(()=>{for(let e of m)g(e)})}})}()}},M=N;export{M as default,N as devtools};
1
+ import{a as e}from"../chunks/chunk-LAUWEM6K.js";import{c as t,d as n,e as l,f as o,g as s,h as r,i as a,n as i}from"../chunks/chunk-BMGEWHCR.js";import"../chunks/chunk-PHAN6L23.js";import"../chunks/chunk-EM3Y3SJS.js";import"../chunks/chunk-6MACFEK7.js";import"../chunks/chunk-ZN52NEIB.js";import"../chunks/chunk-TUQ3OPZQ.js";import"../chunks/chunk-M656SMUU.js";import{a as u,b as d}from"../chunks/chunk-4NJBYXIT.js";var f="__WCSTACK_DEVTOOLS_HOOK__",c=null,m=new Set,p=(e,t,n)=>({absolutePathInfo:{pathInfo:{path:t.t},stateElement:e.element},listIndex:null===n?null:{indexes:e.H(n)}}),h=new WeakMap,k=0;var v=new WeakMap;function g(e){if(null===c)return;let i=v.get(e),u=m.has(e)?function(e,i){let u=new Map,d=new Set,f=(r,a,d,f,c,m)=>{if(r===s)return;let v=function(e,s){return e===t?"textContent":e===n?`class.${s}`:e===l?`attr.${s}`:e===o?`style.${s}`:s}(r,a),g=0===f.n?null:c,w=`${(e=>{let t=h.get(e);return void 0===t&&h.set(e,t=++k),t})(d)}|${v}|${f.t}|${null===g?"":e.H(g).join(",")}`;if(u.has(w))return;let y=i?.get(w);u.set(w,y??{binding:{propName:v,statePathName:f.t,bindingType:m,node:d,replaceNode:d},absoluteAddress:p(e,f,g)})},c=e=>f(e.i,e.name,e.a,e.o,e.r,e.nn()),m=e=>{if(!d.has(e)){if(d.add(e),null!==e.he)for(let t of e.he)c(t);if(e instanceof r&&null!==e.fe){let n=e.F.ze;for(let l=0;l<n.length;l++){let o=e.V?.[l];void 0!==o?c(o):f(n[l].i,n[l].name,e.fe[2*l],n[l].o,e.r,n[l].i===t?"text":"prop")}}if(null!==e.c)for(let t of e.c)v(t)}},v=e=>{if(!d.has(e))if(d.add(e),e instanceof a){f(-1,"for",e.S,e.l.o,e.l.ae,"for");for(let t of e.xe)m(t)}else null!==e.O&&m(e.O)};for(let t of e.ce.values())for(let e of t)c(e),null!==e._&&v(e._);for(let t of e.oe.values())if(null!==t.E&&v(t.E),null!==t.L)for(let e of t.L)v(e);return u}(e,i):new Map;if(void 0!==i)for(let[e,t]of i)u.has(e)||c({type:"state:binding-removed",...t});for(let[e,t]of u)(void 0===i||!i.has(e))&&c({type:"state:binding-added",...t});v.set(e,u)}function w(e){let t=i.get(e);if(void 0===t)throw new Error("[@wcstack/state] devtools: no state tree on this root");return t}function y(e){let t=new Set,n=new Set,l=new Set,o=new Set;for(let s of e.I.all()){for(let e=1;e<=s.n;e++)t.add(s.h[e].t);"*"===s.s&&n.add(s.t),null!==s.getter&&l.add(s.t),null!==s.ie&&o.add(s.t)}let s=e.target;return{rootNode:e.root,element:e.element,paths:{list:t,element:n,getter:l,setter:o},commandTokenNames:new Set(Object.keys(e.commands)),eventTokenNames:new Set(e.Re.keys()),staticDependency:new Map,dynamicDependency:new Map,watchPaths:null!==s.$watch&&"object"==typeof s.$watch?new Set(Object.keys(s.$watch)):null,keyedListPaths:null!==s.$listKeys&&"object"==typeof s.$listKeys?new Set(Object.keys(s.$listKeys)):null}}var S=new WeakSet,b=new WeakMap;function j(e,t){if(("mounting"===t||"reset"===t)&&function(e){let t=(t,n)=>{if(S.has(t))return;S.add(t);let l=t.emit;t.emit=(...o)=>(null!==c&&c({type:"state:token-emit",kind:n,tokenName:t.name,args:o,subscriberCount:t.size,stateElement:e.element}),l.apply(t,o))};for(let n of Object.values(e.commands))t(n,"command");for(let n of e.Re.values())t(n,"event")}(e),"connected"===t){if(m.has(e))return;m.add(e),c?.({type:"state:element-registered",rootNode:e.root,element:e.element}),g(e)}else"disconnected"===t&&(m.delete(e),g(e),c?.({type:"state:element-unregistered",rootNode:e.root,element:e.element}))}function $(e,t,n,l,o,s){if(null===c)return;let r=p(e,t,0===t.n?null:n),a=b.get(e);void 0===a&&b.set(e,a=new Set),a.add(r),s&&c({type:"state:write",absoluteAddress:r,value:o,oldValue:l,hasOldValue:!0})}function M(e){if(null===c)return;let t=b.get(e);b.delete(e),void 0!==t&&c({type:"state:update-batch",addresses:t}),g(e)}function E(e,t,n){c?.({type:"state:binding-apply-error",path:n.o.t,bindingType:n.nn(),error:t})}var O={name:"devtools",install(){u.element=d(u.element,j),u.be=d(u.be,$),u.Fe=d(u.Fe,M),u.Ke=d(u.Ke,E),function(){if(typeof document>"u"||document.documentElement?.hasAttribute("data-wcs-server"))return;let t=globalThis,n=t[f]??(t[f]=function(){let e=new Map,t=new Set,n=e=>{0===t.size?e._setSink(null):e._setSink(n=>{for(let l of t)l.onEvent?.(e.id,n)})};return{version:2,sources:e,register(l){if(!e.has(l.id)){e.set(l.id,l),n(l);for(let e of t)e.onSourceRegistered?.(l)}},unregister(n){let l=e.get(n);if(void 0!==l){l._setSink(null),e.delete(n);for(let e of t)e.onSourceUnregistered?.(n)}},addListener(l){t.add(l);for(let t of e.values())n(t),l.onSourceRegistered?.(t);return()=>{if(t.delete(l))for(let t of e.values())n(t)}}}}());2!==n.version&&console.warn(`[@wcstack/state] devtools hook registry version ${n.version}, expected 2: keeping the existing one.`),n.register({id:`state:${Math.random().toString(36).slice(2,10)}`,kind:"state",packageVersion:e,getStateElements:()=>[...m].map(y),overlays:()=>[],keyedSubscriptions:e=>function(e){let t=[];for(let n of e.I.all()){let l=n.W,o=n.Ce?.length??0;if((null===l||0===l.size)&&0===o)continue;let s,r=0;if(null!==l)for(let e of l.values())r+=e.size;try{s=0===n.n?e.v(n,null):void 0}catch{s=void 0}t.push({path:n.t,tracked:!1,rows:r,keys:null===l?0:l.size,lists:o,lastValue:s})}return t}(w(e)),keys(e){let t=w(e).target;return Object.keys(t).filter(e=>{if(e.includes("*")||"$"===e[0])return!1;let n=Object.getOwnPropertyDescriptor(t,e);return void 0!==n.get||"function"!=typeof n.value})},read(e,t,n){let l;return w(e).element.createState("readonly",e=>{l=e.$resolve(t,n??[])}),l},write(e,t,n,l){w(e).element.createState("writable",e=>{e.$resolve(t,l??[],n)})},_setSink(e){let t=null===c&&null!==e;c=e,null===e&&(v=new WeakMap),u.st=e&&((e,t)=>c?.({...t,stateElement:e.element})),t&&queueMicrotask(()=>{for(let e of m)g(e)})}})}()}},N=O;export{N as default,O as devtools};
2
2
  //# sourceMappingURL=devtools.js.map
@@ -1,2 +1,2 @@
1
- import{b as e,c as t,h as n,j as a}from"../chunks/chunk-7AYOQHZH.js";import{a as i,d as s,f as r}from"../chunks/chunk-M5SODAAE.js";import{e as o}from"../chunks/chunk-ZN52NEIB.js";import"../chunks/chunk-NOPTR2L3.js";import{b as l}from"../chunks/chunk-EIMTT5I3.js";import{a as d,b as c,c as u,e as f,j as h}from"../chunks/chunk-4NJBYXIT.js";function $(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let a=new Array(t.length+1),i=new Array(t.length+1);for(let e=0;e<=t.length;e++)a[e]=e;for(let n=1;n<=e.length;n++){i[0]=n;for(let s=1;s<=t.length;s++){let r=e[n-1]===t[s-1]?0:1;i[s]=Math.min(a[s]+1,i[s-1]+1,a[s-1]+r)}for(let e=0;e<=t.length;e++)a[e]=i[e]}return a[t.length]}function p(e,t){if(0===e.length)return"";let n=e.toLowerCase(),a=null,i=3;for(let e of t){let t=$(n,e.toLowerCase(),2);t<i&&(a=e,i=t)}return null!==a?` Did you mean "${a}"?`:""}var m=" Validate statically: npx @wcstack/lint <file>.",g=["","binding-syntax","template-syntax","binding-path-missing","binding-type-expectation","filter-unknown","filter-arity","getter-cycle","getter-depth-exceeded","index-arity","index-param-range","recursion-unsupported","token-misconfigured","token-undeclared","wildcard-rank","spread-no-bindable","declaration-alias","name-alias"],w=e=>{let t=g[e/100|0];return t?`[wcs/${t}] `:""},b=["enableMustache","sameValueGuard","enableDirectionalInitialSync"],y=(e,t)=>`<${e}${t.map((e,t)=>t%2?`="${e}"`:` ${e}`).join("")}>`,v="https://github.com/wcstack/wcstack/blob/main/docs/csp.md",k={1:()=>"$scan was removed (use $watch or $on)",2:e=>`"${e}" is a getter without a setter`,3:e=>`no row for "${e}"`,4:(e,t)=>`cannot write "${e}": its parent is ${t}`,5:e=>`"${e}" is not a method`,6:e=>`$getAll("${e}"): no loop level in common with the context`,7:e=>`$eqIndex("${e}") needs a list row scope.`,8:()=>"This state is readonly.",9:e=>`$setAll("${e}") needs indexes ([] for every match)`,10:(e,t)=>`$setAll("${e}", …, { spread: true }) needs an array of ${t} values`,11:()=>`updates did not settle after ${e} passes`,41:()=>`render chain depth limit exceeded (${t} drains that rendering itself started); bindings for this batch were not applied.`,12:(e,t)=>`binding "${e}: ${t}" failed to apply.`,13:(e,t)=>`failed to load "${e}": ${t}`,14:()=>"this <wcs-state> failed to initialize; create a new one",15:()=>"state is not initialized",16:e=>`no <script> with id "${e}"`,42:()=>`The inline <script> of <wcs-state> was blocked by Content-Security-Policy. Inline state is evaluated through a blob: URL: give the page's nonce to the <script> that loads @wcstack/state, or allow blob: in script-src. Moving the state into an external file (src="./state.js") needs neither. See ${v}`,43:e=>`Failed to evaluate the inline <script> of <wcs-state>: ${e}. If this page sets a Content-Security-Policy, see ${v}`,17:e=>`a subscriber of token "${e}" threw.`,18:e=>`${e} must be an array of strings.`,19:e=>`${e} entries must be non-empty strings.`,20:(e,t,n)=>`${e} entry "${t}" conflicts with the reserved namespace name "${n}".`,21:(e,t)=>`${e} entry "${t}" is duplicated.`,22:()=>"$on must be an object of handlers.",23:e=>`$on entry "${e}" is not declared in $eventTokens.`,24:e=>`$on entry "${e}" must be a function.`,25:e=>`view-transition naming-limit (${e}) reached.`,26:e=>`filter ${e} requires at least one option`,27:e=>`filter ${e} requires a number as option`,28:e=>`filter ${e} requires a number value`,29:e=>`filter ${e} requires a date value`,30:e=>`filter ${e} requires an array value`,31:()=>"init=/sync= modifiers require enableDirectionalInitialSync.",33:(e,t)=>`Unknown binding modifier "${e}" in "${t}".`,34:e=>`Binding modifier "${e}" may only be specified once.`,35:(e,t)=>`Invalid ${e} modifier value "${t}".`,36:()=>"Event bindings only allow init=none.",37:(e,t)=>`Binding type "${e}" does not support init=${t}.`,38:e=>`Property "${e}" is not declared by wcBindable.`,39:(e,t)=>`init=${e} is incompatible with wcBindable member "${t}".`,40:e=>`sync=connect requires observable property "${e}".`,44:(e,t)=>`${e}: "${t}" is not one of its options, or not of the option's type.${"bootstrapState"===e&&b.includes(t)?" 4.0 moved it to the state's $behavior.":""}`,45:()=>"a re-set state may not change $behavior: create the element again.",47:()=>'a second <wcs-state> on the same root: there is one state tree per root — graft a subtree with <wcs-state mount="path"> (v1\'s name="…" is gone: read the mounted state by its path).',48:e=>`the locale "${e}" (<html lang> or bootstrapState's locale) is not a language tag Intl takes (en-US, not en_US): the locale filters use "en".`,46:()=>'$features must be an array of add-on names (["temporal", "formats"]).',49:(e,...t)=>`${y(e,t)} failed to initialize.`,50:(e,...t)=>`${y(e,t)} $connectedCallback failed.`,51:(e,...t)=>`${y(e,t)} $disconnectedCallback failed.`,101:e=>`Invalid bindText: "${e}". Missing ':' separator between propPart and statePart.`,102:(e,t)=>`"${e}": "${t}" takes no modifiers or filters on its left side — write "${t}:".`,103:e=>`"${e}": "else" takes no value — write "else:".`,104:e=>`Invalid spread binding "${e}": spread target path is required.`,105:e=>`Invalid spread binding "${e}": filters are not allowed on spread targets.`,106:e=>`"${e}": a leading "." binds an element property by name — write a non-empty property that is not a namespace (class, attr, style, command, eventToken, state).`,107:(e,t)=>`unterminated ${e} quote in the filter arguments "(${t})". Close the quote.`,108:e=>`Invalid filter format: missing closing parenthesis in "${e}".`,109:e=>`Invalid filter format: missing opening parenthesis in "${e}".`,110:e=>`Invalid filter format: ")" comes before "(" in "${e}".`,111:(e,t)=>`"${e}": unexpected "${t}" after the filter's closing ")" — separate filters with "|" (write "${e.slice(0,e.lastIndexOf(")")+1)}|${t}").`,112:e=>`an empty filter in "${e}" — remove the extra "|" or name the filter.`,113:(e,t)=>`"${e}" is not a filter name: a modifier list "#${t}" comes before the input filters, not inside one`,114:e=>`"${e}" is not a filter name: "#" cannot appear in one.`,115:e=>`"${e}": a binding takes one modifier list after a single "#"`,116:e=>`"${e}": the left side of a binding must name a property — write "<property>: <path>" (modifiers and input filters come after the name).`,117:(e,t)=>`"${e}" has ${t} path segments — the limit is 512.`,32:e=>`"${e}": the "@name" selector was removed in v2 — there is a single state tree. Mount the named state onto the tree (<wcs-state mount="...">) and read it by its path prefix instead.`,120:e=>`"${e}": a state path cannot go through "__proto__" or "prototype" (it would reach every object's prototype).`,121:e=>`"${e}": "for:" takes no filters — a row is "<path>.<index>", so the rows of a filtered list would name other elements. Declare a getter that returns the filtered list and loop over it ("for: <getter>").`,119:e=>`"${e}": the right side of a binding must name a state path — write "<property>: <path>" (a path segment cannot be empty; "." alone and a leading "." are the loop-relative shorthand).`,201:e=>`Invalid bindText: "${e}". 'if', 'elseif', 'else', and 'for' bindings must be single binding.`,202:e=>`"${e}:" must follow an "if:" template`,204:e=>`a "${e}:" template at the top of inserted content was not rendered, as it would render beside itself out of the inserter's reach: wrap it in an element.`,203:e=>`"${e}:" replaces its element, so it cannot be used inside a "for" / "if" template (a row or branch keeps its nodes by position): bind innerHTML: on a wrapper element instead.`,301:e=>`Path "${e}" does not exist on the state tree.`,401:(e,t)=>`class.${e} needs a boolean, got ${t}.`,501:e=>`filter not found: ${e}.`,601:(e,t,n)=>`filter "${e}" requires at least ${t} argument(s) (${n} given).`,602:(e,t,n)=>`filter "${e}" accepts at most ${t} argument(s) (${n} given).`,701:e=>`"${e}" depends on itself`,801:e=>`"${e}"`,901:(e,t,n,a)=>`${e}("${t}") takes ${n} index(es), got ${a}.`,902:(e,t,n,a)=>`${e}("${t}") takes at most ${n} index(es), got ${a}.`,1001:e=>`"${e}": list index parameters run from $1 to $128.`,1101:e=>`"${e}" uses "**", which is not accepted here.`,1201:(e,t)=>`"${e}: ${t}": the right-hand side must be $command.<name>`,1202:(e,t)=>`<${e}> declares no static wcBindable (${t}).${!e.includes("-")&&t.startsWith("command.")?" A native element's command needs the add-on @wcstack/state/features/native-commands.":""}`,1203:(e,t)=>`<${e}> declares no command "${t}".`,1204:(e,t)=>`<${e}> declares no property "${t}".`,1205:(e,t,n)=>`<${e}> has no command "${t}" (a native <${e}>'s commands: ${n}).`,1301:e=>`eventToken "${e}" is not declared in $eventTokens.`,1302:e=>`"$command.${e}" is not declared in $commandTokens.`,1401:(e,t,n=0)=>`"${e}" needs ${t} enclosing loop level(s); the scope provides ${n}.`,1402:e=>`"${e}" is relative: it needs an enclosing "for" template`,1403:(e,t,n)=>`"${e}" ranges over the rows of "${t}", but the enclosing "for" template at that level renders "${n}".`,1501:(e,t)=>`<${e}> declares no static wcBindable (${t}).`,1601:(e,t)=>`${e} was removed: write ${t}.`,1701:(e,t)=>`${e} was removed: write ${t}.`};function x(e,t){let n=k[e];return void 0===n?`${w(e)}#${e} ${t.join(" ")}`:w(e)+n(...t)}var j=new Set(["binding-syntax","template-syntax","filter-unknown","filter-arity","index-arity","wildcard-rank","token-undeclared","binding-path-missing","index-param-range"]),T=[[/no loop level in common with the context/,"; pass indexes ([] for all)."],[/"([^"#]+)#([^"]*)" is not a filter name: a modifier list .* comes before the input filters/,' — write "<property>#$2|$1".'],[/\[wcs\/recursion-unsupported\]/," It is only meaningful in a $recursion declaration, in a recursive getter key, and in the path argument of $getAll / $setAll — and only when the state declares a $recursion anchor."],[/must be single binding/,' Put the structural binding alone in its own data-wcs (e.g. <template data-wcs="for: items">).'],[/\[wcs\/wildcard-rank\] .* needs \d+ enclosing/,' Wrap it in that many "for" templates, or use $resolve(path, indexes) to name the row explicitly.'],[/\[wcs\/wildcard-rank\] .* ranges over the rows of/,' A "*" in a binding is the row of the loop around it: read a row of another list in a getter, with $resolve(path, indexes).'],[/\[wcs\/binding-type-expectation\] class\.([^ ]+)/,' Write "class.$1: path|truthy" to toggle on truthiness.'],[/path segments — the limit/," Every prefix of a path is interned, so the cost grows with the square of the depth."],[/\[wcs\/index-arity\] \$resolve/,' $resolve takes one index per "*"; $getAll / $setAll take at most that many (fewer expands the rest).'],[/"([^"#]+)#[^"]*" is not a filter name: "#" cannot appear in one/,' Modifiers belong on the left side of the binding, before the ":" — write "$1" here.']],I={inc:"add",dec:"sub",fix:"toFixed",uc:"upper",lc:"lower",cap:"capitalize",rep:"repeat",rev:"reverse",pad:"padStart",null:"nullIfEmpty"};function O(e,t,n){let a=(void 0!==t&&e.includes("[wcs/filter-unknown]")?function(e){if("substr"===e)return' "substr" was removed in 4.0 — write slice(start, start + length): slice takes the end index, not a length.';let t=Object.hasOwn(I,e)?I[e]:null;return null===t?null:` "${e}" was renamed "${t}" in 3.2 and removed in 4.0 — write "${t}".`}(t):null)??(void 0!==t&&void 0!==n?p(t,n):"");for(let[t,n]of T){let i=t.exec(e);null!==i&&(a+=n.replace(/\$(\d)/g,(e,t)=>i[Number(t)]))}let i=/"([^"#]+)#([^"]+)": a binding takes one modifier list/.exec(e);null!==i&&(a+=` — write "${i[1]}#${i[2].split("#").join(",")}".`),e.includes("[wcs/filter-unknown]")&&(e.includes("formats add-on")?a+=' On a split auto page: features="formats" on the root, or "$features": ["formats"].':s.some(r)||(a+=' No formatting filters are installed — add the formats add-on: installFeatures([formats]) from "@wcstack/state/features/formats" (a split auto page: features="formats", or "$features").'));let o=/\[wcs\/([\w-]+)\]/.exec(e);return null!==o&&j.has(o[1])&&!/ path segments — the limit is |inserted content was not rendered|formats add-on/.test(e)&&(a+=m),a}var S=new WeakMap,M=new WeakMap,A=new WeakSet,P=new WeakSet;function W(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 q(e){let t=new Set;for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let e of Object.getOwnPropertyNames(n))"$"!==e[0]&&"constructor"!==e&&t.add(e);return[...t]}function L(e,t){let n=[];for(let e=t;null!==e;e=e.d)n.unshift(e);let a=e.target,i=t=>null===t?null:function(e,t){let n=t.t.split("."),a=n.findIndex((e,t)=>t>0&&/^\d/.test(e));return a<0||n.indexOf("*",a)>=0||void 0!==W(e.target,t.t)?.get?t:e.I.jt(o(t.t).o)}(e,t);for(let t of n){if(null!=i(t)?.getter||null===a||"object"!=typeof a)return null;if("*"===t.s){if(!Array.isArray(a)||0===a.length)return null;a=a[0];continue}if(Array.isArray(a)&&/^\d+$/.test(t.s)){if(Number(t.s)>=a.length)return null;a=a[Number(t.s)];continue}let n=W(a,t.s);if(void 0===n&&null===t.d&&e.vt.has(t.s))return null;if(void 0===n){let n=q(a),s=i(t.d);for(let t of e.I.all())t.d===s&&null!==t.getter&&n.push(t.s);return{seg:t.s,names:n}}if(void 0!==n.get||void 0!==n.set)return null;a=n.value}return null}function N(e){A.has(e)||(A.add(e),setTimeout(()=>function(e){A.delete(e);let t=S.get(e);if(void 0===t)return;let n=M.get(e);void 0===n&&M.set(e,n=new Set);for(let[a,s]of t){if(n.has(a))continue;n.add(a);let t=L(e,a);if(null===t)continue;let r=[...e.root?.querySelectorAll(`${i.tagNames.state}[mount]`)??[]].find(e=>!P.has(e)&&(a.t+".").startsWith(e.getAttribute("mount")+"."));if(void 0!==r){n.delete(a),r.initializePromise.then(()=>{P.add(r),N(e)});continue}let[l,c]=s?["watch-path-missing","$watch path"]:["binding-path-missing","Bound path"];d.st?.(e,{type:"state:path-unresolved",source:s?"watch":"binding",path:a.t,missingSegment:t.seg});let u=e.I.jt(o(a.t).o),f="";if(void 0!==u&&u!==a&&null!==u.getter){let e=u.h.slice(1).map((e,t)=>`for: ${0===t?e.t:e.t.slice(u.h[t].t.length+2)}`);f=` The getter "${u.t}" is declared for the rows of ${e.join(" → ")}; a list named by an index has rows of its own.`}console.warn(`[@wcstack/state] [wcs/${l}] ${c} "${a.t}" does not resolve on the state tree: "${t.seg}" is not declared.${p(t.seg,t.names)}${f} Updates to this path will be silently dropped.${m}`)}}(e),0))}function B(e,t,n=!1){if("$"===t.t[0]||t.t.includes("#")||!n&&null===t.d)return;let a=S.get(e);void 0===a&&S.set(e,a=new Map),a.has(t)||a.set(t,n),N(e)}var C=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),D=!1;function E(e,t,i){let s="html"===i.name?"innerHTML":i.name;if(D||!(t instanceof TypeError)||!a(s)||!("trustedTypes"in globalThis))return;D=!0;let r="function"==typeof n()?.createHTML?"The injected policy's createHTML() did not return a TrustedHTML.":"No sanitizing policy is installed, and @wcstack/state deliberately does not pass state values through an identity policy — that would defeat the CSP.";console.error(`[@wcstack/state] Writing to "${s}" was blocked by Trusted Types (require-trusted-types-for 'script'). ${r}\nInstall a sanitizing policy before the first binding is applied:\n globalThis[Symbol.for("wcstack.trustedTypes.policy")] =\n trustedTypes.createPolicy("my-app", { createHTML: (s) => DOMPurify.sanitize(s) });\nOr bind the value as text instead of HTML. See docs/csp.md section 7.`,{element:i.a,property:s})}var H=new WeakMap;function z(e,t,n){let a=e[t],i=void 0===n?void 0===a?null:`the event carried no detail (undefined) while element.${t} is ${typeof a}`:null===n||"object"!=typeof n||!Object.prototype.hasOwnProperty.call(n,t)||null!==a&&"object"==typeof a?null:`the event's detail is an object with a "${t}" key while element.${t} is ${typeof a}`;if(null===i)return;let s=H.get(e);void 0===s&&H.set(e,s=new Set),!s.has(t)&&(s.add(t),console.warn(`[@wcstack/state] [wcs/default-getter-mismatch] <${e.localName}> "${t}": ${i}. With no getter, state receives e.detail as-is. Dispatch the value itself as detail, or declare getter (e.g. (e) => e.detail.${t}, or (e) => e.target.${t}) on that wcBindable property.`))}var R=[["$streams","$stream"],["$updatedCallback","$renderedCallback"]],U={$trackDependency:"$dependOn",$untrackDependency:"$untracked"},_={name:"diagnostics",install(){d.Lo=O,d.Bo=x,d.So=B,d.detail=z,d.Ke=c(d.Ke,E);let e=d.de;d.de=(t,n)=>{(function(e){void 0!==e.$scan&&l(1);for(let[t,n]of R)void 0!==e[t]&&l(1601,[t,n])})(n),e?.(t,n),function(e){let t=e.$recursion;if(null===t||"object"!=typeof t)return;let n=Object.entries(t);if(1!==n.length||"string"!=typeof n[0][1])return;let[a,i]=n[0];if(!a.endsWith(".*")||!i.endsWith(".*"))return;let s=a.slice(0,-2),r=i.slice(0,-2),o=`.${i}`,l=`${s}.**`,d=q(e),c=d.filter(e=>e.startsWith(l)).map(e=>e.slice(l.length)),u=e=>h(`[wcs/recursion-declaration-invalid] ${e}`);for(let e of c){(e===`.${r}`||e.startsWith(`.${r}.`))&&u(`"${l}${e}" names the recursion structure itself (the "${r}" lists): recursive getters compute values over the nodes.`);for(let t of c)t.length>e.length&&t.endsWith(e)&&new RegExp(`^(?:${C(o)})+$`).test(t.slice(0,t.length-e.length))&&u(`"${l}${e}" and "${l}${t}" expand to the same concrete path at different depths (they differ by whole repetitions of "${i}"). Rename one of them.`);let t=new RegExp(`^${C(a)}(?:${C(o)})*${C(e)}$`);for(let n of d)!n.includes("**")&&t.test(n)&&u(`"${n}" is already defined on the state, so the recursive getter "${l}${e}" cannot expand to it.`)}}(n),function(e){M.delete(e),S.has(e)&&N(e)}(t)},d.ot=u(f,d.ot,(e,t)=>Object.hasOwn(U,t)?l(1701,[t,U[t]]):void 0)}},F=_;export{F as default,_ as diagnostics};
1
+ import{b as e,c as t,h as n,j as a}from"../chunks/chunk-EM3Y3SJS.js";import{a as i,d as s,f as r}from"../chunks/chunk-6MACFEK7.js";import{e as o}from"../chunks/chunk-ZN52NEIB.js";import"../chunks/chunk-TUQ3OPZQ.js";import{b as l}from"../chunks/chunk-M656SMUU.js";import{a as d,b as c,c as u,e as h,j as f}from"../chunks/chunk-4NJBYXIT.js";function $(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let a=new Array(t.length+1),i=new Array(t.length+1);for(let e=0;e<=t.length;e++)a[e]=e;for(let n=1;n<=e.length;n++){i[0]=n;for(let s=1;s<=t.length;s++){let r=e[n-1]===t[s-1]?0:1;i[s]=Math.min(a[s]+1,i[s-1]+1,a[s-1]+r)}for(let e=0;e<=t.length;e++)a[e]=i[e]}return a[t.length]}function p(e,t){if(0===e.length)return"";let n=e.toLowerCase(),a=null,i=3;for(let e of t){let t=$(n,e.toLowerCase(),2);t<i&&(a=e,i=t)}return null!==a?` Did you mean "${a}"?`:""}var m=" Validate statically: npx @wcstack/lint <file>.",g=["","binding-syntax","template-syntax","binding-path-missing","binding-type-expectation","filter-unknown","filter-arity","getter-cycle","getter-depth-exceeded","index-arity","index-param-range","recursion-unsupported","token-misconfigured","token-undeclared","wildcard-rank","spread-no-bindable","declaration-alias","name-alias"],w=e=>{let t=g[e/100|0];return t?`[wcs/${t}] `:""},b=["enableMustache","sameValueGuard","enableDirectionalInitialSync"],y=(e,t)=>`<${e}${t.map((e,t)=>t%2?`="${e}"`:` ${e}`).join("")}>`,v="https://github.com/wcstack/wcstack/blob/main/docs/csp.md",k={1:()=>"$scan was removed (use $watch or $on)",2:e=>`"${e}" is a getter without a setter`,3:e=>`no row for "${e}"`,4:(e,t)=>`cannot write "${e}": its parent is ${t}`,5:e=>`"${e}" is not a method`,6:e=>`$getAll("${e}"): no loop level in common with the context`,7:e=>`$eqIndex("${e}") needs a list row scope.`,8:()=>"This state is readonly.",9:e=>`$setAll("${e}") needs indexes ([] for every match)`,10:(e,t)=>`$setAll("${e}", …, { spread: true }) needs an array of ${t} values`,11:()=>`updates did not settle after ${e} passes`,41:()=>`render chain depth limit exceeded (${t} drains that rendering itself started); bindings for this batch were not applied.`,12:(e,t)=>`binding "${e}: ${t}" failed to apply.`,13:(e,t)=>`failed to load "${e}": ${t}`,14:()=>"this <wcs-state> failed to initialize; create a new one",15:()=>"state is not initialized",16:e=>`no <script> with id "${e}"`,42:()=>`The inline <script> of <wcs-state> was blocked by Content-Security-Policy. Inline state is evaluated through a blob: URL: give the page's nonce to the <script> that loads @wcstack/state, or allow blob: in script-src. Moving the state into an external file (src="./state.js") needs neither. See ${v}`,43:e=>`Failed to evaluate the inline <script> of <wcs-state>: ${e}. If this page sets a Content-Security-Policy, see ${v}`,17:e=>`a subscriber of token "${e}" threw.`,18:e=>`${e} must be an array of strings.`,19:e=>`${e} entries must be non-empty strings.`,20:(e,t,n)=>`${e} entry "${t}" conflicts with the reserved namespace name "${n}".`,21:(e,t)=>`${e} entry "${t}" is duplicated.`,22:()=>"$on must be an object of handlers.",23:e=>`$on entry "${e}" is not declared in $eventTokens.`,24:e=>`$on entry "${e}" must be a function.`,25:e=>`view-transition naming-limit (${e}) reached.`,26:e=>`filter ${e} requires at least one option`,27:e=>`filter ${e} requires a number as option`,28:e=>`filter ${e} requires a number value`,29:e=>`filter ${e} requires a date value`,30:e=>`filter ${e} requires an array value`,31:()=>"init=/sync= modifiers require enableDirectionalInitialSync.",33:(e,t)=>`Unknown binding modifier "${e}" in "${t}".`,34:e=>`Binding modifier "${e}" may only be specified once.`,35:(e,t)=>`Invalid ${e} modifier value "${t}".`,36:()=>"Event bindings only allow init=none.",37:(e,t)=>`Binding type "${e}" does not support init=${t}.`,38:e=>`Property "${e}" is not declared by wcBindable.`,39:(e,t)=>`init=${e} is incompatible with wcBindable member "${t}".`,40:e=>`sync=connect requires observable property "${e}".`,44:(e,t)=>`${e}: "${t}" is not one of its options, or not of the option's type.${"bootstrapState"===e&&b.includes(t)?" 4.0 moved it to the state's $behavior.":""}`,45:()=>"a re-set state may not change $behavior: create the element again.",47:()=>'a second <wcs-state> on the same root: there is one state tree per root — graft a subtree with <wcs-state mount="path"> (v1\'s name="…" is gone: read the mounted state by its path).',48:e=>`the locale "${e}" (<html lang> or bootstrapState's locale) is not a language tag Intl takes (en-US, not en_US): the locale filters use "en".`,46:()=>'$features must be an array of add-on names (["temporal", "formats"]).',49:(e,...t)=>`${y(e,t)} failed to initialize.`,50:(e,...t)=>`${y(e,t)} $connectedCallback failed.`,51:(e,...t)=>`${y(e,t)} $disconnectedCallback failed.`,101:e=>`Invalid bindText: "${e}". Missing ':' separator between propPart and statePart.`,102:(e,t)=>`"${e}": "${t}" takes no modifiers or filters on its left side — write "${t}:".`,103:e=>`"${e}": "else" takes no value — write "else:".`,104:e=>`Invalid spread binding "${e}": spread target path is required.`,105:e=>`Invalid spread binding "${e}": filters are not allowed on spread targets.`,106:e=>`"${e}": a leading "." binds an element property by name — write a non-empty property that is not a namespace (class, attr, style, command, eventToken, state).`,107:(e,t)=>`unterminated ${e} quote in the filter arguments "(${t})". Close the quote.`,108:e=>`Invalid filter format: missing closing parenthesis in "${e}".`,109:e=>`Invalid filter format: missing opening parenthesis in "${e}".`,110:e=>`Invalid filter format: ")" comes before "(" in "${e}".`,111:(e,t)=>`"${e}": unexpected "${t}" after the filter's closing ")" — separate filters with "|" (write "${e.slice(0,e.lastIndexOf(")")+1)}|${t}").`,112:e=>`an empty filter in "${e}" — remove the extra "|" or name the filter.`,113:(e,t)=>`"${e}" is not a filter name: a modifier list "#${t}" comes before the input filters, not inside one`,114:e=>`"${e}" is not a filter name: "#" cannot appear in one.`,115:e=>`"${e}": a binding takes one modifier list after a single "#"`,116:e=>`"${e}": the left side of a binding must name a property — write "<property>: <path>" (modifiers and input filters come after the name).`,117:(e,t)=>`"${e}" has ${t} path segments — the limit is 512.`,32:e=>`"${e}": the "@name" selector was removed in v2 — there is a single state tree. Mount the named state onto the tree (<wcs-state mount="...">) and read it by its path prefix instead.`,120:e=>`"${e}": a state path cannot go through "__proto__" or "prototype" (it would reach every object's prototype).`,121:e=>`"${e}": "for:" takes no filters — a row is "<path>.<index>", so the rows of a filtered list would name other elements. Declare a getter that returns the filtered list and loop over it ("for: <getter>").`,122:(e,t)=>"class"===t?`"${e}": "class:" needs a class name — "class.NAME:" toggles one class (a bare "class:" would set an element property named "class", which does nothing). To set the whole class attribute, bind "className:".`:`"${e}": "attr:" needs an attribute name — "attr.NAME:" sets one attribute (a bare "attr:" would set an element property named "attr", which does nothing).`,119:e=>`"${e}": the right side of a binding must name a state path — write "<property>: <path>" (a path segment cannot be empty; "." alone and a leading "." are the loop-relative shorthand).`,201:e=>`Invalid bindText: "${e}". 'if', 'elseif', 'else', and 'for' bindings must be single binding.`,202:e=>`"${e}:" must follow an "if:" template`,204:e=>`a "${e}:" template at the top of inserted content was not rendered, as it would render beside itself out of the inserter's reach: wrap it in an element.`,203:e=>`"${e}:" replaces its element, so it cannot be used inside a "for" / "if" template (a row or branch keeps its nodes by position): bind innerHTML: on a wrapper element instead.`,301:e=>`Path "${e}" does not exist on the state tree.`,401:(e,t)=>`class.${e} needs a boolean, got ${t}.`,501:e=>`filter not found: ${e}.`,601:(e,t,n)=>`filter "${e}" requires at least ${t} argument(s) (${n} given).`,602:(e,t,n)=>`filter "${e}" accepts at most ${t} argument(s) (${n} given).`,701:e=>`"${e}" depends on itself`,801:e=>`"${e}"`,901:(e,t,n,a)=>`${e}("${t}") takes ${n} index(es), got ${a}.`,902:(e,t,n,a)=>`${e}("${t}") takes at most ${n} index(es), got ${a}.`,1001:e=>`"${e}": list index parameters run from $1 to $128.`,1101:e=>`"${e}" uses "**", which is not accepted here.`,1201:(e,t)=>`"${e}: ${t}": the right-hand side must be $command.<name>`,1202:(e,t)=>`<${e}> declares no static wcBindable (${t}).${!e.includes("-")&&t.startsWith("command.")?" A native element's command needs the add-on @wcstack/state/features/native-commands.":""}`,1203:(e,t)=>`<${e}> declares no command "${t}".`,1204:(e,t)=>`<${e}> declares no property "${t}".`,1205:(e,t,n)=>`<${e}> has no command "${t}" (a native <${e}>'s commands: ${n}).`,1301:e=>`eventToken "${e}" is not declared in $eventTokens.`,1302:e=>`"$command.${e}" is not declared in $commandTokens.`,1401:(e,t,n=0)=>`"${e}" needs ${t} enclosing loop level(s); the scope provides ${n}.`,1402:e=>`"${e}" is relative: it needs an enclosing "for" template`,1403:(e,t,n)=>`"${e}" ranges over the rows of "${t}", but the enclosing "for" template at that level renders "${n}".`,1501:(e,t)=>`<${e}> declares no static wcBindable (${t}).`,1601:(e,t)=>`${e} was removed: write ${t}.`,1701:(e,t)=>`${e} was removed: write ${t}.`};function x(e,t){let n=k[e];return void 0===n?`${w(e)}#${e} ${t.join(" ")}`:w(e)+n(...t)}var j=new Set(["binding-syntax","template-syntax","filter-unknown","filter-arity","index-arity","wildcard-rank","token-undeclared","binding-path-missing","index-param-range"]),T=[[/no loop level in common with the context/,"; pass indexes ([] for all)."],[/"([^"#]+)#([^"]*)" is not a filter name: a modifier list .* comes before the input filters/,' — write "<property>#$2|$1".'],[/\[wcs\/recursion-unsupported\]/," It is only meaningful in a $recursion declaration, in a recursive getter key, and in the path argument of $getAll / $setAll — and only when the state declares a $recursion anchor."],[/must be single binding/,' Put the structural binding alone in its own data-wcs (e.g. <template data-wcs="for: items">).'],[/\[wcs\/wildcard-rank\] .* needs \d+ enclosing/,' Wrap it in that many "for" templates, or use $resolve(path, indexes) to name the row explicitly.'],[/\[wcs\/wildcard-rank\] .* ranges over the rows of/,' A "*" in a binding is the row of the loop around it: read a row of another list in a getter, with $resolve(path, indexes).'],[/\[wcs\/binding-type-expectation\] class\.([^ ]+)/,' Write "class.$1: path|truthy" to toggle on truthiness.'],[/path segments — the limit/," Every prefix of a path is interned, so the cost grows with the square of the depth."],[/\[wcs\/index-arity\] \$resolve/,' $resolve takes one index per "*"; $getAll / $setAll take at most that many (fewer expands the rest).'],[/"([^"#]+)#[^"]*" is not a filter name: "#" cannot appear in one/,' Modifiers belong on the left side of the binding, before the ":" — write "$1" here.']],M={inc:"add",dec:"sub",fix:"toFixed",uc:"upper",lc:"lower",cap:"capitalize",rep:"repeat",rev:"reverse",pad:"padStart",null:"nullIfEmpty"};function S(e,t,n){let a=(void 0!==t&&e.includes("[wcs/filter-unknown]")?function(e){if("substr"===e)return' "substr" was removed in 4.0 — write slice(start, start + length): slice takes the end index, not a length.';let t=Object.hasOwn(M,e)?M[e]:null;return null===t?null:` "${e}" was renamed "${t}" in 3.2 and removed in 4.0 — write "${t}".`}(t):null)??(void 0!==t&&void 0!==n?p(t,n):"");for(let[t,n]of T){let i=t.exec(e);null!==i&&(a+=n.replace(/\$(\d)/g,(e,t)=>i[Number(t)]))}let i=/"([^"#]+)#([^"]+)": a binding takes one modifier list/.exec(e);null!==i&&(a+=` — write "${i[1]}#${i[2].split("#").join(",")}".`),e.includes("[wcs/filter-unknown]")&&(e.includes("formats add-on")?a+=' On a split auto page: features="formats" on the root, or "$features": ["formats"].':s.some(r)||(a+=' No formatting filters are installed — add the formats add-on: installFeatures([formats]) from "@wcstack/state/features/formats" (a split auto page: features="formats", or "$features").'));let o=/\[wcs\/([\w-]+)\]/.exec(e);return null!==o&&j.has(o[1])&&!/ path segments — the limit is |inserted content was not rendered|formats add-on/.test(e)&&(a+=m),a}var I=new WeakMap,O=new WeakMap,A=new WeakSet,P=new WeakSet;function W(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 q(e){let t=new Set;for(let n=e;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let e of Object.getOwnPropertyNames(n))"$"!==e[0]&&"constructor"!==e&&t.add(e);return[...t]}function N(e,t){let n=[];for(let e=t;null!==e;e=e.d)n.unshift(e);let a=e.target,i=t=>null===t?null:function(e,t){let n=t.t.split("."),a=n.findIndex((e,t)=>t>0&&/^\d/.test(e));return a<0||n.indexOf("*",a)>=0||void 0!==W(e.target,t.t)?.get?t:e.I.jt(o(t.t).o)}(e,t);for(let t of n){if(null!=i(t)?.getter||null===a||"object"!=typeof a)return null;if("*"===t.s){if(!Array.isArray(a)||0===a.length)return null;a=a[0];continue}if(Array.isArray(a)&&/^\d+$/.test(t.s)){if(Number(t.s)>=a.length)return null;a=a[Number(t.s)];continue}let n=W(a,t.s);if(void 0===n&&null===t.d&&e.vt.has(t.s))return null;if(void 0===n){let n=q(a),s=i(t.d);for(let t of e.I.all())t.d===s&&null!==t.getter&&n.push(t.s);return{seg:t.s,names:n}}if(void 0!==n.get||void 0!==n.set)return null;a=n.value}return null}function B(e){A.has(e)||(A.add(e),setTimeout(()=>function(e){A.delete(e);let t=I.get(e);if(void 0===t)return;let n=O.get(e);void 0===n&&O.set(e,n=new Set);for(let[a,s]of t){if(n.has(a))continue;n.add(a);let t=N(e,a);if(null===t)continue;let r=[...e.root?.querySelectorAll(`${i.tagNames.state}[mount]`)??[]].find(e=>!P.has(e)&&(a.t+".").startsWith(e.getAttribute("mount")+"."));if(void 0!==r){n.delete(a),r.initializePromise.then(()=>{P.add(r),B(e)});continue}let[l,c]=s?["watch-path-missing","$watch path"]:["binding-path-missing","Bound path"];d.st?.(e,{type:"state:path-unresolved",source:s?"watch":"binding",path:a.t,missingSegment:t.seg});let u=e.I.jt(o(a.t).o),h="";if(void 0!==u&&u!==a&&null!==u.getter){let e=u.h.slice(1).map((e,t)=>`for: ${0===t?e.t:e.t.slice(u.h[t].t.length+2)}`);h=` The getter "${u.t}" is declared for the rows of ${e.join(" → ")}; a list named by an index has rows of its own.`}console.warn(`[@wcstack/state] [wcs/${l}] ${c} "${a.t}" does not resolve on the state tree: "${t.seg}" is not declared.${p(t.seg,t.names)}${h} Updates to this path will be silently dropped.${m}`)}}(e),0))}function C(e,t,n=!1){if("$"===t.t[0]||t.t.includes("#")||!n&&null===t.d)return;let a=I.get(e);void 0===a&&I.set(e,a=new Map),a.has(t)||a.set(t,n),B(e)}var E=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=!1;function D(e,t,i){let s="html"===i.name?"innerHTML":i.name;if(L||!(t instanceof TypeError)||!a(s)||!("trustedTypes"in globalThis))return;L=!0;let r="function"==typeof n()?.createHTML?"The injected policy's createHTML() did not return a TrustedHTML.":"No sanitizing policy is installed, and @wcstack/state deliberately does not pass state values through an identity policy — that would defeat the CSP.";console.error(`[@wcstack/state] Writing to "${s}" was blocked by Trusted Types (require-trusted-types-for 'script'). ${r}\nInstall a sanitizing policy before the first binding is applied:\n globalThis[Symbol.for("wcstack.trustedTypes.policy")] =\n trustedTypes.createPolicy("my-app", { createHTML: (s) => DOMPurify.sanitize(s) });\nOr bind the value as text instead of HTML. See docs/csp.md section 7.`,{element:i.a,property:s})}var z=new WeakMap;function U(e,t,n){let a=e[t],i=void 0===n?void 0===a?null:`the event carried no detail (undefined) while element.${t} is ${typeof a}`:null===n||"object"!=typeof n||!Object.prototype.hasOwnProperty.call(n,t)||null!==a&&"object"==typeof a?null:`the event's detail is an object with a "${t}" key while element.${t} is ${typeof a}`;if(null===i)return;let s=z.get(e);void 0===s&&z.set(e,s=new Set),!s.has(t)&&(s.add(t),console.warn(`[@wcstack/state] [wcs/default-getter-mismatch] <${e.localName}> "${t}": ${i}. With no getter, state receives e.detail as-is. Dispatch the value itself as detail, or declare getter (e.g. (e) => e.detail.${t}, or (e) => e.target.${t}) on that wcBindable property.`))}var H=[["$streams","$stream"],["$updatedCallback","$renderedCallback"]],_={$trackDependency:"$dependOn",$untrackDependency:"$untracked"},F={name:"diagnostics",install(){d.Lo=S,d.Bo=x,d.So=C,d.detail=U,d.Ke=c(d.Ke,D);let e=d.de;d.de=(t,n)=>{(function(e){void 0!==e.$scan&&l(1);for(let[t,n]of H)void 0!==e[t]&&l(1601,[t,n])})(n),e?.(t,n),function(e){let t=e.$recursion;if(null===t||"object"!=typeof t)return;let n=Object.entries(t);if(1!==n.length||"string"!=typeof n[0][1])return;let[a,i]=n[0];if(!a.endsWith(".*")||!i.endsWith(".*"))return;let s=a.slice(0,-2),r=i.slice(0,-2),o=`.${i}`,l=`${s}.**`,d=q(e),c=d.filter(e=>e.startsWith(l)).map(e=>e.slice(l.length)),u=e=>f(`[wcs/recursion-declaration-invalid] ${e}`);for(let e of c){(e===`.${r}`||e.startsWith(`.${r}.`))&&u(`"${l}${e}" names the recursion structure itself (the "${r}" lists): recursive getters compute values over the nodes.`);for(let t of c)t.length>e.length&&t.endsWith(e)&&new RegExp(`^(?:${E(o)})+$`).test(t.slice(0,t.length-e.length))&&u(`"${l}${e}" and "${l}${t}" expand to the same concrete path at different depths (they differ by whole repetitions of "${i}"). Rename one of them.`);let t=new RegExp(`^${E(a)}(?:${E(o)})*${E(e)}$`);for(let n of d)!n.includes("**")&&t.test(n)&&u(`"${n}" is already defined on the state, so the recursive getter "${l}${e}" cannot expand to it.`)}}(n),function(e){O.delete(e),I.has(e)&&B(e)}(t)},d.ot=u(h,d.ot,(e,t)=>Object.hasOwn(_,t)?l(1701,[t,_[t]]):void 0)}},R=F;export{R as default,F as diagnostics};
2
2
  //# sourceMappingURL=diagnostics.js.map