@stacksjs/stx 0.2.894 → 0.2.896

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 (125) hide show
  1. package/dist/{chunk-qn45rk5n.js → chunk-0k437z3q.js} +1 -1
  2. package/dist/{chunk-4s3ts344.js → chunk-142n73c3.js} +1 -1
  3. package/dist/{chunk-0waheg6m.js → chunk-18gfzvn5.js} +1 -1
  4. package/dist/{chunk-pg3yatv3.js → chunk-19v28wj2.js} +2 -2
  5. package/dist/{chunk-5zs5hrgz.js → chunk-1bft48gk.js} +2 -2
  6. package/dist/{chunk-s32gsz18.js → chunk-1y4ad3ma.js} +5 -5
  7. package/dist/{chunk-z8sv926e.js → chunk-2nqmw4dv.js} +1 -1
  8. package/dist/{chunk-gk0h2hp7.js → chunk-35j7gaj5.js} +1 -1
  9. package/dist/chunk-38gz54d6.js +182 -0
  10. package/dist/{chunk-j1mr34da.js → chunk-3jrn01rc.js} +1 -1
  11. package/dist/{chunk-tc94atxh.js → chunk-3sc1w0dz.js} +1 -1
  12. package/dist/{chunk-mj0dnha4.js → chunk-3wz8eys3.js} +1 -1
  13. package/dist/{chunk-90qwzwsm.js → chunk-4akw3bym.js} +1 -1
  14. package/dist/{chunk-vya7cck4.js → chunk-4d85str1.js} +1 -1
  15. package/dist/{chunk-hxm31y5q.js → chunk-54dk6rbc.js} +3 -3
  16. package/dist/chunk-55w7a5tt.js +3 -0
  17. package/dist/{chunk-8qgcvc9r.js → chunk-5zztnr63.js} +1 -1
  18. package/dist/{chunk-ae0qvjkz.js → chunk-66qwkxrv.js} +1 -1
  19. package/dist/{chunk-pjpf21y9.js → chunk-690518hw.js} +1 -1
  20. package/dist/{chunk-5spnw5zr.js → chunk-6s81gd2p.js} +1 -1
  21. package/dist/{chunk-ccecyvwf.js → chunk-6shfk0tt.js} +1 -1
  22. package/dist/{chunk-xdn58ea6.js → chunk-6yqeqesa.js} +4 -4
  23. package/dist/{chunk-0hfn4cek.js → chunk-7vr7nw7p.js} +1 -1
  24. package/dist/{chunk-khaem3zq.js → chunk-7xk40zsm.js} +1 -1
  25. package/dist/{chunk-xvprhdcb.js → chunk-80ky40mm.js} +1 -1
  26. package/dist/chunk-8abrg1v2.js +2 -0
  27. package/dist/{chunk-gzc16hs8.js → chunk-8ccgty8s.js} +2 -2
  28. package/dist/chunk-8e38dzxv.js +2 -0
  29. package/dist/{chunk-n64zbwzr.js → chunk-9rjgq8k4.js} +1 -1
  30. package/dist/{chunk-c5q6jdm9.js → chunk-9tngkmry.js} +4 -4
  31. package/dist/{chunk-s9a9kda4.js → chunk-9v2bpwgb.js} +2 -2
  32. package/dist/chunk-9vpcsn2f.js +2 -0
  33. package/dist/{chunk-kd7k31x3.js → chunk-aj5tsksz.js} +4 -4
  34. package/dist/{chunk-mdrdp6c4.js → chunk-avn3panj.js} +2 -2
  35. package/dist/chunk-b35t77m0.js +2 -0
  36. package/dist/chunk-c8hyr9vb.js +2 -0
  37. package/dist/{chunk-9f8fda1j.js → chunk-ch9028z3.js} +1 -1
  38. package/dist/{chunk-z012vpdz.js → chunk-cmg9x1ka.js} +3 -3
  39. package/dist/chunk-cp5x6kx1.js +2 -0
  40. package/dist/{chunk-x9036mfd.js → chunk-cphc60zw.js} +2 -2
  41. package/dist/chunk-e8szp5wa.js +2 -0
  42. package/dist/{chunk-wk36dj2m.js → chunk-er0hgd96.js} +1 -1
  43. package/dist/{chunk-p06tqhp9.js → chunk-exb4wc0c.js} +1 -1
  44. package/dist/{chunk-j5m4hy3m.js → chunk-fjpaxmvv.js} +2 -2
  45. package/dist/{chunk-yrjm6zyh.js → chunk-fnpq78k3.js} +1 -1
  46. package/dist/{chunk-e9c56r58.js → chunk-g71ppt0e.js} +4 -4
  47. package/dist/{chunk-3mdg7w2d.js → chunk-gxpcdhr3.js} +1 -1
  48. package/dist/{chunk-v6ja6a65.js → chunk-h19fp8g8.js} +2 -2
  49. package/dist/{chunk-d8ptv989.js → chunk-h91ry9p1.js} +4 -4
  50. package/dist/chunk-hn679t1s.js +2 -0
  51. package/dist/{chunk-gjqdp0zx.js → chunk-jrbkvptj.js} +1 -1
  52. package/dist/chunk-jre984qm.js +2 -0
  53. package/dist/chunk-jyd9trff.js +2 -0
  54. package/dist/{chunk-8a71xvx1.js → chunk-knhf7dkn.js} +16 -16
  55. package/dist/{chunk-t79khbtp.js → chunk-m136gh80.js} +2 -2
  56. package/dist/chunk-n2d0jzyv.js +2 -0
  57. package/dist/{chunk-y54vpvy0.js → chunk-n8mfvqqz.js} +1 -1
  58. package/dist/{chunk-cbjvabsa.js → chunk-p1wqyf10.js} +43 -43
  59. package/dist/{chunk-8n5bjars.js → chunk-q671arjn.js} +1 -1
  60. package/dist/chunk-qe3z3x39.js +2 -0
  61. package/dist/{chunk-1a8ev0eh.js → chunk-rr0wvqa3.js} +1 -1
  62. package/dist/chunk-rspsbhcv.js +2 -0
  63. package/dist/{chunk-66qt9q6e.js → chunk-rvn63nv2.js} +19 -19
  64. package/dist/{chunk-c9xg8rc2.js → chunk-s5xfmr87.js} +2 -2
  65. package/dist/chunk-snbhzrfy.js +2 -0
  66. package/dist/{chunk-na92k4va.js → chunk-srsb2zvm.js} +1 -1
  67. package/dist/{chunk-kfbw96c5.js → chunk-t0ttxayz.js} +2 -2
  68. package/dist/chunk-t31twwh0.js +2 -0
  69. package/dist/{chunk-qrk535j6.js → chunk-t3zmfh8w.js} +4 -4
  70. package/dist/{chunk-60z8rka9.js → chunk-t6sdtsf8.js} +5 -5
  71. package/dist/{chunk-gcjqxvbb.js → chunk-ta07gj66.js} +2 -2
  72. package/dist/chunk-tbh7r1wh.js +2 -0
  73. package/dist/chunk-tspz0z7d.js +2 -0
  74. package/dist/chunk-tznd1egg.js +2 -0
  75. package/dist/{chunk-hdqy5v4v.js → chunk-w5kq4k7f.js} +1 -1
  76. package/dist/{chunk-mxf6cfbg.js → chunk-whcrca58.js} +6 -6
  77. package/dist/chunk-x57p5bay.js +2 -0
  78. package/dist/{chunk-6yy54yyp.js → chunk-xbqt53jj.js} +1 -1
  79. package/dist/{chunk-ac3e6nhg.js → chunk-xmg6bmh6.js} +3 -3
  80. package/dist/{chunk-hxq5tsqa.js → chunk-xtq8swr2.js} +1 -1
  81. package/dist/chunk-xvmd0aja.js +2 -0
  82. package/dist/{chunk-2eq3aret.js → chunk-xwrjre34.js} +1 -1
  83. package/dist/{chunk-h7yme97q.js → chunk-xy8smv5e.js} +2 -2
  84. package/dist/{chunk-z3ar05m3.js → chunk-xzj4jyhy.js} +5 -5
  85. package/dist/chunk-ycge4wfk.js +2 -0
  86. package/dist/chunk-z1dym2re.js +2 -0
  87. package/dist/{chunk-1csmm3f6.js → chunk-z3kvxk73.js} +1 -1
  88. package/dist/{chunk-8y39f6z3.js → chunk-zf68afyh.js} +3 -3
  89. package/dist/{chunk-qv4qwa61.js → chunk-zkq66keq.js} +1 -1
  90. package/dist/cli.js +14 -14
  91. package/dist/craft-entry.js +2 -2
  92. package/dist/craft.js +2 -2
  93. package/dist/native/accessibility.d.ts +0 -15
  94. package/dist/native/accessibility.js +2 -6
  95. package/dist/native/compiler/html-to-ir.js +1 -27
  96. package/dist/offline/app-service-worker.d.ts +4 -1
  97. package/dist/offline/app-service-worker.js +23 -5
  98. package/dist/process.js +4 -3
  99. package/dist/pwa.js +1 -1
  100. package/dist/ssg.js +10 -10
  101. package/package.json +5 -5
  102. package/dist/chunk-0d14783x.js +0 -2
  103. package/dist/chunk-0yw075t7.js +0 -2
  104. package/dist/chunk-3ngbdap1.js +0 -2
  105. package/dist/chunk-484x27q5.js +0 -2
  106. package/dist/chunk-4eyyshsq.js +0 -2
  107. package/dist/chunk-4fcb8rmm.js +0 -2
  108. package/dist/chunk-4mmy5pfh.js +0 -2
  109. package/dist/chunk-4pq32bt3.js +0 -2
  110. package/dist/chunk-5kfe3smn.js +0 -2
  111. package/dist/chunk-b4kbj9kq.js +0 -2
  112. package/dist/chunk-b77t5zy2.js +0 -2
  113. package/dist/chunk-brmmkfnq.js +0 -2
  114. package/dist/chunk-btjhb71k.js +0 -2
  115. package/dist/chunk-dz1mkvdw.js +0 -2
  116. package/dist/chunk-dz2zehsh.js +0 -2
  117. package/dist/chunk-eenw264a.js +0 -2
  118. package/dist/chunk-erka2w6z.js +0 -2
  119. package/dist/chunk-gd5a11h2.js +0 -2
  120. package/dist/chunk-jjz64ac2.js +0 -2
  121. package/dist/chunk-jqnfvdx5.js +0 -182
  122. package/dist/chunk-nqarmx3w.js +0 -3
  123. package/dist/chunk-nxjfdtc0.js +0 -2
  124. package/dist/chunk-vm57848v.js +0 -2
  125. package/dist/chunk-xv471ek2.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{M,n,u}from"./chunk-ac3e6nhg.js";import{ae}from"./chunk-8a71xvx1.js";import{bi}from"./chunk-q0y8gv18.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
3
- `),r=[{obj:s,indent:-1}];for(let t of i){let o=t.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(r.length>1&&r[r.length-1].indent>=l)r.pop();let c=r[r.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")c[f]={},r.push({obj:c[f],indent:l});else c[f]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let r=i.trim(),t=r.match(/^\{(\d+)\}\s*(.*)$/);if(t){let l=Number.parseInt(t[1],10);if(s===l)return t[2];continue}let o=r.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),c=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=c)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ne(e,s={}){return j(e,s)}function j(e,s){let i="",r=0;while(r<e.length)if(e[r]==="{"){let t=ie(e,r);if(t===-1){i+=e[r],r++;continue}let o=e.slice(r+1,t);i+=se(o,s),r=t+1}else if(e[r]==="'"&&r+1<e.length)if(e[r+1]==="'")i+="'",r+=2;else if(e[r+1]==="{"||e[r+1]==="}")i+=e[r+1],r+=2;else i+=e[r],r++;else i+=e[r],r++;return i}function ie(e,s){let i=0;for(let r=s;r<e.length;r++)if(e[r]==="{")i++;else if(e[r]==="}"){if(i--,i===0)return r}return-1}function se(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let r=i[0].trim(),t=s[r];if(i.length===1)return t!==void 0?String(t):`{${r}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(t,i.slice(2).join(","),s);case"select":return ue(t,i.slice(2).join(","));case"selectordinal":return de(t,i.slice(2).join(","));case"number":return pe(t,i[2]?.trim());case"date":return fe(t,i[2]?.trim());case"time":return me(t,i[2]?.trim());default:return t!==void 0?String(t):`{${e}}`}}function oe(e){let s=[],i="",r=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="{")r++,i+=o;else if(o==="}")r--,i+=o;else if(o===","&&r===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let r=Number(e)||0,t=P(s),o=`=${r}`;if(t[o])return R(t[o],r,i);let l=ce(r);if(t[l])return R(t[l],r,i);if(t.other)return R(t.other,r,i);return String(r)}function R(e,s,i){let r=e.replace(/#/g,String(s));return j(r,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),r=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&r===0)return"one";return"other"}function ue(e,s){let i=String(e||""),r=P(s);if(r[i])return r[i];return r.other||String(e)}function de(e,s){let i=Number(e)||0,r=P(s),t=ge(i);if(r[t])return r[t].replace(/#/g,String(i));if(r.other)return r.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,r=s%100;if(i===1&&r!==11)return"one";if(i===2&&r!==12)return"two";if(i===3&&r!==13)return"few";return"other"}function P(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,r=i.exec(e);while(r!==null)s[r[1]]=r[2],r=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.dateStyle="short";break;case"medium":r.dateStyle="medium";break;case"long":r.dateStyle="long";break;case"full":r.dateStyle="full";break;default:r.dateStyle="medium"}return i.toLocaleDateString(void 0,r)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.timeStyle="short";break;case"medium":r.timeStyle="medium";break;case"long":r.timeStyle="long";break;case"full":r.timeStyle="full";break;default:r.timeStyle="short"}return i.toLocaleTimeString(void 0,r)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,r={}){let t=e.split("."),o=s;for(let c of t){if(o===void 0||o===null)break;o=o[c]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ne(l,r);if(l.includes("|")&&"count"in r){let c=Number(r.count),a=l.split("|");l=re(a,c)}for(let[c,a]of Object.entries(r)){let g=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let r=s[1]?.length===4?s[1]:void 0;if(r)return he.has(r)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function Hc(e,s,i,r){let t=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...T,...r.i18n},c=await te(l.locale,r);s.__translations=c,s.__locale=l.locale,s.__i18nConfig=l,t=await F(t,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>M(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(r.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,c,l.fallbackToKey,b);return y?ae(t,h,y,!1,p.length):w.trim()}catch(b){if(r.debug)console.error("Error processing @translate directive:",b);return u("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,n.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(r.debug){console.warn(`Processing translations in template. Sections: ${t.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...t.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return t=await F(t,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>M(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(r.debug)console.error("Error parsing parameters for @translate directive:",b)}return ae(t,w,O(f,c,l.fallbackToKey,h),!1,p.length)}catch(h){if(r.debug)console.error("Error processing @translate directive:",h);return u("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,n.EVALUATION_ERROR)}}),t}async function F(e,s,i){let r=[];return e.replace(s,(o,...l)=>{let c=i(o,...l).then((a)=>({match:o,replacement:a}));return r.push(c),o}),(await Promise.all(r)).reduce((o,{match:l,replacement:c})=>o.replace(l,()=>c),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function Uc(e,s,i,r){let t=e;t=t.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,c,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[c]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return t=t.replace(o,(l,c)=>`<span class="sr-only">${c.trim()}</span>`),t=t.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,c,a)=>`<span id="${`desc-${c}`}" class="sr-only">${a}</span>`),t}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(t,o,l)=>{let c=s.get(l);if(!c)c=`stx-a11y-component-${s.size}`,s.set(l,c);return`<${o}${c}`}),r=new Map([...s.entries()].map(([t,o])=>[o,t]));return{protectedSource:i,restore:(t)=>t.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,c)=>{let a=r.get(c);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],r=/<img\s+([^>]*)>/gi,t;t=r.exec(e);while(t!==null){let d=t[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:t[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});t=r.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;t=o.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:t[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});t=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;t=l.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:t[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});t=l.exec(e)}let c=/<(input|select|textarea)\s+([^>]*)>/gi;t=c.exec(e);while(t!==null){let d=t[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){t=c.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=t.index,N=e.substring(0,U),Se=e.substring(U),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:t[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}t=c.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];t=a.exec(e);while(t!==null)g.push(Number.parseInt(t[1],10)),t=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(I(f[1],"lang"),I(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;t=m.exec(e);while(t!==null){let d=t[2];if(!V(I(t[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});t=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;t=w.exec(e);while(t!==null){if(!/\bmuted\b/i.test(t[0]))i.push({type:"autoplay-audio",element:`<${t[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});t=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;t=h.exec(e);while(t!==null)i.push({type:"positive-tabindex",element:`tabindex="${t[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),t=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;t=b.exec(e);while(t!==null){let d=t[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});t=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;t=y.exec(e);while(t!==null){let d=t[1].toLowerCase(),x=t[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:t[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});t=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let r=[];try{let t=globalThis.document.createElement("div");t.innerHTML=i,t.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))r.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),t.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))r.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),t.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&t.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)r.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)r.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let c=t.querySelector("html");if(i.includes("<html")&&c&&!c.hasAttribute("lang"))r.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(c&&_(c.getAttribute("lang"),c.getAttribute("dir")))r.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(t.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)r.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!t.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&t.querySelectorAll("a").length>5)r.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(t.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))r.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))r.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),t.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))r.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),t.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))r.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),t.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)r.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),t.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))r.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!t.querySelector('main, [role="main"]'))r.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});t.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))r.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(t){console.error(`Error checking accessibility in ${s}:`,t)}return r}async function Vc(e,s={}){let i={},{recursive:r=!0,ignorePaths:t=[]}=s,o=Array.isArray(e)?e:[e],l=await bi(o,{recursive:r,ignorePaths:t}),c=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(c.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:c}}var Wc={name:"a11y",handler:(e,s,i,r)=>{if(!s.length)return e;let t=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",c={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[t]||"Make this element accessible";return`<!-- a11y-hint: ${o||c} -->${e}`},hasEndTag:!1},qc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
- export{Hc,Uc,Vc,Wc,qc};
2
+ import{M,n,u}from"./chunk-xmg6bmh6.js";import{ae}from"./chunk-knhf7dkn.js";import{bi}from"./chunk-q0y8gv18.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
3
+ `),r=[{obj:s,indent:-1}];for(let t of i){let o=t.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(r.length>1&&r[r.length-1].indent>=l)r.pop();let c=r[r.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")c[f]={},r.push({obj:c[f],indent:l});else c[f]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let r=i.trim(),t=r.match(/^\{(\d+)\}\s*(.*)$/);if(t){let l=Number.parseInt(t[1],10);if(s===l)return t[2];continue}let o=r.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),c=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=c)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ne(e,s={}){return j(e,s)}function j(e,s){let i="",r=0;while(r<e.length)if(e[r]==="{"){let t=ie(e,r);if(t===-1){i+=e[r],r++;continue}let o=e.slice(r+1,t);i+=se(o,s),r=t+1}else if(e[r]==="'"&&r+1<e.length)if(e[r+1]==="'")i+="'",r+=2;else if(e[r+1]==="{"||e[r+1]==="}")i+=e[r+1],r+=2;else i+=e[r],r++;else i+=e[r],r++;return i}function ie(e,s){let i=0;for(let r=s;r<e.length;r++)if(e[r]==="{")i++;else if(e[r]==="}"){if(i--,i===0)return r}return-1}function se(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let r=i[0].trim(),t=s[r];if(i.length===1)return t!==void 0?String(t):`{${r}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(t,i.slice(2).join(","),s);case"select":return ue(t,i.slice(2).join(","));case"selectordinal":return de(t,i.slice(2).join(","));case"number":return pe(t,i[2]?.trim());case"date":return fe(t,i[2]?.trim());case"time":return me(t,i[2]?.trim());default:return t!==void 0?String(t):`{${e}}`}}function oe(e){let s=[],i="",r=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="{")r++,i+=o;else if(o==="}")r--,i+=o;else if(o===","&&r===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let r=Number(e)||0,t=P(s),o=`=${r}`;if(t[o])return R(t[o],r,i);let l=ce(r);if(t[l])return R(t[l],r,i);if(t.other)return R(t.other,r,i);return String(r)}function R(e,s,i){let r=e.replace(/#/g,String(s));return j(r,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),r=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&r===0)return"one";return"other"}function ue(e,s){let i=String(e||""),r=P(s);if(r[i])return r[i];return r.other||String(e)}function de(e,s){let i=Number(e)||0,r=P(s),t=ge(i);if(r[t])return r[t].replace(/#/g,String(i));if(r.other)return r.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,r=s%100;if(i===1&&r!==11)return"one";if(i===2&&r!==12)return"two";if(i===3&&r!==13)return"few";return"other"}function P(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,r=i.exec(e);while(r!==null)s[r[1]]=r[2],r=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.dateStyle="short";break;case"medium":r.dateStyle="medium";break;case"long":r.dateStyle="long";break;case"full":r.dateStyle="full";break;default:r.dateStyle="medium"}return i.toLocaleDateString(void 0,r)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.timeStyle="short";break;case"medium":r.timeStyle="medium";break;case"long":r.timeStyle="long";break;case"full":r.timeStyle="full";break;default:r.timeStyle="short"}return i.toLocaleTimeString(void 0,r)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,r={}){let t=e.split("."),o=s;for(let c of t){if(o===void 0||o===null)break;o=o[c]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ne(l,r);if(l.includes("|")&&"count"in r){let c=Number(r.count),a=l.split("|");l=re(a,c)}for(let[c,a]of Object.entries(r)){let g=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let r=s[1]?.length===4?s[1]:void 0;if(r)return he.has(r)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function Hc(e,s,i,r){let t=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...T,...r.i18n},c=await te(l.locale,r);s.__translations=c,s.__locale=l.locale,s.__i18nConfig=l,t=await F(t,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>M(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(r.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,c,l.fallbackToKey,b);return y?ae(t,h,y,!1,p.length):w.trim()}catch(b){if(r.debug)console.error("Error processing @translate directive:",b);return u("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,n.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(r.debug){console.warn(`Processing translations in template. Sections: ${t.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...t.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return t=await F(t,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>M(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(r.debug)console.error("Error parsing parameters for @translate directive:",b)}return ae(t,w,O(f,c,l.fallbackToKey,h),!1,p.length)}catch(h){if(r.debug)console.error("Error processing @translate directive:",h);return u("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,n.EVALUATION_ERROR)}}),t}async function F(e,s,i){let r=[];return e.replace(s,(o,...l)=>{let c=i(o,...l).then((a)=>({match:o,replacement:a}));return r.push(c),o}),(await Promise.all(r)).reduce((o,{match:l,replacement:c})=>o.replace(l,()=>c),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function Vc(e,s,i,r){let t=e;t=t.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,c,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[c]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return t=t.replace(o,(l,c)=>`<span class="sr-only">${c.trim()}</span>`),t=t.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,c,a)=>`<span id="${`desc-${c}`}" class="sr-only">${a}</span>`),t}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(t,o,l)=>{let c=s.get(l);if(!c)c=`stx-a11y-component-${s.size}`,s.set(l,c);return`<${o}${c}`}),r=new Map([...s.entries()].map(([t,o])=>[o,t]));return{protectedSource:i,restore:(t)=>t.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,c)=>{let a=r.get(c);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],r=/<img\s+([^>]*)>/gi,t;t=r.exec(e);while(t!==null){let d=t[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:t[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});t=r.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;t=o.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:t[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});t=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;t=l.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:t[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});t=l.exec(e)}let c=/<(input|select|textarea)\s+([^>]*)>/gi;t=c.exec(e);while(t!==null){let d=t[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){t=c.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=t.index,N=e.substring(0,U),Se=e.substring(U),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:t[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}t=c.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];t=a.exec(e);while(t!==null)g.push(Number.parseInt(t[1],10)),t=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(I(f[1],"lang"),I(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;t=m.exec(e);while(t!==null){let d=t[2];if(!V(I(t[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});t=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;t=w.exec(e);while(t!==null){if(!/\bmuted\b/i.test(t[0]))i.push({type:"autoplay-audio",element:`<${t[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});t=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;t=h.exec(e);while(t!==null)i.push({type:"positive-tabindex",element:`tabindex="${t[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),t=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;t=b.exec(e);while(t!==null){let d=t[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});t=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;t=y.exec(e);while(t!==null){let d=t[1].toLowerCase(),x=t[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:t[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});t=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let r=[];try{let t=globalThis.document.createElement("div");t.innerHTML=i,t.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))r.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),t.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))r.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),t.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&t.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)r.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)r.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let c=t.querySelector("html");if(i.includes("<html")&&c&&!c.hasAttribute("lang"))r.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(c&&_(c.getAttribute("lang"),c.getAttribute("dir")))r.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(t.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)r.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!t.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&t.querySelectorAll("a").length>5)r.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(t.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))r.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))r.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),t.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))r.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),t.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))r.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),t.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)r.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),t.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))r.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!t.querySelector('main, [role="main"]'))r.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});t.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))r.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(t){console.error(`Error checking accessibility in ${s}:`,t)}return r}async function Uc(e,s={}){let i={},{recursive:r=!0,ignorePaths:t=[]}=s,o=Array.isArray(e)?e:[e],l=await bi(o,{recursive:r,ignorePaths:t}),c=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(c.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:c}}var Wc={name:"a11y",handler:(e,s,i,r)=>{if(!s.length)return e;let t=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",c={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[t]||"Make this element accessible";return`<!-- a11y-hint: ${o||c} -->${e}`},hasEndTag:!1},qc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
+ export{Hc,Vc,Uc,Wc,qc};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Y}from"./chunk-knhf7dkn.js";function r(t){return Y(t)}
3
+ export{r};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-5kfe3smn.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function qi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-snbhzrfy.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function qi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-e9c56r58.js";import{jo}from"./chunk-nq60tjkz.js";import p from"path";async function _m(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(jo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-nxjfdtc0.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
2
+ import{a}from"./chunk-g71ppt0e.js";import{jo}from"./chunk-nq60tjkz.js";import p from"path";async function _m(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(jo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-z1dym2re.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
3
  export{_m};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vi,xi,Si,ki,zs,Hs,Sy,ky,_y,Cy,Us,Ey}from"./chunk-qrk535j6.js";import"./chunk-ac3e6nhg.js";import"./chunk-0jdz31q1.js";export{Ey as generateDefaultRobotsTxt,Us as generateRobotsTxt,ky as generateSitemap,_y as generateSitemapIndex,ki as injectSeoTags,zs as metaDirective,vi as processMetaDirectives,Si as processSeoDirective,xi as processStructuredData,Sy as registerSeoDirectives,Cy as scanForSitemapEntries,Hs as structuredDataDirective};
2
+ import{vi,xi,Si,ki,zs,Hs,Sy,ky,_y,Cy,Vs,Ey}from"./chunk-t3zmfh8w.js";import"./chunk-xmg6bmh6.js";import"./chunk-0jdz31q1.js";export{Ey as generateDefaultRobotsTxt,Vs as generateRobotsTxt,ky as generateSitemap,_y as generateSitemapIndex,ki as injectSeoTags,zs as metaDirective,vi as processMetaDirectives,Si as processSeoDirective,xi as processStructuredData,Sy as registerSeoDirectives,Cy as scanForSitemapEntries,Hs as structuredDataDirective};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Q,qe}from"./chunk-8a71xvx1.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function gn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=qe(t,s);if(p>s){c=p;continue}let a=Q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{Q,qe}from"./chunk-knhf7dkn.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function gn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=qe(t,s);if(p>s){c=p;continue}let a=Q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{gn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pe,lo,qg,Ry,Kg,Ay,In,g,Y,ae,On,Ne,Gg,Vi,Xg,Py,P,Wi,Jg,Iy,N,Oy}from"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Jg as applyFilters,Ay as clearCustomFilters,Gg as clientLoopScopes,lo as defaultFilters,On as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ae as escapeInterpolatedHtmlValue,N as evaluateExpression,Pe as findMustacheEnd,Kg as getAllFilters,Xg as interpolateScriptAttributes,Vi as interpolateScriptExpressions,Py as interpolateScriptsInTemplate,P as processExpressions,Wi as processExpressionsChunked,qg as registerFilter,Ry as registerFilters,In as replaceInterpolations,Iy as resetRejectedExpressionWarnings,Oy as unescapeHtml,Ne as usesSignalsInScript};
2
+ import{Pe,lo,qg,Ry,Kg,Ay,In,g,Y,ae,On,Ne,Gg,Ui,Xg,Py,P,Wi,Jg,Iy,N,Oy}from"./chunk-knhf7dkn.js";import"./chunk-5zztnr63.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{Jg as applyFilters,Ay as clearCustomFilters,Gg as clientLoopScopes,lo as defaultFilters,On as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ae as escapeInterpolatedHtmlValue,N as evaluateExpression,Pe as findMustacheEnd,Kg as getAllFilters,Xg as interpolateScriptAttributes,Ui as interpolateScriptExpressions,Py as interpolateScriptsInTemplate,P as processExpressions,Wi as processExpressionsChunked,qg as registerFilter,Ry as registerFilters,In as replaceInterpolations,Iy as resetRejectedExpressionWarnings,Oy as unescapeHtml,Ne as usesSignalsInScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y,b,g}from"./chunk-8a71xvx1.js";import{q}from"./chunk-e9c56r58.js";import{i}from"./chunk-cbjvabsa.js";import k from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,n;O.lastIndex=0;while((n=O.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function dh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=z(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=n.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let u=await i(c,f,e,n,l);for(let x=0;x<u.length;x+=s)r.enqueue(u.slice(x,x+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],x=new RegExp(T.source,"g"),m;while((m=x.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let D=await i(I,f,e,n,l);r.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{y,b,g}from"./chunk-knhf7dkn.js";import{q}from"./chunk-g71ppt0e.js";import{i}from"./chunk-p1wqyf10.js";import k from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,n;O.lastIndex=0;while((n=O.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function dh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=z(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=n.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let u=await i(c,f,e,n,l);for(let x=0;x<u.length;x+=s)r.enqueue(u.slice(x,x+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],x=new RegExp(T.source,"g"),m;while((m=x.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let D=await i(I,f,e,n,l);r.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(d.name,i(d.content,f,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -17,7 +17,7 @@ import{y,b,g}from"./chunk-8a71xvx1.js";import{q}from"./chunk-e9c56r58.js";import
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let S=Array.from(h.entries()).map(async([d,u])=>{r.enqueue(await Ua(d,u))});await Promise.all(S)}r.close()}catch(a){r.error(a)}}})}async function Ua(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let S=Array.from(h.entries()).map(async([d,u])=>{r.enqueue(await Va(d,u))});await Promise.all(S)}r.close()}catch(a){r.error(a)}}})}async function Va(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${n}\`);
23
23
  </script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
@@ -43,7 +43,7 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function A(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function ph(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Bu),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await Ua(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function fh(e,t){return e.replace(B,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),w=a[0].trim(),p=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=w,`<div data-suspense="${r}">${p}</div>`})}function gh(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function mh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let S=await i(c,f,e,n,E);for(let d=0;d<S.length;d+=s)r.enqueue(S.slice(d,d+s))}else{let S=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)S.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let x=0;for(let m of S){if(m.start>x){let _=c.slice(x,m.start);if(_.trim()){let C=await i(_,f,e,n,E);r.enqueue(C)}}let v=await i(m.content,f,e,n,E);r.enqueue(v),x=m.end}if(x<c.length){let m=c.slice(x);if(m.trim()){let v=await i(m,f,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function hh(e,t={}){let o={...q,...t,streaming:{...M,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,p={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];p[l]=R}let f=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await y(r,R,e),i(f,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!p[l])return`<div class="error-message">Section "${g(l)}" not found in template "${g(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await y(r,h,e);let S=new Set;return await i(p[l],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return b("Expression",S,e,p[l]||"",0,p[l]||"")}},getSections:()=>Object.keys(p),getTemplate:()=>w}}var Fu={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},zu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),p=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
46
+ </script>`;function A(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function ph(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Bu),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await Va(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function fh(e,t){return e.replace(B,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),w=a[0].trim(),p=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=w,`<div data-suspense="${r}">${p}</div>`})}function gh(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function mh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let S=await i(c,f,e,n,E);for(let d=0;d<S.length;d+=s)r.enqueue(S.slice(d,d+s))}else{let S=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)S.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let x=0;for(let m of S){if(m.start>x){let _=c.slice(x,m.start);if(_.trim()){let C=await i(_,f,e,n,E);r.enqueue(C)}}let v=await i(m.content,f,e,n,E);r.enqueue(v),x=m.end}if(x<c.length){let m=c.slice(x);if(m.trim()){let v=await i(m,f,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function hh(e,t={}){let o={...q,...t,streaming:{...M,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,p={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];p[l]=R}let f=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await y(r,R,e),i(f,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!p[l])return`<div class="error-message">Section "${g(l)}" not found in template "${g(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await y(r,h,e);let S=new Set;return await i(p[l],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return b("Expression",S,e,p[l]||"",0,p[l]||"")}},getSections:()=>Object.keys(p),getTemplate:()=>w}}var Fu={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},zu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),p=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${p?`{${p}}`:"{}"}
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{dh,Ua,Bu,ph,fh,gh,mh,hh,Fu,zu,yh,bh,wh,vh};
194
+ export{dh,Va,Bu,ph,fh,gh,mh,hh,Fu,zu,yh,bh,wh,vh};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{y,Bi,bl,wl,jg,Bg,Fg,zg,Hg,co,Ug,Xe,ie,Je,Vg,Fr,Wg,Sl,kl,Hi,Ye,s,Pn,_l,b,Ce,$y}from"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{kl as SIGNAL_COMPOSABLE_CALL,Ce as clearComponentCache,Hi as componentClientSignalNames,Bi as convertToCommonJS,b as createDetailedErrorMessage,Hg as extractDirectiveNames,bl as extractScriptFromTemplate,y as extractVariables,s as fileExists,$y as getComponentCacheStats,Bg as getPositionInfo,ie as getSharedTranspiler,_l as getSourceLineInfo,zg as hasDirectives,wl as hasVariables,Wg as isHydrateTrigger,Ug as isJavaScriptScript,Ye as renderComponentWithSlot,Pn as resolveTemplatePath,Vg as scopeOnRootElement,co as scopeSequenceKey,Xe as shouldTranspileTypeScript,Sl as slotContentHasExpressions,Je as transpileTypeScript,Fr as userComponentFileExists,Fg as validateDirective,jg as validateTemplate};
2
+ import{y,Bi,bl,wl,jg,Bg,Fg,zg,Hg,co,Vg,Xe,ie,Je,Ug,Fr,Wg,Sl,kl,Hi,Ye,s,Pn,_l,b,Ce,$y}from"./chunk-knhf7dkn.js";import"./chunk-5zztnr63.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{kl as SIGNAL_COMPOSABLE_CALL,Ce as clearComponentCache,Hi as componentClientSignalNames,Bi as convertToCommonJS,b as createDetailedErrorMessage,Hg as extractDirectiveNames,bl as extractScriptFromTemplate,y as extractVariables,s as fileExists,$y as getComponentCacheStats,Bg as getPositionInfo,ie as getSharedTranspiler,_l as getSourceLineInfo,zg as hasDirectives,wl as hasVariables,Wg as isHydrateTrigger,Vg as isJavaScriptScript,Ye as renderComponentWithSlot,Pn as resolveTemplatePath,Ug as scopeOnRootElement,co as scopeSequenceKey,Xe as shouldTranspileTypeScript,Sl as slotContentHasExpressions,Je as transpileTypeScript,Fr as userComponentFileExists,Fg as validateDirective,jg as validateTemplate};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ft}from"./chunk-gzc16hs8.js";import{At,rr}from"./chunk-gcjqxvbb.js";import{ye,$n,Cl,El}from"./chunk-8a71xvx1.js";import{Vr,Wr,qr,Gr,De}from"./chunk-ac3e6nhg.js";import{z}from"./chunk-41z7f41b.js";import{qi}from"./chunk-8qgcvc9r.js";import{S}from"./chunk-d8ptv989.js";import{i}from"./chunk-cbjvabsa.js";import{q,a}from"./chunk-e9c56r58.js";import{Xc}from"./chunk-rb2zbdqd.js";import{Wn,qn,rt,Be,Na,Ma,Kn}from"./chunk-z3ar05m3.js";import{vn,Zo}from"./chunk-mdrdp6c4.js";import{Gn}from"./chunk-nq60tjkz.js";import{fn,pr,fr}from"./chunk-1ph2yhfn.js";import{re}from"./chunk-60z8rka9.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?rr():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Cl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Wn(f)+qn(f)+rt(f),j=El();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:$n(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=De(e.app?.head,{known:Gr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Gn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=qr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Vr(t.html,u);if(g.htmlAttrs)t.html=Wr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Kn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Be(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=fr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",pr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=Na(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Zo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await qi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Xc(e._layerGraph),null,2));Ma(C,r);let F=Date.now()-l;return console.log(`
2
+ import{ft}from"./chunk-8ccgty8s.js";import{At,rr}from"./chunk-ta07gj66.js";import{ye,$n,Cl,El}from"./chunk-knhf7dkn.js";import{Ur,Wr,qr,Gr,De}from"./chunk-xmg6bmh6.js";import{z}from"./chunk-41z7f41b.js";import{qi}from"./chunk-5zztnr63.js";import{S}from"./chunk-h91ry9p1.js";import{i}from"./chunk-p1wqyf10.js";import{q,a}from"./chunk-g71ppt0e.js";import{Xc}from"./chunk-rb2zbdqd.js";import{Wn,qn,rt,Be,Na,Ma,Kn}from"./chunk-xzj4jyhy.js";import{vn,Zo}from"./chunk-avn3panj.js";import{Gn}from"./chunk-nq60tjkz.js";import{fn,pr,fr}from"./chunk-1ph2yhfn.js";import{re}from"./chunk-t6sdtsf8.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?rr():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Cl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Wn(f)+qn(f)+rt(f),j=El();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:$n(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=De(e.app?.head,{known:Gr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Gn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=qr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ur(t.html,u);if(g.htmlAttrs)t.html=Wr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Kn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Be(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=fr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",pr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=Na(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Zo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await qi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Xc(e._layerGraph),null,2));Ma(C,r);let F=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
4
4
  export{Om};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{d,m,$l,p,n,u}from"./chunk-ac3e6nhg.js";import{ut,Nt,kn,mi}from"./chunk-n64zbwzr.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=mi(t,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,f)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,f)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let f=t.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=ut(t,s+7);if(!o)break;let r=o.endPos,c=Nt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=li(t,e,g),t=ui(t,e,g),t=ci(t,e);let v=()=>{let a=kn(t);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?$l(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function ci(w,e){let g=w;function t(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function li(w,e,g){let t=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=ut(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Nt(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),t}function ui(w,e,g){let t=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
2
+ import{d,m,$l,p,n,u}from"./chunk-xmg6bmh6.js";import{ut,Nt,kn,mi}from"./chunk-9rjgq8k4.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=mi(t,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,f)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,f)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let f=t.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=ut(t,s+7);if(!o)break;let r=o.endPos,c=Nt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=li(t,e,g),t=ui(t,e,g),t=ci(t,e);let v=()=>{let a=kn(t);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?$l(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function ci(w,e){let g=w;function t(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function li(w,e,g){let t=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=ut(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Nt(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),t}function ui(w,e,g){let t=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
3
3
  export{ge,ci,li,ui};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{dh,Va,Bu,ph,fh,gh,mh,hh,Fu,zu,yh,bh,wh,vh}from"./chunk-6yqeqesa.js";import"./chunk-p1wqyf10.js";import"./chunk-h91ry9p1.js";import"./chunk-9tngkmry.js";import"./chunk-05x1rd86.js";import"./chunk-s5xfmr87.js";import"./chunk-55w7a5tt.js";import"./chunk-3wz8eys3.js";import"./chunk-80ky40mm.js";import"./chunk-9v2bpwgb.js";import"./chunk-t6sdtsf8.js";import"./chunk-9rjgq8k4.js";import"./chunk-xtq8swr2.js";import"./chunk-n6q1d66k.js";import"./chunk-g71ppt0e.js";import"./chunk-54dk6rbc.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-t3zmfh8w.js";import"./chunk-8ccgty8s.js";import"./chunk-knhf7dkn.js";import"./chunk-5zztnr63.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{Bu as SUSPENSE_RESOLVER_RUNTIME,Va as buildSuspenseResolveScript,hh as createStreamRenderer,gh as extractStreamBoundaries,vh as generateHydrationRuntime,zu as islandDirective,bh as processSectionDirectives,fh as processStreamDirectives,yh as registerStreamingDirectives,ph as renderStreamingPage,dh as streamTemplate,mh as streamTemplateSimple,wh as streamToResponse,Fu as streamingSuspenseDirective};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function _i(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
3
  `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Ci(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Dt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Se(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Tr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Vs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Se(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class $r{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=Se(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");_i(this.routes,s),Ci(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ws(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function qs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function vg(e){k=e.replace(/\/$/,"")}function xg(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Rr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function _g(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Cg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Eg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Jc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Yc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Zc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Ei(e,t){v.set(e,t)}function Qc(e){return v.get(e)}function Tg(e){return v.has(e)}function Lt(){v.clear()}function jt(){return Array.from(v.keys())}async function Bt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ei(o,s);else if(typeof s==="function")Ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Ft(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function zt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Jc(a,i):Yc(),storage:Zc(),state:{},request:a,responseHeaders:i}}async function Ht(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Qc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ks(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function pt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ks(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Dt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Se(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Tr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Us(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Se(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class $r{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=Se(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");_i(this.routes,s),Ci(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ws(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function qs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function vg(e){k=e.replace(/\/$/,"")}function xg(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Rr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function _g(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Cg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Eg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Jc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Yc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Zc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Ei(e,t){v.set(e,t)}function Qc(e){return v.get(e)}function Tg(e){return v.has(e)}function Lt(){v.clear()}function jt(){return Array.from(v.keys())}async function Bt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ei(o,s);else if(typeof s==="function")Ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Ft(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function zt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Jc(a,i):Yc(),storage:Zc(),state:{},request:a,responseHeaders:i}}async function Ht(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Qc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ks(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function pt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ks(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=8;
@@ -4216,4 +4216,4 @@ else {
4216
4216
 
4217
4217
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
4218
4218
  })();
4219
- `}function ft(){if(A)return A;return A=U(W(H()),!0),A}function $g(){if(C)return C;return C=U(H()),C}export{_i,Ci,Dt,Se,Tr,Vs,$r,Ws,qs,vg,xg,Sg,Rr,kg,_g,Cg,Eg,Jc,Yc,Zc,Ei,Qc,Tg,Lt,jt,Bt,Ft,zt,Ht,Ks,pt,ft,$g};
4219
+ `}function ft(){if(A)return A;return A=U(W(H()),!0),A}function $g(){if(C)return C;return C=U(H()),C}export{_i,Ci,Dt,Se,Tr,Us,$r,Ws,qs,vg,xg,Sg,Rr,kg,_g,Cg,Eg,Jc,Yc,Zc,Ei,Qc,Tg,Lt,jt,Bt,Ft,zt,Ht,Ks,pt,ft,$g};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fo,Fh,zh}from"./chunk-zkq66keq.js";import"./chunk-142n73c3.js";import"./chunk-avn3panj.js";import"./chunk-115bb91s.js";import"./chunk-9v2bpwgb.js";import"./chunk-t6sdtsf8.js";import"./chunk-9rjgq8k4.js";import"./chunk-n6q1d66k.js";import"./chunk-g71ppt0e.js";import"./chunk-54dk6rbc.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-t3zmfh8w.js";import"./chunk-8ccgty8s.js";import"./chunk-knhf7dkn.js";import"./chunk-5zztnr63.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{zh as clearComposableCache,Fh as getComposableScript,Fo as listComposableModules};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{_}from"./chunk-ac3e6nhg.js";function ut(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=_(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function Nt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=ut(e,c);if(!o)return null;let i=o.endPos,u=Nt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=ut(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function kn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Ms(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=_(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=Nt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function mi(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=ut(e,c);if(!o)return null;let i=o.endPos,u=Nt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=ut(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{ut,Nt,kn,Ms,mi};
2
+ import{_}from"./chunk-xmg6bmh6.js";function ut(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=_(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function Nt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=ut(e,c);if(!o)return null;let i=o.endPos,u=Nt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=ut(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function kn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Ms(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=_(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=Nt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function mi(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=ut(e,c);if(!o)return null;let i=o.endPos,u=Nt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=ut(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{ut,Nt,kn,Ms,mi};