// @bun
var{defineProperty:V,getOwnPropertyNames:o,getOwnPropertyDescriptor:u}=Object,r=Object.prototype.hasOwnProperty;function l(q){return this[q]}var Qq=(q)=>{var Z=(b??=new WeakMap).get(q),$;if(Z)return Z;if(Z=V({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var J of o(q))if(!r.call(Z,J))V(Z,J,{get:l.bind(q,J),enumerable:!($=u(q,J))||$.enumerable})}return b.set(q,Z),Z},b;var s=(q)=>q;function a(q,Z){this[q]=s.bind(null,Z)}var Wq=(q,Z)=>{for(var $ in Z)V(q,$,{get:Z[$],enumerable:!0,configurable:!0,set:a.bind(Z,$)})};var h=(q,Z)=>()=>(q&&(Z=q(q=0)),Z);var Kq=import.meta.require;function _q(q){F={...F,...q}}function Oq(){F={...m}}function kq(){return{...F}}function qq(q){let Z="",$=null,J=!1;for(let X=0;X<q.length;X++){let Y=q[X];if(J){J=!1;continue}if(Y==="\\"&&$){J=!0;continue}if($){if($==="`"&&Y==="$"&&X+1<q.length&&q[X+1]==="{"){let H=1;X+=2;while(X<q.length&&H>0){if(q[X]==="{")H++;else if(q[X]==="}")H--;if(H>0)Z+=q[X],X++}continue}if(Y===$)$=null;continue}if(Y==='"'||Y==="'"||Y==="`"){$=Y;continue}Z+=Y}return Z}function Zq(q,Z){let $=/[$A-Z_a-z][$\w]*/g,J;while((J=$.exec(q))!==null){let X=J[0],Y=q[J.index-1];if(t.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Y==="."&&x.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function $q(q){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,$;while(($=Z.exec(q))!==null){let J=$[2];if(!x.has(J))continue;let X=q.slice(0,$.index).match(/\S(?=\s*$)/)?.[0],Y=q.slice($.index+$[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Y===":"))throw Error(`Potentially unsafe expression (bracket key ${$[2]}): ${q}`)}}function g(q){let Z=q.trim(),$=qq(Z);Zq($,Z),$q(Z);for(let J of S)if(J.test($))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!F.allowBracketNotation&&e.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function d(q){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[$,J]of Object.entries(q)){if($.startsWith("__")||S.some((X)=>X.test($)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[$]=y(J);else Z[$]=J}return Z}function y(q,Z=0){if(Z>=F.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((J)=>y(J,Z+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let $={};for(let[J,X]of Object.entries(q)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")$[J]=y(X,Z+1);else $[J]=X}return $}function _(q,Z){try{let $=d(Z),J=Object.keys($),X=Object.values($);return Xq(q,J)(...X)}catch{return}}function v(q){try{return g(q),!0}catch{return!1}}function jq(q){try{return g(q),null}catch(Z){return Z instanceof Error?Z.message:String(Z)}}function Dq(q,Z){try{let $=_(q,Z);return Boolean($)}catch{return!1}}function Rq(q,Z){try{let $=_(q,Z);if(Array.isArray($))return $;if($&&typeof $==="object"&&"length"in $){let J=$.length;if(typeof J==="number"&&Number.isFinite(J)&&J>=0&&Number.isInteger(J))return Array.from($)}return[]}catch{return[]}}function Tq(q,Z){try{let $=_(q,Z);if($&&typeof $==="object"&&!Array.isArray($))return $;return{}}catch{return{}}}function Xq(q,Z){let $=g(q),J=/^[A-Za-z_$][\w$]*$/,X=[],Y=[];for(let w=0;w<Z.length;w++){let P=Z[w];if(!J.test(P))continue;if(Jq.has(P))continue;X.push(w),Y.push(P)}let H=Function(...Y,`
    'use strict';
    try {
      return ${$};
    }
catch (e) {
      if (e instanceof ReferenceError || e instanceof TypeError) {
        return undefined;
      }
      throw e;
    }
  `);if(Y.length===Z.length)return H;return(...w)=>{let P=Array(X.length);for(let U=0;U<X.length;U++)P[U]=w[X[U]];return H(...P)}}function Nq(q,Z){try{if(typeof q!=="string")return;if(q.length>f)throw Error(`safeEvaluateCode: input exceeds ${f} chars`);for(let H of S)if(H.test(q))throw Error("Potentially unsafe code detected");let $=d(Z),J=Object.keys($),X=Object.values($);return Function(...J,`
      'use strict';
      ${q}
    `)(...X)}catch{return}}function Yq(q){let Z=q.trim(),$=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of $)if(J.test(Z))return!1;return!0}function Mq(q,Z,$,J,X=1000){if(!Yq(Z))throw Error(`Unsafe expression in @${q}: ${Z}`);let Y=$.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,w)=>{return`\${${w}}`});if(q==="for")return Function(...J,`
      'use strict';
      let result = '';
      for (${Z}) {
        result += \`${Y}\`;
      }
      return result;
    // eslint-disable-next-line pickier/no-unused-vars
    `);else return Function(...J,`
      'use strict';
      let result = '';
      let __safeCounter = 0;
      const __maxIterations = ${X};
      while (${Z} && __safeCounter < __maxIterations) {
        __safeCounter++;
        result += \`${Y}\`;
      }
      // Surface the truncation both inline (for end users) and via
      // console.warn (for developers running \`stx dev\`). A silent cut-off
      // made pages render half a list with no breadcrumb.
      if (__safeCounter >= __maxIterations) {
        result += '<!-- [Loop Error]: Maximum iterations exceeded -->';
        if (typeof console !== 'undefined' && typeof console.warn === 'function') {
          console.warn('[stx] @while loop hit max iterations (' + __maxIterations + '); template output was truncated. Raise via createSafeForLoop(..., maxIterations) if intentional.');
        }
      }
      return result;
    // eslint-disable-next-line pickier/no-unused-vars
    `)}var m,F,S,t,x,e,Jq,f=65536;var p=h(()=>{m={maxSanitizeDepth:10,allowBracketNotation:!1},F={...m};S=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],t=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),x=new Set(["__proto__","constructor","prototype"]),e=/[\w)\]]\s*\[\s*['"]/;Jq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});import wq from"crypto";function I(q){return String(q??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Hq(q){return{...E,...q.forms?.classes}}function T(q,Z,$,J){let X=q||Z;return $?`${X} ${J}`:X}function Uq(){return wq.randomUUID()}function gq(q,Z,$,J){let X=Hq(J),Y=q;return Y=Lq(Y,Z),Y=A(Y,Z),Y=Pq(Y,Z,X),Y=Bq(Y,Z,X),Y}function A(q,Z){let $=q;return $=$.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=Uq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),$=$.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Y=X.toUpperCase();if(X&&!["GET","POST"].includes(Y))return`<input type="hidden" name="_method" value="${I(Y)}">`;return J}),$}function Pq(q,Z,$=E){let J=q;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Y,H,w,P,U="")=>{let L=Y||H||"POST",G=w||P||"",z=K(U),B=L.toUpperCase(),W=["GET","POST"].includes(B)?B:"POST",Q=`<form method="${I(W)}" action="${I(G)}"${z?` ${z}`:""}>`;if(Q+=`
  ${A("@csrf",Z)}`,!["GET","POST"].includes(B))Q+=`
  ${A(`@method('${B}')`,Z)}`;return Q}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Y,H,w,P,U="")=>{let L=Y||H||"",G=w||P||"",z=K(U),B=O(L,Z),W=B!==void 0&&B!==null?B:G||"",Q=z.match(/type=['"]([^'"]+)['"]/i),j=Q?Q[1]:"text",D=k(L,Z),N=z.match(/class=['"]([^'"]+)['"]/i),M=T(N?N[1]:"",$.input,D,$.inputError),R=z.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I(j)}" name="${I(L)}" value="${I(W)}" class="${M}"${R?` ${R}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Y,H="",w="")=>{let P=K(H),U=O(Y,Z)||w.trim(),L=k(Y,Z),G=P.match(/class=['"]([^'"]+)['"]/i),z=T(G?G[1]:"",$.input,L,$.inputError),B=P.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I(Y)}" class="${z}"${B?` ${B}`:""}>${I(U)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Y,H="",w)=>{let P=K(H),U=O(Y,Z),L=k(Y,Z),G=P.match(/class=['"]([^'"]+)['"]/i),z=T(G?G[1]:"",$.input,L,$.inputError),B=P.replace(/class=['"][^'"]+['"]/i,""),W=w;if(U!==void 0)W=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(Q,j,D)=>{if((Array.isArray(U)?U.some((M)=>String(M)===D):String(U)===D)&&!j.includes("selected"))return j.replace(/(<option)/,"$1 selected");return Q});return`<select name="${I(Y)}" class="${z}"${B?` ${B}`:""}>${W}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Y,H="1",w="")=>{let P=K(w),U=O(Y,Z),L=U!==void 0&&(Array.isArray(U)?U.some((W)=>String(W)===H):U===!0||String(U)===H),G=P.match(/class=['"]([^'"]+)['"]/i),z=G?G[1]:$.checkInput,B=P.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I(Y)}" value="${I(H)}" class="${z}"${L?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Y,H,w="")=>{let P=K(w),U=O(Y,Z),L=U!==void 0&&U===H,G=P.match(/class=['"]([^'"]+)['"]/i),z=G?G[1]:$.checkInput,B=P.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I(Y)}" value="${I(H)}" class="${z}"${L?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Y,H="")=>{let w=K(H),P=w.match(/accept=['"]([^'"]+)['"]/i),U=P?P[1]:"",L=w.includes("multiple"),G=k(Y,Z),z=w.match(/class=['"]([^'"]+)['"]/i),B=T(z?z[1]:"",$.input,G,$.inputError),W=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),Q=[`<input type="file" name="${I(Y)}"`,`class="${B}"`];if(U)Q.push(`accept="${I(U)}"`);if(L)Q.push("multiple");if(W)Q.push(W);return`${Q.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Y,H="",w)=>{let P=K(H),U=P.match(/class=['"]([^'"]+)['"]/i),L=U?U[1]:$.label,G=P.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I(Y)}" class="${L}"${G?` ${G}`:""}>${w}</label>`}),J}function Bq(q,Z,$=E){return q.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Y)=>{try{if(k(X,Z))return Y.replace(/\{\{([^}]+)\}\}/g,(H,w)=>{try{if(w.trim()==="$message"||w.trim()==="message")return c(X,Z);if(w.trim().includes("errors.first")||w.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return c(X,Z)}let P=w.trim();if(v(P)){let U=_(P,Z);return U!==void 0?String(U):P}return P}catch{return w}});return""}catch(H){return console.error("Error processing @error directive:",H),J}})}function k(q,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has(q);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,q);return!1}function c(q,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get(q);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,q)){let $=Z.errors[q];return Array.isArray($)?$[0]:String($)}return""}function O(q,Z){let $;if(Z.old&&typeof Z.old==="function")return Z.old(q);if(Z.old&&typeof Z.old==="object")return Z.old[q];if(q.endsWith("[]")){let J=q.slice(0,-2);if($=Z[J],$!==void 0)return $}return Z[q]}function K(q){if(!q.trim())return"";let Z=[],$=q.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec($))!==null){let[,Y,,H]=X;Z.push(`${Y}="${H.trim()}"`)}return Z.join(" ")}function Aq(q,Z){n[q]=Z}function C(q){let[Z,...$]=q.split(":"),J=$.length>0?$.join(":").split(","):[];return{name:Z.trim(),params:J}}function Gq(q,Z,$,J={}){let X=[],Y=$.split("|").map((H)=>H.trim()).filter(Boolean);for(let H of Y){let w=C(H),P=n[w.name];if(!P){console.warn(`Unknown validation rule: ${w.name}`);continue}if(w.name==="confirmed"){let L=`${q}_confirmation`;w.params=[J[L]]}let U=P(Z,w.params||[],q);if(U)X.push(w.message||U)}return{field:q,valid:X.length===0,errors:X}}function Eq(q,Z){let $={};for(let[J,X]of Object.entries(Z)){let Y=Gq(J,q[J],X,q);if(!Y.valid)$[J]=Y.errors}return $}function Lq(q,Z){return q.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,($,J,X,Y)=>{let H=X.split("|").map((P)=>P.trim()),w=[];for(let P of H){let U=C(P);switch(U.name){case"required":w.push("required");break;case"email":w.push('type="email"');break;case"url":w.push('type="url"');break;case"numeric":case"integer":if(w.push('type="number"'),U.name==="integer")w.push('step="1"');break;case"min":if(U.params?.[0])w.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])w.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])w.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${J}:${X} -->${w.length>0?`<!-- attrs:${w.join(" ")} -->`:""}`})}function Cq(q){i[q.name]=q}function zq(q,Z,$={}){let J=[],X=Z.split("|").map((Y)=>Y.trim());for(let Y of X){let H=C(Y),w=i[H.name];if(!w){console.warn(`Unknown validation rule: ${H.name}`);continue}let P=w.validate(q,H.params||[],$);if(P!==!0)J.push(P)}return{valid:J.length===0,errors:J}}function bq(q,Z){let $={},J=!0;for(let[X,Y]of Object.entries(Z)){let H=zq(q[X],Y,q);if(!H.valid)J=!1,$[X]=H.errors}return{valid:J,errors:$}}function hq(q,Z){let $=JSON.stringify(Z);return`
<script>
(function() {
  const form = document.getElementById('${q}');
  if (!form) return;

  const rules = ${$};
  const validators = {
    required: (v) => v !== null && v !== undefined && v !== '' ? true : 'This field is required',
    email: (v) => !v || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(v) ? true : 'Please enter a valid email',
    url: (v) => { if (!v) return true; try { new URL(v); return true; }
catch { return 'Please enter a valid URL'; } },
    numeric: (v) => !v || !isNaN(Number(v)) ? true : 'Please enter a number',
    integer: (v) => !v || Number.isInteger(Number(v)) ? true : 'Please enter a whole number',
    min: (v, p) => !v || (typeof v === 'string' ? v.length >= p : v >= p) ? true : 'Too short/small',
    max: (v, p) => !v || (typeof v === 'string' ? v.length <= p : v <= p) ? true : 'Too long/large',
    regex: (v, p) => !v || new RegExp(p).test(v) ? true : 'Invalid format',
  };

  form.addEventListener('submit', function(e) {
    let valid = true;
    const errors = {};

    for (const [field, fieldRules] of Object.entries(rules)) {
      const input = form.querySelector('[name="' + field + '"]');
      if (!input) continue;

      const value = input.value;
      const ruleList = fieldRules.split('|');

      for (const rule of ruleList) {
        const [name, param] = rule.split(':');
        const validator = validators[name];
        if (validator) {
          const result = validator(value, param);
          if (result !== true) {
            valid = false;
            errors[field] = errors[field] || [];
            errors[field].push(result);
            input.classList.add('is-invalid');
            break;
          }
        }
      }
    }

    if (!valid) {
      e.preventDefault();
      console.log('Validation errors:', errors);
    }
  });
})();
</script>`.trim()}var E,n,i;var Iq=h(()=>{p();E={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};n={required:(q,Z,$)=>{if(q===void 0||q===null||q===""||Array.isArray(q)&&q.length===0)return`The ${$} field is required.`;return null},email:(q,Z,$)=>{if(!q)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(q)))return`The ${$} field must be a valid email address.`;return null},min:(q,Z,$)=>{if(!q)return null;let J=Number(Z[0]);if(typeof q==="string"&&q.length<J)return`The ${$} field must be at least ${J} characters.`;if(typeof q==="number"&&q<J)return`The ${$} field must be at least ${J}.`;if(Array.isArray(q)&&q.length<J)return`The ${$} field must have at least ${J} items.`;return null},max:(q,Z,$)=>{if(!q)return null;let J=Number(Z[0]);if(typeof q==="string"&&q.length>J)return`The ${$} field must not exceed ${J} characters.`;if(typeof q==="number"&&q>J)return`The ${$} field must not exceed ${J}.`;if(Array.isArray(q)&&q.length>J)return`The ${$} field must not have more than ${J} items.`;return null},confirmed:(q,Z,$)=>{if(Z[0]!==void 0&&q!==Z[0])return`The ${$} confirmation does not match.`;return null},numeric:(q,Z,$)=>{if(!q)return null;if(Number.isNaN(Number(q)))return`The ${$} field must be a number.`;return null},integer:(q,Z,$)=>{if(!q)return null;if(!Number.isInteger(Number(q)))return`The ${$} field must be an integer.`;return null},alpha:(q,Z,$)=>{if(!q)return null;if(!/^[a-z]+$/i.test(String(q)))return`The ${$} field must only contain letters.`;return null},alphanumeric:(q,Z,$)=>{if(!q)return null;if(!/^[a-z0-9]+$/i.test(String(q)))return`The ${$} field must only contain letters and numbers.`;return null},url:(q,Z,$)=>{if(!q)return null;try{return new URL(String(q))?null:null}catch{return`The ${$} field must be a valid URL.`}},regex:(q,Z,$)=>{if(!q)return null;try{if(!new RegExp(Z[0]).test(String(q)))return`The ${$} field format is invalid.`;return null}catch{return`The ${$} field has an invalid validation pattern.`}},in:(q,Z,$)=>{if(!q)return null;if(!Z.includes(String(q)))return`The ${$} field must be one of: ${Z.join(", ")}.`;return null},notIn:(q,Z,$)=>{if(!q)return null;if(Z.includes(String(q)))return`The ${$} field must not be: ${Z.join(", ")}.`;return null},date:(q,Z,$)=>{if(!q)return null;let J=new Date(q);if(Number.isNaN(J.getTime()))return`The ${$} field must be a valid date.`;return null},before:(q,Z,$)=>{if(!q)return null;let J=new Date(q),X=new Date(Z[0]);if(J>=X)return`The ${$} field must be before ${Z[0]}.`;return null},after:(q,Z,$)=>{if(!q)return null;let J=new Date(q),X=new Date(Z[0]);if(J<=X)return`The ${$} field must be after ${Z[0]}.`;return null}};i={required:{name:"required",validate:(q)=>{if(q===null||q===void 0||q==="")return"This field is required";if(Array.isArray(q)&&q.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:(q)=>{if(!q)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(q))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:(q)=>{if(!q)return!0;try{return new URL(String(q)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:(q)=>{if(!q)return!0;return!Number.isNaN(Number(q))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:(q)=>{if(!q)return!0;let Z=Number(q);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:(q)=>{if(!q)return!0;return/^[a-z]+$/i.test(String(q))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:(q)=>{if(!q)return!0;return/^[a-z0-9]+$/i.test(String(q))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:(q,Z)=>{if(!q)return!0;let $=Number(Z[0]);if(typeof q==="string")return q.length>=$||`Must be at least ${$} characters`;if(typeof q==="number")return q>=$||`Must be at least ${$}`;if(Array.isArray(q))return q.length>=$||`Must have at least ${$} items`;return!0},toHtml5:(q)=>[`minlength="${q[0]}"`,`min="${q[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:(q,Z)=>{if(!q)return!0;let $=Number(Z[0]);if(typeof q==="string")return q.length<=$||`Must be no more than ${$} characters`;if(typeof q==="number")return q<=$||`Must be no more than ${$}`;if(Array.isArray(q))return q.length<=$||`Must have no more than ${$} items`;return!0},toHtml5:(q)=>[`maxlength="${q[0]}"`,`max="${q[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:(q,Z)=>{if(!q)return!0;let[$,J]=Z.map(Number);if(typeof q==="string")return q.length>=$&&q.length<=J||`Must be between ${$} and ${J} characters`;if(typeof q==="number")return q>=$&&q<=J||`Must be between ${$} and ${J}`;return!0},toHtml5:(q)=>[`minlength="${q[0]}"`,`maxlength="${q[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:(q,Z,$)=>{let J=Object.keys($);for(let X of J)if(X.endsWith("_confirmation")&&$[X]===q)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:(q,Z)=>{if(!q)return!0;return Z.includes(String(q))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:(q,Z)=>{if(!q)return!0;return!Z.includes(String(q))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:(q,Z)=>{if(!q)return!0;try{return new RegExp(Z[0]).test(String(q))||"Invalid format"}catch{return"Invalid format"}},toHtml5:(q)=>[`pattern="${q[0]}"`],message:"Invalid format"},date:{name:"date",validate:(q)=>{if(!q)return!0;let Z=new Date(String(q));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:(q,Z)=>{if(!q)return!0;let $=new Date(String(q)),J=new Date(Z[0]);return $<J||`Must be before ${Z[0]}`},toHtml5:(q)=>[`max="${q[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:(q,Z)=>{if(!q)return!0;let $=new Date(String(q)),J=new Date(Z[0]);return $>J||`Must be after ${Z[0]}`},toHtml5:(q)=>[`min="${q[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:(q,Z)=>{if(!q)return!0;let $=Number(Z[0]);if(typeof q==="string")return q.length===$||`Must be exactly ${$} characters`;if(Array.isArray(q))return q.length===$||`Must have exactly ${$} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:(q)=>{if(!q)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String(q))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}}});Iq();export{zq as validateValueEnhanced,bq as validateFormEnhanced,Eq as validateFields,Gq as validateField,Aq as registerValidationRule,Cq as registerEnhancedValidationRule,Lq as processValidateDirective,gq as processForms,Pq as processFormInputDirectives,Bq as processErrorDirective,A as processBasicFormDirectives,hq as generateValidationScript,i as enhancedValidationRules,E as defaultFormClasses};
