check-types-mini 8.2.1 → 8.2.3

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 8.2.3 (2026-09-06)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **check-types-mini:** replace type-detect with an internal TypeScript helper ([06d7446](https://github.com/codsen/codsen/commit/06d74468c3f28f432a8c4c4fd72d4f9807f34115))
11
+
12
+ ## 8.2.2 (2026-09-01)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **check-types-mini:** harden validation contracts ([ee91068](https://github.com/codsen/codsen/commit/ee910686461b2fcc531a37710917ae6cd58118f2))
17
+
6
18
  ## 8.2.1 (2026-08-22)
7
19
 
8
20
  ### Performance Improvements
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
22
22
  </p>
23
23
 
24
+ **No 3rd party dependencies.** All dependencies, checked recursively, are Codsen packages.
25
+
24
26
  ## Install
25
27
 
26
28
  This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 6.1.0 (`npm i check-types-mini@6.1.0`).
@@ -63,7 +65,7 @@ assert.throws(
63
65
 
64
66
  ## Documentation
65
67
 
66
- Please [visit codsen.com](https://codsen.com/os/check-types-mini/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/check-types-mini/CHANGELOG.md).
68
+ Please [visit codsen.com](https://codsen.com/os/check-types-mini/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/check-types-mini/CHANGELOG.md) or [the website](https://codsen.com/os/check-types-mini/changelog).
67
69
 
68
70
  ## Contributing
69
71
 
@@ -1,24 +1,10 @@
1
1
  /**
2
2
  * @name check-types-mini
3
3
  * @fileoverview Validate options object
4
- * @version 8.2.1
4
+ * @version 8.2.3
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/check-types-mini/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as $,isPlainObject as m,match as I}from"codsen-utils";import g from"type-detect";var j="8.2.1";var U=j,_={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"},C=new Set(["any","anything","every","everything","all","whatever","whatevs"]),v=Object.prototype.hasOwnProperty,M={caseSensitiveMatch:!0};function N(t,s){return s.some(n=>t===n||I(t,n))}function k(t,s){return s.length?t.filter(n=>!s.some(e=>n===e||I(n,e,M))):t}function E(t,s){if(!s.length)return t;let n=new Set(s);return t.filter(e=>!n.has(e))}function R(t){let s={};function n(e,o){if(m(e)){for(let p of Object.keys(e))n(e[p],o?`${o}.${p}`:p);return}let u=Array.isArray(e)?e:[e];s[o]=u.map(p=>`${p}`.toLowerCase().trim())}for(let e of Object.keys(t))n(t[e],e);return s}function w(t,s,n=""){if(Array.isArray(t))for(let e=0;e<t.length;e++){if(t[e]===void 0)continue;let o=n?`${n}.${e}`:`${e}`;s(t[e],void 0,{path:o,parent:t,parentType:"array"}),w(t[e],s,o)}else if(m(t))for(let e of Object.keys(t)){let o=n?`${n}.${e}`:e;s(e,t[e],{path:o,parent:t,parentType:"object"}),w(t[e],s,o)}}function W(t,s){let n=t,e=0;for(;e<=s.length;){let o=s.indexOf(".",e),u=o===-1?s.slice(e):s.slice(e,o);if(n===null||typeof n!="object"&&typeof n!="function"||!v.call(n,u))return[!1,void 0];if(n=n[u],o===-1)return[!0,n];e=o+1}return[!1,void 0]}function L(t,s,n){if(t==null)throw new Error("check-types-mini/checkTypesMini(): [THROW_ID_01] First argument is missing!");let e={..._,...n};if(typeof e.ignoreKeys=="string"&&(e.ignoreKeys=[e.ignoreKeys]),typeof e.ignorePaths=="string"&&(e.ignorePaths=[e.ignorePaths]),typeof e.acceptArraysIgnore=="string"&&(e.acceptArraysIgnore=[e.acceptArraysIgnore]),e.msg=`${e.msg}`.trim(),e.msg[e.msg.length-1]===":"&&(e.msg=e.msg.slice(0,e.msg.length-1).trim()),m(e.schema))e.schema=R(e.schema);else if(e.schema!=null)throw new Error(`check-types-mini/checkTypesMini(): [THROW_ID_02] opts.schema was customised to ${$(e.schema)} which is not object but ${typeof e.schema}`);s==null&&(s={});let o=e.ignoreKeys,u=e.ignorePaths,p=e.acceptArraysIgnore,b=Object.keys(t),y=m(s)?Object.keys(s):[],S=m(e.schema)?Object.keys(e.schema):[];if(e.enforceStrictKeyset)if(S.length){let i=k(E(b,y.concat(S)),o);if(i.length)throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_03] ${e.msg}: ${e.optsVarName}.enforceStrictKeyset is on and the following key${i.length>1?"s":""} ${i.length>1?"are":"is"} not covered by schema and/or reference objects: ${i.join(", ")}`)}else if(y.length){let i=k(E(b,y),o);if(i.length)throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_04] ${e.msg}: The input object has key${i.length>1?"s":""} which ${i.length>1?"are":"is"} not covered by the reference object: ${i.join(", ")}`);if(i=k(E(y,b),o),i.length)throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_05] ${e.msg}: The reference object has key${i.length>1?"s":""} which ${i.length>1?"are":"is"} not present in the input object: ${i.join(", ")}`)}else throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_06] ${e.msg}: Both ${e.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via resolvedOpts.enforceStrictKeyset!`);let d=[];w(t,(i,K,c)=>{let r=K,O=i;if(c.parentType==="array"&&(O=void 0,r=i),d.length&&d.some(a=>c.path.startsWith(`${a}.`))||O&&N(O,o)||N(c.path,u))return r;let P=!(!m(r)&&!Array.isArray(r)&&Array.isArray(c.parent)),D=m(e.schema)&&v.call(e.schema,c.path),[V,H]=m(s)?W(s,c.path):[!1,void 0];if(e.enforceStrictKeyset&&P&&!D&&!V)throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_07] ${e.msg}: ${e.optsVarName}.${c.path} is neither covered by reference object (second input argument), nor ${e.optsVarName}.schema! To stop this error, turn off ${e.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${e.optsVarName}.schema).
11
-
12
- Debug info:
13
-
14
- obj = ${$(t,4)}
15
-
16
- ref = ${$(s,4)}
17
-
18
- innerObj = ${$(c,4)}
19
-
20
- resolvedOpts = ${$(e,4)}
21
-
22
- current = ${$(r,4)}
23
-
24
- `);if(D){let a=e.schema[c.path];if(a.filter(l=>C.has(l)).length)d.push(c.path);else{let l=g(r).toLowerCase();if(r!==!0&&r!==!1&&!a.includes(l)||(r===!0||r===!1)&&!a.includes(String(r))&&!a.includes("boolean"))if(Array.isArray(r)&&e.acceptArrays)for(let h=0,T=r.length;h<T;h++){let A=g(r[h]).toLowerCase();if(!a.includes(A))throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_08] ${e.msg}: ${e.optsVarName}.${c.path}.${h}, the ${h}th element (equal to ${$(r[h])}) is of a type ${A}, but only the following are allowed by the ${e.optsVarName}.schema: ${a.join(", ")}`)}else throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_09] ${e.msg}: ${e.optsVarName}.${c.path} was customised to ${l!=="string"?'"':""}${$(r)}${l!=="string"?'"':""} (type: ${l}) which is not among the allowed types in schema (which is equal to ${$(a)})`)}}else if(s&&m(s)&&V){let a=g(r),f=g(H);if(e.acceptArrays&&Array.isArray(r)&&!p.includes(i)){let l=f.toLowerCase();if(!r.every(T=>g(T).toLowerCase()===l))throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_10] ${e.msg}: ${e.optsVarName}.${c.path} was customised to be array, but not all of its elements are ${l}-type`)}else if(a!==f){let l=a.toLowerCase();throw new TypeError(`check-types-mini/checkTypesMini(): [THROW_ID_11] ${e.msg}: ${e.optsVarName}.${c.path} was customised to ${l==="string"?"":'"'}${$(r)}${l==="string"?"":'"'} which is not ${f.toLowerCase()} but ${l}`)}}return r})}function Y(t,s,n){L(t,s,n)}export{Y as checkTypesMini,_ as defaults,U as version};
10
+ import*as He from"codsen-utils";var Re="8.2.3";var Je=Object.prototype.toString,Ue=typeof self=="object"?self:global,Qe=new Map([[null,"Object"],[Date.prototype,"Date"],[RegExp.prototype,"RegExp"],[Promise.prototype,"Promise"],[Map.prototype,"Map"],[Set.prototype,"Set"],[WeakMap.prototype,"WeakMap"],[WeakSet.prototype,"WeakSet"],[DataView.prototype,"DataView"],[Object.getPrototypeOf(new Map().entries()),"Map Iterator"],[Object.getPrototypeOf(new Set().entries()),"Set Iterator"],[Object.getPrototypeOf([][Symbol.iterator]()),"Array Iterator"],[Object.getPrototypeOf(""[Symbol.iterator]()),"String Iterator"]]);function m(e){let n=typeof e;if(n!=="object")return n;if(e===null)return"null";if(e===Ue)return"global";let t=e;if(Array.isArray(t)&&!(Symbol.toStringTag in t))return"Array";if(typeof window=="object"&&window!==null){if(t===window.location)return"Location";if(t===window.document)return"Document";if(t===window.navigator?.mimeTypes)return"MimeTypeArray";if(t===window.navigator?.plugins)return"PluginArray";if(typeof window.HTMLElement=="function"&&t instanceof window.HTMLElement){if(t.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(t.tagName==="TD")return"HTMLTableDataCellElement";if(t.tagName==="TH")return"HTMLTableHeaderCellElement"}}let r=t[Symbol.toStringTag];return typeof r=="string"?r:Qe.get(Object.getPrototypeOf(t))??Je.call(t).slice(8,-1)}var ft=Re,{formatDiagnosticValue:k,isPlainObject:j,match:Ce}=He,se=Object.getOwnPropertyDescriptor(He,"createMatcher")?.value,R=Object.freeze([]),We=Object.freeze({}),ie={acceptArrays:!1,acceptArraysIgnore:R,enforceStrictKeyset:!0,ignoreKeys:R,ignorePaths:R,msg:"check-types-mini",optsVarName:"opts",reportCompletionFunc:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,schema:We},gt=Object.freeze({...ie}),ye=class extends TypeError{actualType;context;expectedTypes;name="CheckTypesMiniError";path;reason;validatorCode;constructor(n,t,r={}){let o=r.context||ie.msg;super(`check-types-mini/checkTypesMini(): [${n}] ${o}: ${t}`),this.actualType=r.actualType??null,this.context=o,this.expectedTypes=r.expectedTypes?Object.freeze(Array.from(r.expectedTypes)):null,this.path=Object.freeze(Array.from(r.path??R)),this.reason=t,this.validatorCode=n}toJSON(){return{actualType:this.actualType,context:this.context,expectedTypes:this.expectedTypes,message:this.message,name:this.name,path:this.path,reason:this.reason,validatorCode:this.validatorCode}}},Te=new Set(["all","any","anything","every","everything","whatever","whatevs"]),V=Object.prototype.hasOwnProperty,ae={caseSensitiveMatch:!0},Ye=new Map,Ze=new Map,Ge=100,Xe=new Set(["acceptArrays","acceptArraysIgnore","enforceStrictKeyset","ignoreKeys","ignorePaths","msg","optsVarName","reportCompletionFunc","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","schema"]);function be(){return{children:new Map,descriptors:null,implicitContainer:!1}}var Fe=be();function et(e){return"keys"in e}function tt(e){return"keys"in e}function C(e){if(!e)return[];let n=new Array(e.depth),t=e;for(;t;)n[t.depth-1]=t.segment,t=t.parent;return n}function T(e,n){let t=e;for(let r of C(n))/^(?:[A-Za-z_$][A-Za-z0-9_$]*|\d+)$/u.test(r)?t+=`.${r}`:t+=`[${JSON.stringify(r)}]`;return t}function Q(e){let n="";for(let t of e)t==="%"?n+="%25":t==="."?n+="%2E":t==="\\"?n+="%5C":n+=t;return n}function nt(e){return e.encoded}function Ne(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(r==="\\"&&t+1<e.length){let o=e[t+1];o==="."?n+="%2E":o==="%"?n+="%25":o==="\\"?n+="%5C":n+=`\\${o}`,t++}else r==="%"?n+="%25":n+=r}return n}function me(e,n){if(!e.length)return null;if(e.length===1){let r=e[0],o=n?Ze:Ye,u=o.get(r);if(u)return u;let w=n?Ne(r):r,S=se?se(w,ae):Y=>Ce(Y,w,ae);return o.size<Ge&&o.set(r,S),S}let t=n?e.map(Ne):Array.from(e);return se?se(t,ae):r=>Ce(r,t,ae)}function rt(e){let n=[],t="";for(let r=0;r<e.length;r++){let o=e[r];o==="\\"&&r+1<e.length?(t+=e[r+1],r++):o==="."?(n.push(t),t=""):t+=o}return n.push(t),n}function De(e,n){if(n.some(r=>Te.has(r)))return!0;if(e===!0)return n.includes("true")||n.includes("boolean");if(e===!1)return n.includes("false")||n.includes("boolean");let t=m(e).toLowerCase();return t==="object"&&n.includes("object")?j(e):n.includes(t)}function fe(e){return e.includes("object")&&!e.some(n=>Te.has(n))}function ot(e){let n=Array.isArray(e)?e:[e];if(!n.length)return null;let t=[];for(let r=0;r<n.length;r++){if(!V.call(n,r))return null;let o=n[r];if(o!=null&&typeof o!="string")return null;let u=String(o).toLowerCase().trim();if(!u)return null;t.includes(u)||t.push(u)}return t}function $(e){return Array.isArray(e)?Object.keys(e).filter(n=>{let t=Number(n);return Number.isInteger(t)&&t>=0&&t<e.length&&String(t)===n}):Object.keys(e)}function st(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function $e(e,n){if(e)try{e(n)}catch{}}function h(e,n,t={}){throw new ye(e,n,t)}function b(e,n){return V.call(e,n)&&e[n]!==void 0?e[n]:ie[n]}function U(e,n){return e[n]}function Ae(e,n,t){return!!(n?.(e)||t?.(Q(e)))}function W(e,n,t,r,o){return h(e,n,{actualType:r,context:o,path:C(t)})}function ge(e,n){if(e===void 0)return Array.from(n);let t=typeof e=="string"?[e]:e;if(!Array.isArray(t))return null;let r=[];for(let o=0;o<t.length;o++){if(!V.call(t,o)||typeof t[o]!="string")return null;r.push(t[o])}return r}function yt(...e){let[n,t,r]=e;j(n)||h("THROW_ID_01",`The first argument must be a plain object; received ${k(n,4)}.`,{actualType:m(n).toLowerCase()}),(e.length<2||t!==null&&!j(t))&&h("THROW_ID_02",`The second argument must be a plain object or null; received ${k(t,4)}. Pass null explicitly when validating against only a schema.`,{actualType:m(t).toLowerCase()}),r!=null&&!j(r)&&h("THROW_ID_03",`The third argument must be a plain options object, null, or undefined; received ${k(r,4)}.`,{actualType:m(r).toLowerCase()});let o=r??We,u=Object.keys(o).find(s=>!Xe.has(s));u!==void 0&&h("THROW_ID_04",`Unknown option ${k(u)}.`,{path:[u]});let w=ge(b(o,"ignoreKeys"),R),S=ge(b(o,"ignorePaths"),R),Y=ge(b(o,"acceptArraysIgnore"),R);(!w||!S||!Y)&&h("THROW_ID_05","opts.ignoreKeys, opts.ignorePaths, and opts.acceptArraysIgnore must each be a string or a dense array of strings.");let we=b(o,"acceptArrays"),Oe=b(o,"enforceStrictKeyset");(typeof we!="boolean"||typeof Oe!="boolean")&&h("THROW_ID_06","opts.acceptArrays and opts.enforceStrictKeyset must be Booleans.");let A=b(o,"schema");j(A)||h("THROW_ID_07",`opts.schema was customised to ${k(A)} which is not a plain object but ${m(A).toLowerCase()}.`,{actualType:m(A).toLowerCase(),path:["schema"]});let je=b(o,"msg"),ke=b(o,"optsVarName");(typeof je!="string"||typeof ke!="string")&&h("THROW_ID_08","opts.msg and opts.optsVarName must be strings.");let p=je.trim();p.endsWith(":")&&(p=p.slice(0,-1).trim()),p||(p=ie.msg);let Ve=ke,ce=b(o,"reportCompletionFunc"),le=b(o,"reportProgressFunc");(ce!==null&&typeof ce!="function"||le!==null&&typeof le!="function")&&h("THROW_ID_09","opts.reportCompletionFunc and opts.reportProgressFunc must each be a function, null, or undefined.",{context:p});let Z=b(o,"reportProgressFuncFrom"),G=b(o,"reportProgressFuncTo");(!Number.isFinite(Z)||!Number.isFinite(G))&&h("THROW_ID_10","opts.reportProgressFuncFrom and opts.reportProgressFuncTo must be finite numbers.",{context:p}),Z>G&&h("THROW_ID_11",`opts.reportProgressFuncFrom cannot exceed opts.reportProgressFuncTo; received ${Z} and ${G}.`,{context:p});let i={acceptArrays:we,acceptArraysIgnore:Y,enforceStrictKeyset:Oe,ignoreKeys:w,ignorePaths:S,msg:p,optsVarName:Ve,reportCompletionFunc:ce,reportProgressFunc:le,reportProgressFuncFrom:Z,reportProgressFuncTo:G,schema:A},P=!!(i.reportCompletionFunc||i.reportProgressFunc),Ke=i.reportCompletionFunc?Date.now():0,X=0,v=0,Pe=0,ve=0,pe=0,M=0,ee=0,Se,te=null,_=null;P&&(te=(s=!1)=>{if(!i.reportProgressFunc)return;let c=i.reportProgressFuncTo-i.reportProgressFuncFrom,a=s?i.reportProgressFuncTo:i.reportProgressFuncFrom+c*Math.min(.99,ee/(ee+1e3));a!==Se&&(Se=a,$e(i.reportProgressFunc,a))},_=()=>{ee++,ee%1e3===0&&te?.()},te());let K=n,F=t,ne=A,re=$(ne),E=re.length?be():Fe,L="THROW_ID_12",Ee="THROW_ID_13",ue=re.length?new Set([ne]):null,z=re.length?[{value:ne},{index:0,keys:re,node:E,path:null,value:ne}]:[];for(;z.length;){let s=z.pop();if(!tt(s)){ue?.delete(s.value);continue}if(s.index>=s.keys.length)continue;let c=s.keys[s.index++];z.push(s);let a=U(s.value,c),l=rt(c),f=s.node,d=s.path;for(let D=0;D<l.length;D++){let g=l[D],y=f.children.get(g);y||(y=be(),f.children.set(g,y),ve++,_?.()),d={depth:(d?.depth??0)+1,encoded:d?`${d.encoded}.${Q(g)}`:Q(g),parent:d,segment:g},D<l.length-1&&(y.descriptors&&!fe(y.descriptors)&&W(L,`${T("schema",d)} cannot have both a terminal descriptor and nested schema paths.`,d,null,p),y.implicitContainer=!0),d.depth>v&&(v=d.depth),f=y}if(j(a)){f.descriptors&&!fe(f.descriptors)&&W(L,`${T("schema",d)} cannot have both a terminal descriptor and nested schema paths.`,d,"object",p),f.implicitContainer=!0,ue?.has(a)&&W(Ee,`${T("schema",d)} contains a cycle. Cyclic schemas are not supported.`,d,"object",p),ue?.add(a),z.push({value:a}),z.push({index:0,keys:$(a),node:f,path:d,value:a});continue}let O=ot(a);O||W(L,`${T("schema",d)} must be a non-empty type name, null, undefined, or a dense array of those values; received ${k(a,4)}.`,d,m(a).toLowerCase(),p);let N=O;f.descriptors&&W(L,`${T("schema",d)} is declared more than once.`,d,m(a).toLowerCase(),p),(f.children.size||f.implicitContainer)&&!fe(N)&&W(L,`${T("schema",d)} cannot have both a terminal descriptor and nested schema paths.`,d,m(a).toLowerCase(),p),f.descriptors=N}let de=me(i.ignoreKeys,!1),he=me(i.ignorePaths,!0),_e=me(i.acceptArraysIgnore,!1),Ie=$(K),Le=F?$(F):R;if(i.enforceStrictKeyset&&!F&&E.children.size===0&&h("THROW_ID_14",`Both ${i.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as requested via ${i.optsVarName}.enforceStrictKeyset.`,{context:p}),i.enforceStrictKeyset){let s=Ie.filter(c=>!Ae(c,de,he)&&!(F&&V.call(F,c))&&!E.children.has(c));if(s.length){let c=s.length>1,a=E.children.size?`The ${i.optsVarName}.enforceStrictKeyset is on and the following key${c?"s are":" is"} not covered by schema and/or reference objects: ${s.join(", ")}`:`The input object has key${c?"s":""} which ${c?"are":"is"} not covered by the reference object: ${s.join(", ")}`;h("THROW_ID_15",a,{context:p})}}if(i.enforceStrictKeyset&&F){let s=Le.filter(c=>!V.call(K,c)&&!Ae(c,de,he));if(s.length){let c=s.length>1;h("THROW_ID_16",`The reference object has key${c?"s":""} which ${c?"are":"is"} not present in the input object: ${s.join(", ")}`,{context:p})}}let H=[K],I=null,q=[{value:K},{index:0,keys:Ie,path:null,refValue:F,schemaNode:E,value:K}];for(;q.length;){let s=q.pop();if(!et(s)){H.pop(),I?.delete(s.value),I&&H.length<=32&&(I=null);continue}if(s.index>=s.keys.length)continue;let c=s.keys[s.index++];q.push(s);let a={depth:(s.path?.depth??0)+1,encoded:s.path?`${s.path.encoded}.${Q(c)}`:Q(c),parent:s.path,segment:c};P&&(Array.isArray(s.value)?X++:Pe++,a.depth>v&&(v=a.depth),_?.());let l=U(s.value,c),f=Array.isArray(s.value);if(!!(!f&&de?.(c)||he?.(nt(a)))){P&&pe++;continue}let O=s.schemaNode.children.get(c),N=!1;if(O?.descriptors){let x=O.descriptors;if(x.some(B=>Te.has(B))){P&&pe++;continue}if(P&&(M++,_?.()),De(l,x))if((O.implicitContainer||O.children.size)&&j(l))N=!0;else continue;if(!N&&i.acceptArrays&&Array.isArray(l)&&!_e?.(c)){let B=$(l);for(let J of B){let oe=U(l,J);P&&(X++,M++,a.depth+1>v&&(v=a.depth+1),_?.()),De(oe,x)||it(oe,x,a,Number(J),i,p)}continue}N||Me(l,x,a,i,p)}let D=!1,g;st(s.refValue)&&V.call(s.refValue,c)&&(D=!0,g=U(s.refValue,c));let y=!1,ze=g,qe=O??Fe;if(O&&(O.implicitContainer||O.children.size))N||(P&&(M++,_?.()),j(l)||Me(l,["object"],a,i,p)),y=!0;else if(D){if(i.acceptArrays&&Array.isArray(l)&&!Array.isArray(g)&&!_e?.(c)){let x=m(g).toLowerCase(),B=$(l);for(let J of B){let oe=U(l,J);P&&(X++,M++,a.depth+1>v&&(v=a.depth+1),_?.());let xe=m(oe).toLowerCase();xe!==x&&ct(xe,x,a,Number(J),i,p)}continue}P&&(M++,_?.()),m(l)!==m(g)&&lt(l,g,a,i,p),(Array.isArray(l)&&Array.isArray(g)||j(l))&&(y=!0)}else i.enforceStrictKeyset&&(!f||j(l)||Array.isArray(l))&&at(a,i,p);y&&((I?I.has(l):H.includes(l))&&pt(a,i,p),H.push(l),I?I.add(l):H.length>32&&(I=new Set(H)),q.push({value:l}),q.push({index:0,keys:$(l),path:a,refValue:ze,schemaNode:qe,value:l}))}te?.(!0),$e(i.reportCompletionFunc,Object.freeze({arrayElementsVisited:X,maxDepth:v,objectPropertiesVisited:Pe,schemaEntries:ve,timeTakenInMilliseconds:i.reportCompletionFunc?Date.now()-Ke:0,valuesIgnored:pe,valuesValidated:M}))}function at(e,n,t){return h("THROW_ID_17",`${T(n.optsVarName,e)} is neither covered by reference object (second input argument), nor ${n.optsVarName}.schema! To stop this error, turn off ${n.optsVarName}.enforceStrictKeyset or provide a type reference.`,{context:t,path:C(e)})}function Me(e,n,t,r,o){let u=m(e).toLowerCase(),w=u==="string"?"":'"';return h("THROW_ID_18",`${T(r.optsVarName,t)} was customised to ${w}${k(e)}${w} (type: ${u}) which is not among the allowed types in schema (which is equal to ${k(n)})`,{actualType:u,context:o,expectedTypes:n,path:C(t)})}function it(e,n,t,r,o,u){return h("THROW_ID_19",`${T(o.optsVarName,t)}.${r}, the ${r}th element (equal to ${k(e)}) is of a type ${m(e).toLowerCase()}, but only the following are allowed by the ${o.optsVarName}.schema: ${n.join(", ")}`,{actualType:m(e).toLowerCase(),context:u,expectedTypes:n,path:C({depth:t.depth+1,encoded:`${t.encoded}.${r}`,parent:t,segment:String(r)})})}function ct(e,n,t,r,o,u){return h("THROW_ID_20",`${T(o.optsVarName,t)} was customised to be array, but not all of its elements are ${n}-type`,{actualType:e,context:u,expectedTypes:[n],path:C({depth:t.depth+1,encoded:`${t.encoded}.${r}`,parent:t,segment:String(r)})})}function lt(e,n,t,r,o){let u=m(e).toLowerCase(),w=m(n).toLowerCase(),S=u==="string"?"":'"';return h("THROW_ID_21",`${T(r.optsVarName,t)} was customised to ${S}${k(e)}${S} which is not ${w} but ${u}`,{actualType:u,context:o,expectedTypes:[w],path:C(t)})}function pt(e,n,t){return h("THROW_ID_22",`${T(n.optsVarName,e)} contains a cycle. Cyclic input structures are not supported.`,{actualType:"object",context:t,path:C(e)})}export{ye as CheckTypesMiniError,yt as checkTypesMini,gt as defaults,ft as version};
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @name check-types-mini
3
3
  * @fileoverview Validate options object
4
- * @version 8.2.1
4
+ * @version 8.2.3
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/check-types-mini/}
8
8
  */
9
9
 
10
- "use strict";var checkTypesMini=(()=>{var se=Object.create;var D=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,ue=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var B=(e,n,r)=>n in e?D(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,x=(e,n)=>{for(var r in n||(n={}))J.call(n,r)&&B(e,r,n[r]);if(_)for(var r of _(n))ce.call(n,r)&&B(e,r,n[r]);return e};var fe=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(r){throw n=0,r}},pe=(e,n)=>{for(var r in n)D(e,r,{get:n[r],enumerable:!0})},U=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of ae(n))!J.call(e,i)&&i!==r&&D(e,i,{get:()=>n[i],enumerable:!(t=le(n,i))||t.enumerable});return e};var he=(e,n,r)=>(r=e!=null?se(ue(e)):{},U(n||!e||!e.__esModule?D(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>U(D({},"__esModule",{value:!0}),e);var te=fe((M,W)=>{(function(e,n){typeof M=="object"&&typeof W<"u"?W.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.typeDetect=n())})(M,(function(){"use strict";var e=typeof Promise=="function",n=(function(y){if(typeof globalThis=="object")return globalThis;Object.defineProperty(y,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var O=typeDetectGlobalObject;return delete y.typeDetectGlobalObject,O})(Object.prototype),r=typeof Symbol<"u",t=typeof Map<"u",i=typeof Set<"u",l=typeof WeakMap<"u",s=typeof WeakSet<"u",a=typeof DataView<"u",u=r&&typeof Symbol.iterator<"u",f=r&&typeof Symbol.toStringTag<"u",w=i&&typeof Set.prototype.entries=="function",h=t&&typeof Map.prototype.entries=="function",m=w&&Object.getPrototypeOf(new Set().entries()),g=h&&Object.getPrototypeOf(new Map().entries()),o=u&&typeof Array.prototype[Symbol.iterator]=="function",c=o&&Object.getPrototypeOf([][Symbol.iterator]()),p=u&&typeof String.prototype[Symbol.iterator]=="function",b=p&&Object.getPrototypeOf(""[Symbol.iterator]()),S=8,d=-1;function $(y){var O=typeof y;if(O!=="object")return O;if(y===null)return"null";if(y===n)return"global";if(Array.isArray(y)&&(f===!1||!(Symbol.toStringTag in y)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&y===window.location)return"Location";if(typeof window.document=="object"&&y===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&y===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&y===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&y instanceof window.HTMLElement){if(y.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(y.tagName==="TD")return"HTMLTableDataCellElement";if(y.tagName==="TH")return"HTMLTableHeaderCellElement"}}var A=f&&y[Symbol.toStringTag];if(typeof A=="string")return A;var v=Object.getPrototypeOf(y);return v===RegExp.prototype?"RegExp":v===Date.prototype?"Date":e&&v===Promise.prototype?"Promise":i&&v===Set.prototype?"Set":t&&v===Map.prototype?"Map":s&&v===WeakSet.prototype?"WeakSet":l&&v===WeakMap.prototype?"WeakMap":a&&v===DataView.prototype?"DataView":t&&v===g?"Map Iterator":i&&v===m?"Set Iterator":o&&v===c?"Array Iterator":p&&v===b?"String Iterator":v===null?"Object":Object.prototype.toString.call(y).slice(S,d)}return $}))});var Me={};pe(Me,{checkTypesMini:()=>Ne,defaults:()=>ie,version:()=>je});function ye(){let e=[],n=0,r=!1;return{append(t){return r?!1:n+t.length>1999?(e.push("\u2026"),n+=1,r=!0,!1):(e.push(t),n+=t.length,!0)},result(){return e.join("")},stopped(){return r}}}function de(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function I(e,n){if(e.append('"')){for(let r=0;r<n.length&&!e.stopped();r+=1){let t=n.charCodeAt(r);t===34?e.append('\\"'):t===92?e.append("\\\\"):t===8?e.append("\\b"):t===9?e.append("\\t"):t===10?e.append("\\n"):t===12?e.append("\\f"):t===13?e.append("\\r"):t<32||t===8232||t===8233||t>=55296&&t<=57343?e.append(de(t)):e.append(n[r])}e.append('"')}}function me(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function q(e,n){e.append("Symbol(");let r=String(n);r.length>8&&I(e,r.slice(7,-1)),e.append(")")}function F(e,n){typeof n=="symbol"?q(e,n):I(e,String(n))}function k(e,n=0){let r=ye(),t=n===4?4:0,i=new WeakSet,l=0;function s(o){t&&r.append(" ".repeat(o*t))}function a(o,c){o&&r.append(","),t&&(r.append("\n"),s(c+1))}function u(o,c,p){t&&c&&(r.append("\n"),s(p)),r.append(o)}function f(o,c){Object.prototype.hasOwnProperty.call(o,"value")?g(o.value,c):r.append(me(o))}function w(o,c){let p;try{p=Reflect.getOwnPropertyDescriptor(o,"length")}catch(d){r.append("[Uninspectable]");return}let b=p==null?void 0:p.value;if(!Number.isSafeInteger(b)||b<0){r.append("[Uninspectable]");return}r.append("[");let S=!1;for(let d=0;d<b&&!r.stopped();d+=1){if(a(S,c),S=!0,l>=50){r.append("[MaxEntries]");break}l+=1;let $;try{$=Reflect.getOwnPropertyDescriptor(o,String(d))}catch(y){r.append("[Uninspectable]");continue}$!=null&&$.enumerable?f($,c+1):r.append("[Empty]")}u("]",S,c)}function h(o,c){let p;try{p=Reflect.ownKeys(o)}catch(S){r.append("[Uninspectable]");return}r.append("{");let b=!1;for(let S of p){if(r.stopped())break;if(l>=50){a(b,c),b=!0,I(r,"\u2026"),r.append(t?": ":":"),r.append("[MaxEntries]");break}l+=1;let d;try{d=Reflect.getOwnPropertyDescriptor(o,S)}catch($){a(b,c),b=!0,F(r,S),r.append(t?": ":":"),r.append("[Uninspectable]");continue}d!=null&&d.enumerable&&(a(b,c),b=!0,F(r,S),r.append(t?": ":":"),f(d,c+1))}u("}",b,c)}function m(o,c){if(i.has(o)){r.append("[Circular]");return}if(c>=5){r.append("[MaxDepth]");return}let p;try{p=Array.isArray(o)}catch(b){r.append("[Uninspectable]");return}i.add(o);try{p?w(o,c):h(o,c)}finally{i.delete(o)}}function g(o,c){o===null?r.append("null"):typeof o=="string"?I(r,o):typeof o=="number"?r.append(Object.is(o,-0)?"-0":String(o)):typeof o=="boolean"?r.append(o?"true":"false"):typeof o>"u"?r.append("undefined"):typeof o=="bigint"?r.append("".concat(o,"n")):typeof o=="symbol"?q(r,o):typeof o=="function"?r.append("[Function]"):m(o,c)}try{return g(e,0),r.result()}catch(o){return"[Uninspectable]"}}var Le=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);function T(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}var Q,He=(Q=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:Q.get;var Ke=Date.prototype.getTime;var be=256,$e=1024,we=1,Oe=new Map,Se=new Map;function P(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let n=String.fromCharCode(e).toUpperCase();if(n.length!==1)return e;let r=n.charCodeAt(0);return e>127&&r<128?e:r}function V(e,n,r,t,i,l){for(let s=0;s<i;s++){let a=e.charCodeAt(n+s),u=r.charCodeAt(t+s);if(l||(a>=97&&a<=122&&(a-=32),u>=97&&u<=122&&(u-=32)),a!==u)return!1}return!0}function z(e,n,r){let t=n.indexOf("\\");if(t===-1&&e===n)return!0;let i=n.indexOf("*");if(t===-1&&i===-1){if(r)return!1;for(let w=0;w<n.length;w++)if(n.charCodeAt(w)>127)return;return e.length===n.length&&V(e,0,n,0,n.length,!1)}if(t!==-1)return;let l=0,s=!1,a=-1;for(let w=0;w<n.length;w++){let h=n.charCodeAt(w);if(h>127)return;if(h===42){if(a=w,!s){if(l++,l>1)return;s=!0}}else s=!1}let u=a+1,f=n.length-u;return e.length<i+f?!1:V(e,0,n,0,i,r)&&V(e,e.length-f,n,u,f,r)}function ve(e){let n=new Uint32Array(e.length),r=0;for(let t=1;t<e.length;t++){for(;r>0&&e[t]!==e[r];)r=n[r-1];e[t]===e[r]&&r++,n[t]=r}return n}function Ae(e,n){let r=[[]],t=!0,i=!1,l=!1,s=0;for(let m=0;m<e.length;){let g=e.codePointAt(m);if(g!==92){if(g===42)i=!0,l||(r.push([]),l=!0);else{let d=n?g:P(g);r[r.length-1].push(d),t&&(t=d<=127),s++,l=!1}m+=g>65535?2:1;continue}let o=m+1;for(;e.charCodeAt(o)===92;)o++;let c=o-m,p=e.codePointAt(o),b,S=!1;p===42?(S=c%2===0,b=S?c/2:(c-1)/2):p===void 0||p===10||p===13||p===8232||p===8233?b=Math.ceil(c/2):b=Math.floor(c/2);for(let d=0;d<b;d++)r[r.length-1].push(92),s++;if(S){l=!1,m=o;continue}if(p!==void 0){let d=n?p:P(p);r[r.length-1].push(d),t&&(t=d<=127),s++,o+=p>65535?2:1}l=!1,m=o}let a=i&&r[0].length===0,u=i&&r[r.length-1].length===0,f=[];for(let m of r)m.length&&f.push({values:m});let w=a?0:1,h=f.length-(u?0:1);for(let m=w;m<h;m++)f[m].values.length>we&&(f[m].failure=ve(f[m].values));return{asciiOnly:t,endsWithWildcard:u,hasWildcard:i,minimumInputLength:s,segments:f,startsWithWildcard:a}}function Y(e,n){let r=n?Oe:Se,t=e.length<=$e;if(t){let l=r.get(e);if(l)return l}let i=Ae(e,n);if(t){if(r.size>=be){let l=r.keys().next().value;l!==void 0&&r.delete(l)}r.set(e,i)}return i}function Z(e,n){if(n){let i=[];for(let l=0;l<e.length;){let s=e.codePointAt(l);i.push(s),l+=s>65535?2:1}return i}let r=new Uint32Array(e.length),t=0;for(let i=0;i<e.length;){let l=e.codePointAt(i);r[t]=P(l),t++,i+=l>65535?2:1}return t===r.length?r:r.subarray(0,t)}function j(e,n,r,t){for(let i=0;i<r.values.length;i++){let l=e.charCodeAt(n+i);if(!t&&l>=97&&l<=122&&(l-=32),l!==r.values[i])return!1}return!0}function ke(e,n,r,t,i){let l=t-n.values.length;if(l<r)return-1;if(!n.failure){for(let a=r;a<=l;a++)if(j(e,a,n,i))return a;return-1}let s=0;for(let a=r;a<t;a++){let u=e.charCodeAt(a);for(!i&&u>=97&&u<=122&&(u-=32);s>0&&u!==n.values[s];)s=n.failure[s-1];if(u===n.values[s]&&(s++,s===n.values.length))return a-s+1}return-1}function X(e,n,r){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&j(e,0,n.segments[0],r);let t=0,i=n.segments.length,l=0,s=e.length;if(!n.startsWithWildcard){let a=n.segments[0];if(!j(e,0,a,r))return!1;l=a.values.length,t++}if(!n.endsWithWildcard){i--;let a=n.segments[i];if(s-=a.values.length,!j(e,s,a,r))return!1}for(let a=t;a<i;a++){let u=n.segments[a],f=ke(e,u,l,s,r);if(f===-1)return!1;l=f+u.values.length}return!0}function C(e,n,r){for(let t=0;t<r.values.length;t++)if(e[n+t]!==r.values[t])return!1;return!0}function Te(e,n,r,t){let i=t-n.values.length;if(i<r)return-1;if(!n.failure){for(let s=r;s<=i;s++)if(C(e,s,n))return s;return-1}let l=0;for(let s=r;s<t;s++){for(;l>0&&e[s]!==n.values[l];)l=n.failure[l-1];if(e[s]===n.values[l]&&(l++,l===n.values.length))return s-l+1}return-1}function ee(e,n){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&C(e,0,n.segments[0]);let r=0,t=n.segments.length,i=0,l=e.length;if(!n.startsWithWildcard){let s=n.segments[0];if(!C(e,0,s))return!1;i=s.values.length,r++}if(!n.endsWithWildcard){t--;let s=n.segments[t];if(l-=s.values.length,!C(e,l,s))return!1}for(let s=r;s<t;s++){let a=n.segments[s],u=Te(e,a,i,l);if(u===-1)return!1;i=u+a.values.length}return!0}function Ee(e,n,r){let t=z(e,n,r);if(t!==void 0)return t;let i=Y(n,r);return i.asciiOnly?X(e,i,r):ee(Z(e,r),i)}function G(e,n,r,t){var s;let i=z(e,n,r);if(i!==void 0)return i;let l=Y(n,r);return l.asciiOnly?X(e,l,r):((s=t.tokens)!=null||(t.tokens=Z(e,r)),ee(t.tokens,l))}function N(e,n,r){if(typeof n!="string"&&!n.length)return!1;let t=r===void 0?!1:r.caseSensitiveMatch===!0;if(typeof n=="string"){let a=n.charCodeAt(0)===33,u=a?n.slice(1):n,f=Ee(e,u,t);return a?!f:f}let i={},l=!1,s=!1;for(let a of n){let u=a.charCodeAt(0)===33,f=u?a.slice(1):a;if(u){if(G(e,f,t,i))return!1}else l=!0,!s&&G(e,f,t,i)&&(s=!0)}return l?s:!0}var E=he(te(),1);var re="8.2.1";var je=re,ie={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"},Ce=new Set(["any","anything","every","everything","all","whatever","whatevs"]),oe=Object.prototype.hasOwnProperty,Ie={caseSensitiveMatch:!0};function ne(e,n){return n.some(r=>e===r||N(e,r))}function R(e,n){return n.length?e.filter(r=>!n.some(t=>r===t||N(r,t,Ie))):e}function L(e,n){if(!n.length)return e;let r=new Set(n);return e.filter(t=>!r.has(t))}function xe(e){let n={};function r(t,i){if(T(t)){for(let s of Object.keys(t))r(t[s],i?"".concat(i,".").concat(s):s);return}let l=Array.isArray(t)?t:[t];n[i]=l.map(s=>"".concat(s).toLowerCase().trim())}for(let t of Object.keys(e))r(e[t],t);return n}function H(e,n,r=""){if(Array.isArray(e))for(let t=0;t<e.length;t++){if(e[t]===void 0)continue;let i=r?"".concat(r,".").concat(t):"".concat(t);n(e[t],void 0,{path:i,parent:e,parentType:"array"}),H(e[t],n,i)}else if(T(e))for(let t of Object.keys(e)){let i=r?"".concat(r,".").concat(t):t;n(t,e[t],{path:i,parent:e,parentType:"object"}),H(e[t],n,i)}}function Ve(e,n){let r=e,t=0;for(;t<=n.length;){let i=n.indexOf(".",t),l=i===-1?n.slice(t):n.slice(t,i);if(r===null||typeof r!="object"&&typeof r!="function"||!oe.call(r,l))return[!1,void 0];if(r=r[l],i===-1)return[!0,r];t=i+1}return[!1,void 0]}function Pe(e,n,r){if(e==null)throw new Error("check-types-mini/checkTypesMini(): [THROW_ID_01] First argument is missing!");let t=x(x({},ie),r);if(typeof t.ignoreKeys=="string"&&(t.ignoreKeys=[t.ignoreKeys]),typeof t.ignorePaths=="string"&&(t.ignorePaths=[t.ignorePaths]),typeof t.acceptArraysIgnore=="string"&&(t.acceptArraysIgnore=[t.acceptArraysIgnore]),t.msg="".concat(t.msg).trim(),t.msg[t.msg.length-1]===":"&&(t.msg=t.msg.slice(0,t.msg.length-1).trim()),T(t.schema))t.schema=xe(t.schema);else if(t.schema!=null)throw new Error("check-types-mini/checkTypesMini(): [THROW_ID_02] opts.schema was customised to ".concat(k(t.schema)," which is not object but ").concat(typeof t.schema));n==null&&(n={});let i=t.ignoreKeys,l=t.ignorePaths,s=t.acceptArraysIgnore,a=Object.keys(e),u=T(n)?Object.keys(n):[],f=T(t.schema)?Object.keys(t.schema):[];if(t.enforceStrictKeyset)if(f.length){let h=R(L(a,u.concat(f)),i);if(h.length)throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_03] ".concat(t.msg,": ").concat(t.optsVarName,".enforceStrictKeyset is on and the following key").concat(h.length>1?"s":""," ").concat(h.length>1?"are":"is"," not covered by schema and/or reference objects: ").concat(h.join(", ")))}else if(u.length){let h=R(L(a,u),i);if(h.length)throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_04] ".concat(t.msg,": The input object has key").concat(h.length>1?"s":""," which ").concat(h.length>1?"are":"is"," not covered by the reference object: ").concat(h.join(", ")));if(h=R(L(u,a),i),h.length)throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_05] ".concat(t.msg,": The reference object has key").concat(h.length>1?"s":""," which ").concat(h.length>1?"are":"is"," not present in the input object: ").concat(h.join(", ")))}else throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_06] ".concat(t.msg,": Both ").concat(t.optsVarName,".schema and reference objects are missing! We don't have anything to match the keys as you requested via resolvedOpts.enforceStrictKeyset!"));let w=[];H(e,(h,m,g)=>{let o=m,c=h;if(g.parentType==="array"&&(c=void 0,o=h),w.length&&w.some($=>g.path.startsWith("".concat($,".")))||c&&ne(c,i)||ne(g.path,l))return o;let p=!(!T(o)&&!Array.isArray(o)&&Array.isArray(g.parent)),b=T(t.schema)&&oe.call(t.schema,g.path),[S,d]=T(n)?Ve(n,g.path):[!1,void 0];if(t.enforceStrictKeyset&&p&&!b&&!S)throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_07] ".concat(t.msg,": ").concat(t.optsVarName,".").concat(g.path," is neither covered by reference object (second input argument), nor ").concat(t.optsVarName,".schema! To stop this error, turn off ").concat(t.optsVarName,".enforceStrictKeyset or provide some type reference (2nd argument or ").concat(t.optsVarName,".schema).\n\nDebug info:\n\nobj = ").concat(k(e,4),"\n\nref = ").concat(k(n,4),"\n\ninnerObj = ").concat(k(g,4),"\n\nresolvedOpts = ").concat(k(t,4),"\n\ncurrent = ").concat(k(o,4),"\n\n"));if(b){let $=t.schema[g.path];if($.filter(O=>Ce.has(O)).length)w.push(g.path);else{let O=(0,E.default)(o).toLowerCase();if(o!==!0&&o!==!1&&!$.includes(O)||(o===!0||o===!1)&&!$.includes(String(o))&&!$.includes("boolean"))if(Array.isArray(o)&&t.acceptArrays)for(let A=0,v=o.length;A<v;A++){let K=(0,E.default)(o[A]).toLowerCase();if(!$.includes(K))throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_08] ".concat(t.msg,": ").concat(t.optsVarName,".").concat(g.path,".").concat(A,", the ").concat(A,"th element (equal to ").concat(k(o[A]),") is of a type ").concat(K,", but only the following are allowed by the ").concat(t.optsVarName,".schema: ").concat($.join(", ")))}else throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_09] ".concat(t.msg,": ").concat(t.optsVarName,".").concat(g.path," was customised to ").concat(O!=="string"?'"':"").concat(k(o)).concat(O!=="string"?'"':""," (type: ").concat(O,") which is not among the allowed types in schema (which is equal to ").concat(k($),")"))}}else if(n&&T(n)&&S){let $=(0,E.default)(o),y=(0,E.default)(d);if(t.acceptArrays&&Array.isArray(o)&&!s.includes(h)){let O=y.toLowerCase();if(!o.every(v=>(0,E.default)(v).toLowerCase()===O))throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_10] ".concat(t.msg,": ").concat(t.optsVarName,".").concat(g.path," was customised to be array, but not all of its elements are ").concat(O,"-type"))}else if($!==y){let O=$.toLowerCase();throw new TypeError("check-types-mini/checkTypesMini(): [THROW_ID_11] ".concat(t.msg,": ").concat(t.optsVarName,".").concat(g.path," was customised to ").concat(O==="string"?"":'"').concat(k(o)).concat(O==="string"?"":'"'," which is not ").concat(y.toLowerCase()," but ").concat(O))}}return o})}function Ne(e,n,r){Pe(e,n,r)}return ge(Me);})();
10
+ "use strict";var checkTypesMini=(()=>{var xe=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames,lt=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var Me=(e,t,n)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ut=(e,t)=>{for(var n in t||(t={}))ct.call(t,n)&&Me(e,n,t[n]);if(lt)for(var n of lt(t))Xt.call(t,n)&&Me(e,n,t[n]);return e};var pt=(e,t)=>{for(var n in t)xe(e,n,{get:t[n],enumerable:!0})},en=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yt(t))!ct.call(e,o)&&o!==n&&xe(e,o,{get:()=>t[o],enumerable:!(r=Zt(t,o))||r.enumerable});return e};var tn=e=>en(xe({},"__esModule",{value:!0}),e);var H=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);var Yr={};pt(Yr,{CheckTypesMiniError:()=>$e,checkTypesMini:()=>Ur,defaults:()=>$r,version:()=>Fr});var De={};pt(De,{backslash:()=>yn,backtick:()=>wn,codsenCLI:()=>hr,compareFn:()=>or,createMatcher:()=>Ar,deepClone:()=>$n,deepCloneWithMetadata:()=>Nn,detectEol:()=>$t,doublePrime:()=>mn,ellipsis:()=>fn,existy:()=>er,findAllIdx:()=>Yn,formatDiagnosticValue:()=>ke,hairspace:()=>dn,hasOwnProp:()=>rr,includes:()=>ir,inlineTags:()=>_r,intersection:()=>ar,isBool:()=>Jn,isCurrencyChar:()=>Wn,isCurrencySymbol:()=>Hn,isDate:()=>Ft,isInt:()=>Qn,isLatinLetter:()=>Vn,isLetter:()=>En,isLowercaseLetter:()=>Kn,isNull:()=>Gn,isNum:()=>Dt,isNumberChar:()=>Mn,isPlainObject:()=>Rt,isQuote:()=>Ln,isRegExp:()=>Qe,isStr:()=>I,isUppercaseLetter:()=>zn,isWhitespaceChar:()=>Bn,leftDoubleQuote:()=>jt,leftSingleQuote:()=>Ot,match:()=>Sr,multiplicationSign:()=>vn,omit:()=>gr,pullAll:()=>Xn,punctuationChars:()=>On,rawMDash:()=>un,rawNDash:()=>cn,rawNbsp:()=>pn,rawReplacementMark:()=>bn,removeTrailingSlash:()=>Un,resolveEolSetting:()=>nr,rightDoubleQuote:()=>xt,rightSingleQuote:()=>Tt,singlePrime:()=>gn,stringSplice:()=>qn,thinSpace:()=>hn,trimChars:()=>Zn,uniq:()=>tr,version:()=>ln,voidTags:()=>sr});function nn(){let e=[],t=0,n=!1;return{append(r){return n?!1:t+r.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return n}}}function rn(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function Ce(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let r=t.charCodeAt(n);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(rn(r)):e.append(t[n])}e.append('"')}}function on(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function dt(e,t){e.append("Symbol(");let n=String(t);n.length>8&&Ce(e,n.slice(7,-1)),e.append(")")}function ft(e,t){typeof t=="symbol"?dt(e,t):Ce(e,String(t))}function ke(e,t=0){let n=nn(),r=t===4?4:0,o=new WeakSet,s=0;function _(l){r&&n.append(" ".repeat(l*r))}function a(l,g){l&&n.append(","),r&&(n.append("\n"),_(g+1))}function i(l,g,h){r&&g&&(n.append("\n"),_(h)),n.append(l)}function u(l,g){Object.prototype.hasOwnProperty.call(l,"value")?S(l.value,g):n.append(on(l))}function x(l,g){let h;try{h=Reflect.getOwnPropertyDescriptor(l,"length")}catch(T){n.append("[Uninspectable]");return}let j=h==null?void 0:h.value;if(!Number.isSafeInteger(j)||j<0){n.append("[Uninspectable]");return}n.append("[");let O=!1;for(let T=0;T<j&&!n.stopped();T+=1){if(a(O,g),O=!0,s>=50){n.append("[MaxEntries]");break}s+=1;let d;try{d=Reflect.getOwnPropertyDescriptor(l,String(T))}catch(M){n.append("[Uninspectable]");continue}d!=null&&d.enumerable?u(d,g+1):n.append("[Empty]")}i("]",O,g)}function A(l,g){let h;try{h=Reflect.ownKeys(l)}catch(O){n.append("[Uninspectable]");return}n.append("{");let j=!1;for(let O of h){if(n.stopped())break;if(s>=50){a(j,g),j=!0,Ce(n,"\u2026"),n.append(r?": ":":"),n.append("[MaxEntries]");break}s+=1;let T;try{T=Reflect.getOwnPropertyDescriptor(l,O)}catch(d){a(j,g),j=!0,ft(n,O),n.append(r?": ":":"),n.append("[Uninspectable]");continue}T!=null&&T.enumerable&&(a(j,g),j=!0,ft(n,O),n.append(r?": ":":"),u(T,g+1))}i("}",j,g)}function b(l,g){if(o.has(l)){n.append("[Circular]");return}if(g>=5){n.append("[MaxDepth]");return}let h;try{h=Array.isArray(l)}catch(j){n.append("[Uninspectable]");return}o.add(l);try{h?x(l,g):A(l,g)}finally{o.delete(l)}}function S(l,g){l===null?n.append("null"):typeof l=="string"?Ce(n,l):typeof l=="number"?n.append(Object.is(l,-0)?"-0":String(l)):typeof l=="boolean"?n.append(l?"true":"false"):typeof l>"u"?n.append("undefined"):typeof l=="bigint"?n.append("".concat(l,"n")):typeof l=="symbol"?dt(n,l):typeof l=="function"?n.append("[Function]"):b(l,g)}try{return S(e,0),n.result()}catch(l){return"[Uninspectable]"}}var sn="1.10.1",_n=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),We=_n.slice(1).split("_"),Ke=[],ht=127;for(let e=0;e<We.length;e+=2){let t=ht+1+Number.parseInt(We[e],36),n=t+Number.parseInt(We[e+1],36);Ke.push([t,n]),ht=n}function an(e){if(Number.isNaN(e)||e<128||e>1114111)return!1;let t=0,n=Ke.length-1;for(;t<=n;){let r=t+n>>1,o=Ke[r];if(e<o[0])n=r-1;else if(e>o[1])t=r+1;else return!0}return!1}var ln=sn,Ot="\u2018",Tt="\u2019",jt="\u201C",xt="\u201D",cn="\u2013",un="\u2014",pn="\xA0",fn="\u2026",dn="\u200A",hn="\u2009",gn="\u2032",mn="\u2033",yn="\\",bn="\uFFFD",wn="`",vn="\xD7",On=[".",",",";","!","?"],Ct=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),Se=Object.prototype.hasOwnProperty,kt=Function.prototype.toString,Tn=kt.call(Object),Be=class{constructor(){H(this,"hasRepeatedReferences",!1);H(this,"clones",[]);H(this,"index");H(this,"sources",[])}get(e){if(this.index){let n=this.index.get(e);return n!==void 0&&(this.hasRepeatedReferences=!0),n}let t=this.sources.indexOf(e);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(e,t){if(this.index){this.index.set(e,t);return}if(this.sources.push(e),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let n=0;n<this.sources.length;n++)this.index.set(this.sources[n],this.clones[n]);this.sources=[],this.clones=[]}}};function At(e,t){let n=t.get(e);if(n!==void 0)return n;let r=e.slice(0);return t.set(e,r),r}function jn(e,t){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let s=Buffer.from(e);return t.set(e,s),s}let n=At(e.buffer,t);if(e instanceof DataView||Object.prototype.toString.call(e)==="[object DataView]"){let s=new DataView(n,e.byteOffset,e.byteLength);return t.set(e,s),s}let r=e.constructor,o=new r(n,e.byteOffset,e.length);return t.set(e,o),o}function St(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ae(e,t,n,r){for(let o of n){let s=t[o],_=typeof s!="object"||s===null?s:Z(s,r);o==="__proto__"?St(e,o,_):e[o]=_}}function le(e,t,n,r){for(let o of n){let s=Object.getOwnPropertyDescriptor(t,o);if(s){if("value"in s){let _=s.value;s.value=typeof _!="object"||_===null?_:Z(_,r)}Object.defineProperty(e,o,s)}}}var xn=Map.prototype.entries,Cn=Set.prototype.values,Ue=Object.prototype.toString,yt,kn=(yt=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:yt.get,bt,An=(bt=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:bt.get,wt,Sn=(wt=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:wt.get,vt,Pt=(vt=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:vt.get,Pn=RegExp.prototype.test,He;function Rn(e){if(e instanceof ArrayBuffer)return!0;try{return kn.call(e),!0}catch(t){return!1}}function Dn(e){try{return xn.call(e)}catch(t){return null}}function In(e){try{return Cn.call(e)}catch(t){return null}}function Fn(e){var t;try{return He||(He=(t=Object.getOwnPropertyDescriptor(URL.prototype,"href"))==null?void 0:t.get),He.call(e)}catch(n){return null}}function Z(e,t){if(typeof e!="object"||e===null)return e;let n=t.get(e);if(n!==void 0)return n;if(Array.isArray(e)){let i=e.length,u=new Array(i);t.set(e,u);let x=e,A=Object.keys(e);if(A.length===i&&(i===0||A[i-1]==="".concat(i-1)))for(let b=0;b<i;b++){let S=x[b];u[b]=typeof S!="object"||S===null?S:Z(S,t)}else Ae(u,x,A,t);return u}let r=Object.getPrototypeOf(e);if(r===Object.prototype){let i={};return t.set(e,i),Ae(i,e,Object.keys(e),t),i}if(r===null){let i=Object.create(null);return t.set(e,i),Ae(i,e,Object.keys(e),t),i}if(Ft(e)){let i=new Date(It.call(e));return t.set(e,i),le(i,e,Object.keys(e),t),i}if(ArrayBuffer.isView(e))return jn(e,t);if(Rn(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return At(e,t);let o=Dn(e);if(o){let i=new Map;t.set(e,i);for(let[u,x]of o)i.set(Z(u,t),Z(x,t));return le(i,e,Object.keys(e),t),i}let s=In(e);if(s){let i=new Set;t.set(e,i);for(let u of s)i.add(Z(u,t));return le(i,e,Object.keys(e),t),i}if(Qe(e)&&e!==RegExp.prototype){let i=new RegExp(Pt.call(e),An.call(e));return i.lastIndex=e.lastIndex,t.set(e,i),le(i,e,Object.keys(e),t),i}let _=Fn(e);if(_!==null){let i=new URL(_);return t.set(e,i),le(i,e,Object.keys(e),t),i}if(e instanceof Error||Ue.call(e)==="[object Error]"){let i=Object.create(Object.getPrototypeOf(e));return t.set(e,i),le(i,e,Reflect.ownKeys(e),t),i}let a=Object.create(r);return t.set(e,a),Ae(a,e,Object.keys(e),t),a}function $n(e){return Z(e,new Be)}function Nn(e){let t=new Be,n=Z(e,t);return{hasRepeatedReferences:t.hasRepeatedReferences,value:n}}function Mn(e){if(!I(e))return!1;let t=e.charCodeAt(0);return t>=48&&t<=57}function Wn(e){return I(e)&&e.length===1&&Ct.has(e)}function Hn(e){return I(e)&&Ct.has(e)}function qe(e){if(e.length===1){let t=e.charCodeAt(0);return t<55296||t>57343?t:-1}if(e.length===2){let t=e.charCodeAt(0),n=e.charCodeAt(1);if(t>=55296&&t<=56319&&n>=56320&&n<=57343)return(t-55296)*1024+n-56320+65536}return-1}function En(e){if(!I(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91||t>96&&t<123:an(qe(e))}function Vn(e){if(!e||!I(e))return!1;let t=e.charCodeAt(0);return t>64&&t<91||t>96&&t<123}function Ln(e){return I(e)&&(e==='"'||e==="'"||e===Ot||e===Tt||e===jt||e===xt)}function Kn(e){if(!I(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>96&&t<123:qe(e)<0?!1:e===e.toLowerCase()&&e!==e.toUpperCase()}function zn(e){if(!I(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91:qe(e)<0?!1:e===e.toUpperCase()&&e!==e.toLowerCase()}function Bn(e){if(!I(e)||!e)return!1;let t=e.charCodeAt(0);return t<128?t===32||t>8&&t<14:!e[0].trim()}var Un=e=>I(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e;function Rt(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(t,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:r.value)===t&&kt.call(n.value)===Tn}function qn(e="",t=0,n=0,r=""){return t<0&&(t+=e.length,t<0&&(t=0)),e.slice(0,t)+(r||"")+e.slice(t+n)}function I(e){return typeof e=="string"}function Dt(e){return Number.isFinite(e)}function Qn(e){return Number.isSafeInteger(e)&&e>=0}function Jn(e){return typeof e=="boolean"}function Gn(e){return e===null}function Qe(e){if(e===null||typeof e!="object")return!1;try{return e instanceof RegExp?(e.source,!0):Ue.call(e)!=="[object RegExp]"?!1:(Pt.call(e),!0)}catch(t){return!1}}var It=Date.prototype.getTime;function Ft(e){if(e instanceof Date)return!0;if(e===null||typeof e!="object"||Ue.call(e)!=="[object Date]")return!1;try{return It.call(e),!0}catch(t){return!1}}function Zn(e,t){if(!e||!t)return e;let n=!0;for(let a=t.length;a--;)if(t.charCodeAt(a)>127){n=!1;break}if(n){let a=0,i=e.length;if(t.length===1){let u=t.charCodeAt(0);for(;a<i&&e.charCodeAt(a)===u;)a++;for(;i>a&&e.charCodeAt(i-1)===u;)i--}else{for(;a<i&&t.includes(e[a]);)a++;for(;i>a&&t.includes(e[i-1]);)i--}return a===0&&i===e.length?e:e.slice(a,i)}let r=Array.from(e),o=new Set(t),s=0,_=r.length;for(;s<_&&o.has(r[s]);)s++;for(;_>s&&o.has(r[_-1]);)_--;return s===0&&_===r.length?e:r.slice(s,_).join("")}function Yn(e,t){if(!I(e)||!I(t)||t.length===0)return[];let n=[],r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function Xn(e=[],t=[]){if(!e||!Array.isArray(e)||!e.length)return[];if(!t||!Array.isArray(t)||!t.length)return e.slice();if(e.length*t.length<400)return e.filter(r=>!t.includes(r));let n=new Set(t);return e.filter(r=>!n.has(r))}function er(e){return e!=null}function tr(e){return[...new Set(e)]}function $t(e){if(!(typeof e!="string"||!e)){if(e.includes("\r\n"))return"\r\n";if(e.includes("\n"))return"\n";if(e.includes("\r"))return"\r"}}function nr(e,t,n="\n"){if(n!=="\n"&&n!=="\r\n"&&n!=="\r")throw new Error('codsen-utils/resolveEolSetting(): [THROW_ID_01] the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as '.concat(ke(n)));return t==="crlf"?"\r\n":t==="cr"?"\r":t==="lf"?"\n":$t(e)||n}function rr(e,t){return e!=null&&Se.call(e,t)}function or(e,t){return e.localeCompare(t)}var sr=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],_r=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function ir(e,t){if(!Array.isArray(e)||!e.length||!I(t))return!1;for(let n of e){if(typeof n=="string"){if(t===n)return!0;continue}if(Qe(n)){let r=Sn.call(n);r&&(n.lastIndex=0);let o=Pn.call(n,t);if(r&&(n.lastIndex=0),o)return!0}}return!1}function ar(e=[],t=[]){if(!Array.isArray(e)||!Array.isArray(t)||!e.length||!t.length)return[];let n=[];if(e.length*t.length<64){for(let s of e)t.includes(s)&&!n.includes(s)&&n.push(s);return n}let r=new Set(t),o=new Set;for(let s of e)r.has(s)&&!o.has(s)&&(o.add(s),n.push(s));return n}var Ee=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;function lr(e){return e.replace(/-+([^-])/g,(t,n)=>n.toUpperCase())}function cr(e){return e.replace(/([\da-z])([A-Z])/g,"$1-$2").toLowerCase()}function ur(e){return e.replace(/^[\r\n]+/,"").replace(/[\r\n]+$/,"")}function gt(e,t){let n=Number.POSITIVE_INFINITY,r=e.split("\n");for(let s of r){let _=/^[ \t]*(?=\S)/.exec(s);_&&(n=Math.min(n,_[0].length))}let o=" ".repeat(t);return r.map(s=>s.trim()?o+s.slice(n):s).join("\n")}function pr(e,t,n){let r="";return e&&(r=ur(e.replace(/\t+\n*$/,"")),r.includes("\n")&&(r=gt(r,n)),r="\n".concat(r)),t&&(r=r?"".concat(gt("\n".concat(t,"\n"),n)).concat(r):"\n".concat(t)),"".concat(r,"\n")}function fr(e){var r;let t=I(e.name)?e.name:"",{bin:n}=e;return I(n)?t.slice(t.startsWith("@")?t.indexOf("/")+1:0):n&&typeof n=="object"&&(r=Object.keys(n)[0])!=null?r:t}function dr(e,t){let n=e?e.type:void 0;return t===void 0?n==="string"?"":n==="number"?void 0:!0:n==="boolean"?t==="true":n==="number"?Number(t):t}function hr(e="",t={}){var Te,te,E,pe,fe,_e,J,ne,de,z;let n=typeof process>"u"?void 0:process,r=(Te=t.pkg)!=null?Te:{},o=(E=(te=t.argv)!=null?te:n==null?void 0:n.argv.slice(2))!=null?E:[],s=(pe=t.helpIndent)!=null?pe:2,_=(fe=t.autoHelp)!=null?fe:!0,a=(_e=t.autoVersion)!=null?_e:!0,i=(ne=(J=t.version)!=null?J:r.version)!=null?ne:"No version found",u=Se.call(t,"booleanDefault")?t.booleanDefault:!1,x=pr(e,(de=t.description)!=null?de:r.description,s);function A(c){console.log(x),n==null||n.exit(Dt(c)?c:2)}function b(){console.log(i),n==null||n.exit(0)}let S=[],l=new Map;for(let[c,f]of Object.entries((z=t.flags)!=null?z:{})){let y={key:c,type:f.type,isMultiple:!!f.isMultiple,source:f};S.push(y),l.set(c,y),l.set(cr(c),y),f.shortFlag&&l.set(f.shortFlag,y)}let g=[],h={};function j(c,f){let y=l.get(c),R=y?y.key:lr(c);if(y!=null&&y.isMultiple){let D=h[R];Array.isArray(D)?D.push(f):h[R]=[f];return}h[R]=f}function O(c,f){j(c,dr(l.get(c),f))}function T(c,f){return f===void 0?!1:(c==null?void 0:c.type)==="boolean"?f==="true"||f==="false":!(f.startsWith("-")&&f.length>1&&!Ee.test(f))}function d(c,f){let y=c.slice(1);for(let R=0;R<y.length;R++){let D=y[R],F=y.slice(R+1);if(F.startsWith("="))return O(D,F.slice(1)),f;if(Ee.test(F)||F&&/\W/.test(F[0]))return O(D,F),f;let B=l.get(D);if(F&&(B!=null&&B.type)&&B.type!=="boolean")return O(D,F),f;if(F){O(D,void 0);continue}if(T(B,o[f+1]))return O(D,o[f+1]),f+1;O(D,void 0)}return f}for(let c=0;c<o.length;c++){let f=o[c];if(f==="--"){g.push(...o.slice(c+1));break}if(f.startsWith("--")){let y=f.slice(2),R=y.indexOf("=");if(R!==-1){O(y.slice(0,R),y.slice(R+1));continue}if(y.startsWith("no-")){j(y.slice(3),!1);continue}let D=l.get(y);if(T(D,o[c+1])){O(y,o[c+1]),c++;continue}O(y,void 0);continue}if(f.startsWith("-")&&f.length>1&&!Ee.test(f)){c=d(f,c);continue}g.push(f)}for(let c of S)Se.call(h,c.key)||(Se.call(c.source,"default")?h[c.key]=c.source.default:c.isMultiple?h[c.key]=[]:c.type==="boolean"&&u!==void 0&&(h[c.key]=u));!g.length&&o.length===1&&(a&&h.version===!0?b():_&&h.help===!0&&A(0));let M=fr(r);return M&&n&&(n.title=M),{input:g,flags:h,pkg:r,help:x,showHelp:A,showVersion:b}}function gr(e,t=[]){if(!e)return e;if(!Rt(e))throw new Error("codsen-utils/omit(): [THROW_ID_02] Input must be a plain object! It was given as ".concat(ke(e,4),' (typeof is "').concat(typeof e,'")'));let n=Object.getPrototypeOf(e)===null?Object.create(null):{},r=new Be;r.set(e,n);let o=Object.keys(e),s=o.length*t.length<400?void 0:new Set(t);for(let _ of o){if(s?s.has(_):t.includes(_))continue;let a=Z(e[_],r);_==="__proto__"?St(n,_,a):n[_]=a}return n}var mr=256,yr=1024,br=1,wr=new Map,vr=new Map;function ze(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let n=t.charCodeAt(0);return e>127&&n<128?e:n}function Ve(e,t,n,r,o,s){for(let _=0;_<o;_++){let a=e.charCodeAt(t+_),i=n.charCodeAt(r+_);if(s||(a>=97&&a<=122&&(a-=32),i>=97&&i<=122&&(i-=32)),a!==i)return!1}return!0}function Nt(e,t,n){let r=t.indexOf("\\");if(r===-1&&e===t)return!0;let o=t.indexOf("*");if(r===-1&&o===-1){if(n)return!1;for(let x=0;x<t.length;x++)if(t.charCodeAt(x)>127)return;return e.length===t.length&&Ve(e,0,t,0,t.length,!1)}if(r!==-1)return;let s=0,_=!1,a=-1;for(let x=0;x<t.length;x++){let A=t.charCodeAt(x);if(A>127)return;if(A===42){if(a=x,!_){if(s++,s>1)return;_=!0}}else _=!1}let i=a+1,u=t.length-i;return e.length<o+u?!1:Ve(e,0,t,0,o,n)&&Ve(e,e.length-u,t,i,u,n)}function Or(e){let t=new Uint32Array(e.length),n=0;for(let r=1;r<e.length;r++){for(;n>0&&e[r]!==e[n];)n=t[n-1];e[r]===e[n]&&n++,t[r]=n}return t}function Tr(e,t){let n=[[]],r=!0,o=!1,s=!1,_=0;for(let b=0;b<e.length;){let S=e.codePointAt(b);if(S!==92){if(S===42)o=!0,s||(n.push([]),s=!0);else{let T=t?S:ze(S);n[n.length-1].push(T),r&&(r=T<=127),_++,s=!1}b+=S>65535?2:1;continue}let l=b+1;for(;e.charCodeAt(l)===92;)l++;let g=l-b,h=e.codePointAt(l),j,O=!1;h===42?(O=g%2===0,j=O?g/2:(g-1)/2):h===void 0||h===10||h===13||h===8232||h===8233?j=Math.ceil(g/2):j=Math.floor(g/2);for(let T=0;T<j;T++)n[n.length-1].push(92),_++;if(O){s=!1,b=l;continue}if(h!==void 0){let T=t?h:ze(h);n[n.length-1].push(T),r&&(r=T<=127),_++,l+=h>65535?2:1}s=!1,b=l}let a=o&&n[0].length===0,i=o&&n[n.length-1].length===0,u=[];for(let b of n)b.length&&u.push({values:b});let x=a?0:1,A=u.length-(i?0:1);for(let b=x;b<A;b++)u[b].values.length>br&&(u[b].failure=Or(u[b].values));return{asciiOnly:r,endsWithWildcard:i,hasWildcard:o,minimumInputLength:_,segments:u,startsWithWildcard:a}}function Je(e,t){let n=t?wr:vr,r=e.length<=yr;if(r){let s=n.get(e);if(s)return s}let o=Tr(e,t);if(r){if(n.size>=mr){let s=n.keys().next().value;s!==void 0&&n.delete(s)}n.set(e,o)}return o}function Ge(e,t){if(t){let o=[];for(let s=0;s<e.length;){let _=e.codePointAt(s);o.push(_),s+=_>65535?2:1}return o}let n=new Uint32Array(e.length),r=0;for(let o=0;o<e.length;){let s=e.codePointAt(o);n[r]=ze(s),r++,o+=s>65535?2:1}return r===n.length?n:n.subarray(0,r)}function Pe(e,t,n,r){for(let o=0;o<n.values.length;o++){let s=e.charCodeAt(t+o);if(!r&&s>=97&&s<=122&&(s-=32),s!==n.values[o])return!1}return!0}function jr(e,t,n,r,o){let s=r-t.values.length;if(s<n)return-1;if(!t.failure){for(let a=n;a<=s;a++)if(Pe(e,a,t,o))return a;return-1}let _=0;for(let a=n;a<r;a++){let i=e.charCodeAt(a);for(!o&&i>=97&&i<=122&&(i-=32);_>0&&i!==t.values[_];)_=t.failure[_-1];if(i===t.values[_]&&(_++,_===t.values.length))return a-_+1}return-1}function Ze(e,t,n){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&Pe(e,0,t.segments[0],n);let r=0,o=t.segments.length,s=0,_=e.length;if(!t.startsWithWildcard){let a=t.segments[0];if(!Pe(e,0,a,n))return!1;s=a.values.length,r++}if(!t.endsWithWildcard){o--;let a=t.segments[o];if(_-=a.values.length,!Pe(e,_,a,n))return!1}for(let a=r;a<o;a++){let i=t.segments[a],u=jr(e,i,s,_,n);if(u===-1)return!1;s=u+i.values.length}return!0}function Re(e,t,n){for(let r=0;r<n.values.length;r++)if(e[t+r]!==n.values[r])return!1;return!0}function xr(e,t,n,r){let o=r-t.values.length;if(o<n)return-1;if(!t.failure){for(let _=n;_<=o;_++)if(Re(e,_,t))return _;return-1}let s=0;for(let _=n;_<r;_++){for(;s>0&&e[_]!==t.values[s];)s=t.failure[s-1];if(e[_]===t.values[s]&&(s++,s===t.values.length))return _-s+1}return-1}function Ye(e,t){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&Re(e,0,t.segments[0]);let n=0,r=t.segments.length,o=0,s=e.length;if(!t.startsWithWildcard){let _=t.segments[0];if(!Re(e,0,_))return!1;o=_.values.length,n++}if(!t.endsWithWildcard){r--;let _=t.segments[r];if(s-=_.values.length,!Re(e,s,_))return!1}for(let _=n;_<r;_++){let a=t.segments[_],i=xr(e,a,o,s);if(i===-1)return!1;o=i+a.values.length}return!0}function Cr(e,t,n){let r=Nt(e,t,n);if(r!==void 0)return r;let o=Je(t,n);return o.asciiOnly?Ze(e,o,n):Ye(Ge(e,n),o)}function mt(e,t,n,r){var _;let o=Nt(e,t,n);if(o!==void 0)return o;let s=Je(t,n);return s.asciiOnly?Ze(e,s,n):((_=r.tokens)!=null||(r.tokens=Ge(e,n)),Ye(r.tokens,s))}function kr(e,t){let n=e.charCodeAt(0)===33,r=n?e.slice(1):e;return{compiled:r.length===0?void 0:Je(r,t),negative:n}}function Le(e,t,n,r){var s;let o;return t.compiled?t.compiled.asciiOnly?o=Ze(e,t.compiled,n):((s=r.tokens)!=null||(r.tokens=Ge(e,n)),o=Ye(r.tokens,t.compiled)):o=e.length===0,t.negative?!o:o}function Ar(e,t){let n=(t==null?void 0:t.caseSensitiveMatch)===!0,r=typeof e=="string"?[e]:Array.from(new Set(e));if(r.length===0)return()=>!1;let o=r.map(s=>kr(s,n));if(typeof e=="string"){let s=o[0];return _=>Le(_,s,n,{})}return s=>{let _={},a=!1,i=!1;for(let u of o)if(u.negative){if(!Le(s,u,n,_))return!1}else a=!0,!i&&Le(s,u,n,_)&&(i=!0);return a?i:!0}}function Sr(e,t,n){if(typeof t!="string"&&!t.length)return!1;let r=n===void 0?!1:n.caseSensitiveMatch===!0;if(typeof t=="string"){let a=t.charCodeAt(0)===33,i=a?t.slice(1):t,u=Cr(e,i,r);return a?!u:u}let o={},s=!1,_=!1;for(let a of t){let i=a.charCodeAt(0)===33,u=i?a.slice(1):a;if(i){if(mt(e,u,r,o))return!1}else s=!0,!_&&mt(e,u,r,o)&&(_=!0)}return s?_:!0}var Mt="8.2.3";var Rr=Object.prototype.toString,Dr=typeof self=="object"?self:global,Ir=new Map([[null,"Object"],[Date.prototype,"Date"],[RegExp.prototype,"RegExp"],[Promise.prototype,"Promise"],[Map.prototype,"Map"],[Set.prototype,"Set"],[WeakMap.prototype,"WeakMap"],[WeakSet.prototype,"WeakSet"],[DataView.prototype,"DataView"],[Object.getPrototypeOf(new Map().entries()),"Map Iterator"],[Object.getPrototypeOf(new Set().entries()),"Set Iterator"],[Object.getPrototypeOf([][Symbol.iterator]()),"Array Iterator"],[Object.getPrototypeOf(""[Symbol.iterator]()),"String Iterator"]]);function P(e){var o,s,_;let t=typeof e;if(t!=="object")return t;if(e===null)return"null";if(e===Dr)return"global";let n=e;if(Array.isArray(n)&&!(Symbol.toStringTag in n))return"Array";if(typeof window=="object"&&window!==null){if(n===window.location)return"Location";if(n===window.document)return"Document";if(n===((o=window.navigator)==null?void 0:o.mimeTypes))return"MimeTypeArray";if(n===((s=window.navigator)==null?void 0:s.plugins))return"PluginArray";if(typeof window.HTMLElement=="function"&&n instanceof window.HTMLElement){if(n.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(n.tagName==="TD")return"HTMLTableDataCellElement";if(n.tagName==="TH")return"HTMLTableHeaderCellElement"}}let r=n[Symbol.toStringTag];return typeof r=="string"?r:(_=Ir.get(Object.getPrototypeOf(n)))!=null?_:Rr.call(n).slice(8,-1)}var Fr=Mt,{formatDiagnosticValue:Q,isPlainObject:q,match:Wt}=De,Bt,Ie=(Bt=Object.getOwnPropertyDescriptor(De,"createMatcher"))==null?void 0:Bt.value,X=Object.freeze([]),Ut=Object.freeze({}),Ne={acceptArrays:!1,acceptArraysIgnore:X,enforceStrictKeyset:!0,ignoreKeys:X,ignorePaths:X,msg:"check-types-mini",optsVarName:"opts",reportCompletionFunc:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,schema:Ut},$r=Object.freeze(ut({},Ne)),$e=class extends TypeError{constructor(n,r,o={}){var _,a;let s=o.context||Ne.msg;super("check-types-mini/checkTypesMini(): [".concat(n,"] ").concat(s,": ").concat(r));H(this,"actualType");H(this,"context");H(this,"expectedTypes");H(this,"name","CheckTypesMiniError");H(this,"path");H(this,"reason");H(this,"validatorCode");this.actualType=(_=o.actualType)!=null?_:null,this.context=s,this.expectedTypes=o.expectedTypes?Object.freeze(Array.from(o.expectedTypes)):null,this.path=Object.freeze(Array.from((a=o.path)!=null?a:X)),this.reason=r,this.validatorCode=n}toJSON(){return{actualType:this.actualType,context:this.context,expectedTypes:this.expectedTypes,message:this.message,name:this.name,path:this.path,reason:this.reason,validatorCode:this.validatorCode}}},rt=new Set(["all","any","anything","every","everything","whatever","whatevs"]),ue=Object.prototype.hasOwnProperty,Fe={caseSensitiveMatch:!0},Nr=new Map,Mr=new Map,Wr=100,Hr=new Set(["acceptArrays","acceptArraysIgnore","enforceStrictKeyset","ignoreKeys","ignorePaths","msg","optsVarName","reportCompletionFunc","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","schema"]);function nt(){return{children:new Map,descriptors:null,implicitContainer:!1}}var Ht=nt();function Er(e){return"keys"in e}function Vr(e){return"keys"in e}function ee(e){if(!e)return[];let t=new Array(e.depth),n=e;for(;n;)t[n.depth-1]=n.segment,n=n.parent;return t}function K(e,t){let n=e;for(let r of ee(t))/^(?:[A-Za-z_$][A-Za-z0-9_$]*|\d+)$/u.test(r)?n+=".".concat(r):n+="[".concat(JSON.stringify(r),"]");return n}function Oe(e){let t="";for(let n of e)n==="%"?t+="%25":n==="."?t+="%2E":n==="\\"?t+="%5C":t+=n;return t}function Lr(e){return e.encoded}function Et(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="\\"&&n+1<e.length){let o=e[n+1];o==="."?t+="%2E":o==="%"?t+="%25":o==="\\"?t+="%5C":t+="\\".concat(o),n++}else r==="%"?t+="%25":t+=r}return t}function Xe(e,t){if(!e.length)return null;if(e.length===1){let r=e[0],o=t?Mr:Nr,s=o.get(r);if(s)return s;let _=t?Et(r):r,a=Ie?Ie(_,Fe):i=>Wt(i,_,Fe);return o.size<Wr&&o.set(r,a),a}let n=t?e.map(Et):Array.from(e);return Ie?Ie(n,Fe):r=>Wt(r,n,Fe)}function Kr(e){let t=[],n="";for(let r=0;r<e.length;r++){let o=e[r];o==="\\"&&r+1<e.length?(n+=e[r+1],r++):o==="."?(t.push(n),n=""):n+=o}return t.push(n),t}function Vt(e,t){if(t.some(r=>rt.has(r)))return!0;if(e===!0)return t.includes("true")||t.includes("boolean");if(e===!1)return t.includes("false")||t.includes("boolean");let n=P(e).toLowerCase();return n==="object"&&t.includes("object")?q(e):t.includes(n)}function et(e){return e.includes("object")&&!e.some(t=>rt.has(t))}function zr(e){let t=Array.isArray(e)?e:[e];if(!t.length)return null;let n=[];for(let r=0;r<t.length;r++){if(!ue.call(t,r))return null;let o=t[r];if(o!=null&&typeof o!="string")return null;let s=String(o).toLowerCase().trim();if(!s)return null;n.includes(s)||n.push(s)}return n}function se(e){return Array.isArray(e)?Object.keys(e).filter(t=>{let n=Number(t);return Number.isInteger(n)&&n>=0&&n<e.length&&String(n)===t}):Object.keys(e)}function Br(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function Lt(e,t){if(e)try{e(t)}catch(n){}}function k(e,t,n={}){throw new $e(e,t,n)}function L(e,t){return ue.call(e,t)&&e[t]!==void 0?e[t]:Ne[t]}function ve(e,t){return e[t]}function Kt(e,t,n){return!!(t!=null&&t(e)||n!=null&&n(Oe(e)))}function ce(e,t,n,r,o){return k(e,t,{actualType:r,context:o,path:ee(n)})}function tt(e,t){if(e===void 0)return Array.from(t);let n=typeof e=="string"?[e]:e;if(!Array.isArray(n))return null;let r=[];for(let o=0;o<n.length;o++){if(!ue.call(n,o)||typeof n[o]!="string")return null;r.push(n[o])}return r}function Ur(...e){var st,_t,it;let[t,n,r]=e;q(t)||k("THROW_ID_01","The first argument must be a plain object; received ".concat(Q(t,4),"."),{actualType:P(t).toLowerCase()}),(e.length<2||n!==null&&!q(n))&&k("THROW_ID_02","The second argument must be a plain object or null; received ".concat(Q(n,4),". Pass null explicitly when validating against only a schema."),{actualType:P(n).toLowerCase()}),r!=null&&!q(r)&&k("THROW_ID_03","The third argument must be a plain options object, null, or undefined; received ".concat(Q(r,4),"."),{actualType:P(r).toLowerCase()});let o=r!=null?r:Ut,s=Object.keys(o).find(p=>!Hr.has(p));s!==void 0&&k("THROW_ID_04","Unknown option ".concat(Q(s),"."),{path:[s]});let _=tt(L(o,"ignoreKeys"),X),a=tt(L(o,"ignorePaths"),X),i=tt(L(o,"acceptArraysIgnore"),X);(!_||!a||!i)&&k("THROW_ID_05","opts.ignoreKeys, opts.ignorePaths, and opts.acceptArraysIgnore must each be a string or a dense array of strings.");let u=L(o,"acceptArrays"),x=L(o,"enforceStrictKeyset");(typeof u!="boolean"||typeof x!="boolean")&&k("THROW_ID_06","opts.acceptArrays and opts.enforceStrictKeyset must be Booleans.");let A=L(o,"schema");q(A)||k("THROW_ID_07","opts.schema was customised to ".concat(Q(A)," which is not a plain object but ").concat(P(A).toLowerCase(),"."),{actualType:P(A).toLowerCase(),path:["schema"]});let b=L(o,"msg"),S=L(o,"optsVarName");(typeof b!="string"||typeof S!="string")&&k("THROW_ID_08","opts.msg and opts.optsVarName must be strings.");let l=b.trim();l.endsWith(":")&&(l=l.slice(0,-1).trim()),l||(l=Ne.msg);let g=S,h=L(o,"reportCompletionFunc"),j=L(o,"reportProgressFunc");(h!==null&&typeof h!="function"||j!==null&&typeof j!="function")&&k("THROW_ID_09","opts.reportCompletionFunc and opts.reportProgressFunc must each be a function, null, or undefined.",{context:l});let O=L(o,"reportProgressFuncFrom"),T=L(o,"reportProgressFuncTo");(!Number.isFinite(O)||!Number.isFinite(T))&&k("THROW_ID_10","opts.reportProgressFuncFrom and opts.reportProgressFuncTo must be finite numbers.",{context:l}),O>T&&k("THROW_ID_11","opts.reportProgressFuncFrom cannot exceed opts.reportProgressFuncTo; received ".concat(O," and ").concat(T,"."),{context:l});let d={acceptArrays:u,acceptArraysIgnore:i,enforceStrictKeyset:x,ignoreKeys:_,ignorePaths:a,msg:l,optsVarName:g,reportCompletionFunc:h,reportProgressFunc:j,reportProgressFuncFrom:O,reportProgressFuncTo:T,schema:A},M=!!(d.reportCompletionFunc||d.reportProgressFunc),Te=d.reportCompletionFunc?Date.now():0,te=0,E=0,pe=0,fe=0,_e=0,J=0,ne=0,de,z=null,c=null;M&&(z=(p=!1)=>{if(!d.reportProgressFunc)return;let w=d.reportProgressFuncTo-d.reportProgressFuncFrom,m=p?d.reportProgressFuncTo:d.reportProgressFuncFrom+w*Math.min(.99,ne/(ne+1e3));m!==de&&(de=m,Lt(d.reportProgressFunc,m))},c=()=>{ne++,ne%1e3===0&&(z==null||z())},z());let f=t,y=n,R=A,D=se(R),F=D.length?nt():Ht,B="THROW_ID_12",qt="THROW_ID_13",G=D.length?new Set([R]):null,he=D.length?[{value:R},{index:0,keys:D,node:F,path:null,value:R}]:[];for(;he.length;){let p=he.pop();if(!Vr(p)){G==null||G.delete(p.value);continue}if(p.index>=p.keys.length)continue;let w=p.keys[p.index++];he.push(p);let m=ve(p.value,w),v=Kr(w),N=p.node,C=p.path;for(let oe=0;oe<v.length;oe++){let W=v[oe],V=N.children.get(W);V||(V=nt(),N.children.set(W,V),fe++,c==null||c()),C={depth:((st=C==null?void 0:C.depth)!=null?st:0)+1,encoded:C?"".concat(C.encoded,".").concat(Oe(W)):Oe(W),parent:C,segment:W},oe<v.length-1&&(V.descriptors&&!et(V.descriptors)&&ce(B,"".concat(K("schema",C)," cannot have both a terminal descriptor and nested schema paths."),C,null,l),V.implicitContainer=!0),C.depth>E&&(E=C.depth),N=V}if(q(m)){N.descriptors&&!et(N.descriptors)&&ce(B,"".concat(K("schema",C)," cannot have both a terminal descriptor and nested schema paths."),C,"object",l),N.implicitContainer=!0,G!=null&&G.has(m)&&ce(qt,"".concat(K("schema",C)," contains a cycle. Cyclic schemas are not supported."),C,"object",l),G==null||G.add(m),he.push({value:m}),he.push({index:0,keys:se(m),node:N,path:C,value:m});continue}let $=zr(m);$||ce(B,"".concat(K("schema",C)," must be a non-empty type name, null, undefined, or a dense array of those values; received ").concat(Q(m,4),"."),C,P(m).toLowerCase(),l);let re=$;N.descriptors&&ce(B,"".concat(K("schema",C)," is declared more than once."),C,P(m).toLowerCase(),l),(N.children.size||N.implicitContainer)&&!et(re)&&ce(B,"".concat(K("schema",C)," cannot have both a terminal descriptor and nested schema paths."),C,P(m).toLowerCase(),l),N.descriptors=re}let ge=Xe(d.ignoreKeys,!1),me=Xe(d.ignorePaths,!0),ie=Xe(d.acceptArraysIgnore,!1),ot=se(f),Qt=y?se(y):X;if(d.enforceStrictKeyset&&!y&&F.children.size===0&&k("THROW_ID_14","Both ".concat(d.optsVarName,".schema and reference objects are missing! We don't have anything to match the keys as requested via ").concat(d.optsVarName,".enforceStrictKeyset."),{context:l}),d.enforceStrictKeyset){let p=ot.filter(w=>!Kt(w,ge,me)&&!(y&&ue.call(y,w))&&!F.children.has(w));if(p.length){let w=p.length>1,m=F.children.size?"The ".concat(d.optsVarName,".enforceStrictKeyset is on and the following key").concat(w?"s are":" is"," not covered by schema and/or reference objects: ").concat(p.join(", ")):"The input object has key".concat(w?"s":""," which ").concat(w?"are":"is"," not covered by the reference object: ").concat(p.join(", "));k("THROW_ID_15",m,{context:l})}}if(d.enforceStrictKeyset&&y){let p=Qt.filter(w=>!ue.call(f,w)&&!Kt(w,ge,me));if(p.length){let w=p.length>1;k("THROW_ID_16","The reference object has key".concat(w?"s":""," which ").concat(w?"are":"is"," not present in the input object: ").concat(p.join(", ")),{context:l})}}let ae=[f],U=null,ye=[{value:f},{index:0,keys:ot,path:null,refValue:y,schemaNode:F,value:f}];for(;ye.length;){let p=ye.pop();if(!Er(p)){ae.pop(),U==null||U.delete(p.value),U&&ae.length<=32&&(U=null);continue}if(p.index>=p.keys.length)continue;let w=p.keys[p.index++];ye.push(p);let m={depth:((it=(_t=p.path)==null?void 0:_t.depth)!=null?it:0)+1,encoded:p.path?"".concat(p.path.encoded,".").concat(Oe(w)):Oe(w),parent:p.path,segment:w};M&&(Array.isArray(p.value)?te++:pe++,m.depth>E&&(E=m.depth),c==null||c());let v=ve(p.value,w),N=Array.isArray(p.value);if(!!(!N&&(ge!=null&&ge(w))||me!=null&&me(Lr(m)))){M&&_e++;continue}let $=p.schemaNode.children.get(w),re=!1;if($!=null&&$.descriptors){let Y=$.descriptors;if(Y.some(be=>rt.has(be))){M&&_e++;continue}if(M&&(J++,c==null||c()),Vt(v,Y))if(($.implicitContainer||$.children.size)&&q(v))re=!0;else continue;if(!re&&d.acceptArrays&&Array.isArray(v)&&!(ie!=null&&ie(w))){let be=se(v);for(let we of be){let je=ve(v,we);M&&(te++,J++,m.depth+1>E&&(E=m.depth+1),c==null||c()),Vt(je,Y)||Qr(je,Y,m,Number(we),d,l)}continue}re||zt(v,Y,m,d,l)}let oe=!1,W;Br(p.refValue)&&ue.call(p.refValue,w)&&(oe=!0,W=ve(p.refValue,w));let V=!1,Jt=W,Gt=$!=null?$:Ht;if($&&($.implicitContainer||$.children.size))re||(M&&(J++,c==null||c()),q(v)||zt(v,["object"],m,d,l)),V=!0;else if(oe){if(d.acceptArrays&&Array.isArray(v)&&!Array.isArray(W)&&!(ie!=null&&ie(w))){let Y=P(W).toLowerCase(),be=se(v);for(let we of be){let je=ve(v,we);M&&(te++,J++,m.depth+1>E&&(E=m.depth+1),c==null||c());let at=P(je).toLowerCase();at!==Y&&Jr(at,Y,m,Number(we),d,l)}continue}M&&(J++,c==null||c()),P(v)!==P(W)&&Gr(v,W,m,d,l),(Array.isArray(v)&&Array.isArray(W)||q(v))&&(V=!0)}else d.enforceStrictKeyset&&(!N||q(v)||Array.isArray(v))&&qr(m,d,l);V&&((U?U.has(v):ae.includes(v))&&Zr(m,d,l),ae.push(v),U?U.add(v):ae.length>32&&(U=new Set(ae)),ye.push({value:v}),ye.push({index:0,keys:se(v),path:m,refValue:Jt,schemaNode:Gt,value:v}))}z==null||z(!0),Lt(d.reportCompletionFunc,Object.freeze({arrayElementsVisited:te,maxDepth:E,objectPropertiesVisited:pe,schemaEntries:fe,timeTakenInMilliseconds:d.reportCompletionFunc?Date.now()-Te:0,valuesIgnored:_e,valuesValidated:J}))}function qr(e,t,n){return k("THROW_ID_17","".concat(K(t.optsVarName,e)," is neither covered by reference object (second input argument), nor ").concat(t.optsVarName,".schema! To stop this error, turn off ").concat(t.optsVarName,".enforceStrictKeyset or provide a type reference."),{context:n,path:ee(e)})}function zt(e,t,n,r,o){let s=P(e).toLowerCase(),_=s==="string"?"":'"';return k("THROW_ID_18","".concat(K(r.optsVarName,n)," was customised to ").concat(_).concat(Q(e)).concat(_," (type: ").concat(s,") which is not among the allowed types in schema (which is equal to ").concat(Q(t),")"),{actualType:s,context:o,expectedTypes:t,path:ee(n)})}function Qr(e,t,n,r,o,s){return k("THROW_ID_19","".concat(K(o.optsVarName,n),".").concat(r,", the ").concat(r,"th element (equal to ").concat(Q(e),") is of a type ").concat(P(e).toLowerCase(),", but only the following are allowed by the ").concat(o.optsVarName,".schema: ").concat(t.join(", ")),{actualType:P(e).toLowerCase(),context:s,expectedTypes:t,path:ee({depth:n.depth+1,encoded:"".concat(n.encoded,".").concat(r),parent:n,segment:String(r)})})}function Jr(e,t,n,r,o,s){return k("THROW_ID_20","".concat(K(o.optsVarName,n)," was customised to be array, but not all of its elements are ").concat(t,"-type"),{actualType:e,context:s,expectedTypes:[t],path:ee({depth:n.depth+1,encoded:"".concat(n.encoded,".").concat(r),parent:n,segment:String(r)})})}function Gr(e,t,n,r,o){let s=P(e).toLowerCase(),_=P(t).toLowerCase(),a=s==="string"?"":'"';return k("THROW_ID_21","".concat(K(r.optsVarName,n)," was customised to ").concat(a).concat(Q(e)).concat(a," which is not ").concat(_," but ").concat(s),{actualType:s,context:o,expectedTypes:[_],path:ee(n)})}function Zr(e,t,n){return k("THROW_ID_22","".concat(K(t.optsVarName,e)," contains a cycle. Cyclic input structures are not supported."),{actualType:"object",context:n,path:ee(e)})}return tn(Yr);})();
11
+ /**
12
+ * @name codsen-format-diagnostic-value
13
+ * @fileoverview Safely format untrusted JavaScript values for diagnostics
14
+ * @version 1.1.1
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-format-diagnostic-value/}
18
+ */
11
19
  /**
12
20
  * @name codsen-utils
13
21
  * @fileoverview Various utility functions
14
- * @version 1.9.0
22
+ * @version 1.10.1
15
23
  * @author Roy Revelt
16
24
  * @license MIT
17
25
  * {@link https://codsen.com/os/codsen-utils/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "check-types-mini",
3
- "version": "8.2.1",
3
+ "version": "8.2.3",
4
4
  "description": "Validate options object",
5
5
  "keywords": [
6
6
  "compare",
@@ -68,8 +68,7 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "codsen-utils": "^1.9.0",
72
- "type-detect": "^4.1.0"
71
+ "codsen-utils": "^1.10.1"
73
72
  },
74
73
  "engines": {
75
74
  "node": ">=18.20.8"
package/types/index.d.ts CHANGED
@@ -1,26 +1,118 @@
1
1
  declare const version: string;
2
- interface Obj {
3
- [key: string]: any;
2
+ type Obj = object;
3
+ type SchemaTypeName = string | null | undefined;
4
+ type SchemaDescriptor = SchemaTypeName | readonly SchemaTypeName[];
5
+ interface Schema {
6
+ readonly [key: string]: Schema | SchemaDescriptor;
7
+ }
8
+ interface CompletionStats {
9
+ arrayElementsVisited: number;
10
+ maxDepth: number;
11
+ objectPropertiesVisited: number;
12
+ schemaEntries: number;
13
+ timeTakenInMilliseconds: number;
14
+ valuesIgnored: number;
15
+ valuesValidated: number;
4
16
  }
5
17
  interface Opts {
6
- ignoreKeys: string | string[];
7
- ignorePaths: string | string[];
8
18
  acceptArrays: boolean;
9
- acceptArraysIgnore: string | string[];
19
+ acceptArraysIgnore: string | readonly string[];
10
20
  enforceStrictKeyset: boolean;
11
- schema: Obj;
21
+ ignoreKeys: string | readonly string[];
22
+ ignorePaths: string | readonly string[];
12
23
  msg: string;
13
24
  optsVarName: string;
25
+ reportCompletionFunc: null | ((stats: Readonly<CompletionStats>) => void);
26
+ reportProgressFunc: null | ((percentageDone: number) => void);
27
+ reportProgressFuncFrom: number;
28
+ reportProgressFuncTo: number;
29
+ schema: Schema;
30
+ }
31
+ declare const defaults: Readonly<Opts>;
32
+ type CheckTypesMiniThrowId =
33
+ | "THROW_ID_01"
34
+ | "THROW_ID_02"
35
+ | "THROW_ID_03"
36
+ | "THROW_ID_04"
37
+ | "THROW_ID_05"
38
+ | "THROW_ID_06"
39
+ | "THROW_ID_07"
40
+ | "THROW_ID_08"
41
+ | "THROW_ID_09"
42
+ | "THROW_ID_10"
43
+ | "THROW_ID_11"
44
+ | "THROW_ID_12"
45
+ | "THROW_ID_13"
46
+ | "THROW_ID_14"
47
+ | "THROW_ID_15"
48
+ | "THROW_ID_16"
49
+ | "THROW_ID_17"
50
+ | "THROW_ID_18"
51
+ | "THROW_ID_19"
52
+ | "THROW_ID_20"
53
+ | "THROW_ID_21"
54
+ | "THROW_ID_22";
55
+ interface CheckTypesMiniErrorDetails {
56
+ actualType?: string | null;
57
+ context?: string;
58
+ expectedTypes?: readonly string[] | null;
59
+ path?: readonly string[];
60
+ }
61
+ interface CheckTypesMiniErrorJson {
62
+ actualType: string | null;
63
+ context: string;
64
+ expectedTypes: readonly string[] | null;
65
+ message: string;
66
+ name: "CheckTypesMiniError";
67
+ path: readonly string[];
68
+ reason: string;
69
+ validatorCode: CheckTypesMiniThrowId;
70
+ }
71
+ declare class CheckTypesMiniError extends TypeError {
72
+ readonly actualType: string | null;
73
+ readonly context: string;
74
+ readonly expectedTypes: readonly string[] | null;
75
+ readonly name = "CheckTypesMiniError";
76
+ readonly path: readonly string[];
77
+ readonly reason: string;
78
+ readonly validatorCode: CheckTypesMiniThrowId;
79
+ constructor(
80
+ validatorCode: CheckTypesMiniThrowId,
81
+ reason: string,
82
+ details?: CheckTypesMiniErrorDetails,
83
+ );
84
+ toJSON(): CheckTypesMiniErrorJson;
14
85
  }
15
- declare const defaults: Opts;
16
- /**
17
- * Validate options object
18
- */
19
- declare function checkTypesMini(
20
- obj: Obj,
21
- ref: Obj | null,
22
- opts?: Partial<Opts>,
86
+ type PlainObjectInput<T extends object> = T extends
87
+ | readonly unknown[]
88
+ | ((...args: never[]) => unknown)
89
+ | Date
90
+ | RegExp
91
+ | Map<unknown, unknown>
92
+ | Set<unknown>
93
+ | WeakMap<object, unknown>
94
+ | WeakSet<object>
95
+ | Promise<unknown>
96
+ ? never
97
+ : T;
98
+ declare function checkTypesMini<
99
+ TObj extends object,
100
+ TRef extends object | null,
101
+ >(
102
+ obj: PlainObjectInput<TObj>,
103
+ ref: TRef extends object ? PlainObjectInput<TRef> : TRef,
104
+ opts?: Partial<Opts> | null,
23
105
  ): void;
24
106
 
25
- export { checkTypesMini, defaults, version };
26
- export type { Obj, Opts };
107
+ export { CheckTypesMiniError, checkTypesMini, defaults, version };
108
+ export type {
109
+ CheckTypesMiniErrorDetails,
110
+ CheckTypesMiniErrorJson,
111
+ CheckTypesMiniThrowId,
112
+ CompletionStats,
113
+ Obj,
114
+ Opts,
115
+ Schema,
116
+ SchemaDescriptor,
117
+ SchemaTypeName,
118
+ };