// @bun
var{defineProperty:L,getOwnPropertyNames:$,getOwnPropertyDescriptor:A}=Object,B=Object.prototype.hasOwnProperty;function F(j){return this[j]}var O=(j)=>{var k=(U??=new WeakMap).get(j),q;if(k)return k;if(k=L({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var v of $(j))if(!B.call(k,v))L(k,v,{get:F.bind(j,v),enumerable:!(q=A(j,v))||q.enumerable})}return U.set(j,k),k},U;var H=(j)=>j;function S(j,k){this[j]=H.bind(null,k)}var R=(j,k)=>{for(var q in k)L(j,q,{get:k[q],enumerable:!0,configurable:!0,set:S.bind(k,q)})};var x=(j,k)=>()=>(j&&(k=j(j=0)),k);var _=import.meta.require;function I(j,k,q){let v=typeof q==="boolean"?{enabled:q,failOnViolation:q}:q??{enabled:!1},V=v.allowPatterns??[],K=[];for(let{pattern:y,message:z,suggestion:W}of D){if(V.some((G)=>z.includes(G)||y.source.includes(G)))continue;y.lastIndex=0;let Q=j.match(y);if(Q&&Q.length>0){let G=j.split(`
`),J=[];G.forEach((Y,Z)=>{if(y.lastIndex=0,y.test(Y))J.push(Z+1)});let X=J.length>0?` (line${J.length>1?"s":""}: ${J.join(", ")})`:"";K.push(`  \u2717 ${z}${X}
    \u2192 ${W}`)}}if(K.length>0&&v.enabled){let z=`[STX] DOM API violation in ${k.split("/").pop()||k}:
${K.join(`
`)}
  Tip: prefer useRef(), navigate(), and composables for component code`;if(v.failOnViolation)throw Error(z);else console.warn(z)}}var D;var E=x(()=>{D=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});E();export{I as validateClientScript,D as PROHIBITED_DOM_PATTERNS};
