@wcstack/state 3.5.4 → 4.0.0-rc.2

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 (82) hide show
  1. package/README.ja.md +669 -428
  2. package/README.md +667 -426
  3. package/dist/auto.min.js +1 -2
  4. package/dist/define.d.ts +4 -8
  5. package/dist/define.js +1 -1
  6. package/dist/index.d.ts +139 -1483
  7. package/dist/index.esm.js +1 -2
  8. package/dist/manifest.d.ts +18 -59
  9. package/dist/manifest.esm.js +542 -1202
  10. package/dist/parser.d.ts +49 -103
  11. package/dist/parser.esm.js +662 -831
  12. package/dist/split/auto.js +1 -0
  13. package/dist/split/chunks/chunk-732CB4QN.js +1 -0
  14. package/dist/split/chunks/chunk-7PN5YNZZ.js +1 -0
  15. package/dist/split/chunks/chunk-FF6KHTYS.js +1 -0
  16. package/dist/split/chunks/chunk-HFKGUDDJ.js +1 -0
  17. package/dist/split/chunks/chunk-PKDBVBAP.js +1 -0
  18. package/dist/split/chunks/chunk-QI7P7YPP.js +1 -0
  19. package/dist/split/chunks/chunk-QQH6N5CJ.js +1 -0
  20. package/dist/split/chunks/chunk-UM3O6QXD.js +1 -0
  21. package/dist/split/chunks/chunk-WEL3YSG7.js +1 -0
  22. package/dist/split/chunks/chunk-WWJNAZVP.js +1 -0
  23. package/dist/split/chunks/chunk-YOPPVWPQ.js +1 -0
  24. package/dist/split/core.d.ts +114 -1168
  25. package/dist/split/core.js +1 -2
  26. package/dist/split/features/devtools.d.ts +23 -3
  27. package/dist/split/features/devtools.js +1 -2
  28. package/dist/split/features/diagnostics.d.ts +27 -5
  29. package/dist/split/features/diagnostics.js +1 -2
  30. package/dist/split/features/formats.d.ts +21 -5
  31. package/dist/split/features/formats.js +1 -2
  32. package/dist/split/features/list-keys.d.ts +24 -0
  33. package/dist/split/features/list-keys.js +1 -0
  34. package/dist/split/features/recursion.d.ts +23 -3
  35. package/dist/split/features/recursion.js +1 -2
  36. package/dist/split/features/scopes.d.ts +25 -4
  37. package/dist/split/features/scopes.js +1 -2
  38. package/dist/split/features/ssr.d.ts +23 -3
  39. package/dist/split/features/ssr.js +1 -2
  40. package/dist/split/features/temporal.d.ts +19 -4
  41. package/dist/split/features/temporal.js +1 -2
  42. package/dist/wcs-manifest.json +43 -49
  43. package/package.json +15 -17
  44. package/dist/auto.min.js.map +0 -1
  45. package/dist/index.esm.js.map +0 -1
  46. package/dist/split/chunks/binder.js +0 -2
  47. package/dist/split/chunks/binder.js.map +0 -1
  48. package/dist/split/chunks/checkDependency.js +0 -2
  49. package/dist/split/chunks/checkDependency.js.map +0 -1
  50. package/dist/split/chunks/declarationAliases.js +0 -2
  51. package/dist/split/chunks/declarationAliases.js.map +0 -1
  52. package/dist/split/chunks/declarationHooks.js +0 -2
  53. package/dist/split/chunks/declarationHooks.js.map +0 -1
  54. package/dist/split/chunks/diagnosticsHooks.js +0 -2
  55. package/dist/split/chunks/diagnosticsHooks.js.map +0 -1
  56. package/dist/split/chunks/errorGuidance.js +0 -2
  57. package/dist/split/chunks/errorGuidance.js.map +0 -1
  58. package/dist/split/chunks/featureBridge.js +0 -2
  59. package/dist/split/chunks/featureBridge.js.map +0 -1
  60. package/dist/split/chunks/features.d.ts +0 -29
  61. package/dist/split/chunks/filterRegistry.js +0 -2
  62. package/dist/split/chunks/filterRegistry.js.map +0 -1
  63. package/dist/split/chunks/getAllPropertyDescriptors.js +0 -2
  64. package/dist/split/chunks/getAllPropertyDescriptors.js.map +0 -1
  65. package/dist/split/chunks/lifecycleHooks.js +0 -2
  66. package/dist/split/chunks/lifecycleHooks.js.map +0 -1
  67. package/dist/split/chunks/pathDiagnostics.js +0 -2
  68. package/dist/split/chunks/pathDiagnostics.js.map +0 -1
  69. package/dist/split/chunks/registerComponents.js +0 -2
  70. package/dist/split/chunks/registerComponents.js.map +0 -1
  71. package/dist/split/chunks/setAll.js +0 -2
  72. package/dist/split/chunks/setAll.js.map +0 -1
  73. package/dist/split/chunks/version.js +0 -2
  74. package/dist/split/chunks/version.js.map +0 -1
  75. package/dist/split/core.js.map +0 -1
  76. package/dist/split/features/devtools.js.map +0 -1
  77. package/dist/split/features/diagnostics.js.map +0 -1
  78. package/dist/split/features/formats.js.map +0 -1
  79. package/dist/split/features/recursion.js.map +0 -1
  80. package/dist/split/features/scopes.js.map +0 -1
  81. package/dist/split/features/ssr.js.map +0 -1
  82. package/dist/split/features/temporal.js.map +0 -1
@@ -0,0 +1 @@
1
+ import{d as t}from"./chunks/chunk-FF6KHTYS.js";import"./chunks/chunk-PKDBVBAP.js";import"./chunks/chunk-7PN5YNZZ.js";import"./chunks/chunk-HFKGUDDJ.js";import"./chunks/chunk-UM3O6QXD.js";import{a as n}from"./chunks/chunk-732CB4QN.js";import"./chunks/chunk-QI7P7YPP.js";import"./chunks/chunk-QQH6N5CJ.js";import"./chunks/chunk-WWJNAZVP.js";import{a as s,g as o}from"./chunks/chunk-YOPPVWPQ.js";var e,r=["formats","diagnostics","temporal","list-keys","scopes","recursion","ssr","devtools"],a=(e=import.meta.url,t=>Promise.all(t.map(async t=>{if(!r.includes(t))throw new Error(`[@wcstack/state] [wcs/feature-unknown] "${t}" is not an add-on (${r.join(", ")}).`);return(await(import(new URL(`./features/${t}.js`,e).href))).default})));s.dt=t=>a(t).then(o),"loading"===document.readyState&&await new Promise(t=>document.addEventListener("DOMContentLoaded",t,{once:!0}));var u=document.querySelector(`${n.tagNames.state}:not([mount]):not([bind-component])`);o(await a(u?.getAttribute("features")?.split(/\s+/).filter(Boolean)??[])),t();
@@ -0,0 +1 @@
1
+ import{c as t}from"./chunk-WWJNAZVP.js";import{j as e}from"./chunk-YOPPVWPQ.js";var r={bindAttributeName:"data-wcs",commentForPrefix:"wcs-for",commentIfPrefix:"wcs-if",commentElseIfPrefix:"wcs-elseif",commentElsePrefix:"wcs-else",tagNames:{state:"wcs-state",ssr:"wcs-ssr"},locale:typeof document<"u"&&document.documentElement?.lang||"en",enableContractAnalyzer:!1};function a(e){let a=r,s=r.tagNames,n=Object.entries(e).filter(([,t])=>void 0!==t),o=Object.entries(e.tagNames??{}).filter(([,t])=>void 0!==t);for(let[e,r]of n){let s=a[e];(!Object.hasOwn(a,e)||null===r||typeof r!=typeof s||Array.isArray(r)!==Array.isArray(s))&&t(44,["bootstrapState",e])}for(let[e,r]of o)(!Object.hasOwn(s,e)||"string"!=typeof r)&&t(44,["bootstrapState",`tagNames.${e}`]);for(let[t,e]of n)"tagNames"!==t&&(a[t]=e);for(let[t,e]of o)s[t]=e}var s=()=>r,n=["toFixed","locale","upper","lower","capitalize","trim","slice","padStart","padEnd","repeat","reverse","truncate","join","round","floor","ceil","percent","unit","date","time","datetime","ymd","hms"],o=new Map,i=new Map;function f(t){for(let e of Object.keys(t))o.set(e,{...t[e]});i.clear()}function l(t){return o.has(t)}function c(r,a,s){let f=`${r}${function(t,e){return`${JSON.stringify(t)}${JSON.stringify(e)}`}(a,s)}`,l=i.get(f);if(typeof l<"u")return l;let c=o.get(r);void 0===c&&function(r,a){n.includes(r)&&e(`[wcs/filter-unknown] filter not found: ${r}. "${r}" is in the formats add-on — install it with installFeatures([formats]) from "@wcstack/state/features/formats".`,r,a),t(501,[r],r,a)}(r,o.keys());let[m,u]=c.arity;a.length<m&&t(601,[r,m,a.length]),a.length>u&&t(602,[r,u,a.length]);let d=c.factory(a,s);return i.set(f,d),d}export{r as a,a as b,s as c,n as d,f as e,l as f,c as g};
@@ -0,0 +1 @@
1
+ import{a as e,b as t,c as n,f as l,h as i,i as r}from"./chunk-HFKGUDDJ.js";import{a as o,d as s,e as a,j as u,k as c}from"./chunk-UM3O6QXD.js";import{a as h,e as f,g as d}from"./chunk-732CB4QN.js";import{a as m}from"./chunk-QI7P7YPP.js";import{a as p,b as y,c as v,d as g,e as b,f as w,g as x,h as S,i as N,j as k,k as T,l as C,n as A}from"./chunk-QQH6N5CJ.js";import{b as E,c as M}from"./chunk-WWJNAZVP.js";import{a as W}from"./chunk-YOPPVWPQ.js";var j=new Map,P=new Set(["if","elseif","else","for"]),$=new Set([p,"if","elseif","for","..."]),I=new Set([b,w,x,g,y,v]);function L(e){let t=function(e){return T(e,";")}(e).map(N).filter(e=>e.length>0).map(e=>{let t=k(e,":");-1===t&&M(101,[e]);let n=e.slice(0,t).trim(),l=e.slice(t+1).trim(),i=n.split("#")[0].split("|")[0].trim();if($.has(i)){let t;return i!==n&&M(102,[e,i]),i===p?(l.length>0&&M(103,[e]),t={Ge:"#else",Je:[]}):"..."===i?(0===l.length&&M(104,[e]),t=A(l),t.Je.length>0&&M(105,[e])):(t=A(l),"for"===i&&t.Je.length>0&&M(121,[e])),{he:i,ye:[i],en:[],C:[],...t,y:"..."===i?"spread":i}}let r=A(l),o=function(e){let[t,n]=C(e,"input",j),l=t.split("#").map(N);l.length>2&&M(115,[t]);let[i,r]=l,o=i.split(".").map(N);return!(o.length>1&&""===o[0])&&(0===i.length||o.some(e=>0===e.length))&&M(116,[e]),{he:i,ye:o,en:r?r.split(",").map(N):[],C:n}}(n),[s]=o.ye;if(""===s&&o.ye.length>1){let e=o.ye.slice(1);return(e.includes("")||I.has(e[0]))&&M(106,[n]),{...o,he:e.join("."),ye:e,...r,y:"prop"}}return{...o,...r,y:"radio"===i||"checkbox"===i?i:s===y||s.startsWith("on")?"event":"prop"}});return t.length>1&&t.some(e=>P.has(e.y))&&M(201,[e]),t}var F=(e,t)=>({factory:l=>{let r=i(l,0,e);return l=>("number"!=typeof l&&n(e),t(l,r))},arity:[1,1]}),H={eq:{factory:(n,i)=>{let o=n?.[0]??e("eq"),s=r(o,i);return e=>"number"==typeof e?"string"!=typeof s?e===s:(l(o)||t("eq"),e===Number(o)):"string"==typeof e?e===o:e===s},arity:[1,1]},ne:{factory:(n,i)=>{let o=n?.[0]??e("ne"),s=r(o,i);return e=>"number"==typeof e?"string"!=typeof s?e!==s:(l(o)||t("ne"),e!==Number(o)):"string"==typeof e?e!==o:e!==s},arity:[1,1]},not:{factory:()=>e=>!e,arity:[0,0]},lt:F("lt",(e,t)=>e<t),le:F("le",(e,t)=>e<=t),gt:F("gt",(e,t)=>e>t),ge:F("ge",(e,t)=>e>=t),add:F("add",(e,t)=>e+t),sub:F("sub",(e,t)=>e-t),mul:F("mul",(e,t)=>e*t),div:F("div",(e,t)=>e/t),mod:F("mod",(e,t)=>e%t),abs:{factory:()=>e=>("number"!=typeof e&&n("abs"),Math.abs(e)),arity:[0,0]},clamp:{factory:e=>{let t=i(e,0,"clamp"),l=i(e,1,"clamp");return e=>("number"!=typeof e&&n("clamp"),Math.min(Math.max(e,t),l))},arity:[2,2]},int:{factory:()=>e=>parseInt(String(e),10),arity:[0,0]},float:{factory:()=>e=>parseFloat(String(e)),arity:[0,0]},falsy:{factory:()=>e=>!e,arity:[0,0]},truthy:{factory:()=>e=>!!e,arity:[0,0]},defaults:{factory:(t,n)=>{let l=t?.[0]??e("defaults"),i=r(l,n);return e=>e||i},arity:[1,1]},coalesce:{factory:(t,n)=>{let l=t?.[0]??e("coalesce"),i=r(l,n);return e=>e??i},arity:[1,1]},boolean:{factory:()=>e=>!!e,arity:[0,0]},number:{factory:()=>e=>Number(e),arity:[0,0]},string:{factory:()=>e=>String(e),arity:[0,0]},nullIfEmpty:{factory:()=>e=>""===e?null:e,arity:[0,0]}},q=!1;function Q(e,t){if(null!==e)for(let n=0;n<e.length;n++)t=e[n](t);return t}function B(e){return 0===e.length?null:(q||(q=!0,f(H)),e.map(e=>d(e.Dn,e.args,e.literals)))}var J=Symbol.for("wcstack.state.view-transition-naming"),U=new WeakSet;function D(){let e=o("state");return null!==e&&"auto"===e.naming?e.namingLimit:-1}var K=new Set(["click","dblclick","input","change","submit","keydown","keyup","mousedown","mouseup","pointerdown","pointerup"]),G=0,R=2,V=3,O=4,Y=5,X=["text","prop","prop","prop","prop","event","for","if","prop","radio","checkbox","prop","prop","event","spread"],Z=(e,t,n,l)=>e.Ut(t,n.o?.t??n.kt,l,X[n.i]),z=Symbol();function _(e,t,n){let l=t.M;return null===l||"state"===l||"auto"===l&&void 0!==e.v(t.o,n)?t.W:z}var ee=class{constructor(e,t,n,l,i,r,o,s,a,u=null){this.J=!1,this.C=null,this.attribute=null,this.En=!1,this.engine=e,this.i=t,this.a=n,this.name=l,this.o=i,this.r=r,this.$n=o,this.x=s,this.value=a,this.B=u}Zt(){return X[this.i]}apply(){if(null!==this.B)return void this.B.wt();let e=Q(this.x,this.engine.read(this.o,this.r));if(e===this.value&&("object"!=typeof e||null===e||11===this.i||8===this.i||u(this.name)))return;if(this.value===z)return void(this.value=e);let t=this.a;if(11!==this.i)9===this.i?t.checked=void 0!==e&&this.tn()===e:10===this.i?t.checked=Array.isArray(e)&&e.includes(this.tn()):ne(this.i,t,this.name,e),this.value=e;else{if(void 0===e)return void(this.value=e);this.value=e,this.En=!0;try{t[this.name]!==e&&(t[this.name]=e)}finally{this.En=!1}null!==this.attribute&&function(e,t,n){try{if(null==n)e.removeAttribute(t);else{let l=n;if("object"==typeof n)try{l=JSON.stringify(n)}catch{}e.setAttribute(t,String(l))}}catch{}}(t,this.attribute,e)}}tn(){return Q(this.C,this.a.value)}Xo(){let e,t=this.a,n=this.engine;if(9===this.i){if(!t.checked)return;e=this.tn()}else if(10===this.i){let l=this.tn(),i=n.v(this.o,this.r),r=Array.isArray(i)?i:[],o=r.includes(l);if(t.checked?o:!o)return;e=o?r.filter(e=>e!==l):[...r,l]}else e=Q(this.C,t[this.name]);n.P(this.o,this.r,e,!1,!0)}},te=e=>"textContent"===e||"innerText"===e||"innerHTML"===e;function ne(e,t,n,l){switch(e){case 0:return void(t.data=null==l?"":String(l));case 1:return void(te(n)?t[n]="innerHTML"===n?c(l):null==l?"":String(l):u(n)?null==l&&"srcdoc"===n?t.removeAttribute(n):void 0!==l&&(t[n]=c(l)):void 0!==l&&(t[n]!==l&&!("value"===n&&t.value===String(l))&&(t[n]=l),("value"===n||"selectedIndex"===n)&&"select"===t.localName&&(t[le]=[n,l])));case 8:return void(t.innerHTML=c(l));case 2:return null!=l&&"boolean"!=typeof l&&M(401,[n,typeof l]),void t.classList.toggle(n,!0===l);case 3:return void(null==l?t.removeAttribute(n):t.setAttribute(n,String(l)));case 4:return void(null==l?t.style.removeProperty(n):t.style.setProperty(n,String(l)))}}var le=Symbol();function ie(e){let t="optgroup"===e.localName?e.parentNode:e,n=t?.[le];void 0!==n&&(t[n[0]]=n[1])}var re=class{constructor(e,t,n,l){this.d=!0,this.de=null,this.u=null,this.vt=null,this.Nn=null,this.r=e,this.Ve=t,this.I=n,this.T=l}Ho(e,t){let n=t.target,l=this.T,i=[],r=null;for(let t of l.Se){if(t.name!==e)continue;let o=l.Rn[t.a],s=ve(null===this.I?this.Ve:this.I[o[0]],o,1);s.contains(n)&&(s!==r&&i.unshift([]),i[0].push(t),r=s)}for(let e of i){for(let n of e)n.xn(t,this.r);if(t.cancelBubble)return!0}return!1}get l(){return null===this.I?this.Ve:this.I[this.I.length-1]}He(){let e=this.Nn;return(null===e?null:e.Pn(this.Ve))??this.Ve}insertBefore(e,t){let n=this.l;for(let l=this.He();;){let i=l.nextSibling;if(e.insertBefore(l,t),l===n)return;l=i}}fo(){null===this.I?this.Ve.remove():ge(this.He(),this.l)}be(e){if(this.d=!1,null!==this.vt)for(let e of this.vt)e();let t=this.de;if(null!==t)for(let n=0;n<t.length;n++)e.kn(t[n]);if(null!==this.u)for(let e of this.u)e.be()}},oe=class extends re{constructor(e,t,n,l){super(e,t,n,l),this.po=0,this.K=null,this.se=0===l.Ke.length?null:new Array(2*l.Ke.length)}mo(e,t){let n=this.K??=new Array(this.T.Ke.length),l=n[t];if(void 0===l){let i=this.T.Ke[t],r=this.se;l=n[t]=new ee(e,i.i,r[2*t],i.name,i.o,this.r,this,i.x,r[2*t+1])}return l}oo(e,t){let n=this.T.Ke;for(let l=0;l<n.length;l++)n[l].o.Y(t)&&e.Gt(this.mo(e,l))}be(e){let t=this.r;t.E===this&&(t.E=null),super.be(e)}};function se(e,t,n,l){let i=a(n,t.n);try{return e.De(i,t)}catch(n){return e.Ut(n,t.t,l,"for"),null===i?e.oe.get(t):i.u.get(t)}}function ae(e,t,n){n&&e.zo(t);let l=t.$n;null!==l&&(l.de??=[]).push(t)}var ue=null;function ce(){let e=ue;return ue=null,e}var he=-1;function fe(e,t,n,l,i=null){let r,o=t.Rn,s=t.build,a=t.ho,u=null,c=W.Te?.(t,null===l?i:l.S,null!==l),h=!c&&t.Tn,f=c?document.createDocumentFragment():(h?t.root:t.nn).cloneNode(!0);if(!c)for(let e=0;e<s.length;e++){let t=s[e];a[t]=ve(f,o[t],h?1:0)}h?r=f:(u=c||[...f.childNodes],r=u[0]);let d,m=null;if(null!==l?(d=m=new oe(n,r,u,t),null===l.map?n.E=m:l.map.set(n,m)):d=new re(n,r,u,t),he>=0&&function(e,t,n,l){let i=null;if(null===t)i=1===e.nodeType?e:null;else for(let e=0;e<t.length&&null===i;e++)1===t[e].nodeType&&(i=t[e]);let r=i?.style;if(null===i||void 0===r||U.has(i))return;let o=globalThis[J]??={counter:0,assigned:0,warned:!1};o.assigned>=l?o.warned||(o.warned=!0,console.warn(`[@wcstack/state] ${E(25,[l])}`)):(U.add(i),o.assigned++,r.setProperty("view-transition-name",`wcs-${n}-${++o.counter}`),r.setProperty("view-transition-class",`wcs-${n}`))}(r,u,null!==l?"row":"branch",he),t.Se.length>0){let t=e.Mn;if(null===u)r[t]=d;else for(let e of u)1===e.nodeType&&(e[t]=d)}let p=t.Yo,y=e.Ie,v=t.Go?a.slice(0,o.length):a,g=null===m?null:m.se;if(null!==g){let e=t.Ke;for(let t=0;t<e.length;t++)g[2*t]=v[e[t].a],g[2*t+1]=e[t].W}for(let t=0;t<p.length;t++){let l=p[t],i=v[l.a],o=l.A;if(o>=0&&null!==g){let t=m.K?.[o];if(void 0!==t){t.J=!1,e.We(t);continue}try{let t=Q(l.x,e.read(l.o,n));t!==l.W&&(ne(l.i,i,l.name,t),g[2*o+1]=t),null!==y&&e.so(l.o,n)}catch(t){e.bt(t,m.mo(e,o))}continue}switch(l.i){case 6:{let t=new ye(e,l.T,se(e,l.o,n,i),i);(d.u??=[]).push(t),i===r&&(d.Nn=t),t.wt();break}case 7:{let t=me(e,l.q.map(e=>({T:e.T,o:e.o,x:e.x,S:v[e.a]})),n,d);(d.u??=[]).push(t),i===r&&(d.Nn=t);break}default:try{de(e,l,i,n,d)}catch(t){Z(e,t,l,i)}}}return ue=d,f}function de(e,t,n,l,i){let r=n;switch(t.i){case 5:return void function(e,t,n,l,i){let r=n.xn,o=e=>r(e,l);if(n.Qe){let l=e.to(n.name),i=t[l];t[l]=void 0===i?o:e=>{i(e),o(e)},n.we&&t.addEventListener(n.name,e=>e.bubbles||o(e))}else t.addEventListener(n.name,o),n.uo&&null!==i&&(i.vt??=[]).push(()=>t.removeEventListener(n.name,o))}(e,n,t,l,i);case 12:return void xe(e,t,r,i,n=>function(e,t,n,l,i){let r=t.name,o=e.command(t.kt.slice(9));null===i&&Ne(1202,n,`command.${r}`),i.commands.has(r)||M(1203,[n.localName,r]);let s=new WeakRef(n),a=o.subscribe((...e)=>{let t=s.deref();if(void 0!==t)return t.isConnected?t[r](...e):void 0;a()});null!==l&&(l.vt??=[]).push(a)}(e,t,r,i,n));case 13:return void xe(e,t,r,i,n=>function(e,t,n,l,i){let r=t.name;null===i&&Ne(1202,n,`eventToken.${r}`);let o=i.properties.get(r);void 0===o&&M(1204,[n.localName,r]);let s=t.kt;n.addEventListener(o.event,n=>{t.St&&n.preventDefault(),t.$t&&n.stopPropagation();try{e.Ko(s,n,l)}catch(e){console.error(e)}})}(e,t,r,l,n))}let o=t.o,s=a(l,o.n);if(14===t.i)return void xe(e,t,r,i,n=>function(e,t,n,l,i,r){null===r&&Ne(1501,n,`"...: ${t.o.t}"`);let o=new Set([...r.properties.keys(),...r.inputs.keys()]);for(let s of o){if(t.co?.includes(s))continue;let o=e.o(`${t.o.t}.${s}`),a=0===o.n?null:l;Se(e,{...t,M:null,U:null},n,s,o,a,i,r)}}(e,t,r,s,i,n));if(t.we&&1===t.i)return void xe(e,t,r,i,n=>function(e,t,n,l,i,r){if(null!==r)return void Se(e,t,n,t.name,t.o,l,i,r);let o=new ee(e,1,n,t.name,t.o,l,i,t.x,_(e,t,l));o.C=t.C,!W.Jo?.(o,t.ro)&&(ae(e,o,!0),e.We(o))}(e,t,r,s,i,n));let u=new ee(e,t.i,n,t.name,o,s,i,t.x,_(e,t,s));u.C=t.C,ae(e,u,!0),e.We(u),null!==t.Et&&n.addEventListener(t.Et,()=>u.Xo())}function me(e,t,n,l){let i=new pe(e,t,n),r=null;for(let o of t){if(null===o.o)continue;let t=o.o,s=new ee(e,7,o.S,"if",t,a(n,t.n),l,null,void 0,i);ae(e,s,!0),null===l&&i.re.push(s),r??=s}return e.We(r),i}var pe=class{constructor(e,t,n){this.d=!0,this.F=null,this.b=-1,this.re=[],this.engine=e,this.q=t,this.r=n}Pn(e){return null!==this.F&&this.q[this.b].S===e?this.F.He():null}wt(){let e=this.engine,t=-1;for(let n=0;n<this.q.length;n++){let l=this.q[n];if(null===l.o||Q(l.x,e.read(l.o,a(this.r,l.o.n)))){t=n;break}}if(t!==this.b&&(he=D(),null!==this.F&&(this.F.fo(),this.F.be(e),this.F=null),this.b=t,t>=0)){let n=this.q[t],l=fe(e,n.T,this.r,null,n.S);this.F=ce();let i=n.S.parentNode;i.insertBefore(l,n.S),ie(i)}}be(){this.d=!1;for(let e of this.re)this.engine.kn(e);null!==this.F&&this.F.be(this.engine)}},ye=class{constructor(e,t,n,l){this.d=!0,this.ve=[],this.engine=e,this.T=t,this.s=n,this.S=l,null===n.E?(n.E=this,this.map=null):((n.j??=[]).push(this),this.map=new Map)}Pn(e){return 0===this.ve.length?null:this.ve[0].He()}xt(e){return null===this.map?e.E:this.map.get(e)??null}go(e){let t=this.map;null!==t&&t.get(e.r)===e&&t.delete(e.r),e.be(this.engine)}wt(){let e=this.engine,t=this.s.f,n=this.ve;he=D();let l=t.length,i=n.length,r=this.S,o=r.parentNode;if(0===l){if(i>0){ge(n[0].He(),n[i-1].l);for(let e=0;e<i;e++)this.go(n[e])}return void(this.ve=[])}let s=new Array(l),a=0;for(;a<l&&a<i&&this.xt(t[a])===n[a];)s[a]=n[a],a++;let u=i-1,c=l-1;for(;u>=a&&c>=a&&this.xt(t[c])===n[u];)s[c]=n[u],u--,c--;for(let e=a;e<=u;e++){let t=n[e],l=t.r;l.d&&this.xt(l)===t?t.po=e:(t.fo(),this.go(t))}if(a<=c){let n=c-a+1,u=new Int32Array(n),h=!1;if(i>0)for(let e=0;e<n;e++){let n=this.xt(t[a+e]);null!==n&&n.d?(u[e]=n.po,h=!0):u[e]=-1}let f=c+1<l?s[c+1].He():r;if(h){let l=function(e){let t=e.length,n=new Uint8Array(t),l=new Int32Array(t).fill(-1),i=[];for(let n=0;n<t;n++){let t=e[n];if(t<0)continue;let r=0,o=i.length;for(;r<o;){let n=r+o>>1;e[i[n]]<t?r=n+1:o=n}r>0&&(l[n]=i[r-1]),i[r]=n}let r=i.length>0?i[i.length-1]:-1;for(;r>=0;)n[r]=1,r=l[r];return n}(u),i=f;for(let r=n-1;r>=0;r--){let n=t[a+r],u=this.xt(n);null!==u&&u.d?0===l[r]&&u.insertBefore(o,i):(o.insertBefore(fe(e,this.T,n,this),i),u=ce()),s[a+r]=u,i=u.He()}}else{let n=document.createDocumentFragment();for(let l=a;l<=c;l++)n.appendChild(fe(e,this.T,t[l],this)),s[l]=ce();o.insertBefore(n,f)}}this.ve=s,ie(o)}be(){this.d=!1;let e=this.s;if(e.E===this)e.E=null;else if(null!==e.j){let t=e.j.indexOf(this);t>=0&&e.j.splice(t,1),0===e.j.length&&(e.j=null)}for(let e of this.ve)e.be(this.engine);this.map?.clear()}};function ve(e,t,n){for(;n<t.length;n++){e=e.firstChild;for(let l=t[n];l>0;l--)e=e.nextSibling}return e}function ge(e,t){let n=document.createRange();n.setStartBefore(e),n.setEndAfter(t),n.deleteContents()}var be=new WeakMap,we=e=>e.customElementRegistry??customElements;function xe(e,t,n,l,i,r=!1){let o=n.localName;if(!o.includes("-"))return i(null);let s=we(n);if(!r&&!n.isConnected&&void 0===s.get(o)&&"customElementRegistry"in n)return void queueMicrotask(()=>xe(e,t,n,l,i,!0));let a=()=>{let e=s.get(o);s.upgrade(n),i(e?function(e){if(be.has(e))return be.get(e);let t=e.wcBindable,n=null;if(null!==t&&"object"==typeof t&&"wc-bindable"===t.protocol&&Number.isInteger(t.version)&&t.version>=1){n={properties:new Map,inputs:new Map,commands:new Set};for(let e of t.properties??[])n.properties.set(e.name,{event:e.event,getter:"function"==typeof e.getter?e.getter:null,ao:"event"===e.semantics});for(let e of t.inputs??[])n.inputs.set(e.name,{attribute:"string"==typeof e.attribute?e.attribute:null});for(let e of t.commands??[])null!==e&&"object"==typeof e&&"string"==typeof e.name&&n.commands.add(e.name)}return be.set(e,n),n}(e):null)};if(!r&&void 0!==s.get(o))return a();null!==l&&!l.d||function(e,t,n){let l=n;null!==t&&(t.vt??=[]).push(()=>{l=null}),e.then(()=>l?.())}(s.whenDefined(o),l,()=>{try{a()}catch(l){Z(e,l,t,n)}e.xe()})}function Se(e,t,n,l,i=t.o,r,o,s){let a=s.properties.get(l)??null,u=s.inputs.get(l),c=e.Lt;c&&null===a&&void 0===u&&M(38,[l]);let h=t.M;(null===a?"element"===h||"auto"===h:void 0===u&&("state"===h||"auto"===h))&&M(39,[h,l]),"connect"===t.U&&null===a&&M(40,[l]);let f=c&&null!==a&&void 0===u,d=new ee(e,11,n,l,i,r,o,t.x,void 0);d.C=t.C,d.attribute=u?.attribute??null,ae(e,d,!f),null!==a&&!t.ro&&n.addEventListener(a.event,t=>{let i;null!==a.getter?i=a.getter(t):(i=t.detail,a.ao||W.detail?.(n,l,i)),(!d.En||!Object.is(i,d.value))&&(i=Q(d.C,i),null===d.x&&(d.value=i),e.P(d.o,d.r,i,a.ao,!0))});let m=h??(f?"element":"state");if("state"===m)f||e.We(d);else if("element"===m||"auto"===m){let i=()=>{if(null!==o&&!o.d)return;if("auto"===m&&void 0!==e.v(d.o,d.r))return void(f||e.We(d));let t=n[l];null===d.x&&(d.value=t),e.P(d.o,d.r,t,!1,!0)};"connect"!==t.U||n.isConnected?i():Promise.resolve().then(i)}return d}function Ne(e,t,n){M(e,[t.localName,n])}var ke=()=>h.bindAttributeName;function Te(){return{a:0,i:1,name:"",o:null,x:null,W:m,xn:null,T:null,q:null,C:null,Et:null,we:!1,M:null,U:null,ro:!1,St:!1,$t:!1,kt:null,co:null,A:-1,Qe:!1,uo:!1}}var Ce=["state","element","auto","none"],Ae=["call","connect"],Ee="$command.";function Me(e,t,n){S.test(t)&&(null===n&&M(1401,[t,Number(t.slice(1))]),t=`${n.t}.*.${t}`);let l=e.o(function(e,t){return 46!==e.charCodeAt(0)?e:(null===t&&M(1402,[e]),"."===e?`${t.t}.*`:`${t.t}.*${e}`)}(t,n)),i=null===n?0:n.n+1;l.n>i&&M(1401,[l.t,l.n,i]);for(let e=1;e<=l.n;e++){let t=e===i?n:n.c[e];l.c[e]!==t&&M(1403,[l.t,l.c[e].t,t.t])}return W.yo?.(e,l),l}var We=e=>1===e.i&&("outerHTML"===e.name||"outerText"===e.name),je=e=>8===e.i||We(e)||1===e.i&&te(e.name);function Pe(e){M(202,[e])}function $e(e,t,n,l,i){let r=L(t).map(t=>function(e,t,n,l,i){let r=function(e,t){let n=t.find(e=>e.startsWith("on")),l=null,i=null;for(let n of t){let t=n.indexOf("=");if(t<0)continue;e.Lt||M(31);let r=n.slice(0,t).trim(),o=n.slice(t+1).trim(),s="init"===r;!s&&"sync"!==r&&M(33,[r,n]),null!==(s?l:i)&&M(34,[r]),(s?Ce:Ae).includes(o)||M(35,[r,o]),s?l=o:i=o}return{ro:t.includes("ro"),St:t.includes("prevent"),$t:t.includes("stop"),event:n?n.slice(2):null,M:l,U:i}}(e,t.en),o=l.localName.includes("-"),a=t.ye,c=t.Ge;if("event"===t.y){if(null!==r.M&&"none"!==r.M&&M(36),"eventToken"===a[0])return{...Te(),a:i,i:13,name:a.slice(1).join("."),kt:c,we:o,St:r.St,$t:r.$t};let n=c.startsWith(Ee)?c.slice(9):null,{St:l,$t:u}=r,h=t.he.slice(2),f=t.en.includes("direct"),d=!f&&K.has(h);return d&&e.to(h),{...Te(),a:i,i:5,name:h,Qe:d,we:o,uo:f,xn(t,i){l&&t.preventDefault(),u&&t.stopPropagation();try{if(null!==n)e.Uo(n,t,i);else{let n=e.qo(c,t,i);s(n)&&n.then(void 0,e=>console.error(e))}}catch(e){console.error(e)}}}}if("spread"===t.y)return{...Te(),a:i,i:14,o:Me(e,c,n),we:o};if("command"===a[0]&&a.length>1)return c.startsWith(Ee)||M(1201,[t.he,c]),{...Te(),a:i,i:12,name:a.slice(1).join("."),kt:c,we:o};let h=Me(e,c,n),f={...Te(),a:i,i:1,name:t.he,o:h,x:B(t.Je),C:B(t.C),ro:r.ro,M:r.M,U:r.U};if("radio"===t.y||"checkbox"===t.y)return("element"===r.M||"auto"===r.M)&&M(37,[t.y,r.M]),f.i="radio"===t.y?9:10,r.ro||(f.Et=r.event??"input"),f;if(a.length>1){let e=a.slice(1).join("."),t=a[0];if("class"===t||"attr"===t||"style"===t)return f.M=null,f.name=e,"class"===t?(f.i=2,f.W=l.classList.contains(e)):f.i="attr"===t?"srcdoc"===e&&"iframe"===l.localName?1:3:4,f}return"html"===t.he?(f.i=8,f):(f.name="text"===t.he?"textContent":t.he,f.we=o&&!u(f.name),!o&&!r.ro&&function(e,t){let n=e.localName;if("input"===n){let n=(e.getAttribute("type")||"text").toLowerCase();return"button"!==n&&(("radio"===n||"checkbox"===n)&&"checked"===t||"value"===t||"valueAsNumber"===t||"valueAsDate"===t)}return("select"===n||"textarea"===n)&&"value"===t}(l,f.name)&&(f.Et=r.event??("select"===l.localName?"change":"input")),f)}(e,t,n,l,i));for(let e=0;e<r.length;e++)14===r[e].i&&(r[e].co=r.slice(e+1).filter(e=>1===e.i).map(e=>e.name));return r}var Ie=/\{\{([\s\S]+?)\}\}/g;function Le(e){let t=e.data,n=[],l=0;Ie.lastIndex=0;for(let i=Ie.exec(t);null!==i;i=Ie.exec(t)){let r=Ie.lastIndex-i[0].length;r>l&&e.before(t.slice(l,r));let o=e.ownerDocument.createTextNode("");e.before(o),n.push({a:o,Qo:i[1].trim()}),l=Ie.lastIndex}return 0===n.length||(l<t.length&&e.before(t.slice(l)),e.remove()),n}function Fe(e,t,n,l){let i=function(e){return{he:"textContent",ye:["textContent"],en:[],C:[],...A(e),y:"text"}}(t);return{...Te(),a:l,i:0,o:Me(e,i.Ge,n),x:B(i.Je),W:""}}function He(e){let t=e.getAttribute(ke());if(null===t)return null;let n=L(t)[0];return void 0===n||"for"!==n.y&&"if"!==n.y&&"elseif"!==n.y&&"else"!==n.y?null:n}var qe=(e,t)=>0===e?h.commentIfPrefix:null===t.o?h.commentElsePrefix:h.commentElseIfPrefix;function Qe(e,t,n){let l=(t,l)=>({el:t,o:"else"===l.y?null:Me(e,l.Ge,n),x:"else"===l.y?null:B(l.Je)}),i=[l(t,He(t))];for(let e=t.nextSibling;null!==e;e=e.nextSibling){if(3===e.nodeType&&""===e.data.trim()||8===e.nodeType)continue;if(1!==e.nodeType||"template"!==e.localName)break;let t=He(e);if(null===t||"elseif"!==t.y&&"else"!==t.y||(i.push(l(e,t)),"else"===t.y))break}return i}var Be=new WeakSet;function Je(e,t,n,l,i,r,o,s){let a=(t,n)=>{let i=document.createComment(n);return t.replaceWith(i),l&&W.An?.(e,i,t),i},u=t=>{for(let c=0;c<t.length;c++){let f=t[c];if(null!==f.parentNode)if(1===f.nodeType){let t=f,s=t.localName;if(l){if("script"===s||"style"===s||Be.has(t))continue;if(Be.add(t),s===h.tagNames.state){u([...t.childNodes]);continue}}let c="template"===s?He(t):null;if(null!==c){if("for"===c.y){let l=Me(e,c.Ge,n),r=Ke(e,t,l,!0);i(a(t,h.commentForPrefix),l,r)}else"if"===c.y?r(Qe(e,t,n).map((t,l)=>({T:Ke(e,t.el,n,!1),o:t.o,x:t.x,S:a(t.el,qe(l,t))}))):Pe(c.y);continue}let d=t.getAttribute(ke()),m=null===d?null:$e(e,d,n,t,0),p="noscript"!==s&&"iframe"!==s&&!m?.some(je)&&!W.wo?.(t);try{l&&p&&u([...t.childNodes])}finally{null!==m&&o(t,m)}!l&&p&&u([...t.childNodes])}else if(3===f.nodeType&&e.It&&f.data.includes("{{")&&!Be.has(f))for(let{a:e,Qo:t}of Le(f))s(e,t);else if(8===f.nodeType){let e=Ue.exec(f.data),t=e&&f.parentNode.localName;if(null!==t&&"textarea"!==t&&"title"!==t){let t=document.createTextNode("");f.replaceWith(t),s(t,e[1])}}}};u(t)}var Ue=/^\s*@@\s*(?:wcs-text)?\s*:\s*([\s\S]+?)\s*$/,De=e=>{let t=document.createRange();return t.selectNodeContents(e),e.content??t.cloneContents()};function Ke(e,t,n,l){let i=document.importNode(De(t),!0),r=[],o=[],s=e=>r.push(e)-1;Je(e,[...i.childNodes],n,!1,(e,t,n)=>{o.push({...Te(),a:s(e),i:6,o:t,T:n})},e=>{let t=e.map(e=>({a:s(e.S),T:e.T,o:e.o,x:e.x}));o.push({...Te(),a:t[0].a,i:7,q:t})},(e,t)=>{let n=s(e);for(let e of t)We(e)&&M(203,[e.name]),e.a=n;o.push(...t),e.removeAttribute(ke())},(t,l)=>{o.push(Fe(e,l,n,s(t)))}),Oe(i,new Set(r),!0);let a=r.map(e=>function(e,t){let n=[];for(let l=t;l!==e;l=l.parentNode){let e=0;for(let t=l.previousSibling;null!==t;t=t.previousSibling)e++;n.unshift(e)}return n}(i,e)),u=1===i.childNodes.length&&8!==i.firstChild.nodeType,c=o.some(e=>6===e.i||7===e.i),h=[],f=new Set,d=[],m=[],p=l?n.n+1:-1;for(let e of o){if(5===e.i&&e.Qe&&!e.we&&!Ge(r[e.a],i)){d.push(e);continue}m.push(e);let t=e.o;if(null!==t&&t.n===p&&t.c[p]===n&&Re(e)&&(e.A=h.push(e)-1),7===e.i)for(let t of e.q)f.add(t.a);else f.add(e.a)}let y=[...f].sort((e,t)=>e-t);return{nn:i,root:u?i.firstChild:null,Rn:a,build:y,Se:d,Yo:m,Tn:u,Go:c,ho:[],Ke:h}}function Ge(e,t){for(;e.parentNode!==t;e=e.parentNode){if(e.parentNode.localName.includes("-"))return!0;for(let t=e.previousSibling;t;t=t.previousSibling)if(8===t.nodeType)return!0}return!1}function Re(e){if(null!==e.M)return!1;switch(e.i){case 0:case 2:case 3:case 4:case 8:return!0;case 1:return!e.we&&null===e.Et;default:return!1}}var Ve=new Set(["table","thead","tbody","tfoot","tr","colgroup","select","optgroup","datalist"]);function Oe(e,t,n){for(let l=e.firstChild;null!==l;){let e=l.nextSibling;3===l.nodeType?n&&!t.has(l)&&""===l.data.trim()&&l.remove():1===l.nodeType&&Oe(l,t,Ve.has(l.localName)),l=e}}var Ye=new WeakMap;function Xe(e,t){let n=9===t.nodeType?t.body:t;e.root=t,Ye.set(t,e),ze(e,[...n.childNodes]),e.Qt()}function Ze(e,t,n){try{let l="template"===t.localName?He(t):null;null!==l&&!n&&M(204,[l.y]),ze(e,[t])}catch(e){console.error(e)}e.Qt()}function ze(e,t){Je(e,t,null,!0,(t,n,l)=>{new ye(e,l,se(e,n,null,t),t).wt()},t=>{me(e,t,null,null)},(t,n)=>{W.An?.(e,t,n);for(let l of n)de(e,l,t,null,null)},(t,n)=>{W.An?.(e,t,n),de(e,Fe(e,n,null,0),t,null,null)})}export{L as a,we as b,G as c,R as d,V as e,O as f,Y as g,oe as h,ye as i,We as j,je as k,Be as l,De as m,Ye as n,Xe as o,Ze as p};
@@ -0,0 +1 @@
1
+ import{a as t,b as e,c as s}from"./chunk-PKDBVBAP.js";import{n as i,o as n}from"./chunk-7PN5YNZZ.js";import{f as o}from"./chunk-UM3O6QXD.js";import{a,b as r}from"./chunk-732CB4QN.js";import{b as l,c}from"./chunk-WWJNAZVP.js";import{a as h,h as u,i as d}from"./chunk-YOPPVWPQ.js";var m=0,f=new WeakMap;function p(t){let e=t.getRootNode();f.set(e,[...(f.get(e)??[]).filter(e=>e.isConnected&&e!==t),t])}function b(t){let e=f.get(t)??[],s=e.filter(e=>e.getRootNode()===t);return Promise.any(s.map(t=>t.initializePromise.then(()=>t.K||t.connectedCallbackPromise))).then(()=>{},i=>s.length?f.get(t)!==e?b(t):Promise.reject(i.errors[0]):void 0)}var g=typeof HTMLElement>"u"?class{}:HTMLElement,w=class extends g{constructor(){super(),this.engine=null,this.Fn=!1,this._e=!1,this.W=null,this.Ue=null,this.loaded=!1,this.sn=null,this.connectedCallbackPromise=new Promise((t,e)=>{this.rn=t,this.bo=e}),this.connectedCallbackPromise.catch(()=>{}),this.initializePromise=new Promise(t=>{this.on=t})}static{this.getBindingsReady=b}static{this.hasConnectedCallbackPromise=!0}connectedCallback(){if(this.Fn){if(null!==this.Ue)return void this.Ue.qe();p(this);let t=this.engine;return void(null!==t&&Promise.resolve(t.ae("$connectedCallback")).then(()=>{this.isConnected&&h.element?.(t,"connected")},t=>console.error(t)))}this.Fn=!0;let t=this.getRootNode(),e=h.ot?.(this,t);if(e)return this.Ue=e,!e.vo&&this.parentNode instanceof ShadowRoot&&p(this),void(void 0===e.dt?this.ko():e.dt()).then(t=>(this.loaded=!0,e.start(t,()=>this.So()))).then(()=>{this.on(),this.rn()},t=>this.bt(t,e.vo));this.start(t),p(this)}disconnectedCallback(){if(null!==this.Ue)return void this.Ue.On();let t=this.engine;null!==t&&(t.ae("$disconnectedCallback"),h.element?.(t,"disconnected"))}setInitialState(t){if(this._e&&c(14),this.loaded)this.Ue.reset(t);else if(null===this.engine)if(null!==this.sn){let e=this.sn;this.sn=null,e(t)}else this.W=t;else this.engine.reset(t)}createState(t,e){let s=this.engine;null===s&&c(15),"readonly"===t&&s.Ce++;try{e(s.proxy)}finally{"readonly"===t&&s.Ce--}}async createStateAsync(t,e){let s=this.engine;null===s&&c(15),await e("writable"===t?s.proxy:new Proxy(s.proxy,{get(t,e,s){let i=Reflect.get(t,e,s);return"$setAll"===e||"$resolve"===e?(...t)=>(t.length>2&&c(8),i(...t)):i},set(){c(8)}}))}async ko(){await 0;let t=this.getAttribute("state");if(null!==t){let e=e=>[...e.querySelectorAll('script[type="application/json"]')].find(e=>e.id===t),s=e(this.getRootNode())??e(document);return void 0===s?Promise.reject(new Error(`[@wcstack/state] ${l(16,[t])}`)):Promise.resolve(JSON.parse(s.textContent||"{}"))}let e=this.getAttribute("src");if(null!==e)return async function(t){let e=new URL(t,document.baseURI).href;if(/\.json(?:[?#]|$)/.test(e)){let s=await fetch(e);return s.ok||c(13,[t,s.status]),await s.json()}return(await(import(e))).default??{}}(e);let s=this.getAttribute("json");if(null!==s)return Promise.resolve(JSON.parse(s));let i=this.querySelector('script[type="module"]');return null!==i?async function(t){let e=!1,s=t=>{t.effectiveDirective.startsWith("script-src")&&(e=!0)};document.addEventListener("securitypolicyviolation",s);let i="function"==typeof URL.createObjectURL,n=i?URL.createObjectURL(new Blob([t.text],{type:"application/javascript"})):"data:text/javascript;charset=utf-8,"+encodeURIComponent(`${t.text}\n//${++m}`);try{return(await(import(n))).default??{}}catch(t){throw await new Promise(t=>setTimeout(t)),new Error(`[@wcstack/state] ${e?l(42):l(43,[t instanceof Error?t.message:String(t)])}`,{cause:t})}finally{document.removeEventListener("securitypolicyviolation",s),i&&URL.revokeObjectURL(n)}}(i):null!==this.W?Promise.resolve(this.W):new Promise(t=>{this.sn=t})}async start(e){try{let a=e.host;(this.hasAttribute("mount")||this.hasAttribute("bind-component")||a?.hasAttribute("data-wc-definition"))&&d("scopes","<wcs-state>");let r=await this.ko(),l=u(r);if(l&&await l,this.getRootNode()!==e)return this.W=r,this.Fn=!1,void(this.isConnected&&this.connectedCallback());this.hasAttribute("enable-ssr")&&d("ssr","enable-ssr");let m=i.get(e)?.element;m?.isConnected&&(m.K||m.Ue)&&c(47);let f=new o(r,new s);f.element=this,this.engine=f,h.element?.(f,"mounting"),n(f,e),t(),f.bn(),this.So(),await f.ae("$connectedCallback"),this.isConnected&&h.element?.(f,"connected"),this.rn()}catch(t){this._e=!this.K,this.bt(t)}}So(){this.K=!0,this.on()}bt(t,e){let s=["mount","bind-component","state","src"].flatMap(t=>this.hasAttribute(t)?[t,this.getAttribute(t)]:[]);console.error(`[@wcstack/state] ${l(this.K?50:49,[this.localName,...s])}`,t),this.on(),e?this.rn():this.bo(t)}},y=[];function v(){return(y=y.filter(t=>t.deref())).map(t=>t.deref())}function k(t,s){t&&r(t),function(t=customElements){e(),v().includes(t)||y.push(new WeakRef(t));let s=a.tagNames.state;void 0===t.get(s)&&t.define(s,class extends w{}),h.$o?.(t)}(s)}var P=t=>b(t);export{b as a,g as b,v as c,k as d,P as e};
@@ -0,0 +1 @@
1
+ import{c as n}from"./chunk-WWJNAZVP.js";function t(t){n(26,[t])}function u(t){n(27,[t])}function i(t){n(28,[t])}function o(t){n(29,[t])}function r(t){n(30,[t])}function a(n){return!(!n||isNaN(Number(n)))}function c(n,t){return a(n)||u(t),Number(n)}function s(n,u,i){return c(n?.[u]??t(i),i)}function f(n,t){return void 0!==t&&t.length>0?t[0]:n}export{t as a,u as b,i as c,o as d,r as e,a as f,c as g,s as h,f as i};
@@ -0,0 +1 @@
1
+ import{n as t,p as n}from"./chunk-7PN5YNZZ.js";import{a as e,b as l,c as r}from"./chunk-QI7P7YPP.js";import{a as o}from"./chunk-YOPPVWPQ.js";var i=Symbol.for("wcstack.binder"),u=Symbol.for("wcstack.binder.pending"),s=Symbol.for("wcstack.binder.taken");var f=new Set;function a(e,l){if(1!==e.nodeType||!e.isConnected)return;let r=t.get(e.getRootNode());void 0===r||!1===r.element?.isConnected?f.add(e):n(r,e,l?.range)}function c(){let t=[...f];f.clear();for(let n of t)a(n);!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 e=n.splice(0,n.length),l=function(){let t=globalThis,n=t[s];return void 0===n&&(n=new WeakSet,t[s]=n),n}();for(let n of e)l.add(n),t.bind(n)}()}function d(){let t=globalThis;void 0===t[i]&&(t[i]={protocol:"wcs-binder",version:1,bind:a})}var b=class{constructor(){this.name="dirty",this.nt=(t,n)=>{if(0===t.n){let n=t.ee;return n!==e&&n!==l&&(t.ee=l,!0)}let r=null===n?null:n.ut;if(null===r)return!1;let o=r[t.A];return o!==e&&o!==l&&(r[t.A]=l,!0)}}Vo(t,n,e){null!==n.getter&&this.nt(n,e),t.yt(n,e),t.vn(n,e,this.nt)}Lo(t,n){let e=n.s.o.Pt;if(null!==e)for(let l of e)l.n===n.s.n?t.et(l,n,this.nt):t.Yt(n,l,n=>t.et(l,n,this.nt))}Ne(t,n,e){this.nt(n,e),o.me?.(t,n,e),t.yt(n,e),t.vn(n,e,this.nt)}Bo(t,n,o){let i=0===n.n;if(!i&&null===o)return;let u=i?null:o.ut??=new Array(t.Oe).fill(e),s=null===u?n.ee:u[n.A];if(s!==e&&s!==l&&s!==r&&(null===u||n.A in u))return s;s=r;try{return s=t.Do(n,null===u?null:o)}finally{null===u?n.ee=s:u[n.A]=s}}Vt(t){t.ut=null}pt(t){for(let n of t.L.all())null!==n.getter&&(0===n.n?n.ee===l&&(n.ee=r):t.Jt(n.c[n.n],t=>{let e=t.ut;null!==e&&e[n.A]===l&&(e[n.A]=r)}))}};export{c as a,d as b,b as c};
@@ -0,0 +1 @@
1
+ var t=class{constructor(t,l,e){this.u=[],this.getter=null,this.Z=null,this.ke=!1,this.at=[],this.Ae=[],this.ct=null,this.A=-1,this.ee=s,this.Fe=null,this.Rt=null,this.Pt=null,this.V=null,this.Tt=new Set,this.t=t,this.w=e,this.l=l;let i=null===e?[null]:e.c.slice(),h="*"===l;h&&i.push(e),this.n=i.length-1,this._=h?[]:null===e?[l]:[...e._,l],this.c=i}Ln(t){this.Tt.has(t)||(this.Tt.add(t),this.at.push(t),t.Ae.push(this))}Po(){this.getter=null,this.Z=null,this.A=-1,this.ee=s,this.at.length=0,this.Tt.clear(),this.Ae.length=0,this.ct=null,this.Fe=null,this.Rt=null,this.Pt=null,this.V=null}Y(t){let s=this;for(;null!==s;){if(s===t)return!0;s=s.w}return!1}},s=Symbol("unset"),l=Symbol("dirty"),e=Symbol("failed"),i=class{constructor(t=null){this.At=new Map,this.Bn=t}Ft(t){return this.At.get(t)}get(s){let l=this.At.get(s);if(void 0!==l)return l;let e=s.lastIndexOf("."),i=e<0?null:this.get(s.slice(0,e));return l=new t(s,s.slice(e+1),i),this.Bn?.(l),this.At.set(s,l),i&&i.u.push(l),l}all(){return this.At.values()}},h=new Map;function n(t){let s=h.get(t);if(void 0!==s)return s;let l=!0,e=t.split("."),i=[];for(let t=0;t<e.length;t++){let s=e[t],h=s.charCodeAt(0);t>0&&h>=48&&h<=57?(l=!1,i.push(Number(s)),e[t]="*"):"*"===s&&i.push(-1)}if(!l)return{o:e.join("."),indexes:i};let n={o:t,indexes:null};return h.set(t,n),n}export{s as a,l as b,e as c,i as d,n as e};
@@ -0,0 +1 @@
1
+ import{c as t}from"./chunk-WWJNAZVP.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?{Dn:i,args:[],literals:[]}:{Dn: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),{Ge:s,Je: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};
@@ -0,0 +1 @@
1
+ import{d as t,e}from"./chunk-QI7P7YPP.js";import{h as i,m as s}from"./chunk-QQH6N5CJ.js";import{b as l,c as n}from"./chunk-WWJNAZVP.js";import{a as r,i as h}from"./chunk-YOPPVWPQ.js";var o=Symbol.for("wcstack.trustedTypes.policy");function u(){let t=globalThis[o];return null!==t&&"object"==typeof t?t:null}function f(t){globalThis[o]=t}function a(t){return"innerHTML"===t||"outerHTML"===t||"srcdoc"===t}function c(t){if(globalThis.trustedTypes?.isHTML(t))return t;let e=null==t?"":String(t),i=u(),s=i?.createHTML;return"function"==typeof s?s.call(i,e):e}var d=class{constructor(t,e,i){this.ut=null,this.E=null,this.de=null,this.V=null,this.u=null,this.d=!0,this.s=t,this.b=e,this.O=i}},p=class{constructor(t,e){this.G=null,this.was=null,this.f=[],this.E=null,this.j=null,this.J=!1,this.Ot=!1,this.Ye=!1,this.o=t,this.te=e,this.n=t.n+1}},g=[],y=class{constructor(t){this.ft=new Set,this.name=t}get size(){return this.ft.size}subscribe(t){return this.ft.add(t),()=>{this.ft.delete(t)}}unsubscribe(t){return this.ft.delete(t)}emit(...t){let e=[];for(let i of this.ft)try{e.push(i(...t))}catch(t){e.push(void 0),console.error(`[@wcstack/state] ${l(17,[this.name])}`,t)}return e}};function v(t,e,i){if(void 0===t)return[];Array.isArray(t)||n(18,[e]);let s=new Set;for(let l of t)("string"!=typeof l||""===l)&&n(19,[e]),l===i&&n(20,[e,l,i]),s.has(l)&&n(21,[e,l]),s.add(l);return t}var m=Symbol.for("wcstack.transition-runner");function b(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=b(t);if(null!==s)return s.run(e,{source:t,types:i});e()}var w=[["$streams","$stream"],["$updatedCallback","$renderedCallback"]],k=[["$watch","temporal"],["$stream","temporal"],["$listKeys","list-keys"],["$recursion","recursion"]],O=["enableMustache","sameValueGuard","enableDirectionalInitialSync"];function j(t){return t.includes("**")&&s(t),t}var M=0,A=32,H=100;function C(t,e,i){let s=t.get(e);return void 0===s&&t.set(e,s=i()),s}var S=()=>new Set,x=()=>[];function L(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}function P(t,e){return t===e||t!=t&&e!=e}function V(t,e,i){let s=t.V?.get(e);void 0!==s&&s.delete(i)&&0===s.size&&t.V.delete(e)}function Y(t,e){for(let i=0;i<e.length;i++){if(null==t)return;t=t[e[i]]}return t}function D(t,e){for(;null!==t&&t.s.n>e;)t=t.s.te;return null!==t&&t.s.n===e?t:null}function J(t,e,i){let s=D(t,i);return null!==s&&s.s.o===e.c[i]?s:null}var B=class{constructor(e,i){this.Oe=0,this.h=null,this.Ce=0,this.pt=new Set,this.root=null,this.Qe=new Map,this.Mn=Symbol("wcs.block"),this.element=null,this.mt=[],this.Ie=null,this.Wn=[],this.Bt=0,this.H=null,this.oe=new Map,this.re=new Map,this.je=[],this.Le=[],this.Be=[],this.ht=!1,this.un=!1,this.dn=new WeakMap,this.B=0,this.Dt=0,this.fn=!1,this.Mt=!1,this.Wt=!1,this.$e=0,this._n=()=>{this.B=0,this.fn=!1},this.Vn=()=>{this.$e--},this.rp=null,this.rr=null,this.Oo=()=>this._t(),this.Co=(t,e)=>t(this.proxy,...e),this.Hn=[],this.Io={$untracked:t=>{let e=this.H;if(null===e)return t();e.fe++;try{return t()}finally{e.fe--}},$eqIndex:(t,e=1)=>{let i=D(this.h,e);null===i&&n(7,[t]);let s=this.o(t);if(null!==s.getter||s.ke)return this.watchIndex(e),i.b===this.read(s,null);let l=this.H;if(null!==l){let t=l.getter,i=s.Fe??(s.Fe=[]);if(!i.some(i=>i.getter===t&&i.Kn===e)){i.push({getter:t,Kn:e});let l=t.c[e];(l.Rt??(l.Rt=[])).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,D(this.h,i.n)))},$dependOn:t=>{this.resolve(j(t),this.h),null!==this.H&&0===this.H.fe&&this.Un(this.rp,this.rr,this.H)},$getAll:(t,e)=>this.getAll(t,e),$setAll:(t,e,i,s)=>this.pn(t,e,i,s),$resolve:(...t)=>{let e=j(t[0]),i=t[1]??[],s=this.o(e);this.mn("$resolve",e,s,i,!0);let l=this.qn(s,i,null);if(t.length<3)return this.read(s,l);this.P(s,l,t[2])},$postUpdate:t=>{this.resolve(j(t),this.h);let e=this.rp,i=this.rr;"*"===e.l&&null!==i&&(i.O=i.s.G[i.b],this.R.Vt(i)),this.hn(e,i),null!==i&&i.s.Ye&&this.zn(i,e,void 0,i.O,!1),0===e.n&&this.Xn(e,void 0,void 0,!0),this.Ht(e,i,void 0,void 0,!1)}},this.R=i,this.L=new t(t=>this.Ze(t)),this.Yn(e);let s=this;this.proxy=new Proxy(e,{get(t,e,i){let l=s.target;if("symbol"==typeof e)return Reflect.get(l,e);if(36===e.charCodeAt(0))return s.Kt(e);if(e.indexOf(".")<0){let t=s.L.Ft(e);if(void 0===t||null===t.getter){let t=l[e];if("function"==typeof t)return i===s.proxy&&s.K?.(t)||t}if(void 0!==t&&0===t.n)return s.read(t,null)}return s.resolve(e,s.h),s.read(s.rp,s.rr)},set:(t,e,i)=>"symbol"==typeof e?Reflect.set(s.target,e,i):(s.resolve(j(e),s.h),s.P(s.rp,s.rr,i),!0)})}o(t){return this.L.get(t)}Gn(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.Z=s.set??null,null!==l.getter&&l.n>0&&(l.A=this.Oe++)}for(let t of this.L.all())this.Ze(t)}Ze(t){t.t.includes("**")&&s(t.t),("__proto__"===t.l||"prototype"===t.l)&&n(120,[t.t]);let e=t.w;t.ke=null!==e&&"*"!==t.l&&e.n===t.n&&(null!==e.getter||e.ke),null===t.getter&&this.jo(t)}jo(t){let e=t.t,s=t.l;if(i.test(s))t.getter=function(){return this[s]};else{let i=e.split("."),s=i.findIndex((t,e)=>e>0&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57);if(s<0||i.indexOf("*",s)>=0)return;let l=i.slice(0,s).join("."),n=i.slice(s);t.getter=function(){let t=this[e];return void 0!==t?t:Y(this[l],n)},t.Z=function(t){this[e]=t}}t.n>0&&(t.A=this.Oe++)}De(t,e){let i=null===t?this.oe:t.u??=new Map,s=i.get(e);return void 0===s&&i.set(e,s=new p(e,t)),this.U(s),s}Jn(t){try{this.U(t)}catch(e){this.Ut(e,t.o.t,t.E?.S??null,"for")}}U(t){let e=this.v(t.o,t.te),i=t.G;if(e===i)return;t.was=i,this.Qn(t);let s=function(t,e,i){let s=Array.isArray(e)?e:g;if(s===t.G)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].O===s[o];)h[o]=l[o],o++;let u=r-1,f=n-1;for(;u>=o&&f>=o&&l[u].O===s[f];)h[f]=l[u],u--,f--;if(o>u)for(let e=o;e<=f;e++)h[e]=new d(t,e,s[e]);else if(o>f)for(let t=o;t<=u;t++)i.Ct(l[t]);else{let e=new Map;for(let t=o;t<=u;t++){let i=l[t],s=e.get(i.O);void 0===s?e.set(i.O,i):Array.isArray(s)?s.push(i):e.set(i.O,[s,i])}for(let i=o;i<=f;i++){let l,n=s[i],r=e.get(n);void 0!==r&&(Array.isArray(r)?(l=r.shift(),0===r.length&&e.delete(n)):(l=r,e.delete(n))),h[i]=l??new d(t,i,n)}for(let t of e.values())if(Array.isArray(t))for(let e of t)i.Ct(e);else i.Ct(t)}for(let t=o;t<n;t++){let e=h[t];e.b!==t&&(e.b=t,i.To(e))}return t.f=h,t.G=s,l}(t,e,this);if(null===s)return;if(t.G===e){let l=C(this.dn,e,x);if(l.push(t),l.length>1){for(let t of l)t.Ye=!0;if(l.some(t=>t.was!==i)){let e=this.o(`${t.o.t}.*`);for(let t of s)t.d&&this.Ee(e,t)}}}r.qt?.(this,t,s),(null!==t.E||null!==t.j)&&!t.J&&(t.J=!0,this.Le.push(t),this.xe());let l=t.o.Rt;if(null!==l)for(let{source:e,getter:i}of l){let l=this.v(e,null),n=s[l],r=t.f[l];n!==r&&(void 0!==n&&n.d&&this.gn(i,n),void 0!==r&&this.gn(i,r))}}To(t){this.R.Lo(this,t)}Ct(t){t.d=!1;let e=t.V;if(null!==e){for(let t of e)V(t.source,t.key,t.sub);t.V=null}if(null!==t.u)for(let e of t.u.values()){this.Qn(e);for(let t of e.f)this.Ct(t)}}Qn(t){let e=this.dn.get(t.G);void 0!==e&&(e.splice(e.indexOf(t)>>>0,1),t.Ye=!1,1===e.length&&(e[0].Ye=!1))}resolve(t,i){let s=e(t),l=this.o(s.o),n=s.indexes;this.rr=0===l.n?null:null===n?J(i,l,l.n):this.qn(l,n,i),this.rp=l}qn(t,e,i){let s=null;for(let l=1;l<=t.n;l++){let n=t.c[l],r=this.De(s,n),h=e[l-1];if(-1===h&&(h=J(i,t,l)?.b??-1),s=r.f[h]??null,null===s)break}return s}zt(t,e){return 0===t.n?Y(this.target,t._):null===e?void 0:Y(e.O,t._)}read(t,e){let i=this.H;if(null!==i&&0===i.fe&&this.Un(t,e,i),null!==t.getter)return this.R.Bo(this,t,e);if(t.ke){let i=this.read(t.w,e);return i?.[t.l]}return null===t.w&&!(t.l in this.target)&&!this.pt.has(t.l)&&"then"!==t.l&&"toJSON"!==t.l&&n(301,[t.t],t.l,Object.keys(this.target)),this.zt(t,e)}v(t,e){let i=this.H;if(null===i)return this.read(t,e);i.fe++;try{return this.read(t,e)}finally{i.fe--}}Un(t,e,i){let s=i.getter;t.Ln(s),t.n>0&&s.n>0&&D(e,Math.min(t.n,s.n))!==D(i.r,Math.min(t.n,s.n))&&(s.ct??(s.ct=new Set)).add(t)}Do(t,e){for(let i=0;i<this.Bt;i++){let s=this.Wn[i];s.getter===t&&s.r===e&&n(701,[t.t])}this.Bt>=128&&n(801,[t.t]);let i=this.Bt++;this.Ce++;let s=this.Wn[i]??={getter:t,r:e,fe:0,Me:0};s.getter=t,s.r=e,s.fe=0,s.Me=++M;let l=this.H;this.H=s;let r=this.h;this.h=e;try{return t.getter.call(this.proxy)}finally{this.Ce--,this.Bt--,this.H=l,this.h=r,s.r=null}}watchIndex(t){let e=this.H;if(null!==e&&0===e.fe){let i=e.getter,s=i.c[t];if(s){let t=s.Pt??(s.Pt=[]);t.includes(i)||t.push(i)}}}Kt(t){let e=t.charCodeAt(1);if(e>=48&&e<=57){let s=2===t.length?e-48:i.test(t)?+t.slice(1):0;return(s<1||s>128)&&n(1001,[t]),this.watchIndex(s),D(this.h,s)?.b}let s=this.Io[t];if(void 0!==s)return s;switch(t){case"$trackDependency":return n(1701,[t,"$dependOn"]);case"$untrackDependency":return n(1701,[t,"$untracked"]);case"$stateElement":return this.element;case"$command":return this.commands}return r.Kt?.(this,t)}eq(t,e){this.resolve(t,this.h);let i=this.rp,s=this.rr;if(null!==i.getter||i.ke||i.n>0)return P(this.read(i,s),e);let l=this.H;return null!==l&&0===l.fe&&this.Mo(i,e,l),P(this.v(i,null),e)}Mo(t,e,i){let s=i.getter,l=i.r,n=null===l?this.Hn:l.V??(l.V=[]);for(let l=0;l<n.length;l++){let r=n[l];if(r.sub.getter===s&&r.source===t){if(P(r.key,e))return void(r.Me=i.Me);r.Me!==i.Me&&(V(t,r.key,r.sub),n.splice(l--,1))}}let r={getter:s,r:l};C(t.V??=new Map,e,S).add(r),n.push({source:t,key:e,sub:r,Me:i.Me})}Xn(t,e,i,s){this.Xt(t,l=>{let n=l.V;if(null===n&&null===l.Fe)return;let r=l===t?[]:l.t.slice(t.t.length+1).split("."),h=Y(e,r),o=Y(i,r);if(null!==l.Fe&&this.Wo(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.d?this.R.Ne(this,i.getter,i.r):V(l,t,i)}})}P(t,e,i,s=!1,l=!1){if(this.Ce>0&&n(8),l||this.$e>0?this.Mt=!0:this.Wt=!0,r.Re?.(this,t,e,i,l))return;if(null!==t.Z){try{this.yn(t.Z,e,[i])}finally{this.Ht(t,e,void 0,void 0,!1)}return}null!==t.getter&&n(2,[t.t]),t.n>0&&null===e&&n(3,[t.t]);let h=t.ke?this.v(t,e):this.zt(t,e);if(s||!this.jt||!Object.is(h,i)||Object(i)===i){if("*"===t.l){let t=e;t.s.G[t.b]=i,t.O=i,this.R.Vt(t)}else{let s=1===t._.length?0===t.n?this.target:e.O:this.v(t.w,e);null==s&&n(4,[t.t,s]),s[t.l]=i}this.wn(t,e),null!==e&&e.s.Ye&&this.zn(e,t,h,i),0===t.n&&this.Xn(t,h,i),this.Ht(t,e,h,i,!0)}}Zn(t){return(this.dn.get(t.G)??[]).filter(e=>e.G===t.G&&(null===e.te||e.te.d))}zn(t,e,i,s,l=!0){let n=t.s,r=e.t.slice(n.o.t.length+2);for(let e of this.Zn(n)){if(e===n)continue;let h=e.f[t.b];if(void 0===h)continue;let o=this.o(`${e.o.t}.*${r}`);""===r&&(h.O=s,this.R.Vt(h)),l?this.wn(o,h):this.hn(o,h),this.Ht(o,h,i,s,l)}}hn(t,e){this._o(t,e,t=>{this.U(t);for(let e of t.Ye?this.Zn(t):[t]){let t=this.o(`${e.o.t}.*`);for(let i of e.f)this.yt(t,i),this.hn(t,i)}})}wn(t,e){let i=null===e?this.oe:e.u;if(null!==i)for(let e of i.values())e.o.Y(t)&&this.U(e)}_o(t,e,i){let s=null===e?this.oe:e.u;if(null!==s)for(let e of s.values())e.o.Y(t)&&i(e)}Wo(t,e,i,s){for(let{getter:l,Kn:n}of t.Fe)this.eo(l.c[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.gn(l,e)}})}gn(t,e){e.s.n===t.n?this.R.Ne(this,t,e):this.Yt(e,t,e=>this.R.Ne(this,t,e))}Ht(t,e,i,s,l){r.pe?.(this,t,e,i,s,l),this.Ee(t,e)}Ee(t,e){this.R.Vo(this,t,e),this.xe()}to(t){let e=this.Qe.get(t);if(void 0!==e)return e;let i=Symbol(`wcs.on${t}`);this.Qe.set(t,i);let s=this.root,l=this.Mn;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.d&&r.Ho(t,e))return}}),i}reset(t){let e=this.target;this.Yn(t);let i=this.pt;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.re.values())for(let e of t)this.Gt(e);for(let t of this.oe.values())this.no(t);this.Ie=null;try{this._t()}finally{this.bn()}r.element?.(this,"reset")}Yn(t){for(let[e,i]of k)void 0!==t[e]&&h(i,e);void 0!==t.$scan&&n(1);for(let[e,i]of w)void 0!==t[e]&&n(1601,[e,i]);let e=t.$features;if(void 0!==e){Array.isArray(e)||n(46);for(let t of e)h(t,"$features")}let i=void 0===t.$behavior?{}:t.$behavior;("object"!=typeof i||!i||Array.isArray(i))&&n(44,["state","$behavior"]);for(let t in i)(!O.includes(t)||"boolean"!=typeof i[t])&&n(44,["$behavior",t]);let[s,l,o]=O.map(t=>i[t]??!0);void 0!==this.target&&(s!==this.It||l!==this.jt||o!==this.Lt)&&n(45);let u=function(t,e){let i={};for(let s of v(t.$commandTokens,"$commandTokens","$command"))i[s]=e?.[s]??new y(s);return Object.freeze(i)}(t,this.commands),f=function(t,e){let i=new Map;for(let e of v(t.$eventTokens,"$eventTokens"))i.set(e,new y(e));let s=t.$on;if(void 0===s)return i;(null===s||"object"!=typeof s)&&n(22);for(let[t,l]of Object.entries(s)){let s=i.get(t);void 0===s&&n(23,[t]),"function"!=typeof l&&n(24,[t]),s.subscribe((...t)=>e(l,t))}return i}(t,this.Co);this.It=s,this.jt=l,this.Lt=o,r.ie?.(this,t),this.target=t,this.Oe=0;for(let t of this.L.all())t.Po();this.Hn.length=0,this.Gn(t),this.commands=u,this.Se=f}no(t){this.Jn(t);let e=this.o(`${t.o.t}.*`);for(let i of t.f)if(i.ut=null,i.V=null,this.yt(e,i),null!==i.u)for(let t of i.u.values())this.no(t)}D(t){let e=[];for(let i=t;null!==i;i=i.s.te)e.unshift(i.b);return e}Ko(t,e,i){let s=this.Se.get(t);void 0===s&&n(1301,[t],t,this.Se.keys()),s.emit(e,...this.D(i))}command(t){let e=this.commands[t];return void 0===e&&n(1302,[t],t,Object.keys(this.commands)),e}Uo(t,e,i){this.command(t).emit(e,...this.D(i))}qo(t,e,i){let s=t.includes(".")?this.v(this.o(t),null):this.target[t];return"function"!=typeof s&&n(5,[t]),this.yn(s,i,[e,...this.D(i)])}yn(t,e,i){let s=this.h;this.h=e;try{return t.apply(this.proxy,i)}finally{this.h=s}}yt(t,e){if(null!==t.getter){let i=null===e?this.oe:e.u;if(null!==i)for(let e of i.values())!e.Ot&&e.o.Y(t)&&(e.Ot=!0,this.Be.push(e))}if(null===e)return void this.Xt(t,t=>{let e=this.re.get(t);if(void 0!==e)for(let t of e)this.Gt(t)});let i=e.de;if(null!==i)for(let e=0;e<i.length;e++)i[e].o.Y(t)&&this.Gt(i[e]);let s=e.E;null!==s&&null!==s.se&&s.oo(this,t);let l=e.s.j;if(null!==l)for(let i of l){let s=i.map.get(e);void 0!==s&&null!==s.se&&s.oo(this,t)}}vn(t,e,i){this.Xt(t,t=>{let s=t.at;for(let l=0;l<s.length;l++){let n=s[l];if(0===n.n)this.et(n,null,i);else if(null===e||0===t.n||n.c[1]!==t.c[1]||null!==n.ct&&n.ct.has(t))this.Jt(n.c[n.n],t=>this.et(n,t,i));else if(n.n<=t.n){let t=D(e,n.n);null!==t&&this.et(n,t,i)}else this.Yt(e,n,t=>this.et(n,t,i))}})}et(t,e,i){i(t,e)&&(r.me?.(this,t,e),this.yt(t,e),this.vn(t,e,i))}Xt(t,e){e(t);let i=t.u;for(let t=0;t<i.length;t++)this.Xt(i[t],e)}Jt(t,e){this.eo(t,t=>{for(let i of t.f)e(i)})}eo(t,e){if(0===t.n){let i=this.oe.get(t);return void(void 0!==i&&e(i))}this.Jt(t.c[t.n],i=>{let s=i.u?.get(t);void 0!==s&&e(s)})}Yt(t,e,i){if(t.s.n===e.n)return i(t);let s=t.u?.get(e.c[t.s.n+1]);if(void 0!==s)for(let t of s.f)this.Yt(t,e,i)}zo(t){let e=t.r;null===e?C(this.re,t.o,S).add(t):(e.de??(e.de=[])).push(t)}kn(t){let e=t.r;if(null===e)return void this.re.get(t.o)?.delete(t);let i=e.de;e.d&&null!==i&&i.splice(i.indexOf(t)>>>0,1)}Gt(t){t.J||(t.J=!0,this.je.push(t),this.xe())}xe(){this.ht||(this.ht=!0,queueMicrotask(this.Oo))}Sn(){for(let t of this.je)t.J=!1;for(let t of this.Le)t.J=!1;for(let t of this.Be)t.Ot=!1;this.je=[],this.Le=[],this.Be=[],this.R.pt(this)}io(t,e){let i=[...new Set([...this.je,...this.Le,...this.Be].map(t=>t.o.t))];console.error(`[@wcstack/state] ${l(t)}`,i),r.tt?.(this,{type:"state:render-chain-limit",maxDepth:e,paths:i}),this.Sn()}_t(){this.ht=!1;let t=this.Dt;this.Dt=0;let e=0;if(!this.Mt||this.Wt?this._n():t>0?e=t:1===(e=++this.B)&&setTimeout(this._n,0),this.Mt=this.Wt=!1,e>100)101===e?this.io(41,100):this.Sn();else{this.un=!0;try{for(let t=0;this.je.length>0||this.Le.length>0||this.Be.length>0;t++){if(t>=32){this.fn?this.Sn():this.io(11,32),this.fn=!0;break}let i=this.Be;if(i.length>0){this.Be=[];for(let t of i)t.Ot=!1,this.Jn(t)}let s=this.Le,l=this.je;this.Le=[],this.je=[];let n=$("state",()=>{for(let t of s){t.J=!1;for(let e of[t.E,...t.j??[]])if(null!==e&&e.d)try{e.wt()}catch(i){this.Ut(i,t.o.t,e.S,"for")}}for(let t=0;t<l.length;t++){let e=l[t];e.J&&(e.J=!1,(null===e.$n||e.$n.d)&&this.We(e))}this.un||(this.Qt(),this.ht&&(this.Dt=e+1))});void 0!==n&&n.then(void 0,t=>console.error(t))}}finally{this.un=!1}this.Mt=this.Wt=!1,this.Qt(),r.Pe?.(this),t>0&&this.ht&&(this.Dt=e+1)}}bt(t,e){this.mt.push([t,e])}Ut(t,e,i,s){this.bt(t,{o:{t:e},a:i,Zt:()=>s})}We(t){try{t.apply()}catch(e){return void this.mt.push([e,t])}null!==this.Ie&&this.so(t.o,t.r)}so(t,e){let i=C(this.Ie,t.t,x);null!==e&&i.push(this.D(e))}bn(){this.Ie="function"==typeof this.target.$renderedCallback?new Map:null}Qt(){let t=this.Ie;if(null!==t&&t.size>0){this.Ie=new Map;let e,i=[...t.keys()],s={};for(let[e,i]of t)i.length>0&&(s[e]=i);this.$e++;try{e=this.ae("$renderedCallback",[i,s])}catch(t){console.error(t)}L(e)?e.then(this.Vn,t=>{this.Vn(),console.error(t)}):this.$e--}if(0===this.mt.length)return;let e=this.mt;this.mt=[];let i=this.target.$errorCallback;for(let[t,s]of e){r._e?.(this,t,s);let e=s.o.t,n=s.Zt();if("function"==typeof i)try{let i=this.ae("$errorCallback",[t,{path:e,bindingType:n,node:s.a}]);L(i)&&i.then(void 0,t=>console.error(t))}catch(t){console.error(t)}else console.error(`[@wcstack/state] ${l(12,[n,e])}`,t)}}ae(t,e=[]){let i=this.target[t];return"function"==typeof i?this.yn(i,null,e):void 0}lo(t,e,i){if(0===t.n)return void i(null,[]);let s=[],l=(n,r)=>{let h=t.c[n];this.read(h,r);let o=this.De(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);void 0!==e&&this.mn("$getAll",t,i,e,!1);let s=e;if(void 0===s){s=[];let e=this.h;if(null!==e&&i.n>0){for(let t=1;t<=i.n;t++){let l=J(e,i,t);if(null===l)break;s.push(l.b)}0===s.length&&n(6,[t])}}let l=[];return this.lo(i,s,t=>l.push(this.read(i,t))),l}pn(t,e,i,s){Array.isArray(e)||n(9,[t]),this.Ce>0&&n(8);let l=this.o(t);this.mn("$setAll",t,l,e,!1);let r=[];this.lo(l,e,(t,e)=>r.push([t,e.slice()]));let h=!0===s?.spread;h&&(!Array.isArray(i)||i.length!==r.length)&&n(10,[t,r.length]);let o=0;for(let t=0;t<r.length;t++){let[e,s]=r[t],n="function"==typeof i?i(this.v(l,e),...s):h?i[t]:i;void 0!==n&&(this.P(l,e,n),o++)}return o}mn(t,e,i,s,l){let r=s.length;(r>i.n||l&&r<i.n)&&n(l?901:902,[t,e,i.n,r])}};export{b as a,A as b,H as c,L as d,D as e,B as f,o as g,u as h,f as i,a as j,c as k};
@@ -0,0 +1 @@
1
+ var a="4.0.0-rc.2";export{a};
@@ -0,0 +1 @@
1
+ import{a as n,j as e}from"./chunk-YOPPVWPQ.js";var t=["","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"],a=n=>{let e=t[n/100|0];return e?`[wcs/${e}] `:""};function i(e,t=[]){return n.Fo?.(e,t)??`${a(e)}#${e}${t.map(n=>` ${"string"==typeof n?JSON.stringify(n):String(n)}`).join("")}`}function r(n,t,a,r){e(i(n,t),a,r)}export{a,i as b,r as c};
@@ -0,0 +1 @@
1
+ var t={};function a(t,a){return null==t?a:(...e)=>{t(...e),a(...e)}}function e(t,a,e){return null==a?e:(...n)=>{let r=a(...n);return t(r)?r:e(...n)}}var n=t=>!0===t,r=t=>void 0!==t,s=t=>null!=t,l=new Set;function o(t){for(let a of t)l.has(a.name)||(l.add(a.name),a.install())}function u(a){let e=a.$features;if(null!=t.dt&&Array.isArray(e)){let a=e.filter(t=>!l.has(t));if(a.length>0)return t.dt(a)}}function f(t,a){if(!l.has(t))throw new Error(`[@wcstack/state] [wcs/feature-not-installed] ${a} needs the add-on @wcstack/state/features/${t}`)}function i(a,e,n){throw new Error(`[@wcstack/state] ${a}${t.Ao?.(a,e,n)??""}`)}export{t as a,a as b,e as c,n as d,r as e,s as f,o as g,u as h,f as i,i as j};