@lentystyle/core 0.1.0

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 (102) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CHANGELOG.tr.md +13 -0
  3. package/CODE_OF_CONDUCT.md +42 -0
  4. package/CODE_OF_CONDUCT.tr.md +41 -0
  5. package/CONTRIBUTING.md +53 -0
  6. package/CONTRIBUTING.tr.md +50 -0
  7. package/LICENSE.md +281 -0
  8. package/LICENSE.tr.md +280 -0
  9. package/README.md +139 -0
  10. package/README.tr.md +136 -0
  11. package/SECURITY.md +33 -0
  12. package/SECURITY.tr.md +32 -0
  13. package/dist/compiler/imports/chars.min.cjs +2 -0
  14. package/dist/compiler/imports/chars.min.js +2 -0
  15. package/dist/compiler/imports/classify.min.cjs +2 -0
  16. package/dist/compiler/imports/classify.min.js +2 -0
  17. package/dist/compiler/imports/scan.min.cjs +3 -0
  18. package/dist/compiler/imports/scan.min.js +3 -0
  19. package/dist/compiler/incremental.min.cjs +73 -0
  20. package/dist/compiler/incremental.min.js +73 -0
  21. package/dist/compiler/index.min.cjs +67 -0
  22. package/dist/compiler/index.min.js +67 -0
  23. package/dist/compiler/profile.min.cjs +2 -0
  24. package/dist/compiler/profile.min.js +2 -0
  25. package/dist/compiler/renderer.min.cjs +8 -0
  26. package/dist/compiler/renderer.min.js +8 -0
  27. package/dist/compiler/resource-limits.min.cjs +1 -0
  28. package/dist/compiler/resource-limits.min.js +1 -0
  29. package/dist/compiler/security/guard.min.cjs +1 -0
  30. package/dist/compiler/security/guard.min.js +1 -0
  31. package/dist/compiler/variables/array-variable.min.cjs +1 -0
  32. package/dist/compiler/variables/array-variable.min.js +1 -0
  33. package/dist/config.min.cjs +1 -0
  34. package/dist/config.min.js +1 -0
  35. package/dist/guard/hybrid.min.cjs +2 -0
  36. package/dist/guard/hybrid.min.js +2 -0
  37. package/dist/guard/runtime.min.cjs +1 -0
  38. package/dist/guard/runtime.min.js +1 -0
  39. package/dist/guard/shared.min.cjs +1 -0
  40. package/dist/guard/shared.min.js +1 -0
  41. package/dist/guard/ssr.min.cjs +2 -0
  42. package/dist/guard/ssr.min.js +2 -0
  43. package/dist/index.min.cjs +103 -0
  44. package/dist/index.min.js +103 -0
  45. package/dist/runtime/diagnostics.min.cjs +1 -0
  46. package/dist/runtime/diagnostics.min.js +1 -0
  47. package/dist/runtime/features.min.cjs +2 -0
  48. package/dist/runtime/features.min.js +2 -0
  49. package/dist/runtime/index.min.cjs +103 -0
  50. package/dist/runtime/index.min.js +103 -0
  51. package/dist/runtime/lentystyle.compile.worker.min.js +83 -0
  52. package/dist/runtime/lentystyle.debug.min.js +4 -0
  53. package/dist/runtime/lentystyle.integrity.json +12 -0
  54. package/dist/runtime/lentystyle.lazy.min.js +1 -0
  55. package/dist/runtime/lentystyle.log-critical.min.js +1 -0
  56. package/dist/runtime/lentystyle.log-optional.min.js +1 -0
  57. package/dist/runtime/lentystyle.map.min.js +4 -0
  58. package/dist/runtime/lentystyle.min.js +103 -0
  59. package/dist/runtime/lentystyle.observed.min.js +9 -0
  60. package/dist/runtime/lentystyle.performance.min.js +1 -0
  61. package/dist/runtime/lentystyle.worker.min.js +2 -0
  62. package/dist/runtime/options.min.cjs +1 -0
  63. package/dist/runtime/options.min.js +1 -0
  64. package/dist/runtime/style-sheet.min.cjs +1 -0
  65. package/dist/runtime/style-sheet.min.js +1 -0
  66. package/dist/types/compiler/compiler/index.d.ts +4 -0
  67. package/dist/types/compiler/compiler/render/collect-leaves.d.ts +3 -0
  68. package/dist/types/compiler/compiler/render/index.d.ts +3 -0
  69. package/dist/types/compiler/compiler/render/render-buckets.d.ts +3 -0
  70. package/dist/types/compiler/compiler/render/types.d.ts +13 -0
  71. package/dist/types/compiler/compiler/renderer.d.ts +5 -0
  72. package/dist/types/compiler/compiler/resource-limits.d.ts +21 -0
  73. package/dist/types/compiler/compiler/types.d.ts +82 -0
  74. package/dist/types/compiler/index.d.ts +2 -0
  75. package/dist/types/compiler/reader.d.ts +5 -0
  76. package/dist/types/compiler/renderer.d.ts +1 -0
  77. package/dist/types/config.d.ts +14 -0
  78. package/dist/types/index.d.ts +3 -0
  79. package/dist/types/runtime/diagnostics.d.ts +1 -0
  80. package/dist/types/runtime/features.d.ts +1 -0
  81. package/dist/types/runtime/index.d.ts +4 -0
  82. package/dist/types/runtime/options.d.ts +12 -0
  83. package/dist/types/runtime/runtime/features/assets.d.ts +3 -0
  84. package/dist/types/runtime/runtime/features/index.d.ts +5 -0
  85. package/dist/types/runtime/runtime/features/loader.d.ts +2 -0
  86. package/dist/types/runtime/runtime/features/performance-types.d.ts +39 -0
  87. package/dist/types/runtime/runtime/features/registry.d.ts +4 -0
  88. package/dist/types/runtime/runtime/features/types.d.ts +109 -0
  89. package/dist/types/runtime/runtime/loader/context-time.d.ts +2 -0
  90. package/dist/types/runtime/runtime/loader/context-types.d.ts +19 -0
  91. package/dist/types/runtime/runtime/loader/context.d.ts +18 -0
  92. package/dist/types/runtime/runtime/loader/options.d.ts +8 -0
  93. package/dist/types/runtime/runtime/loader/process/import-resolver/types.d.ts +12 -0
  94. package/dist/types/runtime/runtime/loader/process/types.d.ts +25 -0
  95. package/dist/types/runtime/runtime/style-sheet/cache.d.ts +6 -0
  96. package/dist/types/runtime/runtime/style-sheet.d.ts +7 -0
  97. package/dist/types/runtime/runtime/stylesheet-links/auto-loader.d.ts +7 -0
  98. package/dist/types/runtime/runtime/stylesheet-links/dom-compile.d.ts +9 -0
  99. package/dist/types/runtime/runtime/stylesheet-links.d.ts +2 -0
  100. package/dist/types/runtime/style-sheet.d.ts +1 -0
  101. package/dist/types/runtime/style.d.ts +2 -0
  102. package/package.json +117 -0
@@ -0,0 +1,67 @@
1
+ function R(){return{source:"",lineMap:[],outputLine:1}}function x(e,r,n,t){As(e,n,t),e.source+=r,r===`
2
+ `&&(e.outputLine+=1)}function Cr(e,r){let n=1;for(let t=0;t<r.source.length;t+=1){let i=r.source[t],s=Ps(r,n);x(e,i,s.sourceId,s.line),i===`
3
+ `&&(n+=1)}}function In(e,r,n,t){r.source&&(r.source.startsWith(`
4
+ `)||x(e,`
5
+ `,n,t),Cr(e,r),r.source.endsWith(`
6
+ `)||x(e,`
7
+ `,n,t))}function E(e,r){let n=R(),t=1;for(let i=0;i<e.length;i+=1)x(n,e[i],r,t),e[i]===`
8
+ `&&(t+=1);return n}function Ps(e,r){return e.lineMap[r-1]?e.lineMap[r-1]:e.lineMap.length>0?e.lineMap[e.lineMap.length-1]:{sourceId:"<inline>",line:1}}function As(e,r,n){let t=e.outputLine;e.lineMap[t-1]||(e.lineMap[t-1]={sourceId:r,line:n})}function En(e,r){return typeof r=="string"?{id:e,source:r}:r}function $n(e,r){return e&&e.trim().length>0?e:r}function Rr(e){return e===" "||e===" "||e===`
9
+ `||e==="\r"||e==="\f"}function Wn(e){let r=1;for(;r<e.length&&Rr(e[r]);)r+=1;let n=r;for(;r<e.length&&Is(e[r]);)r+=1;return e.slice(n,r).toLowerCase()}function Is(e){let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57?!0:e==="_"||e==="-"}function jn(e){let r=e.indexOf("?"),n=e.indexOf("#"),t=Es(r,n);return(t===-1?e:e.slice(0,t)).trim().toLowerCase()}function Es(e,r){return e===-1?r:r===-1?e:Math.min(e,r)}function Mn(e){var i;let r=e.toLowerCase().indexOf("@import");if(r===-1)return null;let n=r+7;for(;n<e.length&&Tn(e[n]);)n+=1;let t=(i=e[n])!=null?i:"";return t==="'"||t==='"'?$s(e,n):Ms(e,n)?Ws(e,n+4):js(e,n)}function $s(e,r){let n=e[r],t=r+1;for(;t<e.length;){let i=e[t],s=t>r?e[t-1]:"";if(i===n&&s!=="\\")return e.slice(r+1,t);t+=1}return null}function Ws(e,r){let n=e.indexOf(")",r);if(n===-1)return null;let t=e.slice(r,n).trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function js(e,r){let n=r;for(;n<e.length&&!Tn(e[n])&&e[n]!==";";)n+=1;let t=e.slice(r,n).trim();return t||null}function Ms(e,r){return e.slice(r,r+4).toLowerCase()==="url("}function Tn(e){return e===" "||e===" "||e===`
10
+ `||e==="\r"||e==="\f"}function Nn(e){return e==="char"||e==="charset"}function Fn(e){let r=Mn(e);if(!r)return null;let n=jn(r);return n.endsWith(".css")?{raw:r,normalized:n,kind:"css"}:n.endsWith(".luis")?{raw:r,normalized:n,kind:"luis"}:{raw:r,normalized:n,kind:"other"}}function Dn(){return{phase:0}}function Q(e){e.phase>=5||(e.phase=5)}function Bn(e,r,n,t){e.phase>0&&t.push({code:"invalid-directive-position",line:r,message:`[${n}] @charset must be the first top-level statement.`}),e.phase=1}function zn(e,r,n,t){e.phase>=4&&t.push({code:"invalid-directive-order",line:r,message:`[${n}] @layer declaration must be before @import ".luis" and before regular rules.`}),e.phase<3&&(e.phase=3)}function _n(e,r,n,t,i){if(r.kind==="css"||r.kind==="other"){e.phase<2&&(e.phase=2);return}e.phase<4&&(e.phase=4)}function Zn(e){let n=e.toLowerCase().indexOf("@import");if(n===-1)return null;let t=Ds(e,n+7);return t>=e.length?null:e[t]==='"'||e[t]==="'"?Ts(e,t):Bs(e,t)?Ns(e,t):Fs(e,t)}function Ts(e,r){let n=e[r],t=r+1;for(;t<e.length;){if(e[t]===n&&e[t-1]!=="\\")return{start:r,end:t+1};t+=1}return null}function Ns(e,r){let n=e.indexOf(")",r+4);return n===-1?null:{start:r,end:n+1}}function Fs(e,r){let n=r;for(;n<e.length&&!Un(e[n])&&e[n]!==";";)n+=1;return n===r?null:{start:r,end:n}}function Ds(e,r){let n=r;for(;n<e.length&&Un(e[n]);)n+=1;return n}function Un(e){return e===" "||e===" "||e===`
11
+ `||e==="\r"||e==="\f"}function Bs(e,r){return e.slice(r,r+4).toLowerCase()==="url("}function Sr(e,r){let n=Zn(e);if(!n)return`@import "${Kn(r)}";`;let t=e.slice(0,n.start),i=e.slice(n.end);return`${t}"${Kn(r)}"${i}`}function Hn(e,r){let n=e.trim();if(n){if(qn(n))return n;if(!qn(r))return null}else return null;try{return new URL(n,r).href}catch{return null}}function Kn(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function qn(e){let r=e.trim().toLowerCase();return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("data:")}var xe=class extends Error{constructor(n){super(n);this.code="security-check-failed";this.name="LuisSecurityError"}};function w(e,r){let n=r instanceof Error?r.message:String(r);throw new xe(`[LentyStyle][Security] ${e} failed: ${n}`)}var zs=/^(?:javascript|vbscript|data|blob|file):/i,Qn=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,Xn=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,_s=/\\([0-9a-fA-F]{1,6}\s?|.)/g,Zs=/^[0-9a-fA-F]+$/;function We(e){return zs.test(Gn(e).trim())}function Vr(e){return!We(e)}function $(e){let r=Gn(e);return r.includes("</style")||r.includes("<script")||r.includes("</script")||r.includes("javascript:")||Qn.test(e)||Qn.test(r)||Xn.test(e)||Xn.test(r)}function Gn(e){return e.replace(_s,(r,n)=>{let t=Us(n);if(t){let i=Number.parseInt(t,16);return i>1114111?"":String.fromCodePoint(i)}else return n}).toLowerCase()}function Us(e){let r=e.trim();return Zs.test(r)?r:null}function Jn(e){try{return We(e)}catch(r){return w("isUnsafeImportRequest",r)}}function Or(e){try{return $(e)}catch(r){return w("isUnsafeCssImportStatement",r)}}function j(e,r,n,t){e.warnings.push({code:r,line:n,message:t})}function Yn(e,r,n,t,i,s){var g,b;let o=Wn(e);if(Nn(o))return Bn(i,r,n,t.warnings),E(e,n);if(o==="layer")return zn(i,r,n,t.warnings),E(e,n);if(o!=="import")return Q(i),E(e,n);let l=Fn(e);if(!l)return Or(e)?(j(t,"invalid-import-url",r,`[${n}] Unsafe @import URL blocked.`),R()):(Q(i),E(e,n));if(Jn(l.raw))return j(t,"invalid-import-url",r,`[${n}] Unsafe @import URL blocked: ${l.raw}`),R();let a=i.phase;if(_n(i,l,r,n,t.warnings),l.kind!=="luis"&&Or(e))return j(t,"invalid-import-url",r,`[${n}] Unsafe CSS @import blocked: ${l.raw}`),R();if(l.kind==="css"){let O=Hn(l.raw,n);return O?E(Sr(e,O),n):E(e,n)}else if(l.kind!=="luis")return E(e,n);if(!t.options.importResolver)return j(t,"unsupported-import",r,`[${n}] Runtime/dynamic .luis import is disabled. Use compile-time importResolver.`),R();let u=t.options.importResolver(l.raw,n);if(!u)return j(t,"import-not-found",r,`[${n}] Unable to resolve .luis import: ${l.raw}`),R();let c=En(l.raw,u);if(((b=(g=t.options).importModeResolver)==null?void 0:b.call(g,c.id))==="vendor-fast"&&a<=3)return E(Sr(e,c.id),n);if(t.importStack.includes(c.id))return j(t,"import-cycle",r,`[${n}] Import cycle detected for "${c.id}".`),R();let f=t.importStack.length+1;if(f>t.resourceLimits.maxImportDepth)return j(t,"resource-limit",r,`[${n}] Import depth budget exceeded (${f}/${t.resourceLimits.maxImportDepth}) for "${c.id}".`),R();if(t.importCount+1>t.resourceLimits.maxImportCount)return j(t,"resource-limit",r,`[${n}] Import count budget exceeded (${t.importCount+1}/${t.resourceLimits.maxImportCount}) for "${c.id}".`),R();if(t.importedBytes+c.source.length>t.resourceLimits.maxImportedBytes)return j(t,"resource-limit",r,`[${n}] Imported bytes budget exceeded (${t.importedBytes+c.source.length}/${t.resourceLimits.maxImportedBytes}) for "${c.id}".`),R();t.importCount+=1,t.importedBytes+=c.source.length,t.importStack.push(c.id);let m=s(c.source,c.id,t);t.importStack.pop();let d=R();return In(d,m,n,r),d}function et(e,r,n){let t=r+1,i=null,s=0,o=0,l=n;for(;t<e.length;){let a=e[t],u=t>r?e[t-1]:"";if(a===`
12
+ `&&(l+=1),i){a===i&&u!=="\\"&&(i=null),t+=1;continue}if(a==="'"||a==='"'){i=a,t+=1;continue}if(a==="("?s+=1:a===")"&&s>0?s-=1:a==="["?o+=1:a==="]"&&o>0&&(o-=1),a==="{"&&s===0&&o===0)return null;if(a===";"&&s===0&&o===0){let c=e.slice(r,t+1),p=Hs(c);return p?{name:p,statement:c,start:r,end:t+1,lineStart:n,lineEnd:l}:null}t+=1}return null}function Hs(e){let r=1;for(;r<e.length&&Qs(e[r]);)r+=1;let n=r;for(;r<e.length&&Xs(e[r]);)r+=1;return e.slice(n,r).toLowerCase()}function Qs(e){return e===" "||e===" "||e===`
13
+ `||e==="\r"||e==="\f"}function Xs(e){let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57?!0:e==="_"||e==="-"}var Gs=/\{/g,Js=/\}/g;function kr(e,r){let n=r==="{"?Gs:Js;n.lastIndex=0;let t=e.match(n);return t?t.length:0}function ie(e){let r=e.trim();return r.endsWith(";")?r:`${r};`}function rt(e){let r=e.trim(),n=r.indexOf(":");if(n===-1)return ie(r);let t=r.slice(0,n).trimEnd(),i=r.slice(n+1).trim(),s=i.length>0?`${t}: ${i}`:`${t}:`;return ie(s)}function nt(e,r=2){let n=" ".repeat(r);return e.split(`
14
+ `).map(t=>`${n}${t}`).join(`
15
+ `)}function wr(e){let r=[],n="",t=null,i=0,s=0,o=0;for(let a=0;a<e.length;a+=1){let u=e[a],c=a>0?e[a-1]:"";if(t){n+=u,u===t&&c!=="\\"&&(t=null);continue}if(u==="'"||u==='"'){t=u,n+=u;continue}if(u==="("?i+=1:u===")"&&i>0?i-=1:u==="{"?s+=1:u==="}"&&s>0?s-=1:u==="["?o+=1:u==="]"&&o>0&&(o-=1),u===","&&i===0&&s===0&&o===0){let p=n.trim();p.length>0&&r.push(p),n="";continue}n+=u}let l=n.trim();return l.length>0&&r.push(l),r}function Pr(e){if(e.length<2)return!1;let r=e[0],n=e[e.length-1];return r==="'"&&n==="'"||r==='"'&&n==='"'}function tt(e){let r=e.trim();if(Pr(r))return null;let n=Ys(r);return n||eo(r)}function it(e){let r=st(e);return r?!r.startSuffix||!r.endSuffix?!1:r.startSuffix!==r.endSuffix:!1}function Ys(e){let r=st(e);if(!r)return null;let{start:n,end:t,startSuffix:i,endSuffix:s}=r,o=n<=t?1:-1,l=i||s,a=[];for(let u=n;;u+=o){let c=ro(u,n,t,i,s,l);if(a.push(`${u}${c}`),u===t)break}return a}function st(e){let r=e.trim();if(Pr(r))return null;let n=r.match(/^(-?\d+)([a-zA-Z%]+)?\s*-\s*(-?\d+)([a-zA-Z%]+)?$/);if(!n)return null;let[,t,i="",s,o=""]=n;return{start:Number.parseInt(t,10),end:Number.parseInt(s,10),startSuffix:i,endSuffix:o}}function eo(e){let r=e.match(/^([A-Za-z])\s*-\s*([A-Za-z])$/);if(!r)return null;let[,n,t]=r,i=n.charCodeAt(0),s=t.charCodeAt(0),o=i<=s?1:-1,l=[];for(let a=i;l.push(String.fromCharCode(a)),a!==s;a+=o);return l}function ro(e,r,n,t,i,s){return e===r&&t?t:e===n&&i?i:s}function ot(e,r,n){var f;let t=e.lastIndexOf(`
16
+ `,r-1)+1,i=e.indexOf(`
17
+ `,n),s=i===-1?e.length:i,o=e.slice(t,s),l=o.trim(),a=r-t;if(!l||l.startsWith("@for")||l.startsWith("for(")||l.startsWith("@"))return!1;let u=no(o);if(u!==-1&&a<u)return!0;if(/^\s*[a-zA-Z_-][\w-]*\s*:/.test(o)||o.includes(";"))return!1;if(/^\s*([.#\[:&*>+~]|[a-zA-Z][\w-]*(?=[\s.#\[:&*>+~]|$))/.test(o))return!0;let c=o.slice(0,a).trimEnd(),p=(f=c[c.length-1])!=null?f:"";return p==="-"||p==="_"||p==="."}function no(e){for(let r=0;r<e.length;r+=1)if(e[r]==="{"&&e[r-1]!=="$")return r;return-1}function lt(e){return W(e.trim())}function W(e){if(e.length<2)return e;let r=e[0],n=e[e.length-1];return r==="'"&&n==="'"||r==='"'&&n==='"'?e.slice(1,-1):e}function A(e){let r=e.trim();return r.startsWith("[")&&r.endsWith("]")}function X(e){let r=e.trim();if(!A(r))return[];let n=r.slice(1,-1).trim();if(!n)return[];let t=wr(n);if(t.length===1){let i=tt(t[0]);if(i)return i}return t.map(i=>W(i))}function Ar(e){let r=e.trim();if(!A(r))return!1;let n=r.slice(1,-1).trim();if(!n)return!1;let t=wr(n);return t.length!==1?!1:it(t[0])}function Ir(e){return`[${e.join(", ")}]`}function at(e){let r=[],n=0,t=0,i="";for(let s=0;s<e.length;s+=1){let o=e[s];if(o==="("?n+=1:o===")"&&n>0?n-=1:o==="["?t+=1:o==="]"&&t>0&&(t-=1),o===";"&&n===0&&t===0){r.push(i),i="";continue}i+=o}return i.trim()&&r.push(i),r}function D(e,r,n){let t=e[r];if(!t)return;let i=[n,ye(n),to(n),n.toLowerCase(),ye(n).toLowerCase()];for(let o of i)if(Object.prototype.hasOwnProperty.call(t,o))return t[o];let s=n.toLowerCase();for(let[o,l]of Object.entries(t))if(o.toLowerCase()===s||ye(o).toLowerCase()===s)return l}function ye(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`)}function to(e){return e.replace(/-([a-z])/g,(r,n)=>n.toUpperCase())}var Er={maxForIterationsPerLoop:2e3,maxNestedLoopProduct:1e5,maxExpandedRules:5e4,maxOutputCssChars:3e6,maxObservedRules:5e3,maxObservedActiveRules:1e3,maxObservedRuleKeysPerToken:300,maxMutationBatchTokens:1500,maxObservedReevalPerTick:500,maxImportDepth:64,maxImportCount:2e3,maxImportedBytes:4e6};function ut(e){return e.resourcePolicy?e.resourcePolicy:e.debug?"fail-soft":"fail-closed"}function je(e){var r;return{...Er,...(r=e.resourceLimits)!=null?r:{}}}function se(e,r){return{code:"resource-limit",line:e,message:r}}function oe(e){throw new Error(`[LentyStyle][resource-limit] ${e}`)}function B(e){let r=[],n="",t=null,i=0,s=0,o=0;for(let l=0;l<e.length;l+=1){let a=e[l],u=l>0?e[l-1]:"";if(t){n+=a,a===t&&u!=="\\"&&(t=null);continue}if(a==="'"||a==='"'){t=a,n+=a;continue}if(a==="("?i+=1:a===")"&&i>0?i-=1:a==="{"?s+=1:a==="}"&&s>0?s-=1:a==="["?o+=1:a==="]"&&o>0&&(o-=1),a===","&&i===0&&s===0&&o===0){r.push(n),n="";continue}n+=a}return r.push(n),r}function h(e,r,n,t){let i=null,s=0;for(let o=r;o<e.length;o+=1){let l=e[o],a=o>0?e[o-1]:"";if(i){l===i&&a!=="\\"&&(i=null);continue}if(l==="'"||l==='"'){i=l;continue}if(l===n){s+=1;continue}else if(l===t&&(s-=1,s===0))return o}return-1}function y(e,r){let n=r;for(;n<e.length&&le(e[n]);)n+=1;return n}function ct(e){if(e.length===0)return!1;let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||r===95||r===45}function le(e){let r=e.charCodeAt(0);return r===32||r===9||r===10||r===13}function $r(e,r,n){let i=pt(e,r,n==="if"?["@if"]:["elseif","@elseif"]);if(!i)return null;let s=y(e,r+i.length);if(e[s]!=="(")return null;let o=h(e,s,"(",")");if(o===-1)return null;let l=e.slice(s+1,o).trim();if(s=y(e,o+1),e[s]!=="{")return null;let a=h(e,s,"{","}");return a===-1?null:{branch:{type:n,condition:l,body:e.slice(s+1,a)},endIndex:a+1}}function ft(e,r){let n=pt(e,r,["else","@else"]);if(!n)return null;let t=y(e,r+n.length);if(e[t]!=="{")return null;let i=h(e,t,"{","}");return i===-1?null:{branch:{type:"else",condition:"",body:e.slice(t+1,i)},endIndex:i+1}}function Wr(e,r){var i;if(e.slice(r,r+3)!=="@if")return!1;let n=r>0?e[r-1]:"",t=(i=e[r+3])!=null?i:"";return/[a-zA-Z0-9_-]/.test(n)?!1:!(!le(t)&&t!=="(")}function pt(e,r,n){var t;for(let i of n){if(e.slice(r,r+i.length)!==i)continue;let s=r>0?e[r-1]:"",o=(t=e[r+i.length])!=null?t:"";if(!/[a-zA-Z0-9_-]/.test(s)){if(!le(o)&&o!=="("&&o!=="{")continue;return i}}return null}function mt(e){let r=e.trim();return r.startsWith("(")&&r.endsWith(")")?io(r):jr(r)?{variableName:r}:null}function io(e){let r=e.slice(1,-1),n=B(r).map(s=>s.trim());if(n.length!==2)return null;let t=n[0],i=n[1];return jr(t)&&jr(i)?{variableName:t,indexVariableName:i}:null}function jr(e){return/^[a-zA-Z_][\w-]*$/.test(e)}function dt(e,r){for(let n=r;n<e.length;n+=1)if(ve(e,n)!==0)return n;return-1}function Me(e,r){let n=ve(e,r);if(n===0)return null;let t=r+n;if(t=y(e,t),e[t]!=="(")return null;let i=h(e,t,"(",")");if(i===-1)return null;let s=e.slice(t+1,i),o=B(s).map(u=>u.trim());if(o.length!==2)return null;let l=mt(o[0]);if(!l||(t=y(e,i+1),e[t]!=="{"))return null;let a=h(e,t,"{","}");return a===-1?null:{variableName:l.variableName,indexVariableName:l.indexVariableName,sourceExpression:o[1],body:e.slice(t+1,a),endIndex:a+1}}function Te(e,r,n){let t=e.trim(),i=t.match(/^var\(\s*(--[a-zA-Z_][\w-]*)(?:\s*\[\s*([^\]\s]+)\s*\])?\s*\)$/);if(i){let s=r[i[1]],o=n[i[1]];if(s&&typeof i[2]=="string"&&/^\d+$/.test(i[2])){let l=Number.parseInt(i[2],10),a=s[l];return typeof a=="string"?[a]:null}else return s&&typeof i[2]!="string"?s:o&&typeof i[2]!="string"?Object.keys(o):null}return A(t)?X(t):null}function ve(e,r){var l;let n=e.slice(r,r+4)==="@for",t=e.slice(r,r+3)==="for";if(!n&&!t)return 0;let i=n?4:3,s=r>0?e[r-1]:"",o=(l=e[r+i])!=null?l:"";return ct(s)||!le(o)&&o!=="("?0:i}function ae(e,r,n){e.resourcePolicy==="fail-closed"?oe(n):e.warnings.push(se(r,n))}function Ne(e,r){let n=1;for(let t=0;t<r;t+=1)e[t]===`
18
+ `&&(n+=1);return n}function gt(e,r){for(let n=r;n<e.length;n+=1){let t=e[n];if(t==="@"){if(Wr(e,n)||ve(e,n)>0)return n}else if(t==="f"&&ve(e,n)>0)return n}return-1}function bt(e){return/^[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*(?:\.[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*)*$/.test(e)}function Ce(e){return/[a-zA-Z_]/.test(e)}function Mr(e){return/[a-zA-Z0-9_]/.test(e)}function ht(e,r){return e[r]!=="$"||e[r+1]!=="{"?null:so(e,r)}function so(e,r){let n=oo(e,r);if(n===-1)return null;let t=e.slice(r+2,n).trim();if(!t)return null;let i=lo(t)?"key":"expression";return{key:t,mode:i,start:r,end:n+1,raw:e.slice(r,n+1)}}function oo(e,r){var i;let n=1,t=null;for(let s=r+2;s<e.length;s+=1){let o=e[s],l=(i=e[s-1])!=null?i:"";if(t){o===t&&l!=="\\"&&(t=null);continue}if(o==="'"||o==='"'){t=o;continue}if(o==="{")return-1;if(o==="}"&&(n-=1,n===0))return s}return-1}function lo(e){for(let r=0;r<e.length;r+=1){let n=e[r];if(n===" "||n===" "||n===`
19
+ `||n==="\r"||n==="\f"||n==="+"||n==="-"||n==="*"||n==="/"||n==="("||n===")"||n==="'"||n==='"')return!1}return bt(e)}function Lt(e,r){let n=ao(e,r);return`Invalid .luis syntax at line ${vt(e,r)}: plain loop placeholder "${n}" is not supported. Use braced form like "\${i}" or "\${bp.name}".`}function xt(e,r){let n=uo(e,r);return`Invalid .luis syntax at line ${vt(e,r)}: malformed loop placeholder "${n}" is not supported. Use balanced braced form like "\${i}" or "\${bp.name}".`}function yt(e){return`Invalid .luis syntax: loop placeholder "${e}" could not be resolved. Use valid forms like "\${i}" or "\${bp.name}".`}function ao(e,r){let n=r+1;for(;n<e.length;){let t=e[n];if(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||t==="_"||t==="."||t==="-"){n+=1;continue}break}return e.slice(r,n)}function uo(e,r){let n=r+1;for(;n<e.length;){let t=e[n];if(t===`
20
+ `||t==="\r"||t===";")break;n+=1}return e.slice(r,n).trim()}function vt(e,r){let n=1;for(let t=0;t<r;t+=1)e[t]===`
21
+ `&&(n+=1);return n}function G(e){return e.kind==="number"?`${co(e.value)}${e.unit}`:e.value}function Tr(e,r){return!e&&!r?"":e&&!r?e:!e&&r?r:e===r?e:null}function Ct(e,r){return r?e===r?"":null:e}function co(e){let r=Number.parseFloat(e.toFixed(6));return Number.isInteger(r),String(r)}function z(e){let r=W(e.trim()),n=Nr(r);return n||{kind:"string",value:r}}function Nr(e){let r=e[0]==="-"?1:0,n=!1,t=!1;for(;r<e.length;){let s=e[r];if(s>="0"&&s<="9"){n=!0,r+=1;continue}if(s==="."&&!t){t=!0,r+=1;continue}break}if(!n)return null;let i=Number.parseFloat(e.slice(0,r));return Number.isNaN(i)?null:{kind:"number",value:i,unit:e.slice(r)}}function J(e,r){let n=Fr(e,r);return n?{value:fo(n.value),end:n.end}:null}function Fr(e,r){var s;if(e.slice(r,r+4)!=="var(")return null;let n=ue(e,r+4);if(e[n]!=="-"||e[n+1]!=="-")return null;let t=n;if(n+=2,!Fe((s=e[n])!=null?s:""))return null;for(n+=1;n<e.length&&ho(e[n]);)n+=1;let i={variableName:e.slice(t,n),accessKey:null,objectKey:null};if(n=ue(e,n),e[n]==="["){let o=po(e,n);if(!o)return null;i.accessKey=o.value,n=o.end}if(n=ue(e,n),e[n]==="."){let o=mo(e,n+1);if(!o)return null;i.objectKey=o.value,n=o.end}return n=ue(e,n),e[n]!==")"?null:{value:i,end:n+1}}function fo(e){let r=e.accessKey===null?"":`[${e.accessKey}]`,n=e.objectKey===null?"":`.${e.objectKey}`;return`var(${e.variableName}${r}${n})`}function po(e,r){var i;let n=ue(e,r+1);if(!go((i=e[n])!=null?i:""))return null;let t=n;for(n+=1;n<e.length&&bo(e[n]);)n+=1;return n=ue(e,n),e[n]!=="]"?null:{value:e.slice(t,n),end:n+1}}function mo(e,r){var t;if(!Fe((t=e[r])!=null?t:""))return null;let n=r+1;for(;n<e.length&&Dr(e[n]);)n+=1;return{value:e.slice(r,n),end:n}}function Rt(e,r){return e===null?null:/^\d+$/.test(e)?e:e in r?W(r[e].trim()):e}function ue(e,r){let n=r;for(;e[n]===" "||e[n]===" "||e[n]===`
22
+ `||e[n]==="\r"||e[n]==="\f";)n+=1;return n}function go(e){return Fe(e)||St(e)}function bo(e){return Dr(e)||e==="-"}function ho(e){return Dr(e)||e==="-"}function Fe(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function Dr(e){return Fe(e)||St(e)}function St(e){return e>="0"&&e<="9"}function Y(e,r){let n=r.trim(),t=Vt(n),i=Lo(n),s=[n,t,i,n.toLowerCase(),t.toLowerCase()];for(let l of s)if(l in e)return e[l];let o=n.toLowerCase();for(let[l,a]of Object.entries(e))if(l.toLowerCase()===o||Vt(l).toLowerCase()===o)return a}function Vt(e){if(e.startsWith("--"))return e;let r="";for(let n=0;n<e.length;n+=1){let t=e[n];if(t>="A"&&t<="Z"){r+=`-${t.toLowerCase()}`;continue}r+=t}return r}function Lo(e){let r="";for(let n=0;n<e.length;n+=1){let t=e[n];if(t==="-"&&n+1<e.length){let i=e[n+1];if(i>="a"&&i<="z"){r+=i.toUpperCase(),n+=1;continue}}r+=t}return r}function Ot(e,r,n,t,i){if(e.accessKey===null&&e.objectKey===null){let a=t[e.variableName];return typeof a=="string"?z(a):null}else if(e.accessKey===null){let a=D(i,e.variableName,e.objectKey);return typeof a=="string"?z(a):null}let s=Rt(e.accessKey,r);if(s===null)return null;let o=n[e.variableName];if(o)return xo(o,s,e.objectKey,i);if(e.objectKey!==null)return null;let l=D(i,e.variableName,s);return typeof l=="string"?z(l):null}function xo(e,r,n,t){if(!/^\d+$/.test(r))return null;let i=e[Number.parseInt(r,10)];if(typeof i!="string")return null;if(n===null)return z(i);if(!S(i))return null;let s=P(i,t),o=Y(s,n);return typeof o=="string"?z(o):null}function kt(e,r,n,t,i){let s=Fr(e,0);return!s||s.end!==e.length?null:Ot(s.value,r,n,t,i)}function wt(e,r,n,t,i){return e.kind==="string"?{kind:"string",value:e.value}:e.kind==="number"?Nr(e.value):e.kind==="var-call"?kt(e.value,r,n,t,i):e.kind==="identifier"&&e.value in r?z(r[e.value]):null}function Br(e,r,n){if(r==="plus")return yo(e,n);if(r==="minus")return vo(e,n);if(e.kind!=="number"||n.kind!=="number")return null;if(r==="star")return Co(e,n);if(n.value===0)return null;let t=Ct(e.unit,n.unit);return t===null?null:{kind:"number",value:e.value/n.value,unit:t}}function yo(e,r){if(e.kind==="number"&&r.kind==="number"){let n=Tr(e.unit,r.unit);return n===null?null:{kind:"number",value:e.value+r.value,unit:n}}return{kind:"string",value:`${G(e)}${G(r)}`}}function vo(e,r){if(e.kind==="number"&&r.kind==="number"){let n=Tr(e.unit,r.unit);return n===null?null:{kind:"number",value:e.value-r.value,unit:n}}return{kind:"string",value:`${G(e)}-${G(r)}`}}function Co(e,r){let n=e.unit?!r.unit||e.unit===r.unit?e.unit:"":r.unit;return{kind:"number",value:e.value*r.value,unit:n}}function At(e){return It(e)}function It(e){let r=Pt(e);if(!r)return null;for(;;){let n=Re(e);if(!n||n.kind!=="plus"&&n.kind!=="minus")break;e.index+=1;let t=Pt(e);if(!t||(r=Br(r,n.kind,t),!r))return null}return r}function Pt(e){let r=zr(e);if(!r)return null;for(;;){let n=Re(e);if(!n||n.kind!=="star"&&n.kind!=="slash")break;e.index+=1;let t=zr(e);if(!t||(r=Br(r,n.kind,t),!r))return null}return r}function zr(e){let r=Re(e);if(!r||r.kind!=="plus"&&r.kind!=="minus")return Ro(e);e.index+=1;let n=zr(e);return!n||n.kind!=="number"?null:r.kind==="minus"?{kind:"number",value:-n.value,unit:n.unit}:n}function Ro(e){var n;let r=Re(e);if(!r)return null;if(r.kind==="paren-open"){e.index+=1;let t=It(e);return!t||((n=Re(e))==null?void 0:n.kind)!=="paren-close"?null:(e.index+=1,t)}return e.index+=1,wt(r,e.scope,e.arrays,e.variables,e.objectVariables)}function Re(e){var r;return(r=e.tokens[e.index])!=null?r:null}function Et(e){switch(e){case"+":return{kind:"plus",value:"+"};case"-":return{kind:"minus",value:"-"};case"*":return{kind:"star",value:"*"};case"/":return{kind:"slash",value:"/"};case"(":return{kind:"paren-open",value:"("};default:return{kind:"paren-close",value:")"}}}function $t(e,r,n){var i;let t="";for(let s=r+1;s<e.length;s+=1){let o=e[s],l=(i=e[s-1])!=null?i:"";if(o===n&&l!=="\\")return{value:t,end:s+1};t+=o}return null}function Wt(e,r){let n=r,t=!1;for(;n<e.length;){let i=e[n];if(Se(i)){n+=1;continue}if(i==="."&&!t){t=!0,n+=1;continue}break}for(;n<e.length&&Vo(e[n]);)n+=1;return{value:e.slice(r,n),end:n}}function jt(e,r){var t;let n=r+1;for(;n<e.length;){let i=e[n],s=(t=e[n+1])!=null?t:"";if(So(i)){n+=1;continue}if(i==="."&&De(s)){n+=1;continue}break}return{value:e.slice(r,n),end:n}}function Mt(e){return e===" "||e===" "||e===`
23
+ `||e==="\r"||e==="\f"}function Se(e){return e>="0"&&e<="9"}function De(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function So(e){return De(e)||Se(e)}function Vo(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="%"}function Ve(e){var t;let r=[],n=0;for(;n<e.length;){let i=e[n],s=(t=e[n+1])!=null?t:"";if(Mt(i)){n+=1;continue}if(i==="$")throw new Error("Invalid .luis syntax: nested or legacy `$...` usage inside `${...}` is not supported. Use plain identifiers like `${i + j}`.");if(i==="+"||i==="-"||i==="*"||i==="/"||i==="("||i===")"){r.push(Et(i)),n+=1;continue}if(i==="'"||i==='"'){let o=$t(e,n,i);if(!o)return null;r.push({kind:"string",value:o.value}),n=o.end;continue}if(Se(i)||i==="."&&Se(s)){let o=Wt(e,n);r.push({kind:"number",value:o.value}),n=o.end;continue}if(i==="v"){let o=J(e,n);if(o){r.push({kind:"var-call",value:o.value}),n=o.end;continue}}if(De(i)){let o=jt(e,n);r.push({kind:"identifier",value:o.value}),n=o.end;continue}return null}return r}function Tt(e,r,n={},t={},i={}){let s=Ve(e);if(!s||s.length===0)return null;let o={index:0,tokens:s,scope:r,arrays:i,variables:n,objectVariables:t},l=At(o);return!l||o.index!==o.tokens.length?null:G(l)}function _(e,r,n={},t={},i={}){return Tt(e,r,n,t,i)}function Nt(e,r,n,t,i){return e.mode==="key"?e.key in r?r[e.key]:null:_(e.key,r,t,i,n)}function Z(e,r,n,t,i){if(!e.includes("$"))return e;let s=[],o=0;for(let l=0;l<e.length;l+=1){if(e[l]!=="$")continue;if(Oo(e,l))throw new Error(Lt(e,l));let u=ht(e,l);if(!u){if(e[l+1]==="{")throw new Error(xt(e,l));continue}let c=ot(e,u.start,u.end),p=Nt(u,r,n,t,i);if(p===null)throw new Error(yt(u.raw));l>o&&s.push(e.slice(o,l)),c?s.push(lt(p)):s.push(p),l=u.end-1,o=u.end}return o===0?e:(o<e.length&&s.push(e.slice(o)),s.join(""))}function Oo(e,r){var t;let n=(t=e[r+1])!=null?t:"";return n!=="{"&&Ce(n)}function Be(e,r,n,t,i){let s={...e,[r]:n};i&&(s[i]=String(t));let o=n.trim();if(!S(o))return s;let l=P(o);for(let[a,u]of Object.entries(l))s[`${r}.${a}`]=u;return s}function Dt(e,r){return e.includes("for")?Bt(e,r,{},1):e}function Bt(e,r,n,t){let i=0,s="";for(;i<e.length;){let o=dt(e,i);if(o===-1){s+=Ft(e.slice(i),n,r);break}s+=Ft(e.slice(i,o),n,r);let l=Me(e,o);if(!l){s+=e[o],i=o+1;continue}let a=Z(l.sourceExpression,n,r.arrays,r.variables,r.objectVariables),u=Te(a,r.arrays,r.objectVariables);if(!u){s+=e.slice(o,l.endIndex),i=l.endIndex;continue}let c=ko(e,o,r.lineOffset);if(u.length>r.resourceLimits.maxForIterationsPerLoop){ae(r,c,`Loop iteration budget exceeded (${u.length}/${r.resourceLimits.maxForIterationsPerLoop}) in ${r.sourceId}.`),i=l.endIndex;continue}let p=t*u.length;if(p>r.resourceLimits.maxNestedLoopProduct){ae(r,c,`Nested loop product exceeded (${p}/${r.resourceLimits.maxNestedLoopProduct}) in ${r.sourceId}.`),i=l.endIndex;continue}for(let f=0;f<u.length;f+=1){let m=u[f],d=Be(n,l.variableName,m,f,l.indexVariableName);s+=Bt(l.body,r,d,p)}i=l.endIndex}return s}function Ft(e,r,n){return e.includes("$")?Z(e,r,n.arrays,n.variables,n.objectVariables):e}function ko(e,r,n=1){return n+Ne(e,r)-1}function U(e,r){let n=r;for(;n<e.length&&ze(e[n]);)n+=1;return n}function ee(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function ce(e){return ee(e)||e>="0"&&e<="9"||e==="-"}function zt(e){return ee(e)||e==="-"}function _t(e){return ce(e)}function ze(e){return e===" "||e===" "||e===`
24
+ `||e==="\r"}function Zt(e){return e.length>0&&ze(e[0])}function _e(e){return e>="0"&&e<="9"}function re(e,r){var l,a,u;if(!e.startsWith("var(",r))return null;let n=r+4;if(n=U(e,n),e[n]!=="-"||e[n+1]!=="-"||(n+=2,!ee((l=e[n])!=null?l:"")))return null;let t=n;for(n+=1;n<e.length&&ce(e[n]);)n+=1;let i=`--${e.slice(t,n)}`,s=null;if(e[n]==="["){if(n+=1,n=U(e,n),!_e((a=e[n])!=null?a:""))return null;let c=n;for(n+=1;n<e.length&&_e(e[n]);)n+=1;if(n=U(e,n),e[n]!=="]")return null;s=Number.parseInt(e.slice(c,n),10),n+=1}let o=null;if(e[n]==="."){if(n+=1,!wo((u=e[n])!=null?u:""))return null;let c=n;for(n+=1;n<e.length&&ce(e[n]);)n+=1;o=e.slice(c,n)}if(n=U(e,n),e[n]!==")")return null;{let c=n+1;return{start:r,end:c,raw:e.slice(r,c),variableName:i,objectKey:o,arrayIndex:s}}}function wo(e){return ee(e)||_e(e)}function Ut(e,r){if(e[r]!=="&")return null;{let n=r+1;return{startIndex:r,nextIndex:n}}}function Ze(e,r,n,t,i=0){var o;let s="";for(let l=0;l<e.length;l+=1){let a=re(e,l);if(!a){s+=e[l];continue}let u=Po(a.variableName,a.objectKey,a.arrayIndex,r,n,t);s+=(o=Io(u,r,n,t,i))!=null?o:a.raw,l=a.end-1}return s}function Po(e,r,n,t,i,s){return n!==null?Ao(e,r,n,t,i,s):r?D(t,e,r):void 0}function Ao(e,r,n,t,i,s){var l;let o=(l=i[e])==null?void 0:l[n];if(typeof o=="string")if(r)if(Eo(o)){let a=s(o,t);return D({"--item":a},"--item",r)}else return;else return o}function Io(e,r,n,t,i){return!e||!e.includes("var(")||i>=4?e:Ze(e,r,n,t,i+1)}function Eo(e){let r=e.trim();return r.startsWith("{")&&r.endsWith("}")}function Kt(e){let r=e.trim();if(!r.startsWith("var("))return null;let n=r.match(/^var\(\s*(--[a-zA-Z_][\w-]*)\s*\)$/);return n?n[1]:null}function qt(e){let r=e.trim().toLowerCase();return r==="__proto__"||r==="prototype"||r==="constructor"}function S(e){let r=e.trim();return r.startsWith("{")&&r.endsWith("}")}function P(e,r={},n){let i=e.trim().slice(1,-1).trim(),s=Object.create(null);if(!i)return s;let o=n?Dt(i,n):i,l=at(o);for(let a of l){let u=a.trim();if(!u)continue;let c=u.indexOf(":");if(c===-1){let m=Kt(u);if(!m)continue;let d=r[m];if(d){for(let[g,b]of Object.entries(d))s[g]=b;continue}else continue}let p=u.slice(0,c).trim(),f=u.slice(c+1).trim();if(!(!p||!f)){if(qt(p))continue;s[p]=W(f)}}return s}function _r(e,r,n={}){let t=e.trim();if(!t)return[];let i=t.match(/^var\(\s*(--[a-zA-Z_][\w-]*)\s*\)$/);if(i){let s=i[1],o=r[s];return o?Object.entries(o).map(([l,a])=>`${ye(l)}: ${Ze(a,r,n,P)}`):[t]}else return[Ze(t,r,n,P)]}function Ue(e){return S(e)||A(e)?!1:e.includes("{")&&e.includes("}")}function Ke(e){let r=[],n="";for(let t=0;t<e.length;t+=1){let i=e[t];if(i===`
25
+ `){r.push(n),n="";continue}else if(i==="\r"){r.push(n),n="",e[t+1]===`
26
+ `&&(t+=1);continue}n+=i}return r.push(n),r}function fe(e){let r=[],n="",t=null,i=0,s=0,o=0;for(let l=0;l<e.length;l+=1){let a=e[l],u=l>0?e[l-1]:"";if(t){n+=a,a===t&&u!=="\\"&&(t=null);continue}if(a==="'"||a==='"'){t=a,n+=a;continue}if(a==="("?i+=1:a===")"&&i>0?i-=1:a==="{"?s+=1:a==="}"&&s>0?s-=1:a==="["?o+=1:a==="]"&&o>0&&(o-=1),a===";"&&i===0&&s===0&&o===0){r.push({text:n,hasTerminator:!0}),n="";continue}n+=a}return r.push({text:n,hasTerminator:!1}),r}function qe(e){let r=e.match(/^\s*([^{}]+?)\s*\{([\s\S]*)\}\s*;?\s*$/);if(!r)return null;let[,n,t]=r;return{selector:n.trim(),body:t}}function Oe(e,r){let n=e.trim(),t=r.trim();return t.startsWith("&")?t.replace(/&/g,n):t.startsWith(":")||t.startsWith("::")||t.startsWith("[")||t.startsWith(".")||t.startsWith("#")?`${n}${t}`:`${n} ${t}`}function Ht(e){return $o(e)||Wo(e)}function $o(e){var n;let r=0;if(e[r]!=="-"||e[r+1]!=="-"||(r+=2,!ee((n=e[r])!=null?n:"")))return!1;for(r+=1;r<e.length&&ce(e[r]);)r+=1;return r=U(e,r),e[r]===":"}function Wo(e){var t;let r=0,n=(t=e[r])!=null?t:"";if(!zt(n))return!1;for(r+=1;r<e.length&&_t(e[r]);)r+=1;return r=U(e,r),e[r]===":"}function pe(e,r){let n=re(e,r);if(n)return{tokenStart:r,raw:n.raw,hasAmpersandPrefix:!1,reference:n};if(e[r]!=="&")return null;let t=re(e,r+1);return t?{tokenStart:r,raw:e.slice(r,t.end),hasAmpersandPrefix:!0,reference:t}:null}function Zr(e,r){let n="",t=0;for(;t<e.length;){let i=pe(e,t);if(!i){n+=e[t],t+=1;continue}let s=i.reference.objectKey||i.reference.arrayIndex!==null?void 0:r[i.reference.variableName];if(s)n+=i.hasAmpersandPrefix?`&${s}`:s,t=i.reference.end;else{n+=i.raw,t=i.reference.end;continue}}return n}function Qt(e,r){let n=r.classVariables[e];return n?qe(n):null}function Ur(e,r){let n="";for(let t=0;t<e.length;t+=1){let i=pe(e,t);if(!i){n+=e[t];continue}let s=Kr(i.reference,r);n+=s!=null?s:i.raw,t=i.reference.end-1}return n}function Kr(e,r){var n;if(e.arrayIndex!==null){let t=(n=r.arrayVariables[e.variableName])==null?void 0:n[e.arrayIndex];return typeof t!="string"?void 0:e.objectKey?jo(t,e.objectKey,r):t}else if(e.objectKey){let t=r.objectVariables[e.variableName];return t?Y(t,e.objectKey):void 0}else return}function jo(e,r,n){if(!S(e))return;let t=P(e,n.objectVariables);return Y(t,r)}function me(e,r){let n="",t=0;for(;t<e.length;){let i=pe(e,t);if(!i){n+=e[t],t+=1;continue}let s=i.reference;if(s.objectKey||s.arrayIndex!==null){let a=Kr(s,r);n+=a!=null?a:i.raw,t=s.end;continue}let o=r.classVariables[s.variableName];if(o){let a=qe(o);if(a){n=i.hasAmpersandPrefix?Mo(n,a.selector.trim()):`${n}${a.selector.trim()}`,t=s.end;continue}}let l=r.variables[s.variableName];if(l){n+=l.trim(),t=s.end;continue}else n+=s.raw,t=s.end}return n}function Mo(e,r){let n=e.trim();return n?Oe(n,r):r}function qr(e,r){let n=e.trim(),t=r.trim();return t?n?Zt(r)?`${n} ${t}`:`${n}${t}`:t:n}function Xt(e,r,n){let t=e.trim();return t?ze(n)?`${t} ${r}`:Oe(t,r):r}function Hr(e,r){let n=e.trim();if(!n||Ht(n))return null;let t=To(n,r.classVariables);if(t.length===0)return null;let i="",s="",o=0;for(let u=0;u<t.length;u+=1){let c=t[u],p=me(n.slice(o,c.start),r);i=qr(i,p);let f=me(c.rule.selector,r).trim();if(!f)return null;if(c.hasAmpersandPrefix){let m=i.trim();if(m)i=Oe(m,f);else return null}else{let m=c.start>0?n[c.start-1]:"";i=Xt(i,f,m)}s=c.rule.body.trim(),o=c.end}let l=me(n.slice(o),r);i=qr(i,l);let a=i.trim();return!a||!s?null:`${a} { ${s} }`}function To(e,r){let n=[],t=0;for(;t<e.length;){let i=Ut(e,t),s=i?i.nextIndex:t,o=re(e,s);if(!o||o.objectKey||o.arrayIndex!==null){t+=1;continue}if(!r[o.variableName]){t=o.end;continue}let a=Qt(o.variableName,{classVariables:r,variables:{},objectVariables:{},arrayVariables:{}});if(!a){t=o.end;continue}let u=i?i.startIndex:o.start;n.push({start:u,end:o.end,hasAmpersandPrefix:!!i,rule:a}),t=o.end}return n}function Gt(e,r){let n="",t="",i=null,s=!1;for(let o=0;o<e.length;o+=1){let l=e[o];if(i){t+=l,s?s=!1:l==="\\"?s=!0:l===i&&(i=null);continue}if(l==="'"||l==='"'){i=l,t+=l;continue}if(l==="{"){n+=No(t,r),n+="{",t="";continue}else if(l===";"||l==="}"){n+=t,n+=l,t="";continue}t+=l}return n+=t,n}function No(e,r){let n=e.trim();return!n||n.startsWith("@")||!e.includes("var(")?e:me(e,r)}function He(e,r){if(!e.includes("var("))return e;let n=Ke(e),t=[];for(let s of n)t.push(Fo(s,r));let i=t.join(`
27
+ `);return Gt(i,r)}function Fo(e,r){if(!e.includes("var("))return e;if(!e.includes(";")){let s=Hr(e,r);return s||Ur(Zr(e,r.classVariables),r)}let n=fe(e),t=[],i=!1;for(let s of n){let o=Hr(s.text,r);if(o){t.push(o),i=!0;continue}let l=Ur(Zr(s.text,r.classVariables),r);l!==s.text&&(i=!0);let a=s.hasTerminator?";":"";t.push(`${l}${a}`)}return i?t.join(`
28
+ `):e}function Do(e,r,n,t,i,s,o,l,a,u="<inline>",c="fail-closed",p){Bo(r)||(S(r)?i[e]=P(r,i,p?{variables:n,arrays:s,objectVariables:i,sourceId:`${u}::${e}`,resourcePolicy:c,resourceLimits:p,warnings:o,lineOffset:a}:void 0):A(r)?(l&&Ar(r)&&o.push(zo(e,a,r)),s[e]=X(r)):Ue(r)?t[e]=r:n[e]=r)}function Qe(e,r,n,t,i,s,o,l="<inline>",a="fail-closed",u){var c;for(let p of e)Do(p.name,p.value,r,n,t,i,s,o,(c=p.line)!=null?c:1,l,a,u)}function Bo(e){try{return!!($(e)||!S(e)&&!Ue(e)&&!A(e)&&(e.includes("{")||e.includes("}")))}catch(r){return w("containsUnsafeVariablePayload",r)}}function zo(e,r,n){return{code:"invalid-array-range-unit",line:r,message:`Array range "${e}" uses mismatched units in "${n}". Prefer same-unit ranges like [1px-12px] or [1rem-12rem].`}}var Jt=/(^|[^a-zA-Z0-9_-]):root\b/;function de(e){return e.trimStart().startsWith("--")}function Yt(e){return/^[}\s]*$/.test(e)}function ei(e,r,n){return n||r!==0?!1:Jt.test(e)&&e.includes("{")}function ri(e){let r=e.indexOf("{");return r===-1?{prefix:e,inline:""}:{prefix:e.slice(0,r+1),inline:e.slice(r+1)}}function ni(e,r,n,t){return!n&&r===0&&Jt.test(e)&&t>0}var _o=/^--[a-zA-Z_][\w-]*$/;function Xe(e){let r=[],n=e.trim();for(;de(n);){let t=Zo(n);if(!t)break;r.push({name:t.name,value:t.value}),n=t.remainder.trimStart()}return{declarations:r,remainder:n}}function Zo(e){let r=e.indexOf(":");if(r<=2)return null;let n=e.slice(0,r).trim();if(!_o.test(n))return null;let t=0,i=0,s=0,o=null,l=-1;for(let p=r+1;p<e.length;p+=1){let f=e[p],m=p>r+1?e[p-1]:"";if(o){f===o&&m!=="\\"&&(o=null);continue}if(f==="'"||f==='"'){o=f;continue}if(f==="("?t+=1:f===")"&&t>0?t-=1:f==="["?i+=1:f==="]"&&i>0?i-=1:f==="{"?s+=1:f==="}"&&s>0&&(s-=1),f===";"&&t===0&&i===0&&s===0){l=p;break}}if(l===-1){if(o||t>0||i>0||s>0)return null;l=e.length}let a=e.slice(r+1,l).trim();if(!a)return null;let c=l<e.length&&e[l]===";"?l+1:l;return{name:n,value:a,remainder:e.slice(c)}}function ne(e,r=!0,n){var $e,be;if(!e.includes("--")&&!e.includes(":root"))return{cleanSource:e,variables:{},classVariables:{},objectVariables:{},arrayVariables:{},warnings:[]};let t={},i={},s={},o={},l=[],a=[],u=e.split(/\r?\n/),c=0,p=!1,f=0,m=null,d=($e=n==null?void 0:n.sourceId)!=null?$e:"<inline>",g=(be=n==null?void 0:n.resourcePolicy)!=null?be:"fail-closed",b=n==null?void 0:n.resourceLimits;for(let I=0;I<u.length;I+=1){let L=u[I],k=L.trim(),M=I+1;if(m){m.source=`${m.source}
29
+ ${k}`;let C=Xe(m.source),v=C.remainder.trimStart();C.declarations.length>0&&Yt(v)&&(Qe(Qr(C.declarations,m.line),t,i,s,o,l,r,d,g,b),v.length>0&&(a.push(v),O(v)),m=null);continue}if(ei(k,c,p)){let C=ri(L);C.prefix.trim().length>0&&(a.push(C.prefix),O(C.prefix));let v=C.inline.trimStart();if(!v)continue;let he=Xe(v),N=he.remainder.trimStart();if(he.declarations.length>0&&Qe(Qr(he.declarations,M),t,i,s,o,l,r,d,g,b),de(N)){m={source:N,line:M};continue}else N.length>0&&(a.push(N),O(N));continue}if((c===0||p)&&de(k)){let C=Xe(k),v=C.remainder.trimStart();if(C.declarations.length>0&&Qe(Qr(C.declarations,M),t,i,s,o,l,r,d,g,b),de(v)){m={source:v,line:M};continue}else v.length>0&&(a.push(v),O(v));continue}a.push(L),O(L)}return m&&a.push(m.source),{cleanSource:a.join(`
30
+ `),variables:t,classVariables:i,objectVariables:s,arrayVariables:o,warnings:l};function O(I){let L=kr(I,"{"),k=kr(I,"}"),M=I.trim();ni(M,c,p,L)?(p=!0,f=L-k):p&&(f+=L-k),p&&f<=0&&(p=!1,f=0),c+=L-k,c=Math.max(c,0)}}function Qr(e,r){return e.map(n=>{var t;return{...n,line:(t=n.line)!=null?t:r}})}function ti(e,r,n,t){let i=ne(e),s=Uo(i);for(let o of s){let l=n.get(o);l&&l!==r&&t.push({code:"duplicate-import-variable",line:1,message:`[${r}] Variable "${o}" duplicates declaration from "${l}".`}),l||n.set(o,r)}}function Uo(e){return[...Object.keys(e.variables),...Object.keys(e.classVariables),...Object.keys(e.objectVariables),...Object.keys(e.arrayVariables)]}function Xr(e,r,n){var p;ti(e,r,n.variableOwners,n.warnings);let t=Dn(),i=R(),s=0,o=1,l=0,a=null,u=!1,c=!1;for(;s<e.length;){let f=e[s],m=(p=e[s+1])!=null?p:"",d=s>0?e[s-1]:"";if(f===`
31
+ `&&(o+=1),u){f===`
32
+ `&&(u=!1),x(i,f,r,o),s+=1;continue}if(c){if(f==="*"&&m==="/"){c=!1,x(i,"*",r,o),x(i,"/",r,o),s+=2;continue}x(i,f,r,o),s+=1;continue}if(a){f===a&&d!=="\\"&&(a=null),x(i,f,r,o),s+=1;continue}if(f==="'"||f==='"'){a=f,x(i,f,r,o),s+=1;continue}if(f==="/"&&m==="*"){c=!0,x(i,"/",r,o),x(i,"*",r,o),s+=2;continue}else if(f==="/"&&m==="/"){u=!0,x(i,"/",r,o),x(i,"/",r,o),s+=2;continue}if(f==="{"){l+=1,Q(t),x(i,f,r,o),s+=1;continue}else if(f==="}"){l=Math.max(0,l-1),x(i,f,r,o),s+=1;continue}if(l===0&&f==="@"){let g=et(e,s,o);if(!g){Q(t),x(i,f,r,o),s+=1;continue}let b=Yn(g.statement,g.lineStart,r,n,t,Xr);Cr(i,b),s=g.end,o=g.lineEnd;continue}l===0&&!Rr(f)&&Q(t),x(i,f,r,o),s+=1}return i}function ii(e,r){let n=$n(r.sourceId,"<inline>");if(!e.includes("@import")&&!e.includes("@char")&&!e.includes("@charset")&&!e.includes("@layer"))return{...E(e,n),warnings:[]};let t={options:r,warnings:[],variableOwners:new Map,importStack:[n],importCount:0,importedBytes:0,resourceLimits:je(r)};return{...Xr(e,n,t),warnings:t.warnings}}function si(e,r){return ii(e,r)}function Je(e){let r=[],n="",t=0,i=0,s=null;for(let o=0;o<e.length;o+=1){let l=e[o],a=o>0?e[o-1]:"";if(s){l===s&&a!=="\\"&&(s=null),n+=l;continue}else l==='"'||l==="'"?s=l:l==="("?t+=1:l===")"&&t>0?t-=1:l==="["?i+=1:l==="]"&&i>0&&(i-=1);if(l===","&&t===0&&i===0){r.push(n),n="";continue}n+=l}return n.length>0&&r.push(n),r}function oi(e){return e.map(r=>r.trim()).filter(Boolean).join(", ")}function Ge(e){return e.trim().replace(/\s*([>+~])\s*/g,"$1").replace(/\s+/g," ")}function li(e,r){let n=Ge(e),t=Ge(r);if(n===t)return!0;if(!n.startsWith(t))return!1;let i=n[t.length];return Ko(i)}function Ko(e){return e?e===" "||e===">"||e==="+"||e==="~"||e==="."||e==="#"||e===":"||e==="[":!0}function qo(e){return e.endsWith("?!")?{g:"initial",b:2}:e.endsWith("?")?{g:"dynamic",b:1}:null}function Gr(e){let r=e.trim(),n=qo(r);if(!n)return{selector:r,observedMode:"none",hasMarker:!1,markerValid:!1};let t=r.length-n.b,i=r[t-1];if(!i||/\s/.test(i))return{selector:r,observedMode:"none",hasMarker:!0,markerValid:!1};let s=r.slice(0,t);return Ho(s)?{selector:s,observedMode:n.g,hasMarker:!0,markerValid:!0}:{selector:r,observedMode:"none",hasMarker:!0,markerValid:!1}}function Ye(e){return Je(e).map(r=>Gr(r))}function Jr(e){return oi(Ye(e).map(r=>r.selector))}function Ho(e){let r=e.trimEnd();if(!r)return!1;let n=r[r.length-1];return n!==">"&&n!=="+"&&n!=="~"&&n!==","}function ai(e){let r=Qo(e);return r?`Observed marker "?" or "?!" must be attached to the final selector tail. Descendant chains place the marker on the final target element, for example ".host .child?" not ".host? .child". Selector: "${r}".`:null}function Qo(e){for(let r of Je(e))if(Gr(r).observedMode==="none"&&Xo(r))return r.trim();return null}function Xo(e){let r=null,n=0;for(let t=0;t<e.length;t+=1){let i=e[t],s=t>0?e[t-1]:"";if(r){i===r&&s!=="\\"&&(r=null);continue}if(i==="["){n+=1;continue}else if(i==="]"&&n>0){n-=1;continue}else if(n>0&&(i==='"'||i==="'")){r=i;continue}if(i==="?"&&s!=="\\"&&n===0)return!0}return!1}function ui(e,r,n,t){let i=Ye(e);for(let s of i)s.observedMode!=="none"&&Go(s,r,n,t)}function ci(e,r,n){return Ye(e).map(i=>n?{selector:i.selector,observedMode:"none"}:i.observedMode!=="none"?{selector:i.selector,observedMode:i.observedMode}:i.hasMarker?{selector:i.selector,observedMode:"none"}:{selector:i.selector,observedMode:Jo(i.selector,r)})}function Go(e,r,n,t){let i=Ge(e.selector),s=r.get(i);s&&s!==e.observedMode&&t&&t.push({code:"invalid-observed-syntax",line:n,message:`Observed root "${e.selector}" was declared with both "${s}" and "${e.observedMode}" modes. The latest explicit marker is used for inherited selectors.`}),r.set(i,e.observedMode)}function Jo(e,r){let n="none",t=-1;for(let[i,s]of r)s!=="none"&&li(e,i)&&i.length>t&&(n=s,t=i.length);return n}function fi(e,r,n,t,i,s){var l;let o=Yo(e);for(let a of o){let u=s(a.selector,r,i);t.push({key:u,atRules:[...r],selector:a.selector,observedMode:a.observedMode,sourceLine:(l=n.line)!=null?l:1,declarations:[...n.declarations]})}}function Yo(e){let r=[];for(let n of e){let t=r[r.length-1];t&&t.observedMode===n.observedMode?t.selector=`${t.selector}, ${n.selector}`:r.push({selector:n.selector,observedMode:n.observedMode})}return r}function er(e,r){let n=[],t=new Map,i=el(e,r);for(let s of e.children)Yr(s,"",[],n,t,i,r);return n}function Yr(e,r,n,t,i,s,o){var f;if(e.type==="at-rule"){let m=[...n,e.value];for(let d of e.children)Yr(d,r,m,t,i,s,o);return}let l=pi(r,e.value);if(di(l))return;let a=mi(n),u=a?null:ai(l);o&&u&&o.push({code:"invalid-observed-syntax",line:(f=e.line)!=null?f:1,message:u});let c=ci(l,s,a),p=Jr(l);e.declarations.length>0&&fi(c,n,e,t,i,rl);for(let m of e.children)Yr(m,p,n,t,i,s,o)}function el(e,r){let n=new Map;for(let t of e.children)en(t,"",[],n,r);return n}function en(e,r,n,t,i){var a;if(e.type==="at-rule"){for(let u of e.children)en(u,r,[...n,e.value],t,i);return}let s=pi(r,e.value);!mi(n)&&!di(s)&&ui(s,t,(a=e.line)!=null?a:1,i);let l=Jr(s);for(let u of e.children)en(u,l,n,t,i)}function pi(e,r){return e?r.includes("&")?r.split("&").join(e):`${e} ${r}`:r}function rl(e,r,n){var o;let i=`${r.join("")}${e}`,s=(o=n.get(i))!=null?o:0;return n.set(i,s+1),`${i}${s}`}function mi(e){for(let r of e){let n=r.trim().toLowerCase();if(n.startsWith("@keyframes")||n.startsWith("@-webkit-keyframes"))return!0}return!1}function di(e){try{return $(e)}catch(r){return w("containsUnsafeSelectorPayload",r)}}function ke(e){return[`${e.selector} {`,...e.declarations.map(r=>` ${rt(r)}`),"}"].join(`
33
+ `)}function rr(e,r,n){let t=[],i=[];for(let s of e)t.push(ie(s));for(let s of r){let o=n==null?void 0:n.get(s.key);i.push({key:s.key,atRules:[...s.atRules],rule:o!=null?o:ke(s)})}return[...t,...nl(i)]}function nl(e){let r=[];for(let t of e){let i=t.atRules.join(""),s=r[r.length-1];if(s&&s.R===i){s.f.push(t.rule);continue}r.push({R:i,y:[...t.atRules],f:[t.rule]})}let n=[];for(let t of r){if(t.y.length===0){n.push(...t.f);continue}let i=t.f.join(`
34
+
35
+ `);n.push(tl(i,t.y))}return n}function tl(e,r){return r.reduceRight((n,t)=>`${t} {
36
+ ${nt(n)}
37
+ }`,e)}function gi(e){let r=0;for(let n of e)n.observedMode!=="none"&&(r+=1);return r}function bi(e){let r=[],n=[],t=[],i=[];for(let s of e){let o=ke(s),l={key:s.key,selector:s.selector,atRules:[...s.atRules],line:s.sourceLine,rule:o};s.observedMode==="none"?(r.push(s),n.push({...l,observedMode:"none"})):s.observedMode==="dynamic"?t.push(l):s.observedMode==="initial"&&(r.push(s),n.push({...l,observedMode:"initial"}),i.push(l))}return{regularLeaves:r,mainRules:n,observedRules:t,initialObservedRules:i}}function hi(e,r,n,t){return e==="vendor-fast"?!1:rn(r)||rn(n)?!0:!!rn(t)}function rn(e){for(let r in e)return!0;return!1}function V(e,r){let n=r;for(;n<e.length&&il(e[n]);)n+=1;return n}function K(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function te(e){return K(e)||e>="0"&&e<="9"||e==="-"}function Li(e){return K(e)||e==="-"}function xi(e){return te(e)}function il(e){return e===" "||e===" "||e===`
38
+ `||e==="\r"}function nr(e){let r=[],n="";for(let t=0;t<e.length;t+=1){let i=e[t];if(i===`
39
+ `){r.push(n),n="";continue}else if(i==="\r"){r.push(n),n="",e[t+1]===`
40
+ `&&(t+=1);continue}n+=i}return r.push(n),r}function vi(e){var a;let r="",n="",t=0,i=null,s=!1,o=!1,l=!1;for(;t<e.length;){let u=e[t],c=(a=e[t+1])!=null?a:"",p=t>0?e[t-1]:"";if(u===`
41
+ `){o||(r+=`${n}
42
+ `),n="",l=!1,o=!1,t+=1;continue}if(o){t+=1;continue}if(s){u==="*"&&c==="/"?(s=!1,t+=2):t+=1;continue}if(i){n+=u,u===i&&p!=="\\"&&(i=null),yi(u)||(l=!0),t+=1;continue}if(u==="'"||u==='"'){i=u,n+=u,l=!0,t+=1;continue}if(u==="/"&&c==="*"){s=!0,t+=2;continue}else if(u==="/"&&c==="/"&&!l){o=!0,t+=2;continue}n+=u,yi(u)||(l=!0),t+=1}return o||(r+=n),r}function yi(e){return e===" "||e===" "||e==="\r"||e==="\f"}function tr(e,r){var t,i,s;if(!e.startsWith("var(",r))return null;let n=r+4;if(n=V(e,n),e[n]!=="-"||e[n+1]!=="-"||(n+=2,!K((t=e[n])!=null?t:"")))return null;for(n+=1;n<e.length&&te(e[n]);)n+=1;if(n=V(e,n),e[n]==="["){if(n+=1,n=V(e,n),!Ci((i=e[n])!=null?i:""))return null;for(n+=1;n<e.length&&Ci(e[n]);)n+=1;if(n=V(e,n),e[n]!=="]")return null;n+=1,n=V(e,n)}if(e[n]==="."){if(n+=1,!K((s=e[n])!=null?s:""))return null;for(n+=1;n<e.length&&te(e[n]);)n+=1}if(n=V(e,n),e[n]!==")")return null;{let o=n+1;return{raw:e.slice(r,o),end:o}}}function Ci(e){return e>="0"&&e<="9"}function ir(e){let r=e.endsWith(";")?e.slice(0,-1).trimEnd():e,n=tr(r,0);return!!(n&&n.end===r.length)}function ge(e,r){return sr(e,r)||nn(e,r)}function sr(e,r){var t;let n=r;if(e[n]!=="-"||e[n+1]!=="-"||(n+=2,!K((t=e[n])!=null?t:"")))return!1;for(n+=1;n<e.length&&te(e[n]);)n+=1;return n=V(e,n),e[n]===":"}function nn(e,r){var i;let n=r,t=(i=e[n])!=null?i:"";if(!Li(t))return!1;for(n+=1;n<e.length&&xi(e[n]);)n+=1;return n=V(e,n),e[n]===":"}function Ri(e){var n;let r=0;if(e[r]!=="-"||e[r+1]!=="-"||(r+=2,!K((n=e[r])!=null?n:"")))return-1;for(r+=1;r<e.length&&te(e[r]);)r+=1;return r=V(e,r),e[r]===":"?r:-1}function Si(e){let r=nr(e),n=[];for(let t of r){let i=sl(t),s=ol(i);n.push(s)}return n.join(`
43
+ `)}function sl(e){var t;let r="",n=0;for(;n<e.length;){let i=tr(e,n);if(!i){r+=e[n],n+=1;continue}r+=i.raw;let s=i.end,o=V(e,s);((t=e[o])!=null?t:"")!==";"&&ge(e,o)&&(r+=";"),n=s}return r}function ol(e){let r=e.trim();return!ir(r)||r.endsWith(";")?e:`${e.trimEnd()};`}function Vi(e){var n;let r=0;for(;r<e.length;){let t=tr(e,r);if(!t){r+=1;continue}let i=V(e,t.end);if(((n=e[i])!=null?n:"")!==";"&&ge(e,i))return!0;r=t.end}return!1}function Oi(e,r){var s,o;let n=(o=(s=e[r])==null?void 0:s.trim())!=null?o:"";if(!n||!ge(n,0))return!1;let t=ll(e,r+1);if(t===-1)return!1;let i=e[t].trim();return!(!i||i.startsWith("}")||i==="{"||i.endsWith("{")||i.startsWith("@")||ge(i,0)||i.includes("&var(")||/^var\(\s*--/.test(i))}function ll(e,r){for(let n=r;n<e.length;n+=1)if(e[n].trim().length>0)return n;return-1}function wi(e){let r=[],n=nr(e);for(let t=0;t<n.length;t+=1){let i=n[t].trim();if(i&&!al(i)&&!cl(i)){if(Vi(i)){let s=ki(n,t);r.push({code:"missing-semicolon",line:t+1,message:s?`Missing semicolon after var(...) statement before next declaration. (selector: ${s})`:"Missing semicolon after var(...) statement before next declaration."})}if(!i.endsWith(";")&&ul(i)){if(fl(n,t))continue;if(Oi(n,t))continue;let s=ki(n,t);r.push({code:"missing-semicolon",line:t+1,message:s?`Missing semicolon at end of line. (selector: ${s})`:"Missing semicolon at end of line."})}}}return r}function al(e){return e==="{"||e==="}"||e.endsWith("{")||e.endsWith("}")?!0:!!(e.startsWith("@for")||e.startsWith("for(")||e.startsWith("for ("))}function ul(e){return sr(e,0)||nn(e,0)||ir(e)?!0:!!e.includes("&var(")}function cl(e){if(sr(e,0)){if(e.endsWith("[")||e.endsWith("{"))return!0}else return!1;let r=Ri(e);return r===-1?!1:e.slice(r+1).trim().length===0}function fl(e,r){let n=pl(e,r+1);return n===-1?!1:e[n].trim().startsWith("}")}function pl(e,r){for(let n=r;n<e.length;n+=1)if(e[n].trim().length>0)return n;return-1}function ki(e,r){for(let n=r;n>=0;n-=1){let t=e[n].trim();if(t){if(t.startsWith("@"))continue}else continue;let i=t.indexOf("{");if(i<=0)continue;let s=t.slice(0,i).trim();if(!(!s||s.includes(":")&&!s.startsWith(".")&&!s.startsWith("#")))return s}return null}function Pi(e,r=!0){let n=e.includes("/*")||e.includes("//")?vi(e):e,t=r?wi(n):[];return{source:Si(n),warnings:t}}function or(e,r,n,t={}){if(Ai(r))return;let i=_r(r,n,t);for(let s of i)Ai(s)||e.declarations.push(s)}function sn(e,r,n=1){return{type:e,value:r,line:n,declarations:[],children:[]}}function we(e){return e[e.length-1]}function Ii(e){var n;if(!e.startsWith("var("))return!1;let r=4;if(r=tn(e,r),e[r]!=="-"||e[r+1]!=="-"||(r+=2,!Ei((n=e[r])!=null?n:"")))return!1;for(r+=1;r<e.length&&ml(e[r]);)r+=1;return r=tn(e,r),e[r]!==")"?!1:(r+=1,r=tn(e,r),r===e.length)}function tn(e,r){let n=r;for(;n<e.length&&dl(e[n]);)n+=1;return n}function Ei(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function ml(e){return Ei(e)||e>="0"&&e<="9"||e==="-"||e==="_"}function dl(e){return e===" "||e===" "||e===`
44
+ `||e==="\r"}function Ai(e){try{return $(e)}catch(r){return w("containsUnsafeCssPayload",r)}}function $i(e,r,n=1,t={}){var u;let i=sn("root","",n),s=[i],o=[n],l="",a=n;for(let c=0;c<e.length;c+=1){let p=e[c];if(p==="{"){let f=l.trim();if(l="",!f)continue;let m=f.startsWith("@")?"at-rule":"selector",d=sn(m,f,a);we(s).children.push(d),s.push(d),o.push(a);continue}if(p===";"){let f=l.trim();if(l="",!f)continue;let m=we(s);if(m.type==="root"){f.startsWith("@")&&m.declarations.push(f);continue}or(m,f,r,t);continue}if(p==="}"){let f=l.trim();if(l="",f.length>0){let m=we(s);m.type!=="root"&&or(m,f,r,t)}if(s.length===1)throw new Error(`Invalid .luis syntax: unmatched closing brace at line ${a}.`);s.pop(),o.pop();continue}if(p===`
45
+ `||p==="\r"){let f=l.trim(),m=we(s);if(m.type!=="root"&&Ii(f)){or(m,f,r,t),l="";continue}}l+=p,p===`
46
+ `&&(a+=1)}if(s.length!==1){let c=(u=o[o.length-1])!=null?u:a;throw new Error(`Invalid .luis syntax: missing closing brace for block opened near line ${c}.`)}return i}function Wi(e,r,n,t,i){if(!e.includes("var(")||Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(t).length===0)return e;let s="",o={};for(let l=0;l<e.length;l+=1){let a=gl(e,l);if(!a){s+=e[l];continue}if(a.accessKey!==null){let p=bl(a.name,a.accessKey,r,n,t,i,hl(e,l));s+=p!=null?p:a.raw,l=a.end-1;continue}let u=r[a.name];if(!u){s+=a.raw,l=a.end-1;continue}let c=o[a.name];if(typeof c=="string")s+=c;else{let p=u.join(", ");o[a.name]=p,s+=p}l=a.end-1}return s}function gl(e,r){var l,a;if(e.slice(r,r+4)!=="var(")return null;let n=y(e,r+4);if(e[n]!=="-"||e[n+1]!=="-")return null;let t=n;if(n+=2,!Ce((l=e[n])!=null?l:""))return null;for(n+=1;n<e.length&&yl(e[n]);)n+=1;let i=e.slice(t,n),s=null;if(n=y(e,n),e[n]==="["){if(n+=1,n=y(e,n),!Ll((a=e[n])!=null?a:""))return null;let u=n;for(n+=1;n<e.length&&xl(e[n]);)n+=1;if(n=y(e,n),e[n]!=="]")return null;s=e.slice(u,n),n+=1}if(n=y(e,n),e[n]!==")")return null;let o=n+1;return{name:i,accessKey:s,end:o,raw:e.slice(r,o)}}function bl(e,r,n,t,i,s,o){var u,c;let l=n[e],a=t[e];if(l&&/^\d+$/.test(r)){let p=Number.parseInt(r,10);return(u=l[p])!=null?u:null}else return a?(c=D(t,e,r))!=null?c:null:((e in i||e in n)&&s.push({code:"invalid-object-loop-access",line:o,message:`Variable "${e}" is not an object variable and cannot be accessed with [${r}].`}),null)}function hl(e,r){let n=1;for(let t=0;t<r;t+=1)e[t]===`
47
+ `&&(n+=1);return n}function Ll(e){return Ce(e)||ji(e)}function xl(e){return Mr(e)||e==="-"||ji(e)}function yl(e){return Mr(e)||e==="-"}function ji(e){return e>="0"&&e<="9"}function lr(e){if(!e.includes("calc")&&!e.includes("min")&&!e.includes("max")&&!e.includes("clamp"))return[];let r=[],n=/\b(calc|min|max|clamp)\s*\(/g,t=n.exec(e);for(;t;){let i=t[0].lastIndexOf("("),s=t.index+i,o=h(e,s,"(",")");o!==-1&&r.push({start:t.index,end:o+1}),t=n.exec(e)}return r}function Pe(e,r){for(let n of r)if(e>=n.start&&e<n.end)return!0;return!1}function ar(e,r){if(!e.includes("*"))return e;let n=lr(e);return(e.includes("(")?vl(e,r,n):e).replace(/([a-zA-Z0-9_.()%\-]+)\s*\*\s*([a-zA-Z0-9_.()%\-]+)/g,(s,o,l,a)=>{if(Pe(a,n))return s;let u=Ae(o,r),c=Ae(l,r);if(!u||!c)return s;let p=Mi(u.unit,c.unit);if(p===null)return s;let f=u.value*c.value;return`${Ti(f)}${p}`})}function vl(e,r,n){return e.replace(/\(\s*([a-zA-Z0-9_.()%\-]+)\s*\*\s*([a-zA-Z0-9_.()%\-]+)\s*\)([a-zA-Z%]+)/g,(t,i,s,o,l)=>{if(Pe(l,n))return t;let a=Ae(i,r),u=Ae(s,r);if(!a||!u)return t;let c=Mi(a.unit,u.unit);if(c===null)return t;if(c&&c!==o)return t;let p=a.value*u.value;return`${Ti(p)}${o}`})}function Ae(e,r){let n=e.trim(),t=Cl(n);if(t){let s=r[t];return s?Ae(s,r):null}let i=Rl(n);return i||null}function Mi(e,r){return!e&&!r?"":e&&!r?e:!e&&r?r:e===r?e:null}function Ti(e){let r=Number.parseFloat(e.toFixed(6));return Number.isInteger(r),String(r)}function Cl(e){var t;if(!e.startsWith("var(")||!e.endsWith(")"))return null;let r=e.slice(4,-1).trim();if(!r.startsWith("--"))return null;let n=(t=r[2])!=null?t:"";if(!Ni(n))return null;for(let i=3;i<r.length;i+=1)if(!Sl(r[i]))return null;return r}function Rl(e){let r=0;e[r]==="-"&&(r+=1);let n=!1;for(;r<e.length&&on(e[r]);)n=!0,r+=1;if(e[r]===".")for(r+=1;r<e.length&&on(e[r]);)n=!0,r+=1;if(!n)return null;let t=e.slice(0,r),i=e.slice(r);if(i&&!Vl(i))return null;let s=Number.parseFloat(t);return Number.isNaN(s)?null:{value:s,unit:i}}function Ni(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function Sl(e){return Ni(e)||on(e)||e==="-"}function on(e){return e>="0"&&e<="9"}function Vl(e){if(!e)return!1;for(let r=0;r<e.length;r+=1){let n=e[r];if(!(n>="a"&&n<="z"||n>="A"&&n<="Z")&&n!=="%")return!1}return!0}var Ol=/(?:var\(\s*--[a-zA-Z_][\w-]*\s*\)|-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?)(?:\s+[+-]\s+(?:var\(\s*--[a-zA-Z_][\w-]*\s*\)|-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?))+/g;function ur(e,r){let n=lr(e);return e.replace(Ol,(t,i)=>{if(Pe(i,n))return t;let s=kl(t,r);if(s===null)return t;let o=_(s,{});return o===null?t:o})}function kl(e,r){let n="";for(let t=0;t<e.length;t+=1){if(e[t]!=="v"||e.slice(t,t+4)!=="var("){n+=e[t];continue}let i=e.indexOf(")",t+4);if(i===-1)return null;let s=e.slice(t+4,i).trim();if(!s.startsWith("--")||!(s in r))return null;n+=r[s],t=i}return n}function Fi(e){return!e.includes(":{")&&!e.includes(": {")?e:e.split(/\r?\n/).map(t=>{let i=t.trim();return i.includes(";")?t:i.match(/:\s*\{$/)?t.replace(/:\s*\{$/," {"):t}).join(`
48
+ `)}function cr(e,r,n,t,i,s){let o=e;return e.includes("$")&&(o=Z(o,s,n,r,t)),o.includes("var(")&&(o=Wi(o,n,t,r,i)),(o.includes("+")||o.includes("-"))&&(o=ur(o,r)),o.includes("*")&&(o=ar(o,r)),Fi(o)}function Di(e,r){let n=$r(e,r,"if");if(!n)return null;let t=[n.branch],i=n.endIndex;for(;i<e.length;){i=y(e,i);let s=$r(e,i,"elseif");if(s){t.push(s.branch),i=s.endIndex;continue}let o=ft(e,i);o&&(t.push(o.branch),i=o.endIndex);break}return{branches:t,endIndex:i}}function ln(e){let r=[],n=[],t=0;for(let i=0,s=0,o=null;i<e.length;i+=1){let l=e[i],a=i>0?e[i-1]:"";if(o){l===o&&a!=="\\"&&(o=null);continue}if(l==="'"||l==='"'){o=l;continue}l==="("?s+=1:l===")"&&s>0&&(s-=1);let u=s===0?wl(e,i):null;u&&(r.push(e.slice(t,i)),n.push(u),i+=u.length-1,t=i+1)}return r.push(e.slice(t)),{segments:r,operators:n}}function an(e){for(let r=0,n=0,t=null;r<e.length;r+=1){let i=e[r],s=r>0?e[r-1]:"";if(t){i===t&&s!=="\\"&&(t=null);continue}if(i==="'"||i==='"'){t=i;continue}i==="("?n+=1:i===")"&&n>0&&(n-=1);let o=n===0?Pl(e,r):null;if(o)return{operator:o,start:r,end:r+o.length}}return null}function Bi(e){return e.startsWith("(")&&h(e,0,"(",")")===e.length-1?e.slice(1,-1).trim():null}function wl(e,r){return e[r]==="&"&&e[r+1]==="&"?"&&":e[r]==="|"&&e[r+1]==="|"?"||":null}function Pl(e,r){var s,o;let n=e[r],t=(s=e[r+1])!=null?s:"",i=(o=e[r+2])!=null?o:"";return n==="="&&t==="="&&i==="="?"===":n==="!"&&t==="="&&i==="="?"!==":n===">"&&t==="="?">=":n==="<"&&t==="="?"<=":n===">"?">":n==="<"?"<":null}function fn(e,r,n,t,i){let s=ln(e);if(s.operators.length===0)return un(e,r,n,t,i);let o=un(s.segments[0],r,n,t,i);for(let l=0;l<s.operators.length;l+=1)o+=` ${s.operators[l]} ${un(s.segments[l+1],r,n,t,i)}`;return o}function un(e,r,n,t,i){let s=e.trim();if(!s)return s;let o=Bi(s);if(o!==null&&Al(o))return`(${fn(o,r,n,t,i)})`;let l=an(s);if(!l)return cn(s,r,n,t,i);let a=cn(s.slice(0,l.start),r,n,t,i),u=cn(s.slice(l.end),r,n,t,i);return`${a} ${l.operator} ${u}`}function cn(e,r,n,t,i){let s=e.trim();if(!s||Il(s))return s;let o=_(s,r,n,t,i);return o!=null?o:s}function Al(e){return ln(e).operators.length>0||an(e)!==null}function Il(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}function zi(e){let r=[],n=0;for(;n<e.length;){let t=e[n];if(Zi(t)){n+=1;continue}if(t==="("){r.push({type:"lparen",value:"("}),n+=1;continue}else if(t===")"){r.push({type:"rparen",value:")"}),n+=1;continue}let i=_i(e,n);if(i){r.push({type:"operator",value:i}),n+=i.length;continue}let s=El(e,n);if(s)r.push({type:"value",value:s.value}),n=s.endIndex;else return null}return r}function _i(e,r){var s,o;let n=e[r],t=(s=e[r+1])!=null?s:"",i=(o=e[r+2])!=null?o:"";return n==="="&&t==="="&&i==="="?"===":n==="!"&&t==="="&&i==="="?"!==":n===">"&&t==="="?">=":n==="<"&&t==="="?"<=":n==="&"&&t==="&"?"&&":n==="|"&&t==="|"?"||":n===">"?">":n==="<"?"<":null}function El(e,r){let n=e[r];return n==="'"||n==='"'?$l(e,r):e.slice(r,r+4)==="var("?Wl(e,r):jl(e,r)}function $l(e,r){let n=e[r],t=r+1;for(;t<e.length;){let i=e[t],s=t>r?e[t-1]:"";if(i===n&&s!=="\\")return{value:e.slice(r,t+1),endIndex:t+1};t+=1}return null}function Wl(e,r){let n=0;for(let t=r;t<e.length;t+=1){let i=e[t];if(i==="(")n+=1;else if(i===")"&&(n-=1,n===0))return{value:e.slice(r,t+1),endIndex:t+1}}return null}function jl(e,r){let n=r;for(;n<e.length;){let i=e[n],s=i==="="||i==="!"||i===">"||i==="<"||i==="&"||i==="|";if(Zi(i)||i==="("||i===")"||s&&_i(e,n))break;n+=1}let t=e.slice(r,n).trim();return t?{value:t,endIndex:n}:null}function Zi(e){return e===" "||e===" "||e===`
49
+ `||e==="\r"||e==="\f"}function pr(e,r,n,t,i){let s=Ml(e);if(Ki(s.trim()))return{kind:"string",value:s.trim().slice(1,-1)};let o=Tl(s,r,n,t,i);if(Ki(o))return{kind:"string",value:o.slice(1,-1)};if(o==="true"||o==="false")return{kind:"boolean",value:o==="true"};let l=Qi(o);return l?{kind:"number",value:l.value,unit:l.unit}:{kind:"string",value:o}}function qi(e,r,n){if(r==="===")return fr(e)===fr(n);if(r==="!==")return fr(e)!==fr(n);let t=Nl(e,n);return t?r===">"?t.left>t.right:r===">="?t.left>=t.right:r==="<"?t.left<t.right:t.left<=t.right:!1}function Hi(e){return e.kind==="boolean"?e.value:e.kind==="number"?e.value!==0:e.value.length>0}function Ml(e){let r=e.trim();return r.startsWith("$")?r.slice(1):r}function Tl(e,r,n,t,i){if(e in r)return r[e].trim();let s=_(e.trim(),r,n,t,i);return s?s.trim():e.trim()}function Qi(e){var n;let r=e.match(/^(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?$/);return r?{value:Number.parseFloat(r[1]),unit:(n=r[2])!=null?n:""}:null}function fr(e){return e.kind==="number"?`${e.value}${e.unit}`:String(e.value)}function Nl(e,r){let n=Ui(e),t=Ui(r);return!n||!t||n.unit&&t.unit&&n.unit!==t.unit?null:{left:n.value,right:t.value}}function Ui(e){return e.kind==="number"?{value:e.value,unit:e.unit}:e.kind==="string"?Qi(e.value.trim()):null}function Ki(e){return e.length>=2&&e.startsWith("'")&&e.endsWith("'")||e.length>=2&&e.startsWith('"')&&e.endsWith('"')}function Yi(e,r,n,t,i){let s=fn(e,r,n,t,i),o=zi(s);if(!o)return!1;let l={e:0,t:o,n:r,i:n,o:t,p:i},a=es(l);return a!==null&&l.e===l.t.length?a:!1}function es(e){let r=Xi(e);if(r===null)return null;for(;rs(e,"||");){let n=Xi(e);if(n===null)return null;r=r||n}return r}function Xi(e){let r=Gi(e);if(r===null)return null;for(;rs(e,"&&");){let n=Gi(e);if(n===null)return null;r=r&&n}return r}function Gi(e){var s;let r=e.t[e.e];if((r==null?void 0:r.type)==="lparen"){e.e+=1;let o=es(e);return o===null||((s=e.t[e.e])==null?void 0:s.type)!=="rparen"?null:(e.e+=1,o)}let n=Ji(e);if(!n)return null;let t=e.t[e.e];if((t==null?void 0:t.type)==="operator"&&Fl(t.value)){e.e+=1;let o=Ji(e);if(!o)return null;let l=pr(n,e.n,e.i,e.o,e.p),a=pr(o,e.n,e.i,e.o,e.p);return qi(l,t.value,a)}let i=pr(n,e.n,e.i,e.o,e.p);return Hi(i)}function Ji(e){let r=e.t[e.e];return!r||r.type!=="value"?null:(e.e+=1,r.value)}function rs(e,r){let n=e.t[e.e];return!n||n.type!=="operator"||n.value!==r?!1:(e.e+=1,!0)}function Fl(e){return e==="==="||e==="!=="||e===">="||e==="<="||e===">"||e==="<"}function pn(e,r){return mr(e,r,{},1)}function mr(e,r,n,t){let i=0,s="";for(;i<e.length;){let o=gt(e,i);if(o===-1){s+=cr(e.slice(i),r.variables,r.arrays,r.objectVariables,r.warnings,n);break}s+=cr(e.slice(i,o),r.variables,r.arrays,r.objectVariables,r.warnings,n);let l=Di(e,o);if(l){s+=Dl(l.branches,r,n,t),i=l.endIndex;continue}let a=Me(e,o);if(!a){s+=e[o],i=o+1;continue}let u=Z(a.sourceExpression,n,r.arrays,r.variables,r.objectVariables),c=Te(u,r.arrays,r.objectVariables);if(!c){s+=cr(e.slice(o,a.endIndex),r.variables,r.arrays,r.objectVariables,r.warnings,n),i=a.endIndex;continue}let p=Ne(e,o);if(c.length>r.resourceLimits.maxForIterationsPerLoop){ae(r,p,`Loop iteration budget exceeded (${c.length}/${r.resourceLimits.maxForIterationsPerLoop}) in ${r.sourceId}.`),i=a.endIndex;continue}let f=t*c.length;if(f>r.resourceLimits.maxNestedLoopProduct){ae(r,p,`Nested loop product exceeded (${f}/${r.resourceLimits.maxNestedLoopProduct}) in ${r.sourceId}.`),i=a.endIndex;continue}for(let m=0;m<c.length;m+=1){let d=c[m],g=Be(n,a.variableName,d,m,a.indexVariableName);s+=mr(a.body,r,g,f)}i=a.endIndex}return s}function Dl(e,r,n,t){for(let i of e){if(i.type==="else")return mr(i.body,r,n,t);let s=Z(i.condition,n,r.arrays,r.variables,r.objectVariables);if(Yi(s,n,r.variables,r.objectVariables,r.arrays))return mr(i.body,r,n,t)}return""}function mn(e){var o;let r=0,n=null,t=!1,i=!1,s=1;for(;r<e.length;){let l=e[r],a=(o=e[r+1])!=null?o:"",u=r>0?e[r-1]:"";if(t){l===`
50
+ `&&(t=!1,s+=1),r+=1;continue}else if(i){if(l==="*"&&a==="/"){i=!1,r+=2;continue}else l===`
51
+ `&&(s+=1);r+=1;continue}if(n){l===n&&u!=="\\"?n=null:l===`
52
+ `&&(s+=1),r+=1;continue}if(l==="/"&&a==="*"){i=!0,r+=2;continue}else if(l==="/"&&a==="/"){t=!0,r+=2;continue}if(l==="'"||l==='"'){n=l,r+=1;continue}let c=Bl(e,r);if(c)throw new Error(`Invalid .luis syntax: legacy control closer "/${c.keyword}}" is not supported at line ${s}. Use "}" instead.`);l===`
53
+ `&&(s+=1),r+=1}}function Bl(e,r){if(e[r]!=="/")return null;let n=r+1,t=n;for(;n<e.length&&_l(e[n]);)n+=1;let i=e.slice(t,n).toLowerCase();if(!zl(i))return null;for(;n<e.length&&Zl(e[n]);)n+=1;return e[n]!=="}"?null:{keyword:i}}function zl(e){return e==="for"||e==="if"||e==="elseif"||e==="else"}function _l(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function Zl(e){return e===" "||e===" "||e===`
54
+ `||e==="\r"||e==="\f"}function q(e){return/^[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*$/.test(e)}function dr(e,r){return e.slice(0,Math.max(0,r)).split(`
55
+ `).length}function Ul(e){let r=0;for(let n=0;n<e.length;n+=1)e[n]===`
56
+ `&&(r+=1);return r}function ns(e){let r=Ul(e);return r===0?"":`
57
+ `.repeat(r)}function ts(e,r){let n=r+5;n=y(e,n);let t=n;for(;n<e.length&&/[a-zA-Z0-9_-]/.test(e[n]);)n+=1;if(n<=t)return null;let i=e.slice(t,n);if(n=y(e,n),e[n]!=="(")return null;let s=h(e,n,"(",")");if(s===-1)return null;let o=Kl(e.slice(n+1,s));if(n=y(e,s+1),e[n]!=="{")return null;let l=h(e,n,"{","}");return l===-1?null:{definition:{name:i,params:o,body:e.slice(n+1,l),line:dr(e,r)},endIndex:l+1}}function Kl(e){let r=B(e).map(t=>t.trim()).filter(Boolean),n=[];for(let t of r){let i=t.startsWith("$")?t.slice(1).trim():t;q(i)&&n.push(i)}return n}function is(e,r=!0){let n=[],t={},i="",s=0;for(;s<e.length;){let o=e.indexOf("@fun:",s);if(o===-1){i+=e.slice(s);break}let l=dr(e,o),a=ts(e,o);if(!a){r&&n.push(dn("invalid-function-syntax",l,"Invalid function syntax near @fun: declaration.")),i+=e.slice(s,o+5),s=o+5;continue}i+=e.slice(s,o);let u=a.definition;q(u.name)?u.name in t?r&&n.push(dn("duplicate-function",l,`Function "${u.name}" is already defined.`)):t[u.name]=u:r&&n.push(dn("invalid-function-name",l,`Invalid function name "${u.name}".`)),i+=ns(e.slice(o,a.endIndex)),s=a.endIndex}return{source:i,functions:t,warnings:n}}function dn(e,r,n){return{code:e,line:r,message:n}}function ss(e){let r=e;return(r.includes(" + ")||r.includes(" - "))&&(r=ur(r,{})),r.includes("*")&&(r=ar(r,{})),r}function gr(e){return/[a-zA-Z_]/.test(e)}function os(e){return/[a-zA-Z0-9_]/.test(e)}function gn(e,r){var t,i;let n=r;if(!gr((t=e[n])!=null?t:""))return r;for(n+=1;n<e.length;){let s=e[n],o=(i=e[n+1])!=null?i:"";if(os(s)||s==="-"&&os(o))n+=1;else break}return n}function ls(e,r){if(e[r]!=="$")return null;if(e[r+1]==="{")return ql(e,r);let n=bn(e,r+1);return n?{raw:e.slice(r,n.end),end:n.end,name:n.name,objectKey:n.objectKey,arrayIndex:n.arrayIndex}:null}function ql(e,r){let n=e.indexOf("}",r+2);if(n===-1)return null;let t=e.slice(r+2,n).trim();if(!t)return null;let i=bn(t,0);return!i||i.end!==t.length?null:{raw:e.slice(r,n+1),end:n+1,name:i.name,objectKey:i.objectKey,arrayIndex:i.arrayIndex}}function br(e,r){let n=bn(e,r);return n?{raw:e.slice(r,n.end),end:n.end,name:n.name,objectKey:n.objectKey,arrayIndex:n.arrayIndex}:null}function bn(e,r){var l,a;if(!gr((l=e[r])!=null?l:""))return null;let n=gn(e,r),t=e.slice(r,n),i=n,s=null;if(e[i]==="["){let u=e.indexOf("]",i+1);if(u===-1)return null;let c=e.slice(i+1,u).trim();if(!/^\d+$/.test(c))return null;s=Number.parseInt(c,10),i=u+1}let o=null;if(e[i]==="."){let u=i+1;if(!gr((a=e[u])!=null?a:""))return null;i=gn(e,u),o=e.slice(u,i)}return{end:i,name:t,objectKey:o,arrayIndex:s}}function as(e,r){let n="",t=!1;for(let i=0;i<e.length;){let s=Hl(e,i);if(s){n+=s.value,i=s.end;continue}let o=J(e,i);if(o){n+=o.value,i=o.end;continue}let l=Ql(e,i)?br(e,i):null;if(l){let a=r(l);if(a!==null){n+=a,t=!0,i=l.end;continue}}n+=e[i],i+=1}return{value:n,changed:t}}function Hl(e,r){var t;let n=e[r];if(n!=="'"&&n!=='"')return null;for(let i=r+1;i<e.length;i+=1){let s=e[i],o=(t=e[i-1])!=null?t:"";if(s===n&&o!=="\\")return{value:e.slice(r,i+1),end:i+1}}return null}function Ql(e,r){var i;let n=(i=e[r])!=null?i:"",t=r===0?"":e[r-1];return us(n)&&!Xl(t)}function us(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function Xl(e){return us(e)||e>="0"&&e<="9"}function Ie(e,r){let n="";for(let t=0;t<e.length;t+=1){let i=e[t];if(i!=="$"){n+=i;continue}let s=ls(e,t);if(!s){let l=Gl(e,t,r);if(l){n+=l.value,t=l.end-1;continue}n+=i;continue}let o=ps(r,s.name,s.objectKey,s.arrayIndex);typeof o=="string"?s.raw.startsWith("${")&&fs(o)?n+=`\${${o.slice(1)}}`:n+=o:n+=s.raw,t=s.end-1}return n}function Gl(e,r,n){var c;let t=e.indexOf("}",r+2);if(e[r+1]!=="{"||t===-1)return null;let i=e.slice(r+2,t).trim(),s=as(i,p=>cs(n,p.raw,!0)),o=Ve(s.value);if(!o)return null;let l=o.length!==1||((c=o[0])==null?void 0:c.kind)!=="identifier",a=s.changed,u=o.map(p=>{if(p.kind==="string")return`'${p.value.replace(/'/g,"\\'")}'`;if(p.kind!=="identifier")return p.value;let f=cs(n,p.value,l);return f===null?p.value:(a=!0,f)}).join(" ");return a?{value:`\${${u}}`,end:t+1}:null}function fs(e){return/^\$[a-zA-Z_][\w-]*(?:\.[a-zA-Z_][\w-]*)*$/.test(e.trim())}function cs(e,r,n){let t=br(r,0);if(!t||t.end!==r.length)return null;let i=ps(e,t.name,t.objectKey,t.arrayIndex);if(typeof i!="string")return null;let s=Jl(i);if(s)return s;let o=n?ea(i):null;return o||(Yl(i)?i:`'${i.replace(/'/g,"\\'")}'`)}function Jl(e){let r=e.trim();if(fs(r))return`(${r.slice(1)})`;if(!r.startsWith("${")||!r.endsWith("}"))return null;let n=r.slice(2,-1).trim(),t=n?Ve(n):null;return!t||t.length===0?null:`(${t.map(i=>i.value).join(" ")})`}function Yl(e){return/^-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?$/.test(e.trim())}function ea(e){let r=e.trim(),n=J(r,0);return n&&n.end===r.length?n.value:null}function ps(e,r,n,t){var i;if(n){let s=e.objects[r],o=s?Y(s,n):void 0;return typeof o=="string"?o:null}else if(t!==null){let s=(i=e.arrays[r])==null?void 0:i[t];return typeof s=="string"?s:null}else return typeof e.values[r]=="string"?e.values[r]:null}function hn(){return{values:{},objects:{},arrays:{}}}function Ln(e,r,n){var t;for(let i=0;i<r.length;i+=1){let s=r[i],o=(t=n[i])!=null?t:"";ms(e,s,o)}}function xn(e,r){let n=ta(r),t=[],i=fe(e);for(let s of i){let o=s.text.trim(),l=ra(o);if(s.hasTerminator&&l){let u=Ie(l.v,n);ms(n,l.C,u);continue}let a=s.hasTerminator?";":"";t.push(`${s.text}${a}`)}return{r:t.join(""),n}}function ra(e){let r=e.indexOf(":");if(r<=1||e[0]!=="$")return null;let n=e.slice(1,r).trim(),t=e.slice(r+1).trim();return!q(n)||!t?null:{C:n,v:t}}function ms(e,r,n){let t=n.trim();if(S(t)){let i=P(t);e.objects[r]=i,e.values[r]=na(i)}else if(A(t)){let i=X(t);e.arrays[r]=i,e.values[r]=Ir(i)}else e.values[r]=W(t)}function na(e){return`{ ${Object.entries(e).map(([n,t])=>`${n}: ${t};`).join(" ")} }`}function ta(e){return{values:{...e.values},objects:Object.fromEntries(Object.entries(e.objects).map(([r,n])=>[r,{...n}])),arrays:Object.fromEntries(Object.entries(e.arrays).map(([r,n])=>[r,[...n]]))}}function T(e,r,n,t){e.L&&e.s.push({code:r,line:n,message:t})}function ds(e,r){return`@fun.${e}(${r.join(", ")})`}function hr(e,r,n,t,i,s,o){if(t.includes(e.name))return T(n,"function-recursion",s,`Recursive call detected for function "${e.name}".`),ds(e.name,r.args);if(r.args.length!==e.params.length){if(n.L)throw new Error(ia(e.name,e.params.length,r.args.length,s));return T(n,"function-argument-mismatch",s,`Function "${e.name}" expects ${e.params.length} arguments, got ${r.args.length}.`),""}let l=hn();Ln(l,e.params,r.args);let a=xn(e.body,l),u=Ie(a.r,a.n),c=ss(u);return o(c,n,[...t,e.name],i+1,e.line)}function ia(e,r,n,t){return`Invalid .luis syntax at line ${t}: function "${e}" expects ${r} arguments, got ${n}.`}var gs="@fun";function Lr(e){let r=e.trim();if(!r||sa(r))return null;if(!r.startsWith(gs))return null;let n=la(r);if(n===-1)return null;let t=n,i=oa(r,t),s=r.slice(t,i);if(!q(s))return null;let o=i;for(;o<r.length&&/\s/.test(r[o]);)o+=1;if(r[o]!=="(")return null;let l=h(r,o,"(",")");if(l===-1||l!==r.length-1)return null;let a=r.slice(o+1,l).trim(),u=a?B(a).map(c=>c.trim()):[];return{name:s,args:u}}function sa(e){var t,i;let r=null,n=0;for(let s=0;s<e.length;s+=1){let o=e[s],l=(t=e[s+1])!=null?t:"",a=(i=e[s-1])!=null?i:"";if(r){o===r&&a!=="\\"&&(r=null);continue}if(o==="'"||o==='"'){r=o;continue}if(o==="$"&&l==="{"){n+=1,s+=1;continue}if(n>0){o==="{"?n+=1:o==="}"&&(n-=1);continue}if(o==="{"||o==="}")return!0}return!1}function oa(e,r){let n=r;for(;n<e.length&&/[a-zA-Z0-9_-]/.test(e[n]);)n+=1;return n}function la(e){let r=gs.length;return e[r]?e[r]==="."?r+1:(/\s/.test(e[r]),-1):-1}function bs(e,r,n,t,i,s){var u;let o="",l=null,a=!1;for(let c=0;c<e.length;c+=1){let p=e[c],f=(u=e[c-1])!=null?u:"";if(l){o+=p,p===l&&f!=="\\"&&(l=null);continue}if(p==="'"||p==='"'){l=p,o+=p;continue}let m=aa(e,c);if(!m){o+=p;continue}let d=n.l[m.call.name];if(!d){T(n,"unknown-function-call",r,`Function "${m.call.name}" is not defined.`),o+=m.raw,c=m.end-1;continue}o=ca(o),o+=ua(hr(d,m.call,n,t,i,r,s)),c=m.end-1,a=!0}return a?o:e}function aa(e,r){if(e.slice(r,r+5)!=="@fun.")return null;let n=e.indexOf("(",r+5);if(n===-1)return null;let t=h(e,n,"(",")");if(t===-1)return null;let i=e.slice(r,t+1),s=Lr(i);return s?{call:s,raw:i,end:t+1}:null}function ua(e){return e.replace(/;\s*/g,"").replace(/\s+/g," ").trim()}function ca(e){return/:\s+$/.test(e)?e.replace(/\s+$/,""):e}function hs(e){let r=e.trim();if(!r||r.includes(":")||r.includes("{")||r.includes("}")||r[0]==="@")return null;let n=0;for(;n<r.length&&/[a-zA-Z0-9_-]/.test(r[n]);)n+=1;if(n===0)return null;let t=r.slice(0,n),i=yn(r,n);return r[i]!=="("?null:h(r,i,"(",")")===r.length-1?t:null}function Ls(e){var o;let r=e.trim();if(!r.startsWith("@fun")||r.startsWith("@fun.")||r.includes("{")||r.includes("}"))return null;let n=4;if(!/\s/.test((o=r[n])!=null?o:""))return null;n=yn(r,n);let t=n;for(;n<r.length&&/[a-zA-Z0-9_-]/.test(r[n]);)n+=1;if(n<=t)return null;let i=r.slice(t,n),s=yn(r,n);return r[s]!=="("?null:h(r,s,"(",")")===r.length-1?i:null}function yn(e,r){let n=r;for(;n<e.length&&/\s/.test(e[n]);)n+=1;return n}function vn(e,r,n=!0){let t={l:r,s:[],L:n};return{source:Cn(e,t,[],0,1),warnings:t.s}}function Cn(e,r,n,t,i){if(t>32)return e;let s=Ke(e),o=[];for(let l=0;l<s.length;l+=1){let a=s[l],u=i+l,c=fa(a,u,r,n,t);o.push(bs(c,u,r,n,t,Cn))}return o.join(`
58
+ `)}function fa(e,r,n,t,i){let s=fe(e),o=[],l=!1;for(let a of s){let u=a.hasTerminator?Lr(a.text):null;if(!u){let p=a.hasTerminator?hs(a.text):null,f=a.hasTerminator?Ls(a.text):null;p&&p in n.l?T(n,"invalid-function-call",r,`Legacy function call "${p}(...)" is not supported. Use "@fun.${p}(...)".`):f&&f in n.l&&T(n,"invalid-function-call",r,`Legacy function call "@fun ${f}(...)" is not supported. Use "@fun.${f}(...)".`);let m=a.hasTerminator?";":"";o.push(`${a.text}${m}`);continue}let c=n.l[u.name];if(!c){T(n,"unknown-function-call",r,`Function "${u.name}" is not defined.`),o.push(`${a.text};`);continue}o.push(hr(c,u,n,t,i,r,Cn)),l=!0}return l?o.join(`
59
+ `):e}function xs(e,r=!0){let n=is(e,r),t=vn(n.source,n.functions,r);return{source:t.source,warnings:[...n.warnings,...t.warnings]}}function ys(e,r){return{variables:{...e.variables,...r.i},classVariables:{...e.classVariables,...r.w},objectVariables:{...e.objectVariables,...r.o},arrayVariables:{...e.arrayVariables,...r.k},warnings:[...e.warnings,...r.s]}}function vs(e,r=!0,n="full",t){var c,p,f;if(n==="vendor-fast"){let m=ne(e,r,t);return mn(m.cleanSource),{source:m.cleanSource,variables:m.variables,classVariables:m.classVariables,objectVariables:m.objectVariables,arrayVariables:m.arrayVariables,warnings:m.warnings}}let i=pa(e)?xs(e,r):{source:e,warnings:[]},s=ne(i.source,r,t);mn(s.cleanSource);let o=[],l=ma(s.cleanSource)?pn(s.cleanSource,{arrays:s.arrayVariables,variables:s.variables,objectVariables:s.objectVariables,sourceId:(c=t==null?void 0:t.sourceId)!=null?c:"<inline>",resourcePolicy:(p=t==null?void 0:t.resourcePolicy)!=null?p:"fail-closed",resourceLimits:(f=t==null?void 0:t.resourceLimits)!=null?f:Er,warnings:o}):s.cleanSource,a=ne(l,r,t),u=ys({variables:s.variables,classVariables:s.classVariables,objectVariables:s.objectVariables,arrayVariables:s.arrayVariables,warnings:[...i.warnings,...s.warnings,...o]},{i:a.variables,w:a.classVariables,o:a.objectVariables,k:a.arrayVariables,s:a.warnings});return{source:a.cleanSource,variables:u.variables,classVariables:u.classVariables,objectVariables:u.objectVariables,arrayVariables:u.arrayVariables,warnings:u.warnings}}function pa(e){return xr(e,"@fun:")||xr(e,"@fun.")}function ma(e){return xr(e,"@for")||Rn(e,"for","(")||xr(e,"@if")||Rn(e,"elseif","(")||Rn(e,"else","{")||ga(e)}function xr(e,r){var s;let n=null,t=!1,i=!1;for(let o=0;o<e.length;o+=1){let l=e[o],a=(s=e[o+1])!=null?s:"",u=o>0?e[o-1]:"";if(t){l===`
60
+ `&&(t=!1);continue}else if(i){l==="*"&&a==="/"&&(i=!1,o+=1);continue}if(n){l===n&&u!=="\\"&&(n=null);continue}if(l==="/"&&a==="/"){t=!0,o+=1;continue}else if(l==="/"&&a==="*"){i=!0,o+=1;continue}else if(l==='"'||l==="'"){n=l;continue}if(e.slice(o,o+r.length)===r)return!0}return!1}function Rn(e,r,n){var o;let t=null,i=!1,s=!1;for(let l=0;l<e.length;l+=1){let a=e[l],u=(o=e[l+1])!=null?o:"",c=l>0?e[l-1]:"";if(i){a===`
61
+ `&&(i=!1);continue}else if(s){a==="*"&&u==="/"&&(s=!1,l+=1);continue}if(t){a===t&&c!=="\\"&&(t=null);continue}if(a==="/"&&u==="/"){i=!0,l+=1;continue}else if(a==="/"&&u==="*"){s=!0,l+=1;continue}else if(a==='"'||a==="'"){t=a;continue}if(e.slice(l,l+r.length)!==r)continue;let p=l>0?e[l-1]:"";if(/[a-zA-Z0-9_]/.test(p))continue;let f=l+r.length;for(;f<e.length&&da(e[f]);)f+=1;if(e[f]===n)return!0}return!1}function da(e){return e===" "||e===" "||e===`
62
+ `||e==="\r"||e==="\f"}function ga(e){var i,s;let r=null,n=!1,t=!1;for(let o=0;o<e.length;o+=1){let l=e[o],a=(i=e[o+1])!=null?i:"",u=o>0?e[o-1]:"";if(n){l===`
63
+ `&&(n=!1);continue}else if(t){l==="*"&&a==="/"&&(t=!1,o+=1);continue}if(r){l===r&&u!=="\\"&&(r=null);continue}if(l==="/"&&a==="/"){n=!0,o+=1;continue}else if(l==="/"&&a==="*"){t=!0,o+=1;continue}else if(l==='"'||l==="'"){r=l;continue}if(l!=="$")continue;let c=(s=e[o+1])!=null?s:"";if(c==="{"||/[a-zA-Z_]/.test(c))return!0}return!1}var Cs=/\bline\s+(\d+)\b/i;function Rs(e,r,n){let t=e instanceof Error?e:new Error(String(e)),i=t.message.match(Cs);if(!i)throw t;let s=Number.parseInt(i[1],10),o=r[s-1];if(!o)throw t;let l=ba(t.message,o,n),a=new Error(l);throw a.name=t.name,a}function ba(e,r,n){let t=e.replace(Cs,`line ${r.line}`);return r.sourceId===n?t:t.startsWith("Invalid .luis syntax")?t.replace("Invalid .luis syntax",`Invalid .luis syntax in "${r.sourceId}"`):`${t} [source: ${r.sourceId}]`}function Ss(e){let r=[],n=[],t=!0;for(let i of e)!t||!ha(i)?(t=!1,n.push(i)):r.push(i);return[r,n]}function ha(e){let r=e.trim().toLowerCase();return r.startsWith("@charset ")||r.startsWith("@import ")?!0:!!(r.startsWith("@layer ")&&r.endsWith(";"))}function Vs(e){let r=Object.entries(e).filter(([,n])=>La(n));return r.length===0?"":[":root {",...r.map(([n,t])=>` ${n}: ${ie(t)}`),"}"].join(`
64
+ `)}function La(e){try{return $(e)?!1:!(e.includes("{")||e.includes("}"))}catch(r){return w("isSafeRootVariableValue",r)}}function Sn(e){var c,p;let r=!1,n=!1,t=!1,i=!1,s=null,o=!1,l=!1;for(let f=0;f<e.length;f+=1){let m=e[f],d=(c=e[f+1])!=null?c:"",g=f>0?e[f-1]:"";if(o){m===`
65
+ `&&(o=!1);continue}else if(l){m==="*"&&d==="/"&&(l=!1,f+=1);continue}if(s){m===s&&g!=="\\"&&(s=null);continue}if(m==="/"&&d==="/"){o=!0,f+=1;continue}else if(m==="/"&&d==="*"){l=!0,f+=1;continue}if(m==='"'||m==="'"){s=m;continue}if((m==="@"&&H(e,f,"@fun:")||m==="@"&&H(e,f,"@fun.")||m==="@"&&H(e,f,"@fun "))&&(r=!0),(m==="@"&&H(e,f,"@for")||m==="f"&&Ee(e,f,"for(")||m==="@"&&H(e,f,"@if")||m==="e"&&Ee(e,f,"elseif(")||m==="e"&&Ee(e,f,"elseif (")||m==="e"&&Ee(e,f,"else{")||m==="e"&&Ee(e,f,"else {"))&&(n=!0),m==="$"){let b=(p=e[f+1])!=null?p:"";(b==="{"||ya(b))&&(t=!0)}if(m==="&"&&H(e,f+1,"var("))i=!0;else if(m==="v"&&H(e,f,"var(--")){let b=xa(e,f+5);if(b!==-1){let O=e.slice(f+5,b).trim();(O.includes(".")||O.includes("["))&&(i=!0)}}if(r&&n&&t&&i)break}let a=r||n||t||i;return{hasFunctionSyntax:r,hasControlFlowSyntax:n,hasLoopPlaceholderSyntax:t,hasClassVarUsage:i,hasTopLevelLuisOnlyPatterns:a,recommendedMode:a?"full":"vendor-fast"}}function Vn(e,r){return r?r==="full"?{mode:"full",downgradedFromOverride:!1}:e.hasTopLevelLuisOnlyPatterns?{mode:"full",downgradedFromOverride:!0}:{mode:"vendor-fast",downgradedFromOverride:!1}:{mode:e.recommendedMode,downgradedFromOverride:!1}}function H(e,r,n){return e.slice(r,r+n.length)===n}function Ee(e,r,n){let t=r>0?e[r-1]:"";return va(t)?!1:H(e,r,n)}function xa(e,r){let n=1;for(let t=r;t<e.length;t+=1){let i=e[t];if(i==="(")n+=1;else if(i===")"&&(n-=1,n===0))return t}return-1}function ya(e){return/[a-zA-Z_]/.test(e)}function va(e){return/[a-zA-Z0-9_]/.test(e)}function On(e,r={}){var l;let n=r.collectWarnings!==!1,t=ut(r),i=je(r),s=(l=r.sourceId)!=null?l:"<inline>",o=si(e,r);try{let{source:a,warnings:u}=Pi(o.source,n),c=Sn(a),p=Vn(c,r.compileMode),{source:f,variables:m,classVariables:d,objectVariables:g,arrayVariables:b,warnings:O}=vs(a,n,p.mode,{sourceId:s,resourcePolicy:t,resourceLimits:i}),$e=hi(p.mode,d,g,b)?He(f,{classVariables:d,variables:m,objectVariables:g,arrayVariables:b}):f,be=$i($e,g,1,b),I=[],L=er(be,I),k=[];if(L.length>i.maxExpandedRules){let F=`[${s}] Rule budget exceeded (${L.length}/${i.maxExpandedRules}).`;t==="fail-closed"?oe(F):(k.push(se(1,F)),L=L.slice(0,i.maxExpandedRules))}let M=gi(L);if(M>i.maxObservedRules){let F=`[${s}] Observed rule budget exceeded (${M}/${i.maxObservedRules}).`;if(t==="fail-closed")oe(F);else{k.push(se(1,F));let Pn=0,An=new Set;for(let Le of L)Le.observedMode!=="none"&&(Pn<i.maxObservedRules&&An.add(Le.key),Pn+=1);L=L.filter(Le=>Le.observedMode==="none"||An.has(Le.key))}}let{regularLeaves:yr,mainRules:kn,observedRules:C,initialObservedRules:v}=bi(L),he=rr(be.declarations,yr),N=Vs(m),[wn,ws]=Ss(he),vr=[...wn,N,...ws].filter(Boolean).join(`
66
+
67
+ `);if(vr.length>i.maxOutputCssChars){let F=`[${s}] CSS size budget exceeded (${vr.length}/${i.maxOutputCssChars} chars).`;t==="fail-closed"?oe(F):k.push(se(1,F))}return{css:vr,headerRules:wn,rootVariableRule:N,mainRules:kn,variables:m,classVariables:d,objectVariables:g,arrayVariables:b,warnings:n?[...o.warnings,...u,...O,...I,...k]:[],observedRules:C,initialObservedRules:v}}catch(a){Rs(a,o.lineMap,s)}}async function Os(e){if(!e.name.toLowerCase().endsWith(".luis"))throw new Error(`Expected a .luis file, got: ${e.name}`);return e.text()}async function ks(e){if(Sa(e)){if(!Vr(e))throw new Error(`Unsafe .luis URL blocked: ${e}`)}else throw new Error(`URL must point to a .luis file: ${e}`);let r=await fetch(e);if(!r.ok)throw new Error(`Unable to fetch .luis file (${r.status}): ${e}`);return r.text()}async function Ca(e){let r=await Os(e);return On(r)}async function Ra(e){let r=await ks(e);return On(r)}function Sa(e){let r=e.trim().toLowerCase(),n=r.indexOf("?"),t=r.indexOf("#"),i=n===-1?t:t===-1?n:Math.min(n,t);return(i===-1?r:r.slice(0,i)).endsWith(".luis")}export{On as compileLuis,Ca as readAndCompileLuisFile,Ra as readAndCompileLuisFromUrl,Os as readLuisFile,ks as readLuisFromUrl};
@@ -0,0 +1,2 @@
1
+ "use strict";var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var F=(e,l)=>{for(var o in l)c(e,o,{get:l[o],enumerable:!0})},P=(e,l,o,i)=>{if(l&&typeof l=="object"||typeof l=="function")for(let r of M(l))!S.call(e,r)&&r!==o&&c(e,r,{get:()=>l[r],enumerable:!(i=x(l,r))||i.enumerable});return e};var w=e=>P(c({},"__esModule",{value:!0}),e);var k={};F(k,{profileLuisSource:()=>v,resolveCompileMode:()=>y});module.exports=w(k);function v(e){var h,C;let l=!1,o=!1,i=!1,r=!1,u=null,d=!1,m=!1;for(let n=0;n<e.length;n+=1){let t=e[n],p=(h=e[n+1])!=null?h:"",b=n>0?e[n-1]:"";if(d){t===`
2
+ `&&(d=!1);continue}else if(m){t==="*"&&p==="/"&&(m=!1,n+=1);continue}if(u){t===u&&b!=="\\"&&(u=null);continue}if(t==="/"&&p==="/"){d=!0,n+=1;continue}else if(t==="/"&&p==="*"){m=!0,n+=1;continue}if(t==='"'||t==="'"){u=t;continue}if((t==="@"&&s(e,n,"@fun:")||t==="@"&&s(e,n,"@fun.")||t==="@"&&s(e,n,"@fun "))&&(l=!0),(t==="@"&&s(e,n,"@for")||t==="f"&&a(e,n,"for(")||t==="@"&&s(e,n,"@if")||t==="e"&&a(e,n,"elseif(")||t==="e"&&a(e,n,"elseif (")||t==="e"&&a(e,n,"else{")||t==="e"&&a(e,n,"else {"))&&(o=!0),t==="$"){let f=(C=e[n+1])!=null?C:"";(f==="{"||T(f))&&(i=!0)}if(t==="&"&&s(e,n+1,"var("))r=!0;else if(t==="v"&&s(e,n,"var(--")){let f=O(e,n+5);if(f!==-1){let g=e.slice(n+5,f).trim();(g.includes(".")||g.includes("["))&&(r=!0)}}if(l&&o&&i&&r)break}let L=l||o||i||r;return{hasFunctionSyntax:l,hasControlFlowSyntax:o,hasLoopPlaceholderSyntax:i,hasClassVarUsage:r,hasTopLevelLuisOnlyPatterns:L,recommendedMode:L?"full":"vendor-fast"}}function y(e,l){return l?l==="full"?{mode:"full",downgradedFromOverride:!1}:e.hasTopLevelLuisOnlyPatterns?{mode:"full",downgradedFromOverride:!0}:{mode:"vendor-fast",downgradedFromOverride:!1}:{mode:e.recommendedMode,downgradedFromOverride:!1}}function s(e,l,o){return e.slice(l,l+o.length)===o}function a(e,l,o){let i=l>0?e[l-1]:"";return B(i)?!1:s(e,l,o)}function O(e,l){let o=1;for(let i=l;i<e.length;i+=1){let r=e[i];if(r==="(")o+=1;else if(r===")"&&(o-=1,o===0))return i}return-1}function T(e){return/[a-zA-Z_]/.test(e)}function B(e){return/[a-zA-Z0-9_]/.test(e)}
@@ -0,0 +1,2 @@
1
+ function v(e){var L,h;let t=!1,n=!1,i=!1,r=!1,u=null,d=!1,m=!1;for(let l=0;l<e.length;l+=1){let o=e[l],p=(L=e[l+1])!=null?L:"",g=l>0?e[l-1]:"";if(d){o===`
2
+ `&&(d=!1);continue}else if(m){o==="*"&&p==="/"&&(m=!1,l+=1);continue}if(u){o===u&&g!=="\\"&&(u=null);continue}if(o==="/"&&p==="/"){d=!0,l+=1;continue}else if(o==="/"&&p==="*"){m=!0,l+=1;continue}if(o==='"'||o==="'"){u=o;continue}if((o==="@"&&s(e,l,"@fun:")||o==="@"&&s(e,l,"@fun.")||o==="@"&&s(e,l,"@fun "))&&(t=!0),(o==="@"&&s(e,l,"@for")||o==="f"&&a(e,l,"for(")||o==="@"&&s(e,l,"@if")||o==="e"&&a(e,l,"elseif(")||o==="e"&&a(e,l,"elseif (")||o==="e"&&a(e,l,"else{")||o==="e"&&a(e,l,"else {"))&&(n=!0),o==="$"){let f=(h=e[l+1])!=null?h:"";(f==="{"||x(f))&&(i=!0)}if(o==="&"&&s(e,l+1,"var("))r=!0;else if(o==="v"&&s(e,l,"var(--")){let f=b(e,l+5);if(f!==-1){let C=e.slice(l+5,f).trim();(C.includes(".")||C.includes("["))&&(r=!0)}}if(t&&n&&i&&r)break}let c=t||n||i||r;return{hasFunctionSyntax:t,hasControlFlowSyntax:n,hasLoopPlaceholderSyntax:i,hasClassVarUsage:r,hasTopLevelLuisOnlyPatterns:c,recommendedMode:c?"full":"vendor-fast"}}function y(e,t){return t?t==="full"?{mode:"full",downgradedFromOverride:!1}:e.hasTopLevelLuisOnlyPatterns?{mode:"full",downgradedFromOverride:!0}:{mode:"vendor-fast",downgradedFromOverride:!1}:{mode:e.recommendedMode,downgradedFromOverride:!1}}function s(e,t,n){return e.slice(t,t+n.length)===n}function a(e,t,n){let i=t>0?e[t-1]:"";return M(i)?!1:s(e,t,n)}function b(e,t){let n=1;for(let i=t;i<e.length;i+=1){let r=e[i];if(r==="(")n+=1;else if(r===")"&&(n-=1,n===0))return i}return-1}function x(e){return/[a-zA-Z_]/.test(e)}function M(e){return/[a-zA-Z0-9_]/.test(e)}export{v as profileLuisSource,y as resolveCompileMode};
@@ -0,0 +1,8 @@
1
+ "use strict";var S=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var q=(t,e)=>{for(var r in e)S(t,r,{get:e[r],enumerable:!0})},H=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of V(e))!G.call(t,s)&&s!==r&&S(t,s,{get:()=>e[s],enumerable:!(o=B(e,s))||o.enumerable});return t};var X=t=>H(S({},"__esModule",{value:!0}),t);var me={};q(me,{collectRenderLeaves:()=>g,renderCss:()=>pe,renderCssFromLeaves:()=>h,renderLeafRule:()=>b});module.exports=X(me);function f(t){let e=[],r="",o=0,s=0,n=null;for(let l=0;l<t.length;l+=1){let i=t[l],c=l>0?t[l-1]:"";if(n){i===n&&c!=="\\"&&(n=null),r+=i;continue}else i==='"'||i==="'"?n=i:i==="("?o+=1:i===")"&&o>0?o-=1:i==="["?s+=1:i==="]"&&s>0&&(s-=1);if(i===","&&o===0&&s===0){e.push(r),r="";continue}r+=i}return r.length>0&&e.push(r),e}function k(t){return t.map(e=>e.trim()).filter(Boolean).join(", ")}function d(t){return t.trim().replace(/\s*([>+~])\s*/g,"$1").replace(/\s+/g," ")}function P(t,e){let r=d(t),o=d(e);if(r===o)return!0;if(!r.startsWith(o))return!1;let s=r[o.length];return Y(s)}function Y(t){return t?t===" "||t===">"||t==="+"||t==="~"||t==="."||t==="#"||t===":"||t==="[":!0}function J(t){return t.endsWith("?!")?{g:"initial",b:2}:t.endsWith("?")?{g:"dynamic",b:1}:null}function y(t){let e=t.trim(),r=J(e);if(!r)return{selector:e,observedMode:"none",hasMarker:!1,markerValid:!1};let o=e.length-r.b,s=e[o-1];if(!s||/\s/.test(s))return{selector:e,observedMode:"none",hasMarker:!0,markerValid:!1};let n=e.slice(0,o);return K(n)?{selector:n,observedMode:r.g,hasMarker:!0,markerValid:!0}:{selector:e,observedMode:"none",hasMarker:!0,markerValid:!1}}function p(t){return f(t).map(e=>y(e))}function R(t){return k(p(t).map(e=>e.selector))}function K(t){let e=t.trimEnd();if(!e)return!1;let r=e[e.length-1];return r!==">"&&r!=="+"&&r!=="~"&&r!==","}function E(t){let e=Q(t);return e?`Observed marker "?" or "?!" must be attached to the final selector tail. Descendant chains place the marker on the final target element, for example ".host .child?" not ".host? .child". Selector: "${e}".`:null}function Q(t){for(let e of f(t))if(y(e).observedMode==="none"&&Z(e))return e.trim();return null}function Z(t){let e=null,r=0;for(let o=0;o<t.length;o+=1){let s=t[o],n=o>0?t[o-1]:"";if(e){s===e&&n!=="\\"&&(e=null);continue}if(s==="["){r+=1;continue}else if(s==="]"&&r>0){r-=1;continue}else if(r>0&&(s==='"'||s==="'")){e=s;continue}if(s==="?"&&n!=="\\"&&r===0)return!0}return!1}function $(t,e,r,o){let s=p(t);for(let n of s)n.observedMode!=="none"&&ee(n,e,r,o)}function _(t,e,r){return p(t).map(s=>r?{selector:s.selector,observedMode:"none"}:s.observedMode!=="none"?{selector:s.selector,observedMode:s.observedMode}:s.hasMarker?{selector:s.selector,observedMode:"none"}:{selector:s.selector,observedMode:te(s.selector,e)})}function ee(t,e,r,o){let s=d(t.selector),n=e.get(s);n&&n!==t.observedMode&&o&&o.push({code:"invalid-observed-syntax",line:r,message:`Observed root "${t.selector}" was declared with both "${n}" and "${t.observedMode}" modes. The latest explicit marker is used for inherited selectors.`}),e.set(s,t.observedMode)}function te(t,e){let r="none",o=-1;for(let[s,n]of e)n!=="none"&&P(t,s)&&s.length>o&&(r=n,o=s.length);return r}function W(t,e,r,o,s,n){var i;let l=re(t);for(let c of l){let a=n(c.selector,e,s);o.push({key:a,atRules:[...e],selector:c.selector,observedMode:c.observedMode,sourceLine:(i=r.line)!=null?i:1,declarations:[...r.declarations]})}}function re(t){let e=[];for(let r of t){let o=e[e.length-1];o&&o.observedMode===r.observedMode?o.selector=`${o.selector}, ${r.selector}`:e.push({selector:r.selector,observedMode:r.observedMode})}return e}var u=class extends Error{constructor(r){super(r);this.code="security-check-failed";this.name="LuisSecurityError"}};function m(t,e){let r=e instanceof Error?e.message:String(e);throw new u(`[LentyStyle][Security] ${t} failed: ${r}`)}var F=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,N=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,oe=/\\([0-9a-fA-F]{1,6}\s?|.)/g,se=/^[0-9a-fA-F]+$/;function x(t){let e=ne(t);return e.includes("</style")||e.includes("<script")||e.includes("</script")||e.includes("javascript:")||F.test(t)||F.test(e)||N.test(t)||N.test(e)}function ne(t){return t.replace(oe,(e,r)=>{let o=ie(r);if(o){let s=Number.parseInt(o,16);return s>1114111?"":String.fromCodePoint(s)}else return r}).toLowerCase()}function ie(t){let e=t.trim();return se.test(e)?e:null}function g(t,e){let r=[],o=new Map,s=ae(t,e);for(let n of t.children)M(n,"",[],r,o,s,e);return r}function M(t,e,r,o,s,n,l){var C;if(t.type==="at-rule"){let L=[...r,t.value];for(let T of t.children)M(T,e,L,o,s,n,l);return}let i=j(e,t.value);if(w(i))return;let c=D(r),a=c?null:E(i);l&&a&&l.push({code:"invalid-observed-syntax",line:(C=t.line)!=null?C:1,message:a});let z=_(i,n,c),I=R(i);t.declarations.length>0&&W(z,r,t,o,s,ue);for(let L of t.children)M(L,I,r,o,s,n,l)}function ae(t,e){let r=new Map;for(let o of t.children)O(o,"",[],r,e);return r}function O(t,e,r,o,s){var c;if(t.type==="at-rule"){for(let a of t.children)O(a,e,[...r,t.value],o,s);return}let n=j(e,t.value);!D(r)&&!w(n)&&$(n,o,(c=t.line)!=null?c:1,s);let i=R(n);for(let a of t.children)O(a,i,r,o,s)}function j(t,e){return t?e.includes("&")?e.split("&").join(t):`${t} ${e}`:e}function ue(t,e,r){var l;let s=`${e.join("")}${t}`,n=(l=r.get(s))!=null?l:0;return r.set(s,n+1),`${s}${n}`}function D(t){for(let e of t){let r=e.trim().toLowerCase();if(r.startsWith("@keyframes")||r.startsWith("@-webkit-keyframes"))return!0}return!1}function w(t){try{return x(t)}catch(e){return m("containsUnsafeSelectorPayload",e)}}function v(t){let e=t.trim();return e.endsWith(";")?e:`${e};`}function A(t){let e=t.trim(),r=e.indexOf(":");if(r===-1)return v(e);let o=e.slice(0,r).trimEnd(),s=e.slice(r+1).trim(),n=s.length>0?`${o}: ${s}`:`${o}:`;return v(n)}function U(t,e=2){let r=" ".repeat(e);return t.split(`
2
+ `).map(o=>`${r}${o}`).join(`
3
+ `)}function b(t){return[`${t.selector} {`,...t.declarations.map(e=>` ${A(e)}`),"}"].join(`
4
+ `)}function h(t,e,r){let o=[],s=[];for(let n of t)o.push(v(n));for(let n of e){let l=r==null?void 0:r.get(n.key);s.push({key:n.key,atRules:[...n.atRules],rule:l!=null?l:b(n)})}return[...o,...de(s)]}function de(t){let e=[];for(let o of t){let s=o.atRules.join(""),n=e[e.length-1];if(n&&n.R===s){n.f.push(o.rule);continue}e.push({R:s,y:[...o.atRules],f:[o.rule]})}let r=[];for(let o of e){if(o.y.length===0){r.push(...o.f);continue}let s=o.f.join(`
5
+
6
+ `);r.push(fe(s,o.y))}return r}function fe(t,e){return e.reduceRight((r,o)=>`${o} {
7
+ ${U(r)}
8
+ }`,t)}function pe(t){let e=g(t);return h(t.declarations,e)}
@@ -0,0 +1,8 @@
1
+ function f(t){let e=[],r="",o=0,s=0,n=null;for(let l=0;l<t.length;l+=1){let i=t[l],c=l>0?t[l-1]:"";if(n){i===n&&c!=="\\"&&(n=null),r+=i;continue}else i==='"'||i==="'"?n=i:i==="("?o+=1:i===")"&&o>0?o-=1:i==="["?s+=1:i==="]"&&s>0&&(s-=1);if(i===","&&o===0&&s===0){e.push(r),r="";continue}r+=i}return r.length>0&&e.push(r),e}function C(t){return t.map(e=>e.trim()).filter(Boolean).join(", ")}function d(t){return t.trim().replace(/\s*([>+~])\s*/g,"$1").replace(/\s+/g," ")}function k(t,e){let r=d(t),o=d(e);if(r===o)return!0;if(!r.startsWith(o))return!1;let s=r[o.length];return T(s)}function T(t){return t?t===" "||t===">"||t==="+"||t==="~"||t==="."||t==="#"||t===":"||t==="[":!0}function B(t){return t.endsWith("?!")?{g:"initial",b:2}:t.endsWith("?")?{g:"dynamic",b:1}:null}function b(t){let e=t.trim(),r=B(e);if(!r)return{selector:e,observedMode:"none",hasMarker:!1,markerValid:!1};let o=e.length-r.b,s=e[o-1];if(!s||/\s/.test(s))return{selector:e,observedMode:"none",hasMarker:!0,markerValid:!1};let n=e.slice(0,o);return V(n)?{selector:n,observedMode:r.g,hasMarker:!0,markerValid:!0}:{selector:e,observedMode:"none",hasMarker:!0,markerValid:!1}}function p(t){return f(t).map(e=>b(e))}function h(t){return C(p(t).map(e=>e.selector))}function V(t){let e=t.trimEnd();if(!e)return!1;let r=e[e.length-1];return r!==">"&&r!=="+"&&r!=="~"&&r!==","}function P(t){let e=G(t);return e?`Observed marker "?" or "?!" must be attached to the final selector tail. Descendant chains place the marker on the final target element, for example ".host .child?" not ".host? .child". Selector: "${e}".`:null}function G(t){for(let e of f(t))if(b(e).observedMode==="none"&&q(e))return e.trim();return null}function q(t){let e=null,r=0;for(let o=0;o<t.length;o+=1){let s=t[o],n=o>0?t[o-1]:"";if(e){s===e&&n!=="\\"&&(e=null);continue}if(s==="["){r+=1;continue}else if(s==="]"&&r>0){r-=1;continue}else if(r>0&&(s==='"'||s==="'")){e=s;continue}if(s==="?"&&n!=="\\"&&r===0)return!0}return!1}function E(t,e,r,o){let s=p(t);for(let n of s)n.observedMode!=="none"&&H(n,e,r,o)}function $(t,e,r){return p(t).map(s=>r?{selector:s.selector,observedMode:"none"}:s.observedMode!=="none"?{selector:s.selector,observedMode:s.observedMode}:s.hasMarker?{selector:s.selector,observedMode:"none"}:{selector:s.selector,observedMode:X(s.selector,e)})}function H(t,e,r,o){let s=d(t.selector),n=e.get(s);n&&n!==t.observedMode&&o&&o.push({code:"invalid-observed-syntax",line:r,message:`Observed root "${t.selector}" was declared with both "${n}" and "${t.observedMode}" modes. The latest explicit marker is used for inherited selectors.`}),e.set(s,t.observedMode)}function X(t,e){let r="none",o=-1;for(let[s,n]of e)n!=="none"&&k(t,s)&&s.length>o&&(r=n,o=s.length);return r}function _(t,e,r,o,s,n){var i;let l=Y(t);for(let c of l){let a=n(c.selector,e,s);o.push({key:a,atRules:[...e],selector:c.selector,observedMode:c.observedMode,sourceLine:(i=r.line)!=null?i:1,declarations:[...r.declarations]})}}function Y(t){let e=[];for(let r of t){let o=e[e.length-1];o&&o.observedMode===r.observedMode?o.selector=`${o.selector}, ${r.selector}`:e.push({selector:r.selector,observedMode:r.observedMode})}return e}var u=class extends Error{constructor(r){super(r);this.code="security-check-failed";this.name="LuisSecurityError"}};function m(t,e){let r=e instanceof Error?e.message:String(e);throw new u(`[LentyStyle][Security] ${t} failed: ${r}`)}var W=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,F=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,J=/\\([0-9a-fA-F]{1,6}\s?|.)/g,K=/^[0-9a-fA-F]+$/;function L(t){let e=Q(t);return e.includes("</style")||e.includes("<script")||e.includes("</script")||e.includes("javascript:")||W.test(t)||W.test(e)||F.test(t)||F.test(e)}function Q(t){return t.replace(J,(e,r)=>{let o=Z(r);if(o){let s=Number.parseInt(o,16);return s>1114111?"":String.fromCodePoint(s)}else return r}).toLowerCase()}function Z(t){let e=t.trim();return K.test(e)?e:null}function R(t,e){let r=[],o=new Map,s=re(t,e);for(let n of t.children)S(n,"",[],r,o,s,e);return r}function S(t,e,r,o,s,n,l){var O;if(t.type==="at-rule"){let v=[...r,t.value];for(let I of t.children)S(I,e,v,o,s,n,l);return}let i=N(e,t.value);if(D(i))return;let c=j(r),a=c?null:P(i);l&&a&&l.push({code:"invalid-observed-syntax",line:(O=t.line)!=null?O:1,message:a});let U=$(i,n,c),z=h(i);t.declarations.length>0&&_(U,r,t,o,s,oe);for(let v of t.children)S(v,z,r,o,s,n,l)}function re(t,e){let r=new Map;for(let o of t.children)y(o,"",[],r,e);return r}function y(t,e,r,o,s){var c;if(t.type==="at-rule"){for(let a of t.children)y(a,e,[...r,t.value],o,s);return}let n=N(e,t.value);!j(r)&&!D(n)&&E(n,o,(c=t.line)!=null?c:1,s);let i=h(n);for(let a of t.children)y(a,i,r,o,s)}function N(t,e){return t?e.includes("&")?e.split("&").join(t):`${t} ${e}`:e}function oe(t,e,r){var l;let s=`${e.join("")}${t}`,n=(l=r.get(s))!=null?l:0;return r.set(s,n+1),`${s}${n}`}function j(t){for(let e of t){let r=e.trim().toLowerCase();if(r.startsWith("@keyframes")||r.startsWith("@-webkit-keyframes"))return!0}return!1}function D(t){try{return L(t)}catch(e){return m("containsUnsafeSelectorPayload",e)}}function g(t){let e=t.trim();return e.endsWith(";")?e:`${e};`}function w(t){let e=t.trim(),r=e.indexOf(":");if(r===-1)return g(e);let o=e.slice(0,r).trimEnd(),s=e.slice(r+1).trim(),n=s.length>0?`${o}: ${s}`:`${o}:`;return g(n)}function A(t,e=2){let r=" ".repeat(e);return t.split(`
2
+ `).map(o=>`${r}${o}`).join(`
3
+ `)}function x(t){return[`${t.selector} {`,...t.declarations.map(e=>` ${w(e)}`),"}"].join(`
4
+ `)}function M(t,e,r){let o=[],s=[];for(let n of t)o.push(g(n));for(let n of e){let l=r==null?void 0:r.get(n.key);s.push({key:n.key,atRules:[...n.atRules],rule:l!=null?l:x(n)})}return[...o,...se(s)]}function se(t){let e=[];for(let o of t){let s=o.atRules.join(""),n=e[e.length-1];if(n&&n.R===s){n.f.push(o.rule);continue}e.push({R:s,y:[...o.atRules],f:[o.rule]})}let r=[];for(let o of e){if(o.y.length===0){r.push(...o.f);continue}let s=o.f.join(`
5
+
6
+ `);r.push(ne(s,o.y))}return r}function ne(t,e){return e.reduceRight((r,o)=>`${o} {
7
+ ${A(r)}
8
+ }`,t)}function Ue(t){let e=R(t);return M(t.declarations,e)}export{R as collectRenderLeaves,Ue as renderCss,M as renderCssFromLeaves,x as renderLeafRule};
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},p=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of n(r))!a.call(e,o)&&o!==t&&s(e,o,{get:()=>r[o],enumerable:!(u=m(r,o))||u.enumerable});return e};var l=e=>p(s({},"__esModule",{value:!0}),e);var R={};c(R,{DEFAULT_LUIS_RESOURCE_LIMITS:()=>i,buildResourceLimitWarning:()=>b,resolveResourceLimits:()=>L,resolveResourcePolicy:()=>x,throwResourceLimitError:()=>d});module.exports=l(R);var i={maxForIterationsPerLoop:2e3,maxNestedLoopProduct:1e5,maxExpandedRules:5e4,maxOutputCssChars:3e6,maxObservedRules:5e3,maxObservedActiveRules:1e3,maxObservedRuleKeysPerToken:300,maxMutationBatchTokens:1500,maxObservedReevalPerTick:500,maxImportDepth:64,maxImportCount:2e3,maxImportedBytes:4e6};function x(e){return e.resourcePolicy?e.resourcePolicy:e.debug?"fail-soft":"fail-closed"}function L(e){var r;return{...i,...(r=e.resourceLimits)!=null?r:{}}}function b(e,r){return{code:"resource-limit",line:e,message:r}}function d(e){throw new Error(`[LentyStyle][resource-limit] ${e}`)}
@@ -0,0 +1 @@
1
+ var o={maxForIterationsPerLoop:2e3,maxNestedLoopProduct:1e5,maxExpandedRules:5e4,maxOutputCssChars:3e6,maxObservedRules:5e3,maxObservedActiveRules:1e3,maxObservedRuleKeysPerToken:300,maxMutationBatchTokens:1500,maxObservedReevalPerTick:500,maxImportDepth:64,maxImportCount:2e3,maxImportedBytes:4e6};function t(e){return e.resourcePolicy?e.resourcePolicy:e.debug?"fail-soft":"fail-closed"}function s(e){var r;return{...o,...(r=e.resourceLimits)!=null?r:{}}}function u(e,r){return{code:"resource-limit",line:e,message:r}}function i(e){throw new Error(`[LentyStyle][resource-limit] ${e}`)}export{o as DEFAULT_LUIS_RESOURCE_LIMITS,u as buildResourceLimitWarning,s as resolveResourceLimits,t as resolveResourcePolicy,i as throwResourceLimitError};
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},f=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!u.call(t,n)&&n!==r&&i(t,n,{get:()=>e[n],enumerable:!(a=L(e,n))||a.enumerable});return t};var g=t=>f(i({},"__esModule",{value:!0}),t);var d={};S(d,{LuisSecurityError:()=>o,assertSecurityDependency:()=>s,failClosedSecurityCheck:()=>y,rethrowSecurityError:()=>c});module.exports=g(d);var o=class extends Error{constructor(r){super(r);this.code="security-check-failed";this.name="LuisSecurityError"}};function s(t,e){if(!t)throw new o(`[LentyStyle][Security] Required dependency is unavailable: ${e}.`)}function c(t){if(t instanceof o)throw t}function y(t,e){let r=e instanceof Error?e.message:String(e);throw new o(`[LentyStyle][Security] ${t} failed: ${r}`)}
@@ -0,0 +1 @@
1
+ var t=class extends Error{constructor(o){super(o);this.code="security-check-failed";this.name="LuisSecurityError"}};function n(e,r){if(!e)throw new t(`[LentyStyle][Security] Required dependency is unavailable: ${r}.`)}function i(e){if(e instanceof t)throw e}function s(e,r){let o=r instanceof Error?r.message:String(r);throw new t(`[LentyStyle][Security] ${e} failed: ${o}`)}export{t as LuisSecurityError,n as assertSecurityDependency,s as failClosedSecurityCheck,i as rethrowSecurityError};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},I=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of V(e))!z.call(t,n)&&n!==r&&m(t,n,{get:()=>e[n],enumerable:!(s=y(e,n))||s.enumerable});return t};var N=t=>I(m({},"__esModule",{value:!0}),t);var E={};w(E,{hasMismatchedArrayRangeUnits:()=>C,isArrayVariableValue:()=>f,parseArrayVariable:()=>S,serializeArrayVariable:()=>R});module.exports=N(E);function g(t){let e=[],r="",s=null,n=0,l=0,o=0;for(let a=0;a<t.length;a+=1){let i=t[a],c=a>0?t[a-1]:"";if(s){r+=i,i===s&&c!=="\\"&&(s=null);continue}if(i==="'"||i==='"'){s=i,r+=i;continue}if(i==="("?n+=1:i===")"&&n>0?n-=1:i==="{"?l+=1:i==="}"&&l>0?l-=1:i==="["?o+=1:i==="]"&&o>0&&(o-=1),i===","&&n===0&&l===0&&o===0){let d=r.trim();d.length>0&&e.push(d),r="";continue}r+=i}let u=r.trim();return u.length>0&&e.push(u),e}function p(t){if(t.length<2)return!1;let e=t[0],r=t[t.length-1];return e==="'"&&r==="'"||e==='"'&&r==='"'}function h(t){let e=t.trim();if(p(e))return null;let r=W(e);return r||$(e)}function x(t){let e=b(t);return e?!e.startSuffix||!e.endSuffix?!1:e.startSuffix!==e.endSuffix:!1}function W(t){let e=b(t);if(!e)return null;let{start:r,end:s,startSuffix:n,endSuffix:l}=e,o=r<=s?1:-1,u=n||l,a=[];for(let i=r;;i+=o){let c=Z(i,r,s,n,l,u);if(a.push(`${i}${c}`),i===s)break}return a}function b(t){let e=t.trim();if(p(e))return null;let r=e.match(/^(-?\d+)([a-zA-Z%]+)?\s*-\s*(-?\d+)([a-zA-Z%]+)?$/);if(!r)return null;let[,s,n="",l,o=""]=r;return{start:Number.parseInt(s,10),end:Number.parseInt(l,10),startSuffix:n,endSuffix:o}}function $(t){let e=t.match(/^([A-Za-z])\s*-\s*([A-Za-z])$/);if(!e)return null;let[,r,s]=e,n=r.charCodeAt(0),l=s.charCodeAt(0),o=n<=l?1:-1,u=[];for(let a=n;u.push(String.fromCharCode(a)),a!==l;a+=o);return u}function Z(t,e,r,s,n,l){return t===e&&s?s:t===r&&n?n:l}function A(t){if(t.length<2)return t;let e=t[0],r=t[t.length-1];return e==="'"&&r==="'"||e==='"'&&r==='"'?t.slice(1,-1):t}function f(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")}function S(t){let e=t.trim();if(!f(e))return[];let r=e.slice(1,-1).trim();if(!r)return[];let s=g(r);if(s.length===1){let n=h(s[0]);if(n)return n}return s.map(n=>A(n))}function C(t){let e=t.trim();if(!f(e))return!1;let r=e.slice(1,-1).trim();if(!r)return!1;let s=g(r);return s.length!==1?!1:x(s[0])}function R(t){return`[${t.join(", ")}]`}
@@ -0,0 +1 @@
1
+ function c(t){let e=[],r="",n=null,s=0,l=0,o=0;for(let a=0;a<t.length;a+=1){let i=t[a],f=a>0?t[a-1]:"";if(n){r+=i,i===n&&f!=="\\"&&(n=null);continue}if(i==="'"||i==='"'){n=i,r+=i;continue}if(i==="("?s+=1:i===")"&&s>0?s-=1:i==="{"?l+=1:i==="}"&&l>0?l-=1:i==="["?o+=1:i==="]"&&o>0&&(o-=1),i===","&&s===0&&l===0&&o===0){let p=r.trim();p.length>0&&e.push(p),r="";continue}r+=i}let u=r.trim();return u.length>0&&e.push(u),e}function m(t){if(t.length<2)return!1;let e=t[0],r=t[t.length-1];return e==="'"&&r==="'"||e==='"'&&r==='"'}function d(t){let e=t.trim();if(m(e))return null;let r=A(e);return r||S(e)}function h(t){let e=x(t);return e?!e.startSuffix||!e.endSuffix?!1:e.startSuffix!==e.endSuffix:!1}function A(t){let e=x(t);if(!e)return null;let{start:r,end:n,startSuffix:s,endSuffix:l}=e,o=r<=n?1:-1,u=s||l,a=[];for(let i=r;;i+=o){let f=C(i,r,n,s,l,u);if(a.push(`${i}${f}`),i===n)break}return a}function x(t){let e=t.trim();if(m(e))return null;let r=e.match(/^(-?\d+)([a-zA-Z%]+)?\s*-\s*(-?\d+)([a-zA-Z%]+)?$/);if(!r)return null;let[,n,s="",l,o=""]=r;return{start:Number.parseInt(n,10),end:Number.parseInt(l,10),startSuffix:s,endSuffix:o}}function S(t){let e=t.match(/^([A-Za-z])\s*-\s*([A-Za-z])$/);if(!e)return null;let[,r,n]=e,s=r.charCodeAt(0),l=n.charCodeAt(0),o=s<=l?1:-1,u=[];for(let a=s;u.push(String.fromCharCode(a)),a!==l;a+=o);return u}function C(t,e,r,n,s,l){return t===e&&n?n:t===r&&s?s:l}function b(t){if(t.length<2)return t;let e=t[0],r=t[t.length-1];return e==="'"&&r==="'"||e==='"'&&r==='"'?t.slice(1,-1):t}function g(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")}function R(t){let e=t.trim();if(!g(e))return[];let r=e.slice(1,-1).trim();if(!r)return[];let n=c(r);if(n.length===1){let s=d(n[0]);if(s)return s}return n.map(s=>b(s))}function y(t){let e=t.trim();if(!g(e))return!1;let r=e.slice(1,-1).trim();if(!r)return!1;let n=c(r);return n.length!==1?!1:h(n[0])}function V(t){return`[${t.join(", ")}]`}export{y as hasMismatchedArrayRangeUnits,g as isArrayVariableValue,R as parseArrayVariable,V as serializeArrayVariable};
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(i,o)=>{for(var s in o)f(i,s,{get:o[s],enumerable:!0})},L=(i,o,s,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of d(o))!m.call(i,n)&&n!==s&&f(i,n,{get:()=>o[n],enumerable:!(t=l(o,n))||t.enumerable});return i};var w=i=>L(f({},"__esModule",{value:!0}),i);var T={};C(T,{defineLuisConfig:()=>y,loadLuisConfig:()=>E});module.exports=w(T);var r=require("node:fs/promises"),e=require("node:path"),c=require("node:url"),p="luis.config.mjs",h=new Set([".mjs",".js"]);function y(i){return i}async function E(i,o={}){var t;let s=(0,e.resolve)((t=o.cwd)!=null?t:process.cwd());if(i===void 0||typeof i=="string"){let n=await x(s,i!=null?i:p);return{config:await j(n),configDir:(0,e.dirname)(n),configPath:n}}return{config:i,configDir:s,configPath:null}}async function x(i,o){let s=await u(i,"Luis config loader requires one existing working directory."),t=(0,e.resolve)(i,o),n=await u(t,`Luis config path must point to one existing file: ${t}.`),a=(0,e.extname)(n).toLowerCase();if(!h.has(a))throw new Error(`Luis config path must use one supported extension (.mjs or .js): ${n}.`);let g=(0,e.relative)(s,n);if(v(g))throw new Error(`Luis config path must stay inside cwd (${s}): ${n}.`);if(!(await(0,r.stat)(n)).isFile())throw new Error(`Luis config path must point to one file: ${n}.`);return n}async function u(i,o){try{return await(0,r.realpath)(i)}catch{throw new Error(o)}}function v(i){return i===""?!1:i.startsWith("..")||(0,e.isAbsolute)(i)}async function j(i){var t;let o=await import((0,c.pathToFileURL)(i).href),s=(t=o.default)!=null?t:o.luisConfig;if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Luis config must export one object from ${i}.`);return s}
@@ -0,0 +1 @@
1
+ import{realpath as u,stat as c}from"node:fs/promises";import{dirname as g,extname as l,isAbsolute as d,relative as m,resolve as f}from"node:path";import{pathToFileURL as C}from"node:url";var L="luis.config.mjs",w=new Set([".mjs",".js"]);function T(i){return i}async function F(i,s={}){var t;let n=f((t=s.cwd)!=null?t:process.cwd());if(i===void 0||typeof i=="string"){let o=await p(n,i!=null?i:L);return{config:await y(o),configDir:g(o),configPath:o}}return{config:i,configDir:n,configPath:null}}async function p(i,s){let n=await r(i,"Luis config loader requires one existing working directory."),t=f(i,s),o=await r(t,`Luis config path must point to one existing file: ${t}.`),e=l(o).toLowerCase();if(!w.has(e))throw new Error(`Luis config path must use one supported extension (.mjs or .js): ${o}.`);let a=m(n,o);if(h(a))throw new Error(`Luis config path must stay inside cwd (${n}): ${o}.`);if(!(await c(o)).isFile())throw new Error(`Luis config path must point to one file: ${o}.`);return o}async function r(i,s){try{return await u(i)}catch{throw new Error(s)}}function h(i){return i===""?!1:i.startsWith("..")||d(i)}async function y(i){var t;let s=await import(C(i).href),n=(t=s.default)!=null?t:s.luisConfig;if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`Luis config must export one object from ${i}.`);return n}export{T as defineLuisConfig,F as loadLuisConfig};
@@ -0,0 +1,2 @@
1
+ "use strict";var _=Object.create;var y=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)y(e,r,{get:t[r],enumerable:!0})},G=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of N(t))!W.call(e,s)&&s!==r&&y(e,s,{get:()=>t[s],enumerable:!(o=j(t,s))||o.enumerable});return e};var V=(e,t,r)=>(r=e!=null?_(z(e)):{},G(t||!e||!e.__esModule?y(r,"default",{value:e,enumerable:!0}):r,e)),J=e=>G(y({},"__esModule",{value:!0}),e);var Se={};K(Se,{assertHtmlSnapshotSecure:()=>U,assertLuisSourceSecure:()=>O,assertSnapshotEnvelopeSecure:()=>D,scanHtmlSnapshot:()=>h,scanLuisSource:()=>f,scanSnapshotEnvelope:()=>L});module.exports=J(Se);var Q={strict:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},balanced:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},"trusted-build":{luisBytes:1048576,htmlBytes:2097152,sourceCount:128,importDepth:24,importCount:256,importedBytes:4194304,recursionDepth:16}},X={strict:"block",balanced:"warn","trusted-build":"warn"};function m(e){var o,s,i,n,l,a;let t=(o=e==null?void 0:e.preset)!=null?o:"balanced",r=Q[t];return{preset:t,htmlMode:(s=e==null?void 0:e.htmlMode)!=null?s:"hybrid",allowedLocalRoots:[...(i=e==null?void 0:e.allowedLocalRoots)!=null?i:[]],allowedRemoteImportOrigins:Y((n=e==null?void 0:e.allowedRemoteImportOrigins)!=null?n:[]),allowHttpLocalDev:(e==null?void 0:e.allowHttpLocalDev)===!0,limits:{...r,...(l=e==null?void 0:e.limits)!=null?l:{}},unknownFieldMode:(a=e==null?void 0:e.unknownFieldMode)!=null?a:X[t]}}function Y(e){let t=new Set;for(let r of e){let o=r.trim();if(o)try{t.add(new URL(o).origin.toLowerCase())}catch{}}return[...t]}function I(e,t){let r=Math.max(0,Math.min(t,e.length)),o=1,s=1,i=0;for(;i<r;)e.charCodeAt(i)===10?(o+=1,s=1):s+=1,i+=1;return{line:o,column:s}}var Z={"guard.luis.blocked-scheme":{severity:"high"},"guard.luis.absolute-path":{severity:"high"},"guard.luis.remote-import":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.path-outside-root":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.tag-fragment":{severity:"high"},"guard.luis.import-cycle":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.limit-exceeded":{severity:"high"},"guard.html.limit-exceeded":{severity:"high"},"guard.html.blocked-tag":{severity:"high"},"guard.html.blocked-url":{severity:"high"},"guard.html.inline-handler":{severity:"high"},"guard.envelope.invalid-shape":{severity:"high"},"guard.envelope.unknown-field":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}}};function d(e){var i,n;let t=m(e.policy),r=(i=Z[e.code])!=null?i:{severity:"warning"},o=I(e.text,(n=e.index)!=null?n:0),s=q(e.code,r,t,e.blockedOverride);return{code:e.code,severity:r.severity,message:e.message,source:e.source,line:o.line,column:o.column,suggestedAction:e.suggestedAction,blocked:s}}function q(e,t,r,o){var i;if(o!==void 0)return o;if(e==="guard.envelope.unknown-field")return r.unknownFieldMode==="block";let s=(i=t.presetMode)==null?void 0:i[r.preset];return s?s==="block":t.severity==="critical"||t.severity==="high"}var p=require("node:fs"),u=V(require("node:path"),1),P=require("node:url");function x(e){return/^(?:javascript|vbscript|data|blob|file):/i.test(e.trim())}function w(e){return/^(?:https?):\/\//i.test(e.trim())}function ee(e){return e.startsWith("./")||e.startsWith("../")}function S(e){return u.default.posix.isAbsolute(e)||u.default.win32.isAbsolute(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)}function A(e,t){let r=t.trim();return!r||w(r)||x(r)?null:S(r)?u.default.resolve(r):!e||!te(e)||!ee(r)?null:u.default.resolve(u.default.dirname(re(e)),r)}function F(e,t){let r=v(e);if(!r)return!1;for(let o of t){let s=v(o);if(!s)continue;let i=u.default.relative(s,r);if(i===""||!i.startsWith("..")&&!u.default.isAbsolute(i))return!0}return!1}function v(e){try{let t=(0,p.existsSync)(e)?(0,p.realpathSync)(e):u.default.resolve(e);return process.platform==="win32"?t.replace(/\//g,"\\").toLowerCase():t}catch{return null}}function te(e){return S(e)||e.startsWith("file://")}function re(e){return e.startsWith("file://")?(0,P.fileURLToPath)(e):e}function g(e){return e.filter(t=>t.blocked).map(t=>oe(t)).join(`
2
+ `)}function oe(e){return`[${e.code}] ${e.source}:${e.line}:${e.column} ${e.message} Fix: ${e.suggestedAction}`}var se=/@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)'|([^\s;)"']+))/g;function T(e){var r,o,s,i;let t=[];for(let n of e.matchAll(se)){let l=(s=(o=(r=n[1])!=null?r:n[2])!=null?o:n[3])!=null?s:"";l&&t.push({request:l,index:(i=n.index)!=null?i:0})}return t}var E=require("node:fs");function M(e,t){try{let r=new URL(e);return r.protocol==="http:"&&!t.allowHttpLocalDev||r.protocol!=="https:"&&r.protocol!=="http:"?!1:t.allowedRemoteImportOrigins.includes(r.origin.toLowerCase())}catch{return!1}}function $(e){return e.preset==="trusted-build"&&e.allowedLocalRoots.length>0}function B(e){try{return(0,E.readFileSync)(e,"utf8")}catch{return null}}function H(e,t,r,o){let s=[/<script\b/gi,/<iframe\b/gi,/<object\b/gi,/<embed\b/gi,/<base\b/gi,/<meta\b[^>]*http-equiv\s*=\s*["']refresh["']/gi];for(let i of s){let n=i.exec(t);i.lastIndex=0,n&&e.push(d({code:"guard.luis.tag-fragment",message:`Forbidden HTML fragment detected in ${r}.`,source:r,text:t,index:n.index,suggestedAction:"Remove embedded HTML/script fragments from the Luis source.",policy:o}))}}function f(e,t){var s;let r=m(t),o={findings:[],importCount:0,importedBytes:0,stack:[]};return C(e.source,(s=e.sourceId)!=null?s:"<inline>",e.sourceId,r,o,0),o.findings}function O(e,t){let r=f(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function C(e,t,r,o,s,i){if(Buffer.byteLength(e,"utf8")>o.limits.luisBytes){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Source exceeds guard byte limit for ${t}.`,source:t,text:e,suggestedAction:"Split the source or raise the configured luis byte limit.",policy:o}));return}H(s.findings,e,t,o);for(let n of T(e)){if(s.importCount+=1,s.importCount>o.limits.importCount){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import count exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import count limit.",policy:o}));continue}if(i>=o.limits.importDepth){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import depth exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import depth limit.",policy:o}));continue}ie(e,t,r,n.request,n.index,o,s,i)}}function ie(e,t,r,o,s,i,n,l){if(x(o)){n.findings.push(d({code:"guard.luis.blocked-scheme",message:`Blocked import scheme in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Use relative imports or HTTPS allowlisted imports only.",policy:i}));return}if(w(o)){if(M(o,i))return;n.findings.push(d({code:"guard.luis.remote-import",message:`Remote import requires an allowlisted origin in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Add the origin to allowedRemoteImportOrigins or move the import to a local file.",policy:i}));return}if(S(o)&&!$(i)){n.findings.push(d({code:"guard.luis.absolute-path",message:`Absolute local import is blocked in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Use relative imports inside allowedLocalRoots or trusted-build mode.",policy:i}));return}let a=A(r,o);if(a){if(i.allowedLocalRoots.length>0&&!F(a,i.allowedLocalRoots)){n.findings.push(d({code:"guard.luis.path-outside-root",message:`Local import resolves outside allowed roots in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Keep relative imports inside configured roots or remove the import.",policy:i}));return}}else return;let c=v(a);if(c){if(n.stack.includes(c)){n.findings.push(d({code:"guard.luis.import-cycle",message:`Import cycle detected in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Break the import cycle or inline the dependent rules.",policy:i}));return}}else return;let b=B(c);if(b!==null){if(n.importedBytes+=Buffer.byteLength(b,"utf8"),n.importedBytes>i.limits.importedBytes){n.findings.push(d({code:"guard.luis.limit-exceeded",message:`Imported bytes exceed guard limit after reading ${o}.`,source:t,text:e,index:s,suggestedAction:"Reduce imported source volume or raise the imported bytes limit.",policy:i}));return}n.stack.push(c),C(b,c,c,i,n,l+1),n.stack.pop()}}var ne=/<script\b[^>]*>/gi,de=/<(iframe|object|embed|base)\b/gi,le=/<meta\b[^>]*http-equiv\s*=\s*["']refresh["'][^>]*>/gi,ue=/<([a-z][\w:-]*)(?:\s(?:[^<>"']+|"[^"]*"|'[^']*')*)?>/gi,ae=/\son[a-z]+\s*=/gi,ce=/\b(?:href|src|action)\s*=\s*["']\s*(?:javascript|vbscript|data):/gi;function h(e,t){var i;let r=m(t),o=(i=e.source)!=null?i:"<html>",s=[];return Buffer.byteLength(e.html,"utf8")>r.limits.htmlBytes&&s.push(d({code:"guard.html.limit-exceeded",message:`HTML snapshot exceeds guard byte limit for ${o}.`,source:o,text:e.html,suggestedAction:"Reduce HTML snapshot size or raise the configured HTML byte limit.",policy:t})),R(s,e.html,o,r,de,"guard.html.blocked-tag","Remove blocked embed-like tags from the HTML snapshot."),R(s,e.html,o,r,le,"guard.html.blocked-tag","Remove meta refresh tags from the HTML snapshot."),me(s,e.html,o,r),R(s,e.html,o,r,ce,"guard.html.blocked-url","Use safe relative URLs or HTTPS resources only."),ge(s,e.html,o,r),s}function U(e,t){let r=h(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function R(e,t,r,o,s,i,n){for(let l of t.matchAll(s))e.push(d({code:i,message:`Blocked HTML fragment detected in ${r}: ${k(l[0])}`,source:r,text:t,index:l.index,suggestedAction:n,policy:o}))}function me(e,t,r,o){var s,i;for(let n of t.matchAll(ue)){let l=n[0],a=pe(l);for(let c of a.matchAll(ae))e.push(d({code:"guard.html.inline-handler",message:`Blocked HTML fragment detected in ${r}: ${k(l)}`,source:r,text:t,index:((s=n.index)!=null?s:0)+((i=c.index)!=null?i:0),suggestedAction:"Move inline event handlers into trusted application code.",policy:o}))}}function ge(e,t,r,o){if(o.htmlMode==="ssr")for(let s of t.matchAll(ne)){let i=s[0],n=/type\s*=\s*["']application\/json["']/i.test(i)&&/data-lenty-ssr-payload\s*=\s*["']true["']/i.test(i)&&/id\s*=\s*["']lenty-ssr-payload-[^"']+["']/i.test(i),l=/data-lenty-ssr-bootstrap\s*=\s*["']true["']/i.test(i)&&/\ssrc\s*=\s*["'][^"']+["']/i.test(i);n||l||e.push(d({code:"guard.html.blocked-tag",message:`Non-allowlisted script tag detected in ${r}: ${k(i)}`,source:r,text:t,index:s.index,suggestedAction:"Keep only the known LentyStyle SSR payload/bootstrap script tags.",policy:o}))}}function k(e){let t=e.replace(/\s+/g," ").trim();return t.length>96?`${t.slice(0,93)}...`:t}function pe(e){return e.replace(/"[^"]*"|'[^']*'/g,t=>t.length<=2?t:`${t[0]}${" ".repeat(t.length-2)}${t[t.length-1]}`)}var fe=new Set(["routeId","html","sources","schemaVersion"]),he=new Set(["source","sourceId","compileOptions","runtimeOptions"]);function L(e,t){let r=m(t),o=[];if(ye(e,o,r),typeof(e==null?void 0:e.html)!="string"||typeof(e==null?void 0:e.routeId)!="string"||!Array.isArray(e==null?void 0:e.sources))return o;o.push(...h({html:e.html,source:e.routeId},r));for(let s of e.sources)ve(s,e.routeId,o,r),!(typeof(s==null?void 0:s.source)!="string"||typeof(s==null?void 0:s.sourceId)!="string")&&o.push(...f({source:s.source,sourceId:s.sourceId},r));return o}function D(e,t){let r=L(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function ye(e,t,r){let o=JSON.stringify(e,null,2);!e||typeof e!="object"||!e.routeId||typeof e.routeId!="string"||typeof e.html!="string"||!Array.isArray(e.sources)?t.push(d({code:"guard.envelope.invalid-shape",message:"Snapshot envelope must include routeId, html, and sources[].",source:"<envelope>",text:o,suggestedAction:"Send a valid routeId string, html string, and source array.",policy:r})):e.sources.length>r.limits.sourceCount&&t.push(d({code:"guard.envelope.invalid-shape",message:`Snapshot envelope exceeds source count limit (${e.sources.length}).`,source:e.routeId,text:o,suggestedAction:"Reduce the number of sources or raise the configured sourceCount limit.",policy:r}));for(let s of Object.keys(e))fe.has(s)||t.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot envelope field: ${s}`,source:e.routeId||"<envelope>",text:o,suggestedAction:"Remove unknown fields or widen the request contract intentionally.",policy:r}))}function ve(e,t,r,o){let s=JSON.stringify(e,null,2);if(!e||typeof e!="object"||!e.sourceId||typeof e.sourceId!="string"||typeof e.source!="string"){r.push(d({code:"guard.envelope.invalid-shape",message:"Each snapshot source requires string sourceId and source fields.",source:t,text:s,suggestedAction:"Provide string sourceId and source fields for every envelope source.",policy:o}));return}for(let i of Object.keys(e))he.has(i)||r.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot source field: ${i}`,source:t,text:s,suggestedAction:"Remove unknown source fields or widen the request contract intentionally.",policy:o}))}
@@ -0,0 +1,2 @@
1
+ var M={strict:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},balanced:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},"trusted-build":{luisBytes:1048576,htmlBytes:2097152,sourceCount:128,importDepth:24,importCount:256,importedBytes:4194304,recursionDepth:16}},$={strict:"block",balanced:"warn","trusted-build":"warn"};function c(e){var r,s,i,n,l,u;let t=(r=e==null?void 0:e.preset)!=null?r:"balanced",o=M[t];return{preset:t,htmlMode:(s=e==null?void 0:e.htmlMode)!=null?s:"hybrid",allowedLocalRoots:[...(i=e==null?void 0:e.allowedLocalRoots)!=null?i:[]],allowedRemoteImportOrigins:B((n=e==null?void 0:e.allowedRemoteImportOrigins)!=null?n:[]),allowHttpLocalDev:(e==null?void 0:e.allowHttpLocalDev)===!0,limits:{...o,...(l=e==null?void 0:e.limits)!=null?l:{}},unknownFieldMode:(u=e==null?void 0:e.unknownFieldMode)!=null?u:$[t]}}function B(e){let t=new Set;for(let o of e){let r=o.trim();if(r)try{t.add(new URL(r).origin.toLowerCase())}catch{}}return[...t]}function R(e,t){let o=Math.max(0,Math.min(t,e.length)),r=1,s=1,i=0;for(;i<o;)e.charCodeAt(i)===10?(r+=1,s=1):s+=1,i+=1;return{line:r,column:s}}var H={"guard.luis.blocked-scheme":{severity:"high"},"guard.luis.absolute-path":{severity:"high"},"guard.luis.remote-import":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.path-outside-root":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.tag-fragment":{severity:"high"},"guard.luis.import-cycle":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.limit-exceeded":{severity:"high"},"guard.html.limit-exceeded":{severity:"high"},"guard.html.blocked-tag":{severity:"high"},"guard.html.blocked-url":{severity:"high"},"guard.html.inline-handler":{severity:"high"},"guard.envelope.invalid-shape":{severity:"high"},"guard.envelope.unknown-field":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}}};function d(e){var i,n;let t=c(e.policy),o=(i=H[e.code])!=null?i:{severity:"warning"},r=R(e.text,(n=e.index)!=null?n:0),s=O(e.code,o,t,e.blockedOverride);return{code:e.code,severity:o.severity,message:e.message,source:e.source,line:r.line,column:r.column,suggestedAction:e.suggestedAction,blocked:s}}function O(e,t,o,r){var i;if(r!==void 0)return r;if(e==="guard.envelope.unknown-field")return o.unknownFieldMode==="block";let s=(i=t.presetMode)==null?void 0:i[o.preset];return s?s==="block":t.severity==="critical"||t.severity==="high"}import{existsSync as C,lstatSync as he,realpathSync as U}from"node:fs";import m from"node:path";import{fileURLToPath as D}from"node:url";function S(e){return/^(?:javascript|vbscript|data|blob|file):/i.test(e.trim())}function b(e){return/^(?:https?):\/\//i.test(e.trim())}function _(e){return e.startsWith("./")||e.startsWith("../")}function f(e){return m.posix.isAbsolute(e)||m.win32.isAbsolute(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)}function k(e,t){let o=t.trim();return!o||b(o)||S(o)?null:f(o)?m.resolve(o):!e||!j(e)||!_(o)?null:m.resolve(m.dirname(N(e)),o)}function L(e,t){let o=p(e);if(!o)return!1;for(let r of t){let s=p(r);if(!s)continue;let i=m.relative(s,o);if(i===""||!i.startsWith("..")&&!m.isAbsolute(i))return!0}return!1}function p(e){try{let t=C(e)?U(e):m.resolve(e);return process.platform==="win32"?t.replace(/\//g,"\\").toLowerCase():t}catch{return null}}function j(e){return f(e)||e.startsWith("file://")}function N(e){return e.startsWith("file://")?D(e):e}function g(e){return e.filter(t=>t.blocked).map(t=>z(t)).join(`
2
+ `)}function z(e){return`[${e.code}] ${e.source}:${e.line}:${e.column} ${e.message} Fix: ${e.suggestedAction}`}var W=/@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)'|([^\s;)"']+))/g;function G(e){var o,r,s,i;let t=[];for(let n of e.matchAll(W)){let l=(s=(r=(o=n[1])!=null?o:n[2])!=null?r:n[3])!=null?s:"";l&&t.push({request:l,index:(i=n.index)!=null?i:0})}return t}import{readFileSync as K}from"node:fs";function I(e,t){try{let o=new URL(e);return o.protocol==="http:"&&!t.allowHttpLocalDev||o.protocol!=="https:"&&o.protocol!=="http:"?!1:t.allowedRemoteImportOrigins.includes(o.origin.toLowerCase())}catch{return!1}}function P(e){return e.preset==="trusted-build"&&e.allowedLocalRoots.length>0}function A(e){try{return K(e,"utf8")}catch{return null}}function F(e,t,o,r){let s=[/<script\b/gi,/<iframe\b/gi,/<object\b/gi,/<embed\b/gi,/<base\b/gi,/<meta\b[^>]*http-equiv\s*=\s*["']refresh["']/gi];for(let i of s){let n=i.exec(t);i.lastIndex=0,n&&e.push(d({code:"guard.luis.tag-fragment",message:`Forbidden HTML fragment detected in ${o}.`,source:o,text:t,index:n.index,suggestedAction:"Remove embedded HTML/script fragments from the Luis source.",policy:r}))}}function h(e,t){var s;let o=c(t),r={findings:[],importCount:0,importedBytes:0,stack:[]};return T(e.source,(s=e.sourceId)!=null?s:"<inline>",e.sourceId,o,r,0),r.findings}function V(e,t){let o=h(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function T(e,t,o,r,s,i){if(Buffer.byteLength(e,"utf8")>r.limits.luisBytes){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Source exceeds guard byte limit for ${t}.`,source:t,text:e,suggestedAction:"Split the source or raise the configured luis byte limit.",policy:r}));return}F(s.findings,e,t,r);for(let n of G(e)){if(s.importCount+=1,s.importCount>r.limits.importCount){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import count exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import count limit.",policy:r}));continue}if(i>=r.limits.importDepth){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import depth exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import depth limit.",policy:r}));continue}J(e,t,o,n.request,n.index,r,s,i)}}function J(e,t,o,r,s,i,n,l){if(S(r)){n.findings.push(d({code:"guard.luis.blocked-scheme",message:`Blocked import scheme in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Use relative imports or HTTPS allowlisted imports only.",policy:i}));return}if(b(r)){if(I(r,i))return;n.findings.push(d({code:"guard.luis.remote-import",message:`Remote import requires an allowlisted origin in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Add the origin to allowedRemoteImportOrigins or move the import to a local file.",policy:i}));return}if(f(r)&&!P(i)){n.findings.push(d({code:"guard.luis.absolute-path",message:`Absolute local import is blocked in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Use relative imports inside allowedLocalRoots or trusted-build mode.",policy:i}));return}let u=k(o,r);if(u){if(i.allowedLocalRoots.length>0&&!L(u,i.allowedLocalRoots)){n.findings.push(d({code:"guard.luis.path-outside-root",message:`Local import resolves outside allowed roots in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Keep relative imports inside configured roots or remove the import.",policy:i}));return}}else return;let a=p(u);if(a){if(n.stack.includes(a)){n.findings.push(d({code:"guard.luis.import-cycle",message:`Import cycle detected in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Break the import cycle or inline the dependent rules.",policy:i}));return}}else return;let v=A(a);if(v!==null){if(n.importedBytes+=Buffer.byteLength(v,"utf8"),n.importedBytes>i.limits.importedBytes){n.findings.push(d({code:"guard.luis.limit-exceeded",message:`Imported bytes exceed guard limit after reading ${r}.`,source:t,text:e,index:s,suggestedAction:"Reduce imported source volume or raise the imported bytes limit.",policy:i}));return}n.stack.push(a),T(v,a,a,i,n,l+1),n.stack.pop()}}var Q=/<script\b[^>]*>/gi,X=/<(iframe|object|embed|base)\b/gi,Y=/<meta\b[^>]*http-equiv\s*=\s*["']refresh["'][^>]*>/gi,Z=/<([a-z][\w:-]*)(?:\s(?:[^<>"']+|"[^"]*"|'[^']*')*)?>/gi,q=/\son[a-z]+\s*=/gi,ee=/\b(?:href|src|action)\s*=\s*["']\s*(?:javascript|vbscript|data):/gi;function y(e,t){var i;let o=c(t),r=(i=e.source)!=null?i:"<html>",s=[];return Buffer.byteLength(e.html,"utf8")>o.limits.htmlBytes&&s.push(d({code:"guard.html.limit-exceeded",message:`HTML snapshot exceeds guard byte limit for ${r}.`,source:r,text:e.html,suggestedAction:"Reduce HTML snapshot size or raise the configured HTML byte limit.",policy:t})),x(s,e.html,r,o,X,"guard.html.blocked-tag","Remove blocked embed-like tags from the HTML snapshot."),x(s,e.html,r,o,Y,"guard.html.blocked-tag","Remove meta refresh tags from the HTML snapshot."),re(s,e.html,r,o),x(s,e.html,r,o,ee,"guard.html.blocked-url","Use safe relative URLs or HTTPS resources only."),oe(s,e.html,r,o),s}function te(e,t){let o=y(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function x(e,t,o,r,s,i,n){for(let l of t.matchAll(s))e.push(d({code:i,message:`Blocked HTML fragment detected in ${o}: ${w(l[0])}`,source:o,text:t,index:l.index,suggestedAction:n,policy:r}))}function re(e,t,o,r){var s,i;for(let n of t.matchAll(Z)){let l=n[0],u=se(l);for(let a of u.matchAll(q))e.push(d({code:"guard.html.inline-handler",message:`Blocked HTML fragment detected in ${o}: ${w(l)}`,source:o,text:t,index:((s=n.index)!=null?s:0)+((i=a.index)!=null?i:0),suggestedAction:"Move inline event handlers into trusted application code.",policy:r}))}}function oe(e,t,o,r){if(r.htmlMode==="ssr")for(let s of t.matchAll(Q)){let i=s[0],n=/type\s*=\s*["']application\/json["']/i.test(i)&&/data-lenty-ssr-payload\s*=\s*["']true["']/i.test(i)&&/id\s*=\s*["']lenty-ssr-payload-[^"']+["']/i.test(i),l=/data-lenty-ssr-bootstrap\s*=\s*["']true["']/i.test(i)&&/\ssrc\s*=\s*["'][^"']+["']/i.test(i);n||l||e.push(d({code:"guard.html.blocked-tag",message:`Non-allowlisted script tag detected in ${o}: ${w(i)}`,source:o,text:t,index:s.index,suggestedAction:"Keep only the known LentyStyle SSR payload/bootstrap script tags.",policy:r}))}}function w(e){let t=e.replace(/\s+/g," ").trim();return t.length>96?`${t.slice(0,93)}...`:t}function se(e){return e.replace(/"[^"]*"|'[^']*'/g,t=>t.length<=2?t:`${t[0]}${" ".repeat(t.length-2)}${t[t.length-1]}`)}var ie=new Set(["routeId","html","sources","schemaVersion"]),ne=new Set(["source","sourceId","compileOptions","runtimeOptions"]);function E(e,t){let o=c(t),r=[];if(le(e,r,o),typeof(e==null?void 0:e.html)!="string"||typeof(e==null?void 0:e.routeId)!="string"||!Array.isArray(e==null?void 0:e.sources))return r;r.push(...y({html:e.html,source:e.routeId},o));for(let s of e.sources)ue(s,e.routeId,r,o),!(typeof(s==null?void 0:s.source)!="string"||typeof(s==null?void 0:s.sourceId)!="string")&&r.push(...h({source:s.source,sourceId:s.sourceId},o));return r}function de(e,t){let o=E(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function le(e,t,o){let r=JSON.stringify(e,null,2);!e||typeof e!="object"||!e.routeId||typeof e.routeId!="string"||typeof e.html!="string"||!Array.isArray(e.sources)?t.push(d({code:"guard.envelope.invalid-shape",message:"Snapshot envelope must include routeId, html, and sources[].",source:"<envelope>",text:r,suggestedAction:"Send a valid routeId string, html string, and source array.",policy:o})):e.sources.length>o.limits.sourceCount&&t.push(d({code:"guard.envelope.invalid-shape",message:`Snapshot envelope exceeds source count limit (${e.sources.length}).`,source:e.routeId,text:r,suggestedAction:"Reduce the number of sources or raise the configured sourceCount limit.",policy:o}));for(let s of Object.keys(e))ie.has(s)||t.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot envelope field: ${s}`,source:e.routeId||"<envelope>",text:r,suggestedAction:"Remove unknown fields or widen the request contract intentionally.",policy:o}))}function ue(e,t,o,r){let s=JSON.stringify(e,null,2);if(!e||typeof e!="object"||!e.sourceId||typeof e.sourceId!="string"||typeof e.source!="string"){o.push(d({code:"guard.envelope.invalid-shape",message:"Each snapshot source requires string sourceId and source fields.",source:t,text:s,suggestedAction:"Provide string sourceId and source fields for every envelope source.",policy:r}));return}for(let i of Object.keys(e))ne.has(i)||o.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot source field: ${i}`,source:t,text:s,suggestedAction:"Remove unknown source fields or widen the request contract intentionally.",policy:r}))}export{te as assertHtmlSnapshotSecure,V as assertLuisSourceSecure,de as assertSnapshotEnvelopeSecure,y as scanHtmlSnapshot,h as scanLuisSource,E as scanSnapshotEnvelope};
@@ -0,0 +1 @@
1
+ "use strict";var w=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},F=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B(t))!D.call(e,i)&&i!==n&&w(e,i,{get:()=>t[i],enumerable:!(r=N(t,i))||r.enumerable});return e};var _=e=>F(w({},"__esModule",{value:!0}),e);var ne={};z(ne,{LuisSecurityError:()=>c,assertSecurityDependency:()=>y,captureRuntimeCoreScriptElement:()=>v,failClosedSecurityCheck:()=>S,isAllowedLuisSourceUrl:()=>P,isAllowedManifestUrl:()=>k,isAllowedRuntimeScriptUrl:()=>E,isRuntimeDiagnosticsAllowed:()=>U,readRuntimeSecurityPolicy:()=>s,resolveRuntimeCoreScriptInfo:()=>d,resolveRuntimeScriptIntegrity:()=>O,resolveRuntimeStyleNonce:()=>C,rethrowSecurityError:()=>m,verifyLuisSourceIntegrity:()=>j});module.exports=_(ne);var c=class extends Error{constructor(n){super(n);this.code="security-check-failed";this.name="LuisSecurityError"}};function y(e,t){if(!e)throw new c(`[LentyStyle][Security] Required dependency is unavailable: ${t}.`)}function m(e){if(e instanceof c)throw e}function S(e,t){let n=t instanceof Error?t.message:String(t);throw new c(`[LentyStyle][Security] ${e} failed: ${n}`)}var L="",x="";function v(){var n;if(!A())return;let e=document.currentScript;if(!(e instanceof HTMLScriptElement)||!e.src)return;let t=h(e.src,e.getAttribute("data-luis-run"));t&&(L=t.src,x=(n=e.getAttribute("data-luis-run"))!=null?n:"")}function d(){if(!A())return null;if(L){let t=h(L,x);if(t)return t}let e=Array.from(document.querySelectorAll("script[src]"));for(let t=e.length-1;t>=0;t-=1){let n=h(e[t].src,e[t].getAttribute("data-luis-run"));if(n)return n}return null}function h(e,t){if(!e)return null;try{let n=new URL(e,document.baseURI),r=n.pathname;return/\/lentystyle(?:\.min)?\.js$/i.test(r)?{src:n.href,baseHref:new URL(".",n).toString(),origin:n.origin,minified:/\.min\.js$/i.test(r),runTokens:H(t)}:null}catch{return null}}function H(e){if(!e)return[];let t=new Set;for(let n of e.split(",")){let r=n.trim().toLowerCase();r&&t.add(r)}return Array.from(t)}function A(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof URL=="function"}var W=new Set(["javascript:","vbscript:","data:","blob:"]),V=new Set(["http:","https:"]),$=new Set(["lentystyle.min.js","lentystyle.debug.min.js","lentystyle.performance.min.js","lentystyle.map.min.js","lentystyle.lazy.min.js","lentystyle.observed.min.js","lentystyle.worker.min.js","lentystyle.compile.worker.min.js"]);function l(e,t){y(typeof URL=="function","URL API");let n=e.trim();if(!n)return null;try{return new URL(n,t)}catch(r){return m(r),null}}function f(e){let t=e.protocol.toLowerCase();return W.has(t)?!1:V.has(t)}function a(e){var t;return y(typeof window!="undefined"&&!!((t=window.location)!=null&&t.origin),"window.location.origin"),e.origin===window.location.origin}function I(e){return $.has(b(e))}function b(e){var t;return(t=e.pathname.split("/").pop())!=null?t:""}function R(e){let t=new Set;if(!e||e.length===0)return t;for(let n of e){let r=n.trim();if(r)try{t.add(new URL(r).origin)}catch{}}return t}function s(){var t;if(typeof window=="undefined")return{};let e=window;return{...K(),...(t=e.__LentyStyleSecurityPolicy)!=null?t:{}}}function U(){return s().allowRuntimeDiagnostics===!0}function C(){var t;return((t=s().styleNonce)==null?void 0:t.trim())||void 0}function k(e,t){let n=l(e,t);return!n||!f(n)?!1:s().allowCrossOriginManifest===!0||a(n)}function P(e,t){let n=l(e,t);if(!n||!f(n))return!1;let r=s();return a(n)?!0:r.allowCrossOriginLuisSources===!0&&q(r,n)}function q(e,t){var n,r;return!!((r=(n=e.luisSourceIntegrity)==null?void 0:n[t.href])!=null&&r.trim())}function E(e,t){let n=l(e,t);return!n||!f(n)||!I(n)?!1:a(n)?!0:R(s().cdnScriptAllowlist).has(n.origin)}function K(){let e=d();return e?e.runTokens.includes("cdn")?{cdnScriptAllowlist:[e.origin],cdnScriptIntegrityManifest:new URL("lentystyle.integrity.json",e.baseHref).href}:{}:{}}var M=new Map;async function O(e,t){let n=l(e,t);if(!n)return;let r=s(),i=T(r.cdnScriptIntegrity,n);if(i)return i;if(a(n))return;let u=G(r,t);if(!u)return;let o=await J(u);if(o)return T(o,n)}function G(e,t){var o,p,g;let n=(o=e.cdnScriptIntegrityManifest)==null?void 0:o.trim();if(!n)return;let r=(g=(p=d())==null?void 0:p.baseHref)!=null?g:t,i=l(n,r);if(!i||!f(i))return;if(a(i)||R(e.cdnScriptAllowlist).has(i.origin))return i.href}async function J(e){let t=M.get(e);if(t)return t;let n=Q(e);return M.set(e,n),n}async function Q(e){if(typeof fetch!="function")return null;try{let t=await fetch(e);return t.ok?X(await t.json()):null}catch{return null}}function X(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="string")continue;let i=r.trim();i&&(t[n]=i)}return t}function T(e,t){var o,p,g;if(!e)return;let n=b(t),r=(o=e[t.href])==null?void 0:o.trim();if(r)return r;let i=(p=e[t.pathname])==null?void 0:p.trim();return i||((g=e[n])==null?void 0:g.trim())||void 0}var Y={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"};async function j(e,t,n){var u,o;let r=l(e,t);if(!r||!f(r))return!1;if(a(r))return!0;let i=(o=(u=s().luisSourceIntegrity)==null?void 0:u[r.href])==null?void 0:o.trim();return i?Z(n,i):!1}async function Z(e,t){if(typeof crypto=="undefined"||!crypto.subtle||typeof TextEncoder=="undefined")return!1;let n=t.split(/\s+/).filter(Boolean);for(let r of n)if(await ee(e,r))return!0;return!1}async function ee(e,t){let n=t.indexOf("-");if(n<=0)return!1;let r=t.slice(0,n).toLowerCase(),i=t.slice(n+1),u=Y[r];if(!u||!i)return!1;try{let o=await crypto.subtle.digest(u,new TextEncoder().encode(e));return te(o)===i}catch{return!1}}function te(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r+=8192){let i=t.subarray(r,r+8192);n+=String.fromCharCode(...i)}return btoa(n)}
@@ -0,0 +1 @@
1
+ var a=class extends Error{constructor(n){super(n);this.code="security-check-failed";this.name="LuisSecurityError"}};function y(e,t){if(!e)throw new a(`[LentyStyle][Security] Required dependency is unavailable: ${t}.`)}function p(e){if(e instanceof a)throw e}function R(e,t){let n=t instanceof Error?t.message:String(t);throw new a(`[LentyStyle][Security] ${e} failed: ${n}`)}var w="",b="";function U(){var n;if(!x())return;let e=document.currentScript;if(!(e instanceof HTMLScriptElement)||!e.src)return;let t=L(e.src,e.getAttribute("data-luis-run"));t&&(w=t.src,b=(n=e.getAttribute("data-luis-run"))!=null?n:"")}function g(){if(!x())return null;if(w){let t=L(w,b);if(t)return t}let e=Array.from(document.querySelectorAll("script[src]"));for(let t=e.length-1;t>=0;t-=1){let n=L(e[t].src,e[t].getAttribute("data-luis-run"));if(n)return n}return null}function L(e,t){if(!e)return null;try{let n=new URL(e,document.baseURI),r=n.pathname;return/\/lentystyle(?:\.min)?\.js$/i.test(r)?{src:n.href,baseHref:new URL(".",n).toString(),origin:n.origin,minified:/\.min\.js$/i.test(r),runTokens:C(t)}:null}catch{return null}}function C(e){if(!e)return[];let t=new Set;for(let n of e.split(",")){let r=n.trim().toLowerCase();r&&t.add(r)}return Array.from(t)}function x(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof URL=="function"}var k=new Set(["javascript:","vbscript:","data:","blob:"]),P=new Set(["http:","https:"]),E=new Set(["lentystyle.min.js","lentystyle.debug.min.js","lentystyle.performance.min.js","lentystyle.map.min.js","lentystyle.lazy.min.js","lentystyle.observed.min.js","lentystyle.worker.min.js","lentystyle.compile.worker.min.js"]);function c(e,t){y(typeof URL=="function","URL API");let n=e.trim();if(!n)return null;try{return new URL(n,t)}catch(r){return p(r),null}}function f(e){let t=e.protocol.toLowerCase();return k.has(t)?!1:P.has(t)}function l(e){var t;return y(typeof window!="undefined"&&!!((t=window.location)!=null&&t.origin),"window.location.origin"),e.origin===window.location.origin}function v(e){return E.has(h(e))}function h(e){var t;return(t=e.pathname.split("/").pop())!=null?t:""}function S(e){let t=new Set;if(!e||e.length===0)return t;for(let n of e){let r=n.trim();if(r)try{t.add(new URL(r).origin)}catch{}}return t}function u(){var t;if(typeof window=="undefined")return{};let e=window;return{...D(),...(t=e.__LentyStyleSecurityPolicy)!=null?t:{}}}function M(){return u().allowRuntimeDiagnostics===!0}function T(){var t;return((t=u().styleNonce)==null?void 0:t.trim())||void 0}function O(e,t){let n=c(e,t);return!n||!f(n)?!1:u().allowCrossOriginManifest===!0||l(n)}function j(e,t){let n=c(e,t);if(!n||!f(n))return!1;let r=u();return l(n)?!0:r.allowCrossOriginLuisSources===!0&&N(r,n)}function N(e,t){var n,r;return!!((r=(n=e.luisSourceIntegrity)==null?void 0:n[t.href])!=null&&r.trim())}function B(e,t){let n=c(e,t);return!n||!f(n)||!v(n)?!1:l(n)?!0:S(u().cdnScriptAllowlist).has(n.origin)}function D(){let e=g();return e?e.runTokens.includes("cdn")?{cdnScriptAllowlist:[e.origin],cdnScriptIntegrityManifest:new URL("lentystyle.integrity.json",e.baseHref).href}:{}:{}}var A=new Map;async function z(e,t){let n=c(e,t);if(!n)return;let r=u(),i=I(r.cdnScriptIntegrity,n);if(i)return i;if(l(n))return;let s=F(r,t);if(!s)return;let o=await _(s);if(o)return I(o,n)}function F(e,t){var o,m,d;let n=(o=e.cdnScriptIntegrityManifest)==null?void 0:o.trim();if(!n)return;let r=(d=(m=g())==null?void 0:m.baseHref)!=null?d:t,i=c(n,r);if(!i||!f(i))return;if(l(i)||S(e.cdnScriptAllowlist).has(i.origin))return i.href}async function _(e){let t=A.get(e);if(t)return t;let n=H(e);return A.set(e,n),n}async function H(e){if(typeof fetch!="function")return null;try{let t=await fetch(e);return t.ok?W(await t.json()):null}catch{return null}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="string")continue;let i=r.trim();i&&(t[n]=i)}return t}function I(e,t){var o,m,d;if(!e)return;let n=h(t),r=(o=e[t.href])==null?void 0:o.trim();if(r)return r;let i=(m=e[t.pathname])==null?void 0:m.trim();return i||((d=e[n])==null?void 0:d.trim())||void 0}var V={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"};async function $(e,t,n){var s,o;let r=c(e,t);if(!r||!f(r))return!1;if(l(r))return!0;let i=(o=(s=u().luisSourceIntegrity)==null?void 0:s[r.href])==null?void 0:o.trim();return i?q(n,i):!1}async function q(e,t){if(typeof crypto=="undefined"||!crypto.subtle||typeof TextEncoder=="undefined")return!1;let n=t.split(/\s+/).filter(Boolean);for(let r of n)if(await K(e,r))return!0;return!1}async function K(e,t){let n=t.indexOf("-");if(n<=0)return!1;let r=t.slice(0,n).toLowerCase(),i=t.slice(n+1),s=V[r];if(!s||!i)return!1;try{let o=await crypto.subtle.digest(s,new TextEncoder().encode(e));return G(o)===i}catch{return!1}}function G(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r+=8192){let i=t.subarray(r,r+8192);n+=String.fromCharCode(...i)}return btoa(n)}export{a as LuisSecurityError,y as assertSecurityDependency,U as captureRuntimeCoreScriptElement,R as failClosedSecurityCheck,j as isAllowedLuisSourceUrl,O as isAllowedManifestUrl,B as isAllowedRuntimeScriptUrl,M as isRuntimeDiagnosticsAllowed,u as readRuntimeSecurityPolicy,g as resolveRuntimeCoreScriptInfo,z as resolveRuntimeScriptIntegrity,T as resolveRuntimeStyleNonce,p as rethrowSecurityError,$ as verifyLuisSourceIntegrity};
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=(e,r)=>{for(var t in r)c(e,t,{get:r[t],enumerable:!0})},_=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of N(r))!k.call(e,n)&&n!==t&&c(e,n,{get:()=>r[n],enumerable:!(o=U(r,n))||o.enumerable});return e};var P=e=>_(c({},"__esModule",{value:!0}),e);var q={};D(q,{LuisSecurityError:()=>i,assertSecurityDependency:()=>d,createConsoleLentyLogSink:()=>E,emitLentyConsoleLog:()=>s,emitLentyLog:()=>x,failClosedSecurityCheck:()=>v,formatLentyLog:()=>u,hasBlockedScheme:()=>l,hasUnsafeCssPayload:()=>C,isSafeLuisFetchUrl:()=>R,resolveLentyLogEvent:()=>a,rethrowSecurityError:()=>h});module.exports=P(q);var i=class extends Error{constructor(t){super(t);this.code="security-check-failed";this.name="LuisSecurityError"}};function d(e,r){if(!e)throw new i(`[LentyStyle][Security] Required dependency is unavailable: ${r}.`)}function h(e){if(e instanceof i)throw e}function v(e,r){let t=r instanceof Error?r.message:String(r);throw new i(`[LentyStyle][Security] ${e} failed: ${t}`)}var I=/^(?:javascript|vbscript|data|blob|file):/i,b=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,S=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,H=/\\([0-9a-fA-F]{1,6}\s?|.)/g,M=/^[0-9a-fA-F]+$/;function l(e){return I.test(w(e).trim())}function R(e){return!l(e)}function C(e){let r=w(e);return r.includes("</style")||r.includes("<script")||r.includes("</script")||r.includes("javascript:")||b.test(e)||b.test(r)||S.test(e)||S.test(r)}function w(e){return e.replace(H,(r,t)=>{let o=O(t);if(o){let n=Number.parseInt(o,16);return n>1114111?"":String.fromCodePoint(n)}else return t}).toLowerCase()}function O(e){let r=e.trim();return M.test(r)?r:null}var $={RUN0001:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Debug feature requires core script before plugin script."},RUN0002:{scope:"runtime",channel:"performance",severity:"error",layer:"emergency",template:"Performance feature requires core script before plugin script."},RUN0003:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Observed feature requires core script before plugin script."},RUN0004:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Map feature requires core script before plugin script."},RUN0005:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Worker feature requires core script before plugin script."},RUN0006:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Lazy feature requires core script before plugin script."},RUN0007:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"Initial runtime compile failed."},RUN0008:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Runtime {layer} logger bundle could not load. Falling back to emergency console output."},RUN0009:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" could not resolve script URL.'},RUN0010:{scope:"runtime",channel:"security",severity:"error",layer:"critical",template:'Runtime feature "{feature}" blocked: missing SRI hash for cross-origin URL {scriptUrl}.'},RUN0011:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" loaded but did not register.'},RUN0012:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" failed to load: {scriptUrl}'},RUN0013:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}: {warningMessage} (line {line}, code: {warningCode})."},RUN0014:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Loaded imported .luis: {importedHref} (from {sourceLabel})"},RUN0015:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Import diagnostics: {href} (from {importerSourceId}; {sourceLength} chars; {fetchDurationMs} ms; {cacheStatus}; parent: {sourceLabel})"},RUN0016:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} in {headlineDuration} (css: {cssLength} chars){modeSuffix}{executionSuffix}{timingSuffix}{incrementalSuffix}"},RUN0017:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {importHref} in {compileDuration} (css: {cssLength} chars) (imported by: {importerSourceId}; {cacheStatus}; parent: {sourceLabel})"},RUN0018:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} [observed:{event}] in {compileDuration} (css: {cssLength} chars) (observed: {activeRules}/{totalRules} active, changed: {changedRules})"},RUN0019:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{message} (code: resource-limit)."},RUN0020:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:'{sourceLabel}{sourceSuffix}: Invalid observed selector "{selector}"{lineSuffix}. ({reason}, code: invalid-observed-selector).'},RUN0021:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Observed {event}: {sourceLabel} (tokens: {tokenCount}, affected: {changedRules}, active: {activeRules})"},RUN0022:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:'Debug rule map ready: window.__LentyStyleRuleMap["{styleId}"]'},RUN0023:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}{lineLabel} {detailMessage}"},RUN0024:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:".luis stylesheet failed: {href}{lineSuffix}"},RUN0025:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"<style data-luis> failed{lineSuffix}."},GRD0001:{scope:"guard",channel:"security",severity:"error",layer:null,template:"blocked candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},GRD0002:{scope:"guard",channel:"security",severity:"info",layer:null,template:"validated candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},HYB0001:{scope:"hybrid",channel:"hybrid",severity:"info",layer:null,template:"Compiled {routeId} in {duration} (sources: {sourceCount}; compile {compileDuration}; evaluate {evaluateDuration}; cache: {cacheState}; runtime-features: {runtimeFeatures})"},HYB0002:{scope:"hybrid",channel:"debug",severity:"warn",layer:null,template:"{routeId}: {warningMessage} (line {line}, code: {warningCode})."},HYB0003:{scope:"hybrid",channel:"debug",severity:"info",layer:null,template:"{routeId}: {rewriteState}."}};function a(e,r={},t={}){var n;let o=(n=$[e])!=null?n:T(e);return{id:e,...o,message:A(o.template,r),error:t.error}}function T(e){let r=Y(e);return{scope:r,channel:{guard:"security",runtime:"runtime",compiler:"compile",hybrid:"hybrid",ssr:"ssr"}[r],severity:"error",layer:r==="runtime"?"emergency":null,template:`Unregistered log id "${e}".`}}function Y(e){return e.startsWith("RUN")?"runtime":e.startsWith("GRD")?"guard":e.startsWith("HYB")?"hybrid":e.startsWith("SSR")?"ssr":"compiler"}function A(e,r){return e.replace(/\{([a-zA-Z0-9_]+)\}/g,(t,o)=>{let n=r[o];return n===void 0?t:String(n)})}var G="__LentyStyleDispatchLogEvent__";function u(e){let r=e.channel===e.scope?"":`[${e.channel}] `;return`[LentyStyle][${e.scope}][${e.severity}][${e.id}] ${r}${e.message}`}function x(e,r={},t={}){var n;let o=a(e,r,{error:t.error});F(o)||s(o,(n=t.sink)!=null?n:console)}function s(e,r=console){let t=u(e),o=B(e.severity,r);if(e.error===void 0){o(t);return}o(t,e.error)}function E(e=console){return r=>s(r,e)}function B(e,r){var t,o,n,p,y,g,m,L,f;return e==="error"?(o=(t=r.error)!=null?t:r.warn)!=null?o:r.info:e==="warn"?(p=(n=r.warn)!=null?n:r.info)!=null?p:r.error:e==="debug"?(m=(g=(y=r.debug)!=null?y:r.info)!=null?g:r.warn)!=null?m:r.error:(f=(L=r.info)!=null?L:r.warn)!=null?f:r.error}function F(e){let t=globalThis[G];return t?t(e)===!0:!1}
@@ -0,0 +1 @@
1
+ var i=class extends Error{constructor(t){super(t);this.code="security-check-failed";this.name="LuisSecurityError"}};function v(e,r){if(!e)throw new i(`[LentyStyle][Security] Required dependency is unavailable: ${r}.`)}function b(e){if(e instanceof i)throw e}function S(e,r){let t=r instanceof Error?r.message:String(r);throw new i(`[LentyStyle][Security] ${e} failed: ${t}`)}var R=/^(?:javascript|vbscript|data|blob|file):/i,m=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,L=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,C=/\\([0-9a-fA-F]{1,6}\s?|.)/g,w=/^[0-9a-fA-F]+$/;function f(e){return R.test(d(e).trim())}function x(e){return!f(e)}function E(e){let r=d(e);return r.includes("</style")||r.includes("<script")||r.includes("</script")||r.includes("javascript:")||m.test(e)||m.test(r)||L.test(e)||L.test(r)}function d(e){return e.replace(C,(r,t)=>{let n=U(t);if(n){let o=Number.parseInt(n,16);return o>1114111?"":String.fromCodePoint(o)}else return t}).toLowerCase()}function U(e){let r=e.trim();return w.test(r)?r:null}var N={RUN0001:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Debug feature requires core script before plugin script."},RUN0002:{scope:"runtime",channel:"performance",severity:"error",layer:"emergency",template:"Performance feature requires core script before plugin script."},RUN0003:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Observed feature requires core script before plugin script."},RUN0004:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Map feature requires core script before plugin script."},RUN0005:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Worker feature requires core script before plugin script."},RUN0006:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Lazy feature requires core script before plugin script."},RUN0007:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"Initial runtime compile failed."},RUN0008:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Runtime {layer} logger bundle could not load. Falling back to emergency console output."},RUN0009:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" could not resolve script URL.'},RUN0010:{scope:"runtime",channel:"security",severity:"error",layer:"critical",template:'Runtime feature "{feature}" blocked: missing SRI hash for cross-origin URL {scriptUrl}.'},RUN0011:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" loaded but did not register.'},RUN0012:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" failed to load: {scriptUrl}'},RUN0013:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}: {warningMessage} (line {line}, code: {warningCode})."},RUN0014:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Loaded imported .luis: {importedHref} (from {sourceLabel})"},RUN0015:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Import diagnostics: {href} (from {importerSourceId}; {sourceLength} chars; {fetchDurationMs} ms; {cacheStatus}; parent: {sourceLabel})"},RUN0016:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} in {headlineDuration} (css: {cssLength} chars){modeSuffix}{executionSuffix}{timingSuffix}{incrementalSuffix}"},RUN0017:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {importHref} in {compileDuration} (css: {cssLength} chars) (imported by: {importerSourceId}; {cacheStatus}; parent: {sourceLabel})"},RUN0018:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} [observed:{event}] in {compileDuration} (css: {cssLength} chars) (observed: {activeRules}/{totalRules} active, changed: {changedRules})"},RUN0019:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{message} (code: resource-limit)."},RUN0020:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:'{sourceLabel}{sourceSuffix}: Invalid observed selector "{selector}"{lineSuffix}. ({reason}, code: invalid-observed-selector).'},RUN0021:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Observed {event}: {sourceLabel} (tokens: {tokenCount}, affected: {changedRules}, active: {activeRules})"},RUN0022:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:'Debug rule map ready: window.__LentyStyleRuleMap["{styleId}"]'},RUN0023:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}{lineLabel} {detailMessage}"},RUN0024:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:".luis stylesheet failed: {href}{lineSuffix}"},RUN0025:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"<style data-luis> failed{lineSuffix}."},GRD0001:{scope:"guard",channel:"security",severity:"error",layer:null,template:"blocked candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},GRD0002:{scope:"guard",channel:"security",severity:"info",layer:null,template:"validated candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},HYB0001:{scope:"hybrid",channel:"hybrid",severity:"info",layer:null,template:"Compiled {routeId} in {duration} (sources: {sourceCount}; compile {compileDuration}; evaluate {evaluateDuration}; cache: {cacheState}; runtime-features: {runtimeFeatures})"},HYB0002:{scope:"hybrid",channel:"debug",severity:"warn",layer:null,template:"{routeId}: {warningMessage} (line {line}, code: {warningCode})."},HYB0003:{scope:"hybrid",channel:"debug",severity:"info",layer:null,template:"{routeId}: {rewriteState}."}};function a(e,r={},t={}){var o;let n=(o=N[e])!=null?o:k(e);return{id:e,...n,message:_(n.template,r),error:t.error}}function k(e){let r=D(e);return{scope:r,channel:{guard:"security",runtime:"runtime",compiler:"compile",hybrid:"hybrid",ssr:"ssr"}[r],severity:"error",layer:r==="runtime"?"emergency":null,template:`Unregistered log id "${e}".`}}function D(e){return e.startsWith("RUN")?"runtime":e.startsWith("GRD")?"guard":e.startsWith("HYB")?"hybrid":e.startsWith("SSR")?"ssr":"compiler"}function _(e,r){return e.replace(/\{([a-zA-Z0-9_]+)\}/g,(t,n)=>{let o=r[n];return o===void 0?t:String(o)})}var P="__LentyStyleDispatchLogEvent__";function h(e){let r=e.channel===e.scope?"":`[${e.channel}] `;return`[LentyStyle][${e.scope}][${e.severity}][${e.id}] ${r}${e.message}`}function I(e,r={},t={}){var o;let n=a(e,r,{error:t.error});O(n)||s(n,(o=t.sink)!=null?o:console)}function s(e,r=console){let t=h(e),n=M(e.severity,r);if(e.error===void 0){n(t);return}n(t,e.error)}function H(e=console){return r=>s(r,e)}function M(e,r){var t,n,o,c,l,u,p,y,g;return e==="error"?(n=(t=r.error)!=null?t:r.warn)!=null?n:r.info:e==="warn"?(c=(o=r.warn)!=null?o:r.info)!=null?c:r.error:e==="debug"?(p=(u=(l=r.debug)!=null?l:r.info)!=null?u:r.warn)!=null?p:r.error:(g=(y=r.info)!=null?y:r.warn)!=null?g:r.error}function O(e){let t=globalThis[P];return t?t(e)===!0:!1}export{i as LuisSecurityError,v as assertSecurityDependency,H as createConsoleLentyLogSink,s as emitLentyConsoleLog,I as emitLentyLog,S as failClosedSecurityCheck,h as formatLentyLog,f as hasBlockedScheme,E as hasUnsafeCssPayload,x as isSafeLuisFetchUrl,a as resolveLentyLogEvent,b as rethrowSecurityError};