@faqir-ui/core 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/cdn.json +35 -35
  2. package/dist/faqir-core.js +528 -333
  3. package/dist/faqir-core.min.js +3 -3
  4. package/dist/faqir-core.min.js.map +3 -3
  5. package/dist/faqir-core.mjs +532 -482
  6. package/dist/faqir.aurora.css +1486 -1036
  7. package/dist/faqir.brutalist.css +1486 -1036
  8. package/dist/faqir.candy.css +1486 -1036
  9. package/dist/faqir.clinical.css +1486 -1036
  10. package/dist/faqir.contrast.css +1486 -1036
  11. package/dist/faqir.default.css +1486 -1036
  12. package/dist/faqir.document-serif.css +1486 -1036
  13. package/dist/faqir.document.css +1486 -1036
  14. package/dist/faqir.editorial-document.css +1486 -1036
  15. package/dist/faqir.editorial.css +1486 -1036
  16. package/dist/faqir.fintech.css +1486 -1036
  17. package/dist/faqir.glass.css +1486 -1036
  18. package/dist/faqir.ink-document.css +1486 -1036
  19. package/dist/faqir.ink.css +1486 -1036
  20. package/dist/faqir.luxe.css +1486 -1036
  21. package/dist/faqir.midnight.css +1486 -1036
  22. package/dist/faqir.neo.css +1486 -1036
  23. package/dist/faqir.neumorph.css +1486 -1036
  24. package/dist/faqir.nordic.css +1486 -1036
  25. package/dist/faqir.organic.css +1486 -1036
  26. package/dist/faqir.paper.css +1486 -1036
  27. package/dist/faqir.slate.css +1486 -1036
  28. package/dist/faqir.soft.css +1486 -1036
  29. package/dist/faqir.sunset.css +1486 -1036
  30. package/dist/faqir.swiss-document.css +1486 -1036
  31. package/dist/faqir.swiss.css +1486 -1036
  32. package/dist/faqir.terminal.css +1486 -1036
  33. package/dist/plugins/faqir-mask.js +1 -2
  34. package/dist/plugins/faqir-rules.js +1 -1
  35. package/dist/sri.json +33 -33
  36. package/faqir-core.d.ts +18 -3
  37. package/package.json +1 -1
@@ -254,7 +254,6 @@
254
254
  selectionStart: selectionStart == null ? el.selectionStart : selectionStart,
255
255
  selectionEnd: selectionEnd == null ? el.selectionEnd : selectionEnd,
256
256
  }),
257
- true,
258
257
  );
259
258
  }
260
259
 
@@ -289,7 +288,7 @@
289
288
  var caret = el.selectionStart;
290
289
  var result = formatResult(el.value);
291
290
  result.caret = Math.min(caret == null ? result.value.length : caret, result.value.length);
292
- commit(result, true);
291
+ commit(result);
293
292
  }
294
293
 
295
294
  el.addEventListener("beforeinput", onBeforeInput, true);
@@ -60,4 +60,4 @@
60
60
  * `aria-required` on a control it was told to own, and a computed control's
61
61
  * `value` — the frozen five-attribute protocol is untouched.
62
62
  */
63
- (()=>{var{defineProperty:$1,getOwnPropertyNames:W8,getOwnPropertyDescriptor:V8}=Object,X8=Object.prototype.hasOwnProperty;var _1=new WeakMap,K8=(Z)=>{var Q=_1.get(Z),B;if(Q)return Q;if(Q=$1({},"__esModule",{value:!0}),Z&&typeof Z==="object"||typeof Z==="function")W8(Z).map((W)=>!X8.call(Q,W)&&$1(Q,W,{get:()=>Z[W],enumerable:!(B=V8(Z,W))||B.enumerable}));return _1.set(Z,Q),Q};var U8=(Z,Q)=>{for(var B in Q)$1(Z,B,{get:Q[B],enumerable:!0,configurable:!0,set:(W)=>Q[B]=()=>W})};var XZ={};U8(XZ,{install:()=>Q8});class H extends Error{constructor(Z,Q){super(`@faqir-ui/rules: ${Z}`);this.name="DefinitionError",this.path=Q}}var z8=/^(\d{4})-(\d{2})-(\d{2})$/,Y8=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/i,H8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,G8=/^[A-Za-z][A-Za-z0-9+.-]*:[^\s\x00-\x1f]+$/,C8=/^[^\s@,;<>()[\]\\"]+@[^\s@.,;<>()[\]\\"]+(?:\.[^\s@.,;<>()[\]\\"]+)*\.[A-Za-z]{2,}$/,F8=/^\+?[0-9 ().-]{6,24}$/,M8=/^[A-Za-z0-9][A-Za-z0-9 -]{0,10}[A-Za-z0-9]$/,I8=/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/,A8=[31,28,31,30,31,30,31,31,30,31,30,31];function O8(Z){return Z%4===0&&Z%100!==0||Z%400===0}function D1(Z){let Q=z8.exec(Z);if(!Q)return!1;let B=Number(Q[1]),W=Number(Q[2]),J=Number(Q[3]);if(W<1||W>12||J<1)return!1;let $=W===2&&O8(B)?29:A8[W-1];return J<=$}function R1(Z){let Q=Y8.exec(Z);if(!Q)return!1;let B=Number(Q[1]),W=Number(Q[2]),J=Q[3]===void 0?0:Number(Q[3]);return B<=23&&W<=59&&J<=60}function N8(Z){let Q=/^(.+?)[Tt ](.+)$/.exec(Z);if(!Q)return!1;return D1(Q[1])&&R1(Q[2])}function q8(Z){if(!F8.test(Z))return!1;let Q=Z.replace(/\D/g,"");return Q.length>=7&&Q.length<=15}function L8(Z){let Q=Z.replace(/[\s-]/g,"").toUpperCase();if(!I8.test(Q))return!1;let B=Q.slice(4)+Q.slice(0,4),W="";for(let $ of B)W+=$>="A"&&$<="Z"?String($.charCodeAt(0)-55):$;let J=0;for(let $=0;$<W.length;$+=7)J=Number(String(J)+W.slice($,$+7))%97;return J===1}function T8(Z){if(Z.length<2||Z.length>12)return!1;if(!M8.test(Z))return!1;return!/[ -]{2}/.test(Z)}var m=new Map([["email",(Z)=>C8.test(Z)&&Z.length<=254],["uri",(Z)=>G8.test(Z)],["date",D1],["time",R1],["date-time",N8],["phone",q8],["iban",L8],["uuid",(Z)=>H8.test(Z)],["postal-code",T8]]),zZ=Object.freeze([...m.keys()]);function b1(Z){return m.has(Z)}function k1(){return[...m.keys()].sort()}function E1(Z,Q){let B=m.get(Z);if(!B)return!0;return B(Q)===!0}var _=1000,h=1e4,J1=1000,B1=64,W1=9999;var j8=Object.freeze(["required","type","enum","const","pattern","format","minLength","maxLength","minimum","exclusiveMinimum","maximum","exclusiveMaximum","multipleOf","minItems","maxItems","uniqueItems"]),y1=Object.freeze({required:"This field is required.",type:"Please enter a valid value.",enum:"Please choose one of the allowed values.",const:"Please enter the required value.",pattern:"Please match the requested format.",format:"Please enter a valid value.",minLength:"Please lengthen this value.",maxLength:"Please shorten this value.",minimum:"Value is too small.",exclusiveMinimum:"Value is too small.",maximum:"Value is too large.",exclusiveMaximum:"Value is too large.",multipleOf:"Please enter a valid value.",minItems:"Please choose more items.",maxItems:"Please choose fewer items.",uniqueItems:"Please remove the duplicate entries."}),D=Object.freeze({rule:"Please check this value.","remote-error":"This value could not be checked right now."}),V1="en";function c(Z,Q){if(!Q||typeof Z!=="string"||Z.indexOf("{")===-1)return Z;return Z.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(B,W)=>{if(!Object.prototype.hasOwnProperty.call(Q,W))return B;let J=Q[W];if(J===void 0||J===null)return B;if(Array.isArray(J))return J.map(($)=>String($)).join(", ");return String(J)})}function R(Z){let{messages:Q,locale:B,path:W,rule:J,params:$,fallback:V}=Z,K=Z.defaultLocale||"en",U=[`${W}.${J}`,J];for(let X of[B,K]){if(!X)continue;let Y=Q&&Object.prototype.hasOwnProperty.call(Q,X)?Q[X]:void 0;if(!Y)continue;for(let z of U){let G=Object.prototype.hasOwnProperty.call(Y,z)?Y[z]:void 0;if(typeof G==="string")return c(G,$)}}if(typeof V==="string")return c(V,$);for(let X of[y1,D])if(Object.prototype.hasOwnProperty.call(X,J)){let Y=X[J];if(typeof Y==="string")return c(Y,$)}return J}function x(Z){return{min:1,unbounded:!1,wide:!1,flex:!1,zeroWidth:!1,empty:!1,first:Z,innerUnbounded:!1,innerSole:!1,ambiguous:!1}}function P8(Z){return Z.flex||Z.innerSole}function S8(Z,Q){let B=Z[Q],W=null;if(B==="*")W={min:0,max:1/0,end:Q+1};else if(B==="+")W={min:1,max:1/0,end:Q+1};else if(B==="?")W={min:0,max:1,end:Q+1};else if(B==="{"){let J=/^\{(\d+)(,(\d*))?\}/.exec(Z.slice(Q));if(!J)return null;let $=Number(J[1]),V=J[2]===void 0?$:J[3]===""?1/0:Number(J[3]);W={min:$,max:V,end:Q+J[0].length}}if(W&&Z[W.end]==="?")W.end+=1;return W}function _8(Z,Q){if(Z[Q+2]==="{"&&"upP".includes(Z[Q+1])){let B=Z.indexOf("}",Q+3);if(B!==-1)return B+1}return Q+2}function D8(Z,Q){let B;try{B=Z.map((W)=>new RegExp(`^(?:${W})$`))}catch{return!0}for(let W of Q)if(B.filter((J)=>J.test(W)).length>1)return!0;return!1}function R8(Z){let Q=["(?!)"];for(let B of Z)if(Q.push(B.first),!B.empty)return{first:Q.join("|"),empty:!1};return{first:Q.join("|"),empty:!0}}function u(Z){let Q=[{alternatives:[[]],zeroWidth:!1}],B=!1,W=!1,J=new Set(`${Z} \u2028\uFEFF`);for(let U=0;U<128;U+=1)J.add(String.fromCharCode(U));let $=()=>{let U=Q[Q.length-1];return U.alternatives[U.alternatives.length-1]},V=()=>Object.assign(x("(?!)"),{zeroWidth:!0,empty:!0}),K=0;while(K<Z.length){let U=Z[K];if(U==="\\"){let X=_8(Z,K);$().push("bB".includes(Z[K+1])?V():x(Z.slice(K,X))),K=X}else if(U==="["){let X=K+1;while(X<Z.length&&Z[X]!=="]")X=Z[X]==="\\"?X+2:X+1;$().push(x(Z.slice(K,X+1))),K=X+1}else if(U==="("){let X=K+1,Y=!1;if(Z[X]==="?")if(Z[X+1]==="="||Z[X+1]==="!")Y=!0,X+=2;else if(Z[X+1]==="<"&&(Z[X+2]==="="||Z[X+2]==="!"))Y=!0,X+=3;else if(Z[X+1]==="<"){let z=Z.indexOf(">",X+2);X=z===-1?X+2:z+1}else X+=2;Q.push({alternatives:[[]],zeroWidth:Y}),K=X}else if(U===")"&&Q.length>1){let X=Q.pop(),Y=X.alternatives.map(R8),z=X.zeroWidth?V():x(Y.map((G)=>G.first).join("|"));z.empty||=Y.some((G)=>G.empty),z.ambiguous=Y.length>1&&D8(Y.map((G)=>G.first),J);for(let G of X.alternatives){if(G.some((C)=>C.unbounded||C.innerUnbounded))z.innerUnbounded=!0;if(G.some((C)=>C.ambiguous))z.ambiguous=!0;let A=G.findIndex(P8);if(A!==-1&&G.every((C,M)=>M===A||C.min===0||C.zeroWidth))z.innerSole=!0}$().push(z),K+=1}else if(U==="|")Q[Q.length-1].alternatives.push([]),K+=1;else if(U==="^"||U==="$")$().push(V()),K+=1;else{let X=S8(Z,K),Y=$(),z=Y[Y.length-1];if(X&&z){if(z.min=z.min*X.min,z.unbounded=X.max===1/0,z.wide=X.max>1,z.flex=z.wide&&X.max>X.min,X.min===0)z.empty=!0;if(!z.zeroWidth&&z.innerUnbounded&&z.wide)B=!0;if(!z.zeroWidth&&X.max>10&&(z.innerSole||z.ambiguous))W=!0;K=X.end}else $().push(x(U)),K+=1}}if(W)return"catastrophic";return B?"nested":null}function n(Z){return`${Z} repeats a group that can match the same text more than one way, like (a+)+ or (a|a)+, and can backtrack catastrophically.`}var l="1";class o{constructor(Z,Q,B,W,J){this.version=l,this.fields=Z,this.required=Q,this.messages=B,this.defaultLocale=W,this.rules=J}}var b8=["string","number","integer","boolean"],x1=new Set([...b8,"object","array"]),v1=new Set(["version","fields","required","messages","defaultLocale","rules"]),y=["type","title","description","required","enum","const"],f1={string:new Set([...y,"pattern","format","minLength","maxLength"]),number:new Set([...y,"minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"]),integer:new Set([...y,"minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"]),boolean:new Set(y),object:new Set([...y,"properties"]),array:new Set([...y,"items","minItems","maxItems","uniqueItems"])},k8=Object.freeze(Object.fromEntries(Object.entries(f1).map(([Z,Q])=>[Z,Object.freeze([...Q].sort())]))),E8=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"],y8=0.000000001;function I(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function O(Z,Q){return Object.prototype.hasOwnProperty.call(Z,Q)}var g1=new Set(["__proto__","constructor","prototype"]);function z1(Z){return T(Z).some((Q)=>g1.has(Q))}function j(Z,Q){if(z1(Z))throw new H(`the path "${Z}" at ${Q} names __proto__, constructor or prototype.`,Q)}function q(Z){return Z.replace(/\[(\d+)\]/g,".$1")}function T(Z){return q(Z).split(".").filter((Q)=>Q.length>0)}function w(Z,Q){let B=Z,W=Q;while(W.length>0){if(B===void 0||B===null)return;if(I(B)&&O(B,W))return B[W];let J=T(W);if(J.length===0)return;let $=J[0];if(Array.isArray(B)){let V=Number($);if(!Number.isInteger(V))return;B=B[V]}else if(I(B))B=O(B,$)?B[$]:void 0;else return;W=J.slice(1).join(".")}return B}function x8(Z){for(let Q of T(Z)){if(g1.has(Q))return!1;if(/^\d+$/.test(Q)&&Number(Q)>W1)return!1}return!0}function w1(Z,Q,B){let W=T(Q),J=Z;for(let $=0;$<W.length-1;$++){let V=W[$],K=/^\d+$/.test(W[$+1]),U=O(J,V)?J[V]:void 0,X=I(U)||Array.isArray(U)?U:K?[]:{};J[V]=X,J=X}J[W[W.length-1]]=B}function v8(Z,Q){let B=T(Q),W=Z;for(let $=0;$<B.length-1;$++)if(W=O(W,B[$])?W[B[$]]:void 0,!I(W)&&!Array.isArray(W))return;let J=B[B.length-1];if(Array.isArray(W))W.splice(Number(J),1);else if(I(W))delete W[J]}function v(Z,Q,B){let W=Z[Q];if(W===void 0)return;if(typeof W!=="number"||!Number.isFinite(W))throw new H(`"${Q}" at ${B} must be a finite number.`,B)}function X1(Z,Q){if(!I(Z))throw new H(`the field schema at ${Q} must be an object.`,Q);let B=Z.type;if(typeof B!=="string"||!x1.has(B))throw new H(`the field at ${Q} needs a "type" of ${[...x1].join(", ")}${B===void 0?"":` (got ${JSON.stringify(B)})`}.`,Q);let W=f1[B];for(let $ of Object.keys(Z))if(!W.has($))throw new H(`unsupported keyword "${$}" at ${Q} (a "${B}" field accepts ${[...W].sort().join(", ")}).`,Q);let J={type:B,schema:Z};if(Z.required!==void 0)if(Z.required===!0)J.selfRequired=!0;else if(B==="object"&&Array.isArray(Z.required)){for(let $ of Z.required)if(typeof $!=="string")throw new H(`"required" at ${Q} must list property names.`,Q);J.requiredChildren=new Set(Z.required)}else throw new H(B==="object"?`"required" at ${Q} must be true (the object itself is required) or an array of property names.`:`"required" at ${Q} must be true; only an object field may list property names.`,Q);if(Z.enum!==void 0&&(!Array.isArray(Z.enum)||Z.enum.length===0))throw new H(`"enum" at ${Q} must be a non-empty array.`,Q);if(B==="string"){if(Z.pattern!==void 0){if(typeof Z.pattern!=="string")throw new H(`"pattern" at ${Q} must be a string.`,Q);if(Z.pattern.length>_)throw new H(`"pattern" at ${Q} is ${Z.pattern.length} characters; the limit is ${_}.`,Q);try{J.regex=new RegExp(Z.pattern)}catch($){throw new H(`"pattern" at ${Q} is not a valid regular expression: ${$ instanceof Error?$.message:String($)}`,Q)}if(u(Z.pattern)==="catastrophic")throw new H(n(`"pattern" at ${Q}`),Q)}if(Z.format!==void 0){if(typeof Z.format!=="string"||!b1(Z.format))throw new H(`unknown format ${JSON.stringify(Z.format)} at ${Q} (known: ${k1().join(", ")} — add one with registerFormat).`,Q)}v(Z,"minLength",Q),v(Z,"maxLength",Q)}if(B==="number"||B==="integer"){for(let $ of E8)v(Z,$,Q);if(typeof Z.multipleOf==="number"&&Z.multipleOf<=0)throw new H(`"multipleOf" at ${Q} must be greater than zero.`,Q)}if(B==="object"){let $=new Map;if(Z.properties!==void 0){if(!I(Z.properties))throw new H(`"properties" at ${Q} must be an object.`,Q);for(let[V,K]of Object.entries(Z.properties))j(V,`${Q}.properties`),$.set(V,X1(K,`${Q}.${V}`))}for(let V of J.requiredChildren??[])if(!$.has(V))throw new H(`"required" at ${Q} names "${V}", which is not one of its properties.`,Q);J.properties=$}if(B==="array"){if(v(Z,"minItems",Q),v(Z,"maxItems",Q),Z.uniqueItems!==void 0&&typeof Z.uniqueItems!=="boolean")throw new H(`"uniqueItems" at ${Q} must be a boolean.`,Q);if(Z.items!==void 0){let $=X1(Z.items,`${Q}[]`);if($.selfRequired)throw new H(`"required" at ${Q}[] has no meaning: array items are checked by minItems, not by presence.`,`${Q}[]`);J.items=$}}return J}function Y1(Z){if(Z instanceof o)return Z;if(!I(Z))throw new H("a definition must be an object.","");for(let W of Object.keys(Z))if(!v1.has(W))throw new H(`unsupported definition key "${W}" (accepted: ${[...v1].sort().join(", ")}).`,W);if(Z.version!==void 0&&Z.version!==l)throw new H(`unsupported definition version ${JSON.stringify(Z.version)}; this package implements "${l}".`,"version");if(Z.fields!==void 0&&!I(Z.fields))throw new H('"fields" must be a map of paths to field schemas.',"fields");if(Z.messages!==void 0&&!I(Z.messages))throw new H('"messages" must be a map of locales to message tables.',"messages");if(Z.defaultLocale!==void 0&&typeof Z.defaultLocale!=="string")throw new H('"defaultLocale" must be a string.',"defaultLocale");if(Z.rules!==void 0&&!Array.isArray(Z.rules))throw new H('"rules" must be an array.',"rules");let Q=new Map;for(let[W,J]of Object.entries(Z.fields??{})){if(T(W).length===0)throw new H('"fields" has an empty path key.',"fields");j(W,"fields"),Q.set(q(W),X1(J,W))}let B=new Set;if(Z.required!==void 0){if(!Array.isArray(Z.required))throw new H('"required" must be an array of field paths.',"required");for(let W of Z.required){if(typeof W!=="string")throw new H('"required" must list field paths as strings.',"required");let J=q(W);if(!Q.has(J))throw new H(`"required" names "${W}", which is not a key of "fields".`,"required");B.add(J)}}return new o(Q,B,Z.messages??{},typeof Z.defaultLocale==="string"?Z.defaultLocale:V1,Array.isArray(Z.rules)?Z.rules:[])}function H1(Z){if(Z===void 0||Z===null)return!0;if(typeof Z==="string"&&Z.length===0)return!0;if(Array.isArray(Z)&&Z.length===0)return!0;return!1}function w8(Z,Q){switch(Q){case"string":return typeof Z==="string";case"number":return typeof Z==="number"&&Number.isFinite(Z);case"integer":return typeof Z==="number"&&Number.isInteger(Z);case"boolean":return typeof Z==="boolean";case"object":return I(Z);case"array":return Array.isArray(Z);default:return!1}}function b(Z){if(Array.isArray(Z))return`[${Z.map(b).join(",")}]`;if(I(Z))return`{${Object.keys(Z).sort().map((Q)=>`${JSON.stringify(Q)}:${b(Z[Q])}`).join(",")}}`;return JSON.stringify(Z)??"undefined"}function K1(Z,Q,B,W,J){let $=Z.schema,V=(U,X)=>{J.findings.push({path:B,rule:U,message:R({messages:J.messages,locale:J.locale,defaultLocale:J.defaultLocale,path:B,rule:U,params:{path:B,title:$.title,...X}}),params:X})};if(H1(Q)){if(W)V("required",{});return}let K=Z.type;if(!w8(Q,K)){V("type",{type:K});return}if($.enum!==void 0){let U=$.enum;if(!U.some((X)=>b(X)===b(Q)))V("enum",{allowed:U})}if($.const!==void 0&&b($.const)!==b(Q))V("const",{const:$.const});if(K==="string"){let U=Q;if(Z.regex&&(U.length>h||!Z.regex.test(U)))V("pattern",{pattern:$.pattern});if(typeof $.format==="string"&&!E1($.format,U))V("format",{format:$.format});let X=[...U].length;if(typeof $.minLength==="number"&&X<$.minLength)V("minLength",{limit:$.minLength,actual:X});if(typeof $.maxLength==="number"&&X>$.maxLength)V("maxLength",{limit:$.maxLength,actual:X})}if(K==="number"||K==="integer"){let U=Q;if(typeof $.minimum==="number"&&U<$.minimum)V("minimum",{limit:$.minimum});if(typeof $.exclusiveMinimum==="number"&&U<=$.exclusiveMinimum)V("exclusiveMinimum",{limit:$.exclusiveMinimum});if(typeof $.maximum==="number"&&U>$.maximum)V("maximum",{limit:$.maximum});if(typeof $.exclusiveMaximum==="number"&&U>=$.exclusiveMaximum)V("exclusiveMaximum",{limit:$.exclusiveMaximum});if(typeof $.multipleOf==="number"){let X=U/$.multipleOf;if(Math.abs(X-Math.round(X))>y8)V("multipleOf",{multipleOf:$.multipleOf})}}if(K==="array"){let U=Q;if(typeof $.minItems==="number"&&U.length<$.minItems)V("minItems",{limit:$.minItems,actual:U.length});if(typeof $.maxItems==="number"&&U.length>$.maxItems)V("maxItems",{limit:$.maxItems,actual:U.length});if($.uniqueItems===!0){let X=new Set;for(let Y=0;Y<U.length;Y++){let z=b(U[Y]);if(X.has(z)){V("uniqueItems",{index:Y});break}X.add(z)}}if(Z.items)for(let X=0;X<U.length;X++)K1(Z.items,U[X],`${B}.${X}`,!1,J)}if(K==="object"&&Z.properties){let U=Z.requiredChildren;for(let[X,Y]of Z.properties){let z=Y.selfRequired===!0||U!==void 0&&U.has(X);K1(Y,w(Q,X),`${B}.${X}`,z,J)}}}function p1(Z,Q,B){let W={findings:[],messages:Z.messages,locale:B?.locale,defaultLocale:Z.defaultLocale},J=B?.required;for(let[$,V]of Z.fields){let K=V.selfRequired===!0||Z.required.has($)||J!==void 0&&J.has($);K1(V,w(Q,$),$,K,W)}return W.findings}var f8=new Set(["true","on","yes","1"]),g8=new Set(["false","off","no","0"]),p8=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;function d8(Z,Q){if(typeof Z!=="string")return Z;let B=Z.trim();if(B.length===0)return;if(Q==="number"||Q==="integer")return p8.test(B)?Number(B):Z;if(Q==="boolean"){let W=B.toLowerCase();if(f8.has(W))return!0;if(g8.has(W))return!1;return Z}return Z}function U1(Z,Q){if(Z.type==="array"){if(Q===void 0||Q===null)return Q;let B=Array.isArray(Q)?Q:Q===""?[]:[Q];return(Z.items?B.map((J)=>U1(Z.items,J)):B.slice()).filter((J)=>J!==void 0)}if(Z.type==="object"){if(!I(Q))return Q;let B={...Q};for(let[W,J]of Z.properties??[]){if(!Object.prototype.hasOwnProperty.call(B,W))continue;let $=U1(J,B[W]);if($===void 0)delete B[W];else B[W]=$}return B}return d8(Q,Z.type)}function G1(Z){let Q={},B=(J,$)=>{if(typeof $!=="string"||z1($))return;if(!O(Q,$))Q[$]=J;else if(Array.isArray(Q[$]))Q[$].push(J);else Q[$]=[Q[$],J]},W=Z;if(W&&typeof W[Symbol.iterator]==="function"){for(let J of W)if(Array.isArray(J))B(J[1],J[0])}else if(W&&typeof W.forEach==="function")W.forEach(B);return Q}function C1(Z,Q){let B=Y1(Z);if(!I(Q))return{};let W=new Set;for(let $ of B.fields.keys())W.add(T($)[0]);let J={};for(let[$,V]of Object.entries(Q)){if(z1($))continue;let K=T($);if(K.length>1&&W.has(K[0])&&x8($))w1(J,$,V);else J[$]=V}for(let[$,V]of B.fields){let K=w(J,$);if(K===void 0)continue;let U=U1(V,K);if(U===void 0)v8(J,$);else w1(J,$,U)}return J}var h1=Object.freeze({var:0,missing:0,missing_some:2,if:0,and:1,or:1,"!":1,"!!":1,"==":2,"===":2,"!=":2,"!==":2,"<":2,"<=":2,">":2,">=":2,"+":1,"-":1,"*":1,"/":2,"%":2,min:1,max:1,cat:0,substr:2,in:2,some:2,all:2,none:2,date:3,regex:2}),c1=Object.freeze(Object.keys(h1)),m8=new Set(c1),u1=Object.freeze(["==","!=","<","<=",">",">="]),h8=new Set(u1),s=new Map,c8=200;function i(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function N(Z){if(Array.isArray(Z))return Z.length>0;return Boolean(Z)}function k(Z){return Array.isArray(Z)?Z:[Z]}function f(Z,Q){let B=Q??"",W=B?B:"this expression",J=0,$=(V,K)=>{if(J+=1,J>J1)throw new H(`the logic at ${W} has more than ${J1} nodes.`,B);if(K>B1)throw new H(`the logic at ${W} nests deeper than ${B1} levels.`,B);if(Array.isArray(V)){for(let G of V)$(G,K+1);return}if(!i(V))return;let U=Object.keys(V);if(U.length!==1)throw new H(`a logic expression at ${W} must be a single-operator object; this one has ${U.length===0?"none":`${U.length} (${U.join(", ")})`}.`,B);let X=U[0];if(!m8.has(X))throw new H(`unsupported operator "${X}" at ${W} (implemented: ${c1.join(", ")}).`,B);let Y=k(V[X]),z=h1[X];if(Y.length<z)throw new H(`"${X}" at ${W} needs at least ${z} argument${z===1?"":"s"}, got ${Y.length}.`,B);if(X==="date"&&!h8.has(String(Y[1])))throw new H(`"date" at ${W} needs one of ${u1.join(", ")} as its middle argument (got ${JSON.stringify(Y[1])}).`,B);if(X==="regex")n1(Y[0],B);for(let G of Y)$(G,K+1)};$(Z,0)}function n1(Z,Q){let B=Q?Q:"this expression";if(typeof Z!=="string")throw new H(`"regex" at ${B} needs a literal pattern string as its first argument.`,Q);let W=s.get(Z);if(W)return W;if(Z.length>_)throw new H(`the "regex" pattern at ${B} is ${Z.length} characters; the limit is ${_}.`,Q);let J;try{J=new RegExp(Z)}catch($){throw new H(`the "regex" pattern at ${B} is not a valid regular expression: ${$ instanceof Error?$.message:String($)}`,Q)}if(u(Z)==="catastrophic")throw new H(n(`the "regex" pattern at ${B}`),Q);if(s.size>=c8)s.clear();return s.set(Z,J),J}function F1(Z,Q,B){if(Q===void 0||Q===null||Q===""||Array.isArray(Q)&&Q.length===0)return Z===void 0?null:Z;let W=Z;for(let J of String(Q).split(".")){if(W===void 0||W===null)return B??null;if(Array.isArray(W)){let $=Number(J);W=Number.isInteger($)?W[$]:void 0}else if(i(W))W=Object.prototype.hasOwnProperty.call(W,J)?W[J]:void 0;else return B??null}if(W===void 0)return B??null;return W}function d1(Z){return Z===void 0||Z===null||Z===""}function L(Z){return typeof Z==="number"?Z:parseFloat(String(Z))}function m1(Z){if(typeof Z==="number")return Number.isFinite(Z)?Z:null;if(typeof Z!=="string")return null;let Q=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:?\d{2})?)?$/.exec(Z.trim());if(!Q)return null;let[,B,W,J,$,V,K,U,X]=Q,Y=Number(B),z=Number(W),G=Number(J);if(z<1||z>12||G<1||G>31)return null;let A=$===void 0?0:Number($),C=V===void 0?0:Number(V),M=K===void 0?0:Number(K);if(A>23||C>59||M>59)return null;let d=U===void 0?0:Number(U.padEnd(3,"0")),Z1=Date.UTC(Y,z-1,G,A,C,M,d),Q1=new Date(Z1);if(Q1.getUTCFullYear()!==Y||Q1.getUTCMonth()!==z-1||Q1.getUTCDate()!==G)return null;if(X===void 0||X==="Z")return Z1;let $8=X[0]==="-"?1:-1,J8=Number(X.slice(1,3)),B8=Number(X.slice(-2));return Z1+$8*(J8*60+B8)*60000}function u8(Z,Q,B){switch(Q){case"==":return Z===B;case"!=":return Z!==B;case"<":return Z<B;case"<=":return Z<=B;case">":return Z>B;default:return Z>=B}}function F(Z,Q){if(Array.isArray(Z))return Z.map(($)=>F($,Q));if(!i(Z))return Z;let B=Object.keys(Z)[0],W=Z[B];if(B==="if"){let $=k(W);for(let V=0;V+1<$.length;V+=2)if(N(F($[V],Q)))return F($[V+1],Q);return $.length%2===1?F($[$.length-1],Q):null}if(B==="and"||B==="or"){let $=k(W),V=null;for(let K of $)if(V=F(K,Q),N(V)===(B==="or"))return V;return V}if(B==="some"||B==="all"||B==="none"){let $=k(W),V=F($[0],Q);if(!Array.isArray(V))return B==="none";let K=V.some((U)=>N(F($[1],U)));if(B==="some")return K;if(B==="none")return!K;return V.length>0&&V.every((U)=>N(F($[1],U)))}if(B==="regex"){let $=k(W),V=n1($[0],""),K=F($[1],Q);if(typeof K!=="string"||K.length>h)return!1;return V.test(K)}let J=k(W).map(($)=>F($,Q));switch(B){case"var":return F1(Q,J[0],J.length>1?J[1]:void 0);case"missing":return(J.length===1&&Array.isArray(J[0])?J[0]:J).filter((V)=>d1(F1(Q,V,void 0)));case"missing_some":{let $=Number(J[0]),V=Array.isArray(J[1])?J[1]:[J[1]],K=V.filter((U)=>d1(F1(Q,U,void 0)));return V.length-K.length>=$?[]:K}case"!":return!N(J[0]);case"!!":return N(J[0]);case"==":return J[0]==J[1];case"!=":return J[0]!=J[1];case"===":return J[0]===J[1];case"!==":return J[0]!==J[1];case"<":return J.length>2?J[0]<J[1]&&J[1]<J[2]:J[0]<J[1];case"<=":return J.length>2?J[0]<=J[1]&&J[1]<=J[2]:J[0]<=J[1];case">":return J.length>2?J[0]>J[1]&&J[1]>J[2]:J[0]>J[1];case">=":return J.length>2?J[0]>=J[1]&&J[1]>=J[2]:J[0]>=J[1];case"+":return J.map(L).reduce(($,V)=>$+V,0);case"-":return J.length===1?-L(J[0]):L(J[0])-L(J[1]);case"*":return J.map(L).reduce(($,V)=>$*V);case"/":return L(J[0])/L(J[1]);case"%":return L(J[0])%L(J[1]);case"min":return Math.min(...J);case"max":return Math.max(...J);case"cat":return J.map(($)=>$===null||$===void 0?"":String($)).join("");case"substr":{let $=[...String(J[0])],V=Math.trunc(Number(J[1]))||0;if(V<0)V=Math.max($.length+V,0);let K=$.length;if(J.length>2){let U=Math.trunc(Number(J[2]))||0;K=U<0?$.length+U:Math.min(V+U,$.length)}return $.slice(V,Math.max(K,V)).join("")}case"in":{let $=J[1];if(Array.isArray($))return $.indexOf(J[0])!==-1;if(typeof $==="string")return $.indexOf(String(J[0]))!==-1;return!1}default:{let $=m1(J[0]),V=m1(J[2]);if($===null||V===null)return!1;return u8($,String(J[1]),V)}}}function l1(Z){let Q=[],B=(W)=>{if(Array.isArray(W)){for(let V of W)B(V);return}if(!i(W))return;let J=Object.keys(W)[0],$=k(W[J]);if(J==="var"){let V=$[0];if(typeof V==="string"&&V.length>0)Q.push(V)}else if(J==="missing"||J==="missing_some"){for(let V of $.flat())if(typeof V==="string")Q.push(V)}for(let V of $)B(V)};return B(Z),Q}var M1=Object.freeze(["show","require","validate","compute","jump"]),I1="remote",a={show:["id","show","when"],require:["id","require","when"],validate:["id","validate","path","message","remote"],compute:["id","compute","value"],jump:["id","jump","from","when"]};Object.freeze(a);for(let Z of Object.values(a))Object.freeze(Z);var A1=new WeakMap;function o1(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function s1(Z){return q(Z).split(".").filter((Q)=>Q.length>0)}function P(Z,Q,B){if(typeof Z!=="string"||Z.length===0)throw new H(`"${Q}" at ${B} must be a non-empty string.`,B);return Z}function n8(Z,Q,B){let W=`rules[${Q}]`;if(!o1(Z))throw new H(`the rule at ${W} must be an object.`,W);let J=P(Z.id,"id",W),$=`rules[${Q}] ("${J}")`,V=M1.filter((z)=>Z[z]!==void 0);if(V.length===0)throw new H(`the rule at ${$} has no verb (one of ${M1.join(", ")}).`,$);if(V.length>1)throw new H(`the rule at ${$} has ${V.length} verbs (${V.join(", ")}); a rule does one thing.`,$);let K=V[0],U=a[K];for(let z of Object.keys(Z))if(!U.includes(z))throw new H(`unsupported key "${z}" at ${$} (a "${K}" rule accepts ${U.join(", ")}).`,$);if(K==="show"||K==="require"){let z=q(P(Z[K],K,$));if(j(z,$),Z.when===void 0)throw new H(`"${K}" at ${$} needs a "when" condition; a rule with no condition never changes anything.`,$);if(K==="require"&&!B.has(z))throw new H(`"require" at ${$} names "${z}", which is not a key of "fields".`,$);return f(Z.when,$),{id:J,verb:K,path:z,when:Z.when}}if(K==="compute"){let z=q(P(Z.compute,"compute",$));if(j(z,$),Z.value===void 0)throw new H(`"compute" at ${$} needs a "value" expression.`,$);return f(Z.value,$),{id:J,verb:K,path:z,value:Z.value}}if(K==="jump"){let z=P(Z.jump,"jump",$),G=P(Z.from,"from",$);if(j(z,$),j(G,$),Z.when!==void 0)f(Z.when,$);return{id:J,verb:K,path:z,from:G,when:Z.when}}let X=q(P(Z.path,"path",$));j(X,$);let Y=Z.message===void 0?void 0:P(Z.message,"message",$);if(Z.validate===I1){let z=P(Z.remote,"remote",$);return{id:J,verb:K,path:X,message:Y,remote:z,isRemote:!0}}if(Z.remote!==void 0)throw new H(`"remote" at ${$} only belongs to a rule whose "validate" is ${JSON.stringify(I1)}.`,$);return f(Z.validate,$),{id:J,verb:K,path:X,message:Y,logic:Z.validate}}function l8(Z){if(Z.length===0)return[];let Q=Z.map((V)=>V.path),B=Z.map(()=>[]);for(let V=0;V<Z.length;V++){let K=l1(Z[V].value).map(q);for(let U=0;U<Z.length;U++){let X=Q[U];if(K.some((z)=>z===X||z.startsWith(`${X}.`)||X.startsWith(`${z}.`)))B[V].push(U)}}let W=[],J=Z.map(()=>!1),$=!0;while(W.length<Z.length&&$){$=!1;for(let V=0;V<Z.length;V++){if(J[V]||B[V].some((K)=>!J[K]))continue;J[V]=!0,W.push(Z[V]),$=!0}}if(W.length<Z.length){let V=Z.filter((K,U)=>!J[U]);throw new H(V.length===1?`the "compute" rule "${V[0].id}" reads "${V[0].path}", the value it writes, so it can never settle.`:`the "compute" rules ${V.map((K)=>`"${K.id}"`).join(", ")} depend on each other in a cycle.`,"rules")}return W}function g(Z){let Q=Y1(Z);if(!A1.has(Q)){let B=Q.rules.map(($,V)=>n8($,V,Q.fields)),W=new Set;for(let $ of B){if(W.has($.id))throw new H(`two rules share the id "${$.id}"; ids address messages, so they must be unique.`,"rules");W.add($.id)}let J=l8(B.filter(($)=>$.verb==="compute"));A1.set(Q,{all:B,computes:J})}return Q}function o8(Z){return A1.get(Z)??{all:[],computes:[]}}function t(Z,Q,B){let[W,...J]=Q,$=J.length>0&&/^\d+$/.test(J[0]);if(Array.isArray(Z)){let K=Z.slice(),U=Number(W);return K[U]=J.length===0?B:t(K[U],J,B),K}if(Z===void 0||Z===null){if(/^\d+$/.test(W)){let K=[];return K[Number(W)]=J.length===0?B:t($?[]:{},J,B),K}}let V=o1(Z)?{...Z}:{};return V[W]=J.length===0?B:t(O(V,W)?V[W]:void 0,J,B),V}function O1(Z,Q){let B=(J)=>O(Z,J)&&Z[J]===!1;if(B(Q))return!0;let W=s1(Q);for(let J=1;J<W.length;J++)if(B(W.slice(0,J).join(".")))return!0;return!1}function i1(Z,Q){let{all:B,computes:W}=o8(Z),J={},$={},V={},K={},U=Q;for(let X of W){let Y=F(X.value,U);J[X.path]=Y,U=t(U,s1(X.path),Y)}for(let X of B)if(X.verb==="show"){let Y=N(F(X.when,U));$[X.path]=(O($,X.path)?$[X.path]:!0)&&Y}for(let X of B)if(X.verb==="require"){let Y=N(F(X.when,U));V[X.path]=(O(V,X.path)?V[X.path]:!1)||Y}for(let X of Object.keys(V))if(O1($,X))V[X]=!1;for(let X of B){if(X.verb!=="jump")continue;let Y=X.from;if(O(K,Y))continue;if(X.when===void 0||N(F(X.when,U)))K[Y]=X.path}return{computed:J,visible:$,required:V,next:K,data:U,rules:B}}function N1(Z,Q){let B=i1(g(Z),Q);return{visible:B.visible,required:B.required,computed:B.computed,next:B.next}}function s8(Z,Q,B,W){if(O1(B,Z.path))return!1;if(Q.fields.has(Z.path)&&H1(w(W,Z.path)))return!1;return!0}function i8(Z,Q,B,W,J,$){return{path:Q.path,rule:B,message:$??R({messages:Z.messages,locale:W,defaultLocale:Z.defaultLocale,path:Q.path,rule:B,params:{path:Q.path,...J},fallback:B==="remote-error"?D["remote-error"]:Q.message??D.rule}),params:J}}function q1(Z,Q,B){let W=g(Z),J=B?.locale,$=i1(W,Q),V=new Set;for(let[X,Y]of Object.entries($.required))if(Y)V.add(X);let K=p1(W,$.data,{locale:J,required:V}).filter((X)=>!O1($.visible,X.path)),U=[];for(let X of $.rules){if(X.verb!=="validate")continue;if(!s8(X,W,$.visible,$.data))continue;if(X.isRemote){U.push(X.id);continue}if(!N(F(X.logic,$.data)))K.push(i8(W,X,X.id,J,{}))}return{valid:K.length===0&&U.length===0,findings:K,computed:$.computed,visible:$.visible,required:$.required,next:$.next,pending:U}}var E=null,r=new WeakMap,L1=new WeakSet,t1=new WeakMap,a1=new Set;function t8(){return{visible:{},required:{},computed:{},next:{}}}function S(Z,Q,B){if(E&&E.devtools&&E.devtools.report&&E.devtools.report(Z,Q))return;if(a1.has(Z))return;if(a1.add(Z),typeof console<"u"&&console.warn)console.warn("[Faqir] l-rules: "+(B||Z))}function p(Z){return Z.replace(/\[(\d+)\]/g,".$1")}function e(Z,Q,B){let W=Z.querySelectorAll("input, select, textarea"),J=p(Q),$=[];for(let V=0;V<W.length;V++){if(!W[V].name)continue;let K=p(W[V].name);if(K===J||!B&&K.indexOf(J+".")===0)$.push(W[V])}return $}function a8(Z){return Z.closest('[data-ui="field-group"]')||Z}function P1(Z,Q){let B=[],W=Z.querySelectorAll("input, select, textarea");for(let J=0;J<W.length;J++){let $=W[J],V=$.name;if(!V||Q.hidden.has($))continue;if($.tagName==="SELECT"){let K=$.options;for(let U=0;U<K.length;U++)if(K[U].selected&&!K[U].disabled)B.push([V,K[U].value]);continue}if($.tagName==="INPUT"){let K=$.type;if(K==="submit"||K==="button"||K==="reset"||K==="image")continue;if((K==="checkbox"||K==="radio")&&!$.checked)continue;if(K==="file"){let U=$.files;for(let X=0;U&&X<U.length;X++)B.push([V,U[X]]);continue}}B.push([V,$.value])}return C1(Q.definition,G1(B))}function Z8(Z,Q){for(let W=0;W<Q.length;W++){let J=Q[W].target;if(Z.hidden.has(J))Z.foreign.set(J,J.disabled)}let B=!1;if(Z.hidden.forEach(function(W){let J=W;if(!J.disabled)Z.foreign.set(W,!1),J.disabled=!0,B=!0}),B&&Z.observer)Z.observer.takeRecords()}function S1(Z){Z8(Z,Z.observer?Z.observer.takeRecords():[])}function r1(Z,Q,B){if(Q.disabled===B)return;if(Q.disabled=B,Z.observer)Z.observer.takeRecords()}function r8(Z,Q,B){let W=Object.keys(B);if(W.length===0)return;S1(Q);let J=new Map,$=Z.querySelectorAll("input, select, textarea");for(let V=0;V<$.length;V++){let K=$[V];if(!K.name)continue;let U=p(K.name),X=!1,Y=!0;for(let G=0;G<W.length;G++)if(U===W[G]||U.indexOf(W[G]+".")===0){if(X=!0,B[W[G]]===!1)Y=!1}if(!X)continue;let z=a8(K);if(J.set(z,J.get(z)===!0||!Y),!Y&&!Q.hidden.has(K))Q.foreign.set(K,K.disabled),Q.hidden.add(K),r1(Q,K,!0);else if(Y&&Q.hidden.has(K)){let G=Q.foreign.get(K)===!0;Q.hidden.delete(K),Q.foreign.delete(K),r1(Q,K,G)}}J.forEach(function(V,K){if(V&&!K.hasAttribute("hidden"))K.setAttribute("hidden",""),L1.add(K);else if(!V&&L1.has(K))K.removeAttribute("hidden"),L1.delete(K)})}function e8(Z,Q,B){let W=e(Z,Q);for(let J=0;J<W.length;J++){let $=W[J],V=t1.get($);if(!V)V={required:$.required===!0,aria:$.getAttribute("aria-required")==="true"},t1.set($,V);let K=V.required||B===!0;if($.required!==K)$.required=K;if(K||V.aria)$.setAttribute("aria-required","true");else $.removeAttribute("aria-required")}}function ZZ(Z,Q,B,W){if(Q){let V=B.split("."),K=Q,U=!0;for(let Y=0;Y<V.length-1&&U;Y++){let z=K[V[Y]];if(z&&typeof z==="object")K=z;else U=!1}let X=V[V.length-1];if(U&&K[X]!==W)K[X]=W}let J=W===void 0||W===null?"":String(W),$=e(Z,B,!0);for(let V=0;V<$.length;V++)if($[V].value!==J)$[V].value=J}function T1(Z,Q){let B;try{S1(Q),B=N1(Q.definition,P1(Z,Q))}catch(W){let J=W instanceof Error?W.message:String(W);S("l-rules could not evaluate its rules: "+J,Z,J);return}r8(Z,Q,B.visible);for(let W in B.required)e8(Z,W,B.required[W]);for(let W in B.computed)ZZ(Z,Q.scope,W,B.computed[W]);Q.state.visible=B.visible,Q.state.required=B.required,Q.state.computed=B.computed,Q.state.next=B.next}function QZ(Z,Q,B){for(let W=0;W<Z.findings.length;W++){let J=Z.findings[W];if(J.rule===Q&&(B===void 0||J.path===B))return J.message}return!0}function e1(Z,Q,B,W){return function(){try{return QZ(q1(Q.definition,P1(Z,Q),{locale:Q.locale}),B,W)}catch(J){let $=J instanceof Error?J.message:String(J);return S("l-rules could not evaluate its rules: "+$,Z,$),!0}}}function $Z(Z,Q,B){return function(W){let J=P1(Z,Q);return fetch(B.remote,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:B.path,value:W,data:J})}).then(function($){if(!$.ok)throw Error("remote check answered "+$.status);return $.json()}).then(function($){if(!$||typeof $!=="object"||typeof $.ok!=="boolean")throw Error("remote check answered without a boolean `ok`");if($.ok)return!0;if(typeof $.message==="string"&&$.message)return $.message;let V=p(B.path);return R({messages:Q.definition.messages,locale:Q.locale,defaultLocale:Q.definition.defaultLocale,path:V,rule:B.id,params:{path:V,remote:B.remote},fallback:B.message||D.rule})})}}function JZ(Z,Q){let B=Q.split(".");for(let W=B.length;W>0;W--){let J=Z.fields.get(B.slice(0,W).join("."));if(!J)continue;for(let $=W;$<B.length&&J;$++)J=J.type==="object"&&J.properties?J.properties.get(B[$]):J.type==="array"&&/^\d+$/.test(B[$])?J.items:null;return!!(J&&J.regex)}return!1}function BZ(Z,Q,B){let W=[];for(let U=0;U<B.length;U++){let X=B[U];if(!X||X.validate===void 0)continue;let Y=X.validate==="remote"?$Z(Z,Q,X):e1(Z,Q,X.id),z=X.path,G=[],A=e(Z,z,!0);for(let C=0;C<A.length;C++)if(G.indexOf(A[C].name)===-1)G.push(A[C].name);if(G.length===0)G.push(z);for(let C=0;C<G.length;C++)W.push({field:G[C],name:X.id,fn:Y,message:X.message})}let J=W.length,$=Z.querySelectorAll("input, textarea");for(let U=0;U<$.length;U++){let X=$[U];if(!X.name||X.hasAttribute("pattern"))continue;let Y=p(X.name);if(JZ(Q.definition,Y))W.push({field:X.name,name:"pattern",fn:e1(Z,Q,"pattern",Y)})}if(W.length===0)return[];let V=E;if(!V.validate)return S("l-rules has "+W.length+" check(s) to run but faqir-validate is not loaded, so none of them can run. Load faqir-validate.js before faqir-rules.js.",Z,"faqir-validate is not loaded; validate rules cannot run."),[];if(J>0&&!Z.hasAttribute("l-validate"))S("l-rules has "+J+" validate rule(s) on a form with no l-validate, so nothing validates them on submit. Add l-validate to the form.",Z,"a form with validate rules has no l-validate.");let K=[];for(let U=0;U<W.length;U++){let X=W[U],Y=V.validate.register(Z,X.field,X.name,X.fn,X.message);if(typeof Y==="function")K.push(Y)}return K}function WZ(Z,Q){for(let B=0;B<Q.length;B++){let W=Q[B];if(!W||W.jump!==void 0||W.compute!==void 0)continue;let J=W.show||W.require||W.path;if(typeof J!=="string"||e(Z,J).length>0)continue;if(W.validate!==void 0){S('l-rules rule "'+W.id+'" is a form-level check: its path "'+J+'" names no control in this form, so a server can report it but this page has no field-group to show it on.',Z,'rule "'+W.id+'" is a form-level check with nowhere to report.');continue}S('l-rules rule "'+W.id+'" names the field "'+J+'", which no control '+"in this form is named for — the rule will never change anything.",Z,'rule "'+W.id+'" names an absent field "'+J+'".')}}function VZ(Z,Q,B,W){let J=(Q||"").trim();if(!J)return W.why="l-rules has no value, so there is no definition to apply.",null;let $=J.charAt(0);if($==="#"||$==="."||$==="["){let K=null;try{K=document.querySelector(J)}catch(U){K=null}if(!K)return W.why='l-rules="'+J+'" matches no element.',null;try{return JSON.parse(K.textContent||"")}catch(U){return W.why='l-rules="'+J+'" found an element whose JSON does not parse.',null}}let V=E.evaluate(J,B,Z);if(typeof V==="string")try{return JSON.parse(V)}catch(K){return W.why='l-rules="'+J+'" is a string that does not parse as JSON.',null}if(!V||typeof V!=="object")return W.why='l-rules="'+J+'" resolved to '+(V===void 0?"nothing":typeof V)+", not a rules definition.",null;return V}function Q8(Z){E=Z,Z.magic("rules",function(Q,B){return r.get(B)||t8()}),Z.directive("rules",function(Q,B,W){let J={why:""},$=VZ(Q,B.expression,W,J);if(!$){S(J.why,Q,J.why);return}let V;try{V=g($)}catch(M){let d=M instanceof Error?M.message:String(M);S("l-rules refused this definition: "+d,Q,d);return}let K=Z.reactive({visible:{},required:{},computed:{},next:{}});r.set(W,K);let U={definition:V,scope:W,state:K,locale:typeof document<"u"&&document.documentElement&&document.documentElement.lang||void 0,hidden:new Set,foreign:new Map,observer:null};if(typeof MutationObserver==="function")U.observer=new MutationObserver(function(M){Z8(U,M)}),U.observer.observe(Q,{subtree:!0,attributes:!0,attributeFilter:["disabled"]});let X=V.rules||[];WZ(Q,X);let Y=BZ(Q,U,X);T1(Q,U);let z=!0;function G(){T1(Q,U)}function A(){setTimeout(function(){if(z)T1(Q,U)},0)}function C(){S1(U)}return Q.addEventListener("input",G,!0),Q.addEventListener("change",G,!0),Q.addEventListener("reset",A,!0),Q.addEventListener("submit",C,!0),function(){if(z=!1,Q.removeEventListener("input",G,!0),Q.removeEventListener("change",G,!0),Q.removeEventListener("reset",A,!0),Q.removeEventListener("submit",C,!0),U.observer)U.observer.disconnect();for(let M=0;M<Y.length;M++)Y[M]();if(r.get(W)===K)r.delete(W)}})}var j1=typeof globalThis<"u"&&globalThis.Faqir||typeof window<"u"&&window.Faqir;if(j1&&typeof j1.plugin==="function")j1.plugin(Q8);})();
63
+ (()=>{var{defineProperty:re,getOwnPropertyNames:ot,getOwnPropertyDescriptor:at}=Object,ut=Object.prototype.hasOwnProperty;function ft(e){return this[e]}var lt=(e)=>{var t=(_e??=new WeakMap).get(e),i;if(t)return t;if(t=re({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var s of ot(e))if(!ut.call(t,s))re(t,s,{get:ft.bind(e,s),enumerable:!(i=at(e,s))||i.enumerable})}return _e.set(e,t),t},_e;var ct=(e)=>e;function dt(e,t){this[e]=ct.bind(null,t)}var mt=(e,t)=>{for(var i in t)re(e,i,{get:t[i],enumerable:!0,configurable:!0,set:dt.bind(t,i)})};var dn={};mt(dn,{install:()=>nt});class d extends Error{constructor(e,t){super(`@faqir-ui/rules: ${e}`);this.name="DefinitionError",this.path=t}}var pt=/^(\d{4})-(\d{2})-(\d{2})$/,ht=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/i,gt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,yt=/^[A-Za-z][A-Za-z0-9+.-]*:[^\s\x00-\x1f]+$/,bt=/^[^\s@,;<>()[\]\\"]+@[^\s@.,;<>()[\]\\"]+(?:\.[^\s@.,;<>()[\]\\"]+)*\.[A-Za-z]{2,}$/,wt=/^\+?[0-9 ().-]{6,24}$/,Et=/^[A-Za-z0-9][A-Za-z0-9 -]{0,10}[A-Za-z0-9]$/,At=/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/,xt=[31,28,31,30,31,30,31,31,30,31,30,31];function St(e){return e%4===0&&e%100!==0||e%400===0}function je(e){let t=pt.exec(e);if(!t)return!1;let i=Number(t[1]),s=Number(t[2]),r=Number(t[3]);if(s<1||s>12||r<1)return!1;let n=s===2&&St(i)?29:xt[s-1];return r<=n}function qe(e){let t=ht.exec(e);if(!t)return!1;let i=Number(t[1]),s=Number(t[2]),r=t[3]===void 0?0:Number(t[3]);return i<=23&&s<=59&&r<=60}function $t(e){let t=/^(.+?)[Tt ](.+)$/.exec(e);if(!t)return!1;return je(t[1])&&qe(t[2])}function Ot(e){if(!wt.test(e))return!1;let t=e.replace(/\D/g,"");return t.length>=7&&t.length<=15}function vt(e){let t=e.replace(/[\s-]/g,"").toUpperCase();if(!At.test(t))return!1;let i=t.slice(4)+t.slice(0,4),s="";for(let n of i)s+=n>="A"&&n<="Z"?String(n.charCodeAt(0)-55):n;let r=0;for(let n=0;n<s.length;n+=7)r=Number(String(r)+s.slice(n,n+7))%97;return r===1}function Lt(e){if(e.length<2||e.length>12)return!1;if(!Et.test(e))return!1;return!/[ -]{2}/.test(e)}var z=new Map([["email",(e)=>bt.test(e)&&e.length<=254],["uri",(e)=>yt.test(e)],["date",je],["time",qe],["date-time",$t],["phone",Ot],["iban",vt],["uuid",(e)=>gt.test(e)],["postal-code",Lt]]),hn=Object.freeze([...z.keys()]);function Ne(e){return z.has(e)}function Ie(){return[...z.keys()].sort()}function Me(e,t){let i=z.get(e);if(!i)return!0;return i(t)===!0}var _=1000,G=1e4,ie=1000,se=64,oe=9999;var _t=Object.freeze(["required","type","enum","const","pattern","format","minLength","maxLength","minimum","exclusiveMinimum","maximum","exclusiveMaximum","multipleOf","minItems","maxItems","uniqueItems"]),Re=Object.freeze({required:"This field is required.",type:"Please enter a valid value.",enum:"Please choose one of the allowed values.",const:"Please enter the required value.",pattern:"Please match the requested format.",format:"Please enter a valid value.",minLength:"Please lengthen this value.",maxLength:"Please shorten this value.",minimum:"Value is too small.",exclusiveMinimum:"Value is too small.",maximum:"Value is too large.",exclusiveMaximum:"Value is too large.",multipleOf:"Please enter a valid value.",minItems:"Please choose more items.",maxItems:"Please choose fewer items.",uniqueItems:"Please remove the duplicate entries."}),j=Object.freeze({rule:"Please check this value.","remote-error":"This value could not be checked right now."}),ae="en";function X(e,t){if(!t||typeof e!=="string"||e.indexOf("{")===-1)return e;return e.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(i,s)=>{if(!Object.prototype.hasOwnProperty.call(t,s))return i;let r=t[s];if(r===void 0||r===null)return i;if(Array.isArray(r))return r.map((n)=>String(n)).join(", ");return String(r)})}function q(e){let{messages:t,locale:i,path:s,rule:r,params:n,fallback:o}=e,u=e.defaultLocale||"en",f=[`${s}.${r}`,r];for(let a of[i,u]){if(!a)continue;let c=t&&Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(!c)continue;for(let l of f){let m=Object.prototype.hasOwnProperty.call(c,l)?c[l]:void 0;if(typeof m==="string")return X(m,n)}}if(typeof o==="string")return X(o,n);for(let a of[Re,j])if(Object.prototype.hasOwnProperty.call(a,r)){let c=a[r];if(typeof c==="string")return X(c,n)}return r}function k(e){return{min:1,unbounded:!1,wide:!1,flex:!1,zeroWidth:!1,empty:!1,first:e,innerUnbounded:!1,innerSole:!1,ambiguous:!1}}function jt(e){return e.flex||e.innerSole}function qt(e,t){let i=e[t],s=null;if(i==="*")s={min:0,max:1/0,end:t+1};else if(i==="+")s={min:1,max:1/0,end:t+1};else if(i==="?")s={min:0,max:1,end:t+1};else if(i==="{"){let r=/^\{(\d+)(,(\d*))?\}/.exec(e.slice(t));if(!r)return null;let n=Number(r[1]),o=r[2]===void 0?n:r[3]===""?1/0:Number(r[3]);s={min:n,max:o,end:t+r[0].length}}if(s&&e[s.end]==="?")s.end+=1;return s}function Nt(e,t){if(e[t+2]==="{"&&"upP".includes(e[t+1])){let i=e.indexOf("}",t+3);if(i!==-1)return i+1}return t+2}function It(e,t){let i;try{i=e.map((s)=>new RegExp(`^(?:${s})$`))}catch{return!0}for(let s of t)if(i.filter((r)=>r.test(s)).length>1)return!0;return!1}function Mt(e){let t=["(?!)"];for(let i of e)if(t.push(i.first),!i.empty)return{first:t.join("|"),empty:!1};return{first:t.join("|"),empty:!0}}function H(e){let t=[{alternatives:[[]],zeroWidth:!1}],i=!1,s=!1,r=new Set(`${e} \u2028\uFEFF`);for(let f=0;f<128;f+=1)r.add(String.fromCharCode(f));let n=()=>{let f=t[t.length-1];return f.alternatives[f.alternatives.length-1]},o=()=>Object.assign(k("(?!)"),{zeroWidth:!0,empty:!0}),u=0;while(u<e.length){let f=e[u];if(f==="\\"){let a=Nt(e,u);n().push("bB".includes(e[u+1])?o():k(e.slice(u,a))),u=a}else if(f==="["){let a=u+1;while(a<e.length&&e[a]!=="]")a=e[a]==="\\"?a+2:a+1;n().push(k(e.slice(u,a+1))),u=a+1}else if(f==="("){let a=u+1,c=!1;if(e[a]==="?")if(e[a+1]==="="||e[a+1]==="!")c=!0,a+=2;else if(e[a+1]==="<"&&(e[a+2]==="="||e[a+2]==="!"))c=!0,a+=3;else if(e[a+1]==="<"){let l=e.indexOf(">",a+2);a=l===-1?a+2:l+1}else a+=2;t.push({alternatives:[[]],zeroWidth:c}),u=a}else if(f===")"&&t.length>1){let a=t.pop(),c=a.alternatives.map(Mt),l=a.zeroWidth?o():k(c.map((m)=>m.first).join("|"));l.empty||=c.some((m)=>m.empty),l.ambiguous=c.length>1&&It(c.map((m)=>m.first),r);for(let m of a.alternatives){if(m.some((p)=>p.unbounded||p.innerUnbounded))l.innerUnbounded=!0;if(m.some((p)=>p.ambiguous))l.ambiguous=!0;let b=m.findIndex(jt);if(b!==-1&&m.every((p,g)=>g===b||p.min===0||p.zeroWidth))l.innerSole=!0}n().push(l),u+=1}else if(f==="|")t[t.length-1].alternatives.push([]),u+=1;else if(f==="^"||f==="$")n().push(o()),u+=1;else{let a=qt(e,u),c=n(),l=c[c.length-1];if(a&&l){if(l.min=l.min*a.min,l.unbounded=a.max===1/0,l.wide=a.max>1,l.flex=l.wide&&a.max>a.min,a.min===0)l.empty=!0;if(!l.zeroWidth&&l.innerUnbounded&&l.wide)i=!0;if(!l.zeroWidth&&a.max>10&&(l.innerSole||l.ambiguous))s=!0;u=a.end}else n().push(k(f)),u+=1}}if(s)return"catastrophic";return i?"nested":null}function Y(e){return`${e} repeats a group that can match the same text more than one way, like (a+)+ or (a|a)+, and can backtrack catastrophically.`}var W="1";class J{constructor(e,t,i,s,r){this.version=W,this.fields=e,this.required=t,this.messages=i,this.defaultLocale=s,this.rules=r}}var Rt=["string","number","integer","boolean"],ke=new Set([...Rt,"object","array"]),Te=new Set(["version","fields","required","messages","defaultLocale","rules"]),R=["type","title","description","required","enum","const"],De={string:new Set([...R,"pattern","format","minLength","maxLength"]),number:new Set([...R,"minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"]),integer:new Set([...R,"minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"]),boolean:new Set(R),object:new Set([...R,"properties"]),array:new Set([...R,"items","minItems","maxItems","uniqueItems"])},kt=Object.freeze(Object.fromEntries(Object.entries(De).map(([e,t])=>[e,Object.freeze([...t].sort())]))),Tt=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"],Pt=0.000000001;function y(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ce=new Set(["__proto__","constructor","prototype"]);function ce(e){return S(e).some((t)=>Ce.has(t))}function O(e,t){if(ce(e))throw new d(`the path "${e}" at ${t} names __proto__, constructor or prototype.`,t)}function A(e){return e.replace(/\[(\d+)\]/g,".$1")}function S(e){return A(e).split(".").filter((t)=>t.length>0)}function P(e,t){let i=e,s=t;while(s.length>0){if(i===void 0||i===null)return;if(y(i)&&w(i,s))return i[s];let r=S(s);if(r.length===0)return;let n=r[0];if(Array.isArray(i)){let o=Number(n);if(!Number.isInteger(o))return;i=i[o]}else if(y(i))i=w(i,n)?i[n]:void 0;else return;s=r.slice(1).join(".")}return i}function Dt(e){for(let t of S(e)){if(Ce.has(t))return!1;if(/^\d+$/.test(t)&&Number(t)>oe)return!1}return!0}function Pe(e,t,i){let s=S(t),r=e;for(let n=0;n<s.length-1;n++){let o=s[n],u=/^\d+$/.test(s[n+1]),f=w(r,o)?r[o]:void 0,a=y(f)||Array.isArray(f)?f:u?[]:{};r[o]=a,r=a}r[s[s.length-1]]=i}function Ct(e,t){let i=S(t),s=e;for(let n=0;n<i.length-1;n++)if(s=w(s,i[n])?s[i[n]]:void 0,!y(s)&&!Array.isArray(s))return;let r=i[i.length-1];if(Array.isArray(s))s.splice(Number(r),1);else if(y(s))delete s[r]}function T(e,t,i){let s=e[t];if(s===void 0)return;if(typeof s!=="number"||!Number.isFinite(s))throw new d(`"${t}" at ${i} must be a finite number.`,i)}function ue(e,t){if(!y(e))throw new d(`the field schema at ${t} must be an object.`,t);let i=e.type;if(typeof i!=="string"||!ke.has(i))throw new d(`the field at ${t} needs a "type" of ${[...ke].join(", ")}${i===void 0?"":` (got ${JSON.stringify(i)})`}.`,t);let s=De[i];for(let n of Object.keys(e))if(!s.has(n))throw new d(`unsupported keyword "${n}" at ${t} (a "${i}" field accepts ${[...s].sort().join(", ")}).`,t);let r={type:i,schema:e};if(e.required!==void 0)if(e.required===!0)r.selfRequired=!0;else if(i==="object"&&Array.isArray(e.required)){for(let n of e.required)if(typeof n!=="string")throw new d(`"required" at ${t} must list property names.`,t);r.requiredChildren=new Set(e.required)}else throw new d(i==="object"?`"required" at ${t} must be true (the object itself is required) or an array of property names.`:`"required" at ${t} must be true; only an object field may list property names.`,t);if(e.enum!==void 0&&(!Array.isArray(e.enum)||e.enum.length===0))throw new d(`"enum" at ${t} must be a non-empty array.`,t);if(i==="string"){if(e.pattern!==void 0){if(typeof e.pattern!=="string")throw new d(`"pattern" at ${t} must be a string.`,t);if(e.pattern.length>_)throw new d(`"pattern" at ${t} is ${e.pattern.length} characters; the limit is ${_}.`,t);try{r.regex=new RegExp(e.pattern)}catch(n){throw new d(`"pattern" at ${t} is not a valid regular expression: ${n instanceof Error?n.message:String(n)}`,t)}if(H(e.pattern)==="catastrophic")throw new d(Y(`"pattern" at ${t}`),t)}if(e.format!==void 0){if(typeof e.format!=="string"||!Ne(e.format))throw new d(`unknown format ${JSON.stringify(e.format)} at ${t} (known: ${Ie().join(", ")} — add one with registerFormat).`,t)}T(e,"minLength",t),T(e,"maxLength",t)}if(i==="number"||i==="integer"){for(let n of Tt)T(e,n,t);if(typeof e.multipleOf==="number"&&e.multipleOf<=0)throw new d(`"multipleOf" at ${t} must be greater than zero.`,t)}if(i==="object"){let n=new Map;if(e.properties!==void 0){if(!y(e.properties))throw new d(`"properties" at ${t} must be an object.`,t);for(let[o,u]of Object.entries(e.properties))O(o,`${t}.properties`),n.set(o,ue(u,`${t}.${o}`))}for(let o of r.requiredChildren??[])if(!n.has(o))throw new d(`"required" at ${t} names "${o}", which is not one of its properties.`,t);r.properties=n}if(i==="array"){if(T(e,"minItems",t),T(e,"maxItems",t),e.uniqueItems!==void 0&&typeof e.uniqueItems!=="boolean")throw new d(`"uniqueItems" at ${t} must be a boolean.`,t);if(e.items!==void 0){let n=ue(e.items,`${t}[]`);if(n.selfRequired)throw new d(`"required" at ${t}[] has no meaning: array items are checked by minItems, not by presence.`,`${t}[]`);r.items=n}}return r}function de(e){if(e instanceof J)return e;if(!y(e))throw new d("a definition must be an object.","");for(let s of Object.keys(e))if(!Te.has(s))throw new d(`unsupported definition key "${s}" (accepted: ${[...Te].sort().join(", ")}).`,s);if(e.version!==void 0&&e.version!==W)throw new d(`unsupported definition version ${JSON.stringify(e.version)}; this package implements "${W}".`,"version");if(e.fields!==void 0&&!y(e.fields))throw new d('"fields" must be a map of paths to field schemas.',"fields");if(e.messages!==void 0&&!y(e.messages))throw new d('"messages" must be a map of locales to message tables.',"messages");if(e.defaultLocale!==void 0&&typeof e.defaultLocale!=="string")throw new d('"defaultLocale" must be a string.',"defaultLocale");if(e.rules!==void 0&&!Array.isArray(e.rules))throw new d('"rules" must be an array.',"rules");let t=new Map;for(let[s,r]of Object.entries(e.fields??{})){if(S(s).length===0)throw new d('"fields" has an empty path key.',"fields");O(s,"fields"),t.set(A(s),ue(r,s))}let i=new Set;if(e.required!==void 0){if(!Array.isArray(e.required))throw new d('"required" must be an array of field paths.',"required");for(let s of e.required){if(typeof s!=="string")throw new d('"required" must list field paths as strings.',"required");let r=A(s);if(!t.has(r))throw new d(`"required" names "${s}", which is not a key of "fields".`,"required");i.add(r)}}return new J(t,i,e.messages??{},typeof e.defaultLocale==="string"?e.defaultLocale:ae,Array.isArray(e.rules)?e.rules:[])}function me(e){if(e===void 0||e===null)return!0;if(typeof e==="string"&&e.length===0)return!0;if(Array.isArray(e)&&e.length===0)return!0;return!1}function Ft(e,t){switch(t){case"string":return typeof e==="string";case"number":return typeof e==="number"&&Number.isFinite(e);case"integer":return typeof e==="number"&&Number.isInteger(e);case"boolean":return typeof e==="boolean";case"object":return y(e);case"array":return Array.isArray(e);default:return!1}}function N(e){if(Array.isArray(e))return`[${e.map(N).join(",")}]`;if(y(e))return`{${Object.keys(e).sort().map((t)=>`${JSON.stringify(t)}:${N(e[t])}`).join(",")}}`;return JSON.stringify(e)??"undefined"}function fe(e,t,i,s,r){let n=e.schema,o=(f,a)=>{r.findings.push({path:i,rule:f,message:q({messages:r.messages,locale:r.locale,defaultLocale:r.defaultLocale,path:i,rule:f,params:{path:i,title:n.title,...a}}),params:a})};if(me(t)){if(s)o("required",{});return}let u=e.type;if(!Ft(t,u)){o("type",{type:u});return}if(n.enum!==void 0){let f=n.enum;if(!f.some((a)=>N(a)===N(t)))o("enum",{allowed:f})}if(n.const!==void 0&&N(n.const)!==N(t))o("const",{const:n.const});if(u==="string"){let f=t;if(e.regex&&(f.length>G||!e.regex.test(f)))o("pattern",{pattern:n.pattern});if(typeof n.format==="string"&&!Me(n.format,f))o("format",{format:n.format});let a=[...f].length;if(typeof n.minLength==="number"&&a<n.minLength)o("minLength",{limit:n.minLength,actual:a});if(typeof n.maxLength==="number"&&a>n.maxLength)o("maxLength",{limit:n.maxLength,actual:a})}if(u==="number"||u==="integer"){let f=t;if(typeof n.minimum==="number"&&f<n.minimum)o("minimum",{limit:n.minimum});if(typeof n.exclusiveMinimum==="number"&&f<=n.exclusiveMinimum)o("exclusiveMinimum",{limit:n.exclusiveMinimum});if(typeof n.maximum==="number"&&f>n.maximum)o("maximum",{limit:n.maximum});if(typeof n.exclusiveMaximum==="number"&&f>=n.exclusiveMaximum)o("exclusiveMaximum",{limit:n.exclusiveMaximum});if(typeof n.multipleOf==="number"){let a=f/n.multipleOf;if(Math.abs(a-Math.round(a))>Pt)o("multipleOf",{multipleOf:n.multipleOf})}}if(u==="array"){let f=t;if(typeof n.minItems==="number"&&f.length<n.minItems)o("minItems",{limit:n.minItems,actual:f.length});if(typeof n.maxItems==="number"&&f.length>n.maxItems)o("maxItems",{limit:n.maxItems,actual:f.length});if(n.uniqueItems===!0){let a=new Set;for(let c=0;c<f.length;c++){let l=N(f[c]);if(a.has(l)){o("uniqueItems",{index:c});break}a.add(l)}}if(e.items)for(let a=0;a<f.length;a++)fe(e.items,f[a],`${i}.${a}`,!1,r)}if(u==="object"&&e.properties){let f=e.requiredChildren;for(let[a,c]of e.properties){let l=c.selfRequired===!0||f!==void 0&&f.has(a);fe(c,P(t,a),`${i}.${a}`,l,r)}}}function Fe(e,t,i){let s={findings:[],messages:e.messages,locale:i?.locale,defaultLocale:e.defaultLocale},r=i?.required;for(let[n,o]of e.fields){let u=o.selfRequired===!0||e.required.has(n)||r!==void 0&&r.has(n);fe(o,P(t,n),n,u,s)}return s.findings}var Ut=new Set(["true","on","yes","1"]),zt=new Set(["false","off","no","0"]),Gt=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;function Xt(e,t){if(typeof e!=="string")return e;let i=e.trim();if(i.length===0)return;if(t==="number"||t==="integer")return Gt.test(i)?Number(i):e;if(t==="boolean"){let s=i.toLowerCase();if(Ut.has(s))return!0;if(zt.has(s))return!1;return e}return e}function le(e,t){if(e.type==="array"){if(t===void 0||t===null)return t;let i=Array.isArray(t)?t:t===""?[]:[t];return(e.items?i.map((r)=>le(e.items,r)):i.slice()).filter((r)=>r!==void 0)}if(e.type==="object"){if(!y(t))return t;let i={...t};for(let[s,r]of e.properties??[]){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let n=le(r,i[s]);if(n===void 0)delete i[s];else i[s]=n}return i}return Xt(t,e.type)}function pe(e){let t={},i=(r,n)=>{if(typeof n!=="string"||ce(n))return;if(!w(t,n))t[n]=r;else if(Array.isArray(t[n]))t[n].push(r);else t[n]=[t[n],r]},s=e;if(s&&typeof s[Symbol.iterator]==="function"){for(let r of s)if(Array.isArray(r))i(r[1],r[0])}else if(s&&typeof s.forEach==="function")s.forEach(i);return t}function he(e,t){let i=de(e);if(!y(t))return{};let s=new Set;for(let n of i.fields.keys())s.add(S(n)[0]);let r={};for(let[n,o]of Object.entries(t)){if(ce(n))continue;let u=S(n);if(u.length>1&&s.has(u[0])&&Dt(n))Pe(r,n,o);else r[n]=o}for(let[n,o]of i.fields){let u=P(r,n);if(u===void 0)continue;let f=le(o,u);if(f===void 0)Ct(r,n);else Pe(r,n,f)}return r}var Ge=Object.freeze({var:0,missing:0,missing_some:2,if:0,and:1,or:1,"!":1,"!!":1,"==":2,"===":2,"!=":2,"!==":2,"<":2,"<=":2,">":2,">=":2,"+":1,"-":1,"*":1,"/":2,"%":2,min:1,max:1,cat:0,substr:2,in:2,some:2,all:2,none:2,date:3,regex:2}),Xe=Object.freeze(Object.keys(Ge)),Ht=new Set(Xe),He=Object.freeze(["==","!=","<","<=",">",">="]),Yt=new Set(He),Z=new Map,Wt=200;function V(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function E(e){if(Array.isArray(e))return e.length>0;return Boolean(e)}function I(e){return Array.isArray(e)?e:[e]}function D(e,t){let i=t??"",s=i?i:"this expression",r=0,n=(o,u)=>{if(r+=1,r>ie)throw new d(`the logic at ${s} has more than ${ie} nodes.`,i);if(u>se)throw new d(`the logic at ${s} nests deeper than ${se} levels.`,i);if(Array.isArray(o)){for(let m of o)n(m,u+1);return}if(!V(o))return;let f=Object.keys(o);if(f.length!==1)throw new d(`a logic expression at ${s} must be a single-operator object; this one has ${f.length===0?"none":`${f.length} (${f.join(", ")})`}.`,i);let a=f[0];if(!Ht.has(a))throw new d(`unsupported operator "${a}" at ${s} (implemented: ${Xe.join(", ")}).`,i);let c=I(o[a]),l=Ge[a];if(c.length<l)throw new d(`"${a}" at ${s} needs at least ${l} argument${l===1?"":"s"}, got ${c.length}.`,i);if(a==="date"&&!Yt.has(String(c[1])))throw new d(`"date" at ${s} needs one of ${He.join(", ")} as its middle argument (got ${JSON.stringify(c[1])}).`,i);if(a==="regex")Ye(c[0],i);for(let m of c)n(m,u+1)};n(e,0)}function Ye(e,t){let i=t?t:"this expression";if(typeof e!=="string")throw new d(`"regex" at ${i} needs a literal pattern string as its first argument.`,t);let s=Z.get(e);if(s)return s;if(e.length>_)throw new d(`the "regex" pattern at ${i} is ${e.length} characters; the limit is ${_}.`,t);let r;try{r=new RegExp(e)}catch(n){throw new d(`the "regex" pattern at ${i} is not a valid regular expression: ${n instanceof Error?n.message:String(n)}`,t)}if(H(e)==="catastrophic")throw new d(Y(`the "regex" pattern at ${i}`),t);if(Z.size>=Wt)Z.clear();return Z.set(e,r),r}function ge(e,t,i){if(t===void 0||t===null||t===""||Array.isArray(t)&&t.length===0)return e===void 0?null:e;let s=e;for(let r of String(t).split(".")){if(s===void 0||s===null)return i??null;if(Array.isArray(s)){let n=Number(r);s=Number.isInteger(n)?s[n]:void 0}else if(V(s))s=Object.prototype.hasOwnProperty.call(s,r)?s[r]:void 0;else return i??null}if(s===void 0)return i??null;return s}function Ue(e){return e===void 0||e===null||e===""}function x(e){return typeof e==="number"?e:parseFloat(String(e))}function ze(e){if(typeof e==="number")return Number.isFinite(e)?e:null;if(typeof e!=="string")return null;let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:?\d{2})?)?$/.exec(e.trim());if(!t)return null;let[,i,s,r,n,o,u,f,a]=t,c=Number(i),l=Number(s),m=Number(r);if(l<1||l>12||m<1||m>31)return null;let b=n===void 0?0:Number(n),p=o===void 0?0:Number(o),g=u===void 0?0:Number(u);if(b>23||p>59||g>59)return null;let U=f===void 0?0:Number(f.padEnd(3,"0")),te=Date.UTC(c,l-1,m,b,p,g,U),ne=new Date(te);if(ne.getUTCFullYear()!==c||ne.getUTCMonth()!==l-1||ne.getUTCDate()!==m)return null;if(a===void 0||a==="Z")return te;let rt=a[0]==="-"?1:-1,it=Number(a.slice(1,3)),st=Number(a.slice(-2));return te+rt*(it*60+st)*60000}function Jt(e,t,i){switch(t){case"==":return e===i;case"!=":return e!==i;case"<":return e<i;case"<=":return e<=i;case">":return e>i;default:return e>=i}}function h(e,t){if(Array.isArray(e))return e.map((n)=>h(n,t));if(!V(e))return e;let i=Object.keys(e)[0],s=e[i];if(i==="if"){let n=I(s);for(let o=0;o+1<n.length;o+=2)if(E(h(n[o],t)))return h(n[o+1],t);return n.length%2===1?h(n[n.length-1],t):null}if(i==="and"||i==="or"){let n=I(s),o=null;for(let u of n)if(o=h(u,t),E(o)===(i==="or"))return o;return o}if(i==="some"||i==="all"||i==="none"){let n=I(s),o=h(n[0],t);if(!Array.isArray(o))return i==="none";let u=o.some((f)=>E(h(n[1],f)));if(i==="some")return u;if(i==="none")return!u;return o.length>0&&o.every((f)=>E(h(n[1],f)))}if(i==="regex"){let n=I(s),o=Ye(n[0],""),u=h(n[1],t);if(typeof u!=="string"||u.length>G)return!1;return o.test(u)}let r=I(s).map((n)=>h(n,t));switch(i){case"var":return ge(t,r[0],r.length>1?r[1]:void 0);case"missing":return(r.length===1&&Array.isArray(r[0])?r[0]:r).filter((o)=>Ue(ge(t,o,void 0)));case"missing_some":{let n=Number(r[0]),o=Array.isArray(r[1])?r[1]:[r[1]],u=o.filter((f)=>Ue(ge(t,f,void 0)));return o.length-u.length>=n?[]:u}case"!":return!E(r[0]);case"!!":return E(r[0]);case"==":return r[0]==r[1];case"!=":return r[0]!=r[1];case"===":return r[0]===r[1];case"!==":return r[0]!==r[1];case"<":return r.length>2?r[0]<r[1]&&r[1]<r[2]:r[0]<r[1];case"<=":return r.length>2?r[0]<=r[1]&&r[1]<=r[2]:r[0]<=r[1];case">":return r.length>2?r[0]>r[1]&&r[1]>r[2]:r[0]>r[1];case">=":return r.length>2?r[0]>=r[1]&&r[1]>=r[2]:r[0]>=r[1];case"+":return r.map(x).reduce((n,o)=>n+o,0);case"-":return r.length===1?-x(r[0]):x(r[0])-x(r[1]);case"*":return r.map(x).reduce((n,o)=>n*o);case"/":return x(r[0])/x(r[1]);case"%":return x(r[0])%x(r[1]);case"min":return Math.min(...r);case"max":return Math.max(...r);case"cat":return r.map((n)=>n===null||n===void 0?"":String(n)).join("");case"substr":{let n=[...String(r[0])],o=Math.trunc(Number(r[1]))||0;if(o<0)o=Math.max(n.length+o,0);let u=n.length;if(r.length>2){let f=Math.trunc(Number(r[2]))||0;u=f<0?n.length+f:Math.min(o+f,n.length)}return n.slice(o,Math.max(u,o)).join("")}case"in":{let n=r[1];if(Array.isArray(n))return n.indexOf(r[0])!==-1;if(typeof n==="string")return n.indexOf(String(r[0]))!==-1;return!1}default:{let n=ze(r[0]),o=ze(r[2]);if(n===null||o===null)return!1;return Jt(n,String(r[1]),o)}}}function We(e){let t=[],i=(s)=>{if(Array.isArray(s)){for(let o of s)i(o);return}if(!V(s))return;let r=Object.keys(s)[0],n=I(s[r]);if(r==="var"){let o=n[0];if(typeof o==="string"&&o.length>0)t.push(o)}else if(r==="missing"||r==="missing_some"){for(let o of n.flat())if(typeof o==="string")t.push(o)}for(let o of n)i(o)};return i(e),t}var ye=Object.freeze(["show","require","validate","compute","jump"]),be="remote",K={show:["id","show","when"],require:["id","require","when"],validate:["id","validate","path","message","remote"],compute:["id","compute","value"],jump:["id","jump","from","when"]};Object.freeze(K);for(let e of Object.values(K))Object.freeze(e);var we=new WeakMap;function Je(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ze(e){return A(e).split(".").filter((t)=>t.length>0)}function v(e,t,i){if(typeof e!=="string"||e.length===0)throw new d(`"${t}" at ${i} must be a non-empty string.`,i);return e}function Zt(e,t,i){let s=`rules[${t}]`;if(!Je(e))throw new d(`the rule at ${s} must be an object.`,s);let r=v(e.id,"id",s),n=`rules[${t}] ("${r}")`,o=ye.filter((l)=>e[l]!==void 0);if(o.length===0)throw new d(`the rule at ${n} has no verb (one of ${ye.join(", ")}).`,n);if(o.length>1)throw new d(`the rule at ${n} has ${o.length} verbs (${o.join(", ")}); a rule does one thing.`,n);let u=o[0],f=K[u];for(let l of Object.keys(e))if(!f.includes(l))throw new d(`unsupported key "${l}" at ${n} (a "${u}" rule accepts ${f.join(", ")}).`,n);if(u==="show"||u==="require"){let l=A(v(e[u],u,n));if(O(l,n),e.when===void 0)throw new d(`"${u}" at ${n} needs a "when" condition; a rule with no condition never changes anything.`,n);if(u==="require"&&!i.has(l))throw new d(`"require" at ${n} names "${l}", which is not a key of "fields".`,n);return D(e.when,n),{id:r,verb:u,path:l,when:e.when}}if(u==="compute"){let l=A(v(e.compute,"compute",n));if(O(l,n),e.value===void 0)throw new d(`"compute" at ${n} needs a "value" expression.`,n);return D(e.value,n),{id:r,verb:u,path:l,value:e.value}}if(u==="jump"){let l=v(e.jump,"jump",n),m=v(e.from,"from",n);if(O(l,n),O(m,n),e.when!==void 0)D(e.when,n);return{id:r,verb:u,path:l,from:m,when:e.when}}let a=A(v(e.path,"path",n));O(a,n);let c=e.message===void 0?void 0:v(e.message,"message",n);if(e.validate===be){let l=v(e.remote,"remote",n);return{id:r,verb:u,path:a,message:c,remote:l,isRemote:!0}}if(e.remote!==void 0)throw new d(`"remote" at ${n} only belongs to a rule whose "validate" is ${JSON.stringify(be)}.`,n);return D(e.validate,n),{id:r,verb:u,path:a,message:c,logic:e.validate}}function Vt(e){if(e.length===0)return[];let t=e.map((o)=>o.path),i=e.map(()=>[]);for(let o=0;o<e.length;o++){let u=We(e[o].value).map(A);for(let f=0;f<e.length;f++){let a=t[f];if(u.some((l)=>l===a||l.startsWith(`${a}.`)||a.startsWith(`${l}.`)))i[o].push(f)}}let s=[],r=e.map(()=>!1),n=!0;while(s.length<e.length&&n){n=!1;for(let o=0;o<e.length;o++){if(r[o]||i[o].some((u)=>!r[u]))continue;r[o]=!0,s.push(e[o]),n=!0}}if(s.length<e.length){let o=e.filter((u,f)=>!r[f]);throw new d(o.length===1?`the "compute" rule "${o[0].id}" reads "${o[0].path}", the value it writes, so it can never settle.`:`the "compute" rules ${o.map((u)=>`"${u.id}"`).join(", ")} depend on each other in a cycle.`,"rules")}return s}function C(e){let t=de(e);if(!we.has(t)){let i=t.rules.map((n,o)=>Zt(n,o,t.fields)),s=new Set;for(let n of i){if(s.has(n.id))throw new d(`two rules share the id "${n.id}"; ids address messages, so they must be unique.`,"rules");s.add(n.id)}let r=Vt(i.filter((n)=>n.verb==="compute"));we.set(t,{all:i,computes:r})}return t}function Bt(e){return we.get(e)??{all:[],computes:[]}}function B(e,t,i){let[s,...r]=t,n=r.length>0&&/^\d+$/.test(r[0]);if(Array.isArray(e)){let u=e.slice(),f=Number(s);return u[f]=r.length===0?i:B(u[f],r,i),u}if(e===void 0||e===null){if(/^\d+$/.test(s)){let u=[];return u[Number(s)]=r.length===0?i:B(n?[]:{},r,i),u}}let o=Je(e)?{...e}:{};return o[s]=r.length===0?i:B(w(o,s)?o[s]:void 0,r,i),o}function Ee(e,t){let i=(r)=>w(e,r)&&e[r]===!1;if(i(t))return!0;let s=Ze(t);for(let r=1;r<s.length;r++)if(i(s.slice(0,r).join(".")))return!0;return!1}function Ve(e,t){let{all:i,computes:s}=Bt(e),r={},n={},o={},u={},f=t;for(let a of s){let c=h(a.value,f);r[a.path]=c,f=B(f,Ze(a.path),c)}for(let a of i)if(a.verb==="show"){let c=E(h(a.when,f));n[a.path]=(w(n,a.path)?n[a.path]:!0)&&c}for(let a of i)if(a.verb==="require"){let c=E(h(a.when,f));o[a.path]=(w(o,a.path)?o[a.path]:!1)||c}for(let a of Object.keys(o))if(Ee(n,a))o[a]=!1;for(let a of i){if(a.verb!=="jump")continue;let c=a.from;if(w(u,c))continue;if(a.when===void 0||E(h(a.when,f)))u[c]=a.path}return{computed:r,visible:n,required:o,next:u,data:f,rules:i}}function Ae(e,t){let i=Ve(C(e),t);return{visible:i.visible,required:i.required,computed:i.computed,next:i.next}}function Kt(e,t,i,s){if(Ee(i,e.path))return!1;if(t.fields.has(e.path)&&me(P(s,e.path)))return!1;return!0}function Qt(e,t,i,s,r,n){return{path:t.path,rule:i,message:n??q({messages:e.messages,locale:s,defaultLocale:e.defaultLocale,path:t.path,rule:i,params:{path:t.path,...r},fallback:i==="remote-error"?j["remote-error"]:t.message??j.rule}),params:r}}function xe(e,t,i){let s=C(e),r=i?.locale,n=Ve(s,t),o=new Set;for(let[a,c]of Object.entries(n.required))if(c)o.add(a);let u=Fe(s,n.data,{locale:r,required:o}).filter((a)=>!Ee(n.visible,a.path)),f=[];for(let a of n.rules){if(a.verb!=="validate")continue;if(!Kt(a,s,n.visible,n.data))continue;if(a.isRemote){f.push(a.id);continue}if(!E(h(a.logic,n.data)))u.push(Qt(s,a,a.id,r,{}))}return{valid:u.length===0&&f.length===0,findings:u,computed:n.computed,visible:n.visible,required:n.required,next:n.next,pending:f}}var M=null,Q=new WeakMap,Se=new WeakSet,Be=new WeakMap,Ke=new Set;function en(){return{visible:{},required:{},computed:{},next:{}}}function L(e,t,i){if(M&&M.devtools&&M.devtools.report&&M.devtools.report(e,t))return;if(Ke.has(e))return;if(Ke.add(e),typeof console<"u"&&console.warn)console.warn("[Faqir] l-rules: "+(i||e))}function F(e){return e.replace(/\[(\d+)\]/g,".$1")}function ee(e,t,i){let s=e.querySelectorAll("input, select, textarea"),r=F(t),n=[];for(let o=0;o<s.length;o++){if(!s[o].name)continue;let u=F(s[o].name);if(u===r||!i&&u.indexOf(r+".")===0)n.push(s[o])}return n}function tn(e){return e.closest('[data-ui="field-group"]')||e}function ve(e,t){let i=[],s=e.querySelectorAll("input, select, textarea");for(let r=0;r<s.length;r++){let n=s[r],o=n.name;if(!o||t.hidden.has(n))continue;if(n.tagName==="SELECT"){let u=n.options;for(let f=0;f<u.length;f++)if(u[f].selected&&!u[f].disabled)i.push([o,u[f].value]);continue}if(n.tagName==="INPUT"){let u=n.type;if(u==="submit"||u==="button"||u==="reset"||u==="image")continue;if((u==="checkbox"||u==="radio")&&!n.checked)continue;if(u==="file"){let f=n.files;for(let a=0;f&&a<f.length;a++)i.push([o,f[a]]);continue}}i.push([o,n.value])}return he(t.definition,pe(i))}function tt(e,t){for(let s=0;s<t.length;s++){let r=t[s].target;if(e.hidden.has(r))e.foreign.set(r,r.disabled)}let i=!1;if(e.hidden.forEach(function(s){let r=s;if(!r.disabled)e.foreign.set(s,!1),r.disabled=!0,i=!0}),i&&e.observer)e.observer.takeRecords()}function Le(e){tt(e,e.observer?e.observer.takeRecords():[])}function Qe(e,t,i){if(t.disabled===i)return;if(t.disabled=i,e.observer)e.observer.takeRecords()}function nn(e,t,i){let s=Object.keys(i);if(s.length===0)return;Le(t);let r=new Map,n=e.querySelectorAll("input, select, textarea");for(let o=0;o<n.length;o++){let u=n[o];if(!u.name)continue;let f=F(u.name),a=!1,c=!0;for(let m=0;m<s.length;m++)if(f===s[m]||f.indexOf(s[m]+".")===0){if(a=!0,i[s[m]]===!1)c=!1}if(!a)continue;let l=tn(u);if(r.set(l,r.get(l)===!0||!c),!c&&!t.hidden.has(u))t.foreign.set(u,u.disabled),t.hidden.add(u),Qe(t,u,!0);else if(c&&t.hidden.has(u)){let m=t.foreign.get(u)===!0;t.hidden.delete(u),t.foreign.delete(u),Qe(t,u,m)}}r.forEach(function(o,u){if(o&&!u.hasAttribute("hidden"))u.setAttribute("hidden",""),Se.add(u);else if(!o&&Se.has(u))u.removeAttribute("hidden"),Se.delete(u)})}function rn(e,t,i){let s=ee(e,t);for(let r=0;r<s.length;r++){let n=s[r],o=Be.get(n);if(!o)o={required:n.required===!0,aria:n.getAttribute("aria-required")==="true"},Be.set(n,o);let u=o.required||i===!0;if(n.required!==u)n.required=u;if(u||o.aria)n.setAttribute("aria-required","true");else n.removeAttribute("aria-required")}}function sn(e,t,i,s){if(t){let o=i.split("."),u=t,f=!0;for(let c=0;c<o.length-1&&f;c++){let l=u[o[c]];if(l&&typeof l==="object")u=l;else f=!1}let a=o[o.length-1];if(f&&u[a]!==s)u[a]=s}let r=s===void 0||s===null?"":String(s),n=ee(e,i,!0);for(let o=0;o<n.length;o++)if(n[o].value!==r)n[o].value=r}function $e(e,t){let i;try{Le(t),i=Ae(t.definition,ve(e,t))}catch(s){let r=s instanceof Error?s.message:String(s);L("l-rules could not evaluate its rules: "+r,e,r);return}nn(e,t,i.visible);for(let s in i.required)rn(e,s,i.required[s]);for(let s in i.computed)sn(e,t.scope,s,i.computed[s]);t.state.visible=i.visible,t.state.required=i.required,t.state.computed=i.computed,t.state.next=i.next}function on(e,t,i){for(let s=0;s<e.findings.length;s++){let r=e.findings[s];if(r.rule===t&&(i===void 0||r.path===i))return r.message}return!0}function et(e,t,i,s){return function(){try{return on(xe(t.definition,ve(e,t),{locale:t.locale}),i,s)}catch(r){let n=r instanceof Error?r.message:String(r);return L("l-rules could not evaluate its rules: "+n,e,n),!0}}}function an(e,t,i){return function(s){let r=ve(e,t);return fetch(i.remote,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i.path,value:s,data:r})}).then(function(n){if(!n.ok)throw Error("remote check answered "+n.status);return n.json()}).then(function(n){if(!n||typeof n!=="object"||typeof n.ok!=="boolean")throw Error("remote check answered without a boolean `ok`");if(n.ok)return!0;if(typeof n.message==="string"&&n.message)return n.message;let o=F(i.path);return q({messages:t.definition.messages,locale:t.locale,defaultLocale:t.definition.defaultLocale,path:o,rule:i.id,params:{path:o,remote:i.remote},fallback:i.message||j.rule})})}}function un(e,t){let i=t.split(".");for(let s=i.length;s>0;s--){let r=e.fields.get(i.slice(0,s).join("."));if(!r)continue;for(let n=s;n<i.length&&r;n++)r=r.type==="object"&&r.properties?r.properties.get(i[n]):r.type==="array"&&/^\d+$/.test(i[n])?r.items:null;return!!(r&&r.regex)}return!1}function fn(e,t,i){let s=[];for(let f=0;f<i.length;f++){let a=i[f];if(!a||a.validate===void 0)continue;let c=a.validate==="remote"?an(e,t,a):et(e,t,a.id),l=a.path,m=[],b=ee(e,l,!0);for(let p=0;p<b.length;p++)if(m.indexOf(b[p].name)===-1)m.push(b[p].name);if(m.length===0)m.push(l);for(let p=0;p<m.length;p++)s.push({field:m[p],name:a.id,fn:c,message:a.message})}let r=s.length,n=e.querySelectorAll("input, textarea");for(let f=0;f<n.length;f++){let a=n[f];if(!a.name||a.hasAttribute("pattern"))continue;let c=F(a.name);if(un(t.definition,c))s.push({field:a.name,name:"pattern",fn:et(e,t,"pattern",c)})}if(s.length===0)return[];let o=M;if(!o.validate)return L("l-rules has "+s.length+" check(s) to run but faqir-validate is not loaded, so none of them can run. Load faqir-validate.js before faqir-rules.js.",e,"faqir-validate is not loaded; validate rules cannot run."),[];if(r>0&&!e.hasAttribute("l-validate"))L("l-rules has "+r+" validate rule(s) on a form with no l-validate, so nothing validates them on submit. Add l-validate to the form.",e,"a form with validate rules has no l-validate.");let u=[];for(let f=0;f<s.length;f++){let a=s[f],c=o.validate.register(e,a.field,a.name,a.fn,a.message);if(typeof c==="function")u.push(c)}return u}function ln(e,t){for(let i=0;i<t.length;i++){let s=t[i];if(!s||s.jump!==void 0||s.compute!==void 0)continue;let r=s.show||s.require||s.path;if(typeof r!=="string"||ee(e,r).length>0)continue;if(s.validate!==void 0){L('l-rules rule "'+s.id+'" is a form-level check: its path "'+r+'" names no control in this form, so a server can report it but this page has no field-group to show it on.',e,'rule "'+s.id+'" is a form-level check with nowhere to report.');continue}L('l-rules rule "'+s.id+'" names the field "'+r+'", which no control '+"in this form is named for — the rule will never change anything.",e,'rule "'+s.id+'" names an absent field "'+r+'".')}}function cn(e,t,i,s){let r=(t||"").trim();if(!r)return s.why="l-rules has no value, so there is no definition to apply.",null;let n=r.charAt(0);if(n==="#"||n==="."||n==="["){let u=null;try{u=document.querySelector(r)}catch(f){u=null}if(!u)return s.why='l-rules="'+r+'" matches no element.',null;try{return JSON.parse(u.textContent||"")}catch(f){return s.why='l-rules="'+r+'" found an element whose JSON does not parse.',null}}let o=M.evaluate(r,i,e);if(typeof o==="string")try{return JSON.parse(o)}catch(u){return s.why='l-rules="'+r+'" is a string that does not parse as JSON.',null}if(!o||typeof o!=="object")return s.why='l-rules="'+r+'" resolved to '+(o===void 0?"nothing":typeof o)+", not a rules definition.",null;return o}function nt(e){M=e,e.magic("rules",function(t,i){return Q.get(i)||en()}),e.directive("rules",function(t,i,s){let r={why:""},n=cn(t,i.expression,s,r);if(!n){L(r.why,t,r.why);return}let o;try{o=C(n)}catch(g){let U=g instanceof Error?g.message:String(g);L("l-rules refused this definition: "+U,t,U);return}let u=e.reactive({visible:{},required:{},computed:{},next:{}});Q.set(s,u);let f={definition:o,scope:s,state:u,locale:typeof document<"u"&&document.documentElement&&document.documentElement.lang||void 0,hidden:new Set,foreign:new Map,observer:null};if(typeof MutationObserver==="function")f.observer=new MutationObserver(function(g){tt(f,g)}),f.observer.observe(t,{subtree:!0,attributes:!0,attributeFilter:["disabled"]});let a=o.rules||[];ln(t,a);let c=fn(t,f,a);$e(t,f);let l=!0;function m(){$e(t,f)}function b(){setTimeout(function(){if(l)$e(t,f)},0)}function p(){Le(f)}return t.addEventListener("input",m,!0),t.addEventListener("change",m,!0),t.addEventListener("reset",b,!0),t.addEventListener("submit",p,!0),function(){if(l=!1,t.removeEventListener("input",m,!0),t.removeEventListener("change",m,!0),t.removeEventListener("reset",b,!0),t.removeEventListener("submit",p,!0),f.observer)f.observer.disconnect();for(let g=0;g<c.length;g++)c[g]();if(Q.get(s)===u)Q.delete(s)}})}var Oe=typeof globalThis<"u"&&globalThis.Faqir||typeof window<"u"&&window.Faqir;if(Oe&&typeof Oe.plugin==="function")Oe.plugin(nt);})();
package/dist/sri.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
- "faqir-core.js": "sha384-Ehw+8Knrsxpt9enram44fdKrZh9cJoKDO8WeN7+gZ4DDJEH/RwHiceK7lgfiGprw",
3
- "faqir-core.min.js": "sha384-+FqfiMSc4+AeDam5DHWdByfqFpegDaGaYGsKVFeKqrV2YHahZla6egt04qPvvHSc",
4
- "faqir-core.min.js.map": "sha384-eMfL8gnKtbSNBDSDa8FvuTsbIe5QFjcgaMktueIfzLSGL48HzFBmCA6Wt4mMKapj",
5
- "faqir-core.mjs": "sha384-GIAWwY5wDRhwHb3/yKRvQ7D8oSmMI4PZKI0IsSMye5K1mnIwtCbgG20zphtOCn2x",
6
- "faqir.aurora.css": "sha384-TrPBHGXGxwY6sLypt3kbjbhEHz87wsYgqQhzPqi5zghmsiqewgykQx6aS+WP2O0h",
7
- "faqir.brutalist.css": "sha384-N/VfEAEdOZ2PGFX4xsPzlHEmDkXtjzmkXXW1Ta3PCtBV/RZm1rF4EYsfwLEvwqPZ",
8
- "faqir.candy.css": "sha384-/lk9HAr46O2pYwsM8vE8MBVkPLB1t2otA3Edfux98b564DvNkWqpsD4DSVdcmHAX",
9
- "faqir.clinical.css": "sha384-quTFS0lcUB0sz5ysan8vVX75oBDNzY+of7CmKDEoX5fM5OCIbYEttiZ8eLL/vQ4u",
10
- "faqir.contrast.css": "sha384-Kkc5S9mDWhATTvHHfZhNd+rN06hSCvbKLuqa5y+cwtvlF7jSunMH1bLkfrZsVw5f",
11
- "faqir.default.css": "sha384-bbc2p6aV7UYxrmv8M6x0buppf4uT7yh8DZ9d///ykZjXQokcZNtOk6xK1UUl6Mnj",
12
- "faqir.document-serif.css": "sha384-gruBhX1KhlPRKzCVMODRBoOB+IpJM3lgYB+xQgCbu35onXyy+OFvh0MBDThrRFSq",
13
- "faqir.document.css": "sha384-oC4VnHJi2ez8nAPSBwN4GWOz+BraAWcXXcGjNrQmdKujuA3fVmawKwolH1zIEzT0",
14
- "faqir.editorial-document.css": "sha384-sKWLbBQ4IvgSvhLYo0nE95l6pqku+T0VTmkkoTwg/YOx5vM9gBAPA7f6CLE8gLNa",
15
- "faqir.editorial.css": "sha384-N5sYSpAAOB81nDI+eShZ+gTZ5zbTMwaUt9fIPxwiNWBkKdaEJnsvyP3na/2SyNbv",
16
- "faqir.fintech.css": "sha384-xY6baIhCB0boozwIAPzhPg2FFZ8RhqSf/13CWeda9Bd+9D5bvZbNuiFcO67GGLOL",
17
- "faqir.glass.css": "sha384-MW9qUMfNSCgUyQjY/UqCpRxsXxuDEoVFvvpLy2htmV1Vc2mtn/z7uCXscj6Yn5zq",
18
- "faqir.ink-document.css": "sha384-uWhbYEZwSDk3QHPMWe7lzYM0HELolHkW8xyqoowVvXrToqTXnSYVw7zTVET3kTVC",
19
- "faqir.ink.css": "sha384-57zpUenZ+vVG/PViYuf1yxB0VxdV/5hxhZbKy9vi8XawKTMpbbU7AtnvgZ81ZIvs",
20
- "faqir.luxe.css": "sha384-AP+OFzUaZ0RNEOGS95dsf09tD8ltts0VslqgCyaJ3CBHHkesKJ+/MT3SA4gZPxbe",
21
- "faqir.midnight.css": "sha384-xsSMTT7Pf9i0CDFfx5hlzCBkHx5gsfORYS3rZuKnasgMkHumNUsy0fTBFcHBxSo3",
22
- "faqir.neo.css": "sha384-rNHNMTeReWOmjhAayIam2CSmH3cUpHI3VbCOxg1hhk0GE3pAB2GX6tqzXH8OU9kX",
23
- "faqir.neumorph.css": "sha384-7N6RHoYWSlnTHeTwVWrCn4ey1KR62fsAS0p1QVyb0gcljIYhcMWADZrmH/hOjhx+",
24
- "faqir.nordic.css": "sha384-A/O40XHz2mMUs3tKWT7usnwgAxSsdFpb8uXKNMtoIa3OBaR2Ibpqg5mGNov90PaT",
25
- "faqir.organic.css": "sha384-acTW5ka4Zy5SXHHn1My078WAnPkj6/KbLHKuWzToArB8rWlwZGRqlFxfq8VNAaqY",
26
- "faqir.paper.css": "sha384-O26GS1gp6lFBZmollq/g21aUGVoWixAfBEsFxhWzPif1X2ZrjeXyIOEmCn25R1Dz",
27
- "faqir.slate.css": "sha384-lSeSUhJCMUsQxM1oS2AbeqbfdLzquz4zYDYSF1N2bpA4JC0g/7fcJA/lWvkZugyq",
28
- "faqir.soft.css": "sha384-G7xaO/Rr9RdMdBch66kUiS+atQOluVXhwIb039G7WJg6KvAxDBSbA/7v8y9ouhZH",
29
- "faqir.sunset.css": "sha384-7FyjK1RJrkGTvOSFLH15WiRI1i8V3bbfpUuv4Gq3stG1NwC56/JkXOH4uPscY95b",
30
- "faqir.swiss-document.css": "sha384-hQKtiQvaCu9ot5TJnCIlPjZhUJif5cacuE27IvJi1j99iF9HuNOvfGp+epSzJlMT",
31
- "faqir.swiss.css": "sha384-Ki39mfAWeHD1KRjAB07b4MygOk5swzXSp5sUKcTWldXuiNhpNTWo+vOeponF4yfB",
32
- "faqir.terminal.css": "sha384-EE2EAqi6sG4GTe8l+7w0p8gqCjZu8A+dkfNFCx90Ue/loSNUSnLIYDqdAsApyOOR",
2
+ "faqir-core.js": "sha384-GHlaOUQ2hVOWHPv9DiXtyYgtCqdiwSB9LZ9gzvEcImqa8ISSkWprEfGjBpth/hK2",
3
+ "faqir-core.min.js": "sha384-QIoNAZIvm+fow0p483t3dS7yjI/2mNpEfyg+xRq6mIKNJ0pbhTMDvS+RsXzWPXH+",
4
+ "faqir-core.min.js.map": "sha384-D9M6vk5GQ302jHMYBA42YyBBAzoYFB14/Ai+4Q3SvYoHKaNnOwgVUCmY0udJee7l",
5
+ "faqir-core.mjs": "sha384-NgEl5+je3pP718IFtOWR3i5nlcXmYOT2wVeY8yl5/03e1S6leM4kIIOXnewOgTqL",
6
+ "faqir.aurora.css": "sha384-ZfycA0bNs1ZOLQFVAShto3TMcXm1ZkYd7HkENleFW9UHWAmM0rYFmAsDlRcbpD1P",
7
+ "faqir.brutalist.css": "sha384-rKEWQ1ocsmIa4hFZrqSyZwADRrt2zlp+xvEeSjXgTlSq+xbODy16jyj0TThiRRIH",
8
+ "faqir.candy.css": "sha384-9j6Hc3tfMFgU6AvZWLmXKXmWbe3UtYy4BPlfSCLWJ72OdhVzv/9uCVCsesXc3lll",
9
+ "faqir.clinical.css": "sha384-fkMPP/oMpdji3Jbk4ZNAEwFCwxFVwcBSJm5xBmL8Fyw+XG5R9DG3jQdu7p3PwK2j",
10
+ "faqir.contrast.css": "sha384-OHHowNIftVzWHlj6/4ps50ZHA6MJG6AkCxcixjZ63tkxCDpr83Wp7BLLbRJAb6ho",
11
+ "faqir.default.css": "sha384-m9mJ/+g9iFEVKJCVE46Cfvmf21WKOOxjGKXwSAnUTacD6MKXMsZc9J+yWCyvWBNn",
12
+ "faqir.document-serif.css": "sha384-g/vf0oMKMJNlxzcY2EMzou3EB5K6iN/09n6dbODX2ByMqZovShnKNynZVFdQzCE9",
13
+ "faqir.document.css": "sha384-HINAn/RdXt2R48f7F44PZlhc1//xUew3qwL79YzJTsezdvePKQdFltQwOtyihUXu",
14
+ "faqir.editorial-document.css": "sha384-7/lBHx0lZ9PJqB42PKKE55LtgXo682gOWgInWLgtIlUjoCzLR5/oTanZfGwd/Bch",
15
+ "faqir.editorial.css": "sha384-uUiMtRova00e/GuBXW/N2uVY3l048tYj3bv+ga067W6ZvKwx4i8yULm6RbxB8wlo",
16
+ "faqir.fintech.css": "sha384-OWyfsC3mjXV3OXWG2uo/vioWW9tnv8W+jDENq1XqC1Lj4Y02pRDfaB10kIQoWri6",
17
+ "faqir.glass.css": "sha384-qkx/DVixf/A+8Cw7R7ADAKdyZnICWasgTMwmyEKNoI59AiGjRR6rr5+8IVmS+UMw",
18
+ "faqir.ink-document.css": "sha384-a39pfAsSIa/wBMpwwF6kvZw6kWLc1qRHFcZefJCY2f49lpmeYzaEi2g9YVCwYc9V",
19
+ "faqir.ink.css": "sha384-xWghw25FmwTdJKEyG76GUh/K7kuDMspbefBPUkfDUTcC9ZRdfMqRtbHLzTxo/ugb",
20
+ "faqir.luxe.css": "sha384-EhVP+DEEzB9f7JenTo9G+1WdeLWUsEdYy59k4b/1uiP+/plnjr+TceCb4b+dkfGy",
21
+ "faqir.midnight.css": "sha384-RpEh4Rhpw3ffsiV1Xy+S2ZhLhQMiwxnwHLwfB1vDwCSR7SlyoEQB/+sJNT5pgoC3",
22
+ "faqir.neo.css": "sha384-peEZz+vAHXoXmmTZbFTcBKQka7IZAe2HnyBDDLXyTjSsGPZ7AMYVYzvaa9O9XfVF",
23
+ "faqir.neumorph.css": "sha384-XjnfiTcYKSOS6QGxXXhlWjgxwsc2IK/uMRrB9JxiV9bxKNV19aiHeTR4keBtnSuy",
24
+ "faqir.nordic.css": "sha384-ia8Jun21Bvz26UJkbnus0saxO2/Pxh/C+OStv07uFe029z8Ma9aEjFqXG9XQNazF",
25
+ "faqir.organic.css": "sha384-uNmSZ1VJwDxC9hh7NnwDy5sUYEx7CFZdPQDmpebO5SVDOhIPJyo9baRc4+4tD4sa",
26
+ "faqir.paper.css": "sha384-v19qP8TYy5uqAGiFTb0lLnpId68wYMGYNKalvZ+sKVL836TQC3ZC8k2LTvFVfX3n",
27
+ "faqir.slate.css": "sha384-XfZ4IWpVS7+6m6ZqU3nEsNveg7X7WU5s9yOU+tkTkV6ALMohiG9u+zhCSkWuLCBJ",
28
+ "faqir.soft.css": "sha384-YZ8hVr92Fbfdnve44ue2RvojtgPyJcdzO55vMnCo7aH5WtnznV6SRIl3/p+Pypk5",
29
+ "faqir.sunset.css": "sha384-h2Ovn9eS+QCl24cojeI8LNjWk1uIsB3pjdyVxOz8KizMXQltFm3B9Y/rGL3OLx71",
30
+ "faqir.swiss-document.css": "sha384-ujQOm08Wdiy3TW2HNrf4dpBH5nwXjqgWJGPEPMXr6zZ4ihu6udkAroXjuTQyJhJc",
31
+ "faqir.swiss.css": "sha384-4C8wATYMgbyNm4wjsaxgqqtVEpMQI4EyAfsNBVFwB8GuNkMrsrhMIP0rpRWBYhJ4",
32
+ "faqir.terminal.css": "sha384-fcEM0/i8MaY7XKf5Bhqt8cELiuJwCn8pwFX/tYPhDstOYzii4msJxufh9xFpk4zX",
33
33
  "plugins/faqir-collapse.js": "sha384-3l5Z+isXlDkidRevDGkuNOiDp6eJ2ML11RkXA0j4ixQBaepuu8pAhyY4YRnR1qB7",
34
34
  "plugins/faqir-intersect.js": "sha384-Q/akZjAcnTnGYPKBP7b8c3iyYbHTIW1IPjBivzOH9dE7Nflr9Cu6adjeDXU2bhk6",
35
- "plugins/faqir-mask.js": "sha384-7yA/VdjGdg/6vwX+zUbughO6ERyV2rEsVyNYBO5ghqJbAhj9912F9qMPTkLc55B6",
35
+ "plugins/faqir-mask.js": "sha384-QvmZoq/+9/ef3U9JkdKlRMFhUMNGjnKct4JC3g7/ypEXEuTeny3JlUvsnrFv75v+",
36
36
  "plugins/faqir-persist.js": "sha384-o0jfddebC8QZ3S26VXUlOme723BNMlb/N7vqpn+fWpSeEFXzpq+3MoeXhVL/0PSv",
37
- "plugins/faqir-rules.js": "sha384-xE90r5W3AlWKu+idcwx6NAkVUcRWMgM9ZJ1VgJLOguj/0GYP0jfflCojiCWt4FVq",
37
+ "plugins/faqir-rules.js": "sha384-xJ/JhLJ+0oryaniOzZISjeDFAgiJfFwlUw+wCrLdmpr8m0ZAtN4rsvqD/1gwl/T/",
38
38
  "plugins/faqir-validate.js": "sha384-TIyGNL8dHBnFdV56LAhdklvhQLsClQqGuQ7DT0Zgxva8DIzfONXZSJYTXhQxJcN0"
39
39
  }
package/faqir-core.d.ts CHANGED
@@ -76,6 +76,12 @@ export interface Magics {
76
76
  * expression is written on. Every magic that walks the DOM starts here.
77
77
  */
78
78
  readonly $el: Element;
79
+ /**
80
+ * The element the directive is written on — the `<input>` carrying `l-init`,
81
+ * the button carrying `@click`. The root in `l-data` and a root's `l-init`;
82
+ * the `<template>` in `l-for`'s list and `l-key` expressions. [1.1F-06]
83
+ */
84
+ readonly $this: Element;
79
85
  /** The scope's `l-ref` elements, keyed by name. */
80
86
  readonly $refs: Record<string, Element>;
81
87
  /** Every store registered with `Faqir.store()`. */
@@ -739,10 +745,12 @@ export interface DevtoolsComponent {
739
745
  /**
740
746
  * One recorded diagnostic. The production engine records none, so
741
747
  * `warnings()` is always `[]` there — every class exists only in
742
- * `faqir-core.dev.js`. `key` is a duplicate `l-key` in a keyed `l-for`.
748
+ * `faqir-core.dev.js`. `key` is a duplicate `l-key` in a keyed `l-for`;
749
+ * `style` is a `:style` that declares `display` beside `l-show`; `shadow` is
750
+ * an `l-for` loop variable that shadows a name its scope already has.
743
751
  */
744
752
  export interface DevtoolsWarning {
745
- kind: "expression" | "directive" | "reorder" | "key" | "html" | "plugin";
753
+ kind: "expression" | "directive" | "reorder" | "key" | "html" | "style" | "shadow" | "plugin";
746
754
  message: string;
747
755
  /** The offending element, as a short label. */
748
756
  element: string | null;
@@ -837,7 +845,14 @@ export interface FaqirGlobal {
837
845
  ): void;
838
846
 
839
847
  // ── Lifecycle ──
840
- /** Bootstrap. Runs automatically unless the script tag carries `data-manual`. */
848
+ /**
849
+ * Bootstrap. Runs automatically — on `DOMContentLoaded`, or one task after the
850
+ * engine is evaluated when the document is already parsed (a module, `defer`
851
+ * script or bundler import), so `data()` / `directive()` calls made right after
852
+ * importing it are seen. Opt out with `data-manual` on the engine's `<script>`,
853
+ * or on the page's `<script type="module">` when the engine is imported.
854
+ * Safe to call again: already-bound markup is not re-bound.
855
+ */
841
856
  start(): void;
842
857
  /** Initialize one subtree, optionally inside an existing scope. */
843
858
  initTree(root: Element, parentScope?: Scope | null): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faqir-ui/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Faqir UI runtime engine — the Alpine-style reactive core (faqir-core.js), minified CDN build, and prebuilt per-theme CSS bundles. Zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/faqir-core.mjs",