ata-validator 1.62.0 → 1.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +68 -13
  2. package/build.mjs +1 -0
  3. package/index.browser.mjs +23 -4
  4. package/index.bundle.mjs +14 -4
  5. package/index.edge.mjs +14 -4
  6. package/index.js +7 -2
  7. package/lib/aot-build.js +18 -0
  8. package/lib/aot-impl.js +20 -0
  9. package/lib/codegen-engine.js +72 -3
  10. package/lib/compiled-common.js +2 -1
  11. package/lib/email-literal.js +4 -1
  12. package/lib/error-runtime-features.js +41 -0
  13. package/lib/error-runtime.browser.js +15 -0
  14. package/lib/error-runtime.js +1 -32
  15. package/lib/formats-source.js +39 -40
  16. package/lib/interpreter-core.js +17 -9
  17. package/lib/ir/emit-deps.mjs +131 -0
  18. package/lib/ir/emit.mjs +560 -0
  19. package/lib/ir/front.mjs +834 -0
  20. package/lib/ir/index.mjs +10 -0
  21. package/lib/ir/refs.mjs +108 -0
  22. package/lib/ir/run.mjs +520 -0
  23. package/lib/ir/table.mjs +233 -0
  24. package/lib/js-compiler-errors.js +25 -7
  25. package/lib/js-compiler.js +6 -2
  26. package/lib/kernels/collapse.mjs +114 -0
  27. package/lib/kernels/custom.mjs +70 -0
  28. package/lib/kernels/fill.mjs +6 -0
  29. package/lib/kernels/formats-small.mjs +40 -0
  30. package/lib/kernels/formats.mjs +29 -0
  31. package/lib/kernels/index.mjs +11 -0
  32. package/lib/kernels/kernels.mjs +285 -0
  33. package/lib/kernels/leaves.mjs +28 -0
  34. package/lib/kernels/order.mjs +25 -0
  35. package/lib/kernels/plan-rich.mjs +17 -0
  36. package/lib/kernels/plan.d.ts +9 -0
  37. package/lib/kernels/plan.mjs +128 -0
  38. package/lib/kernels/preprocess.mjs +223 -0
  39. package/lib/kernels/rank.mjs +97 -0
  40. package/lib/kernels/rt.mjs +249 -0
  41. package/lib/kernels/table.mjs +182 -0
  42. package/lib/kernels/unique.mjs +157 -0
  43. package/lib/native-positions.js +1 -1
  44. package/lib/openapi.d.ts +2 -0
  45. package/lib/openapi.js +128 -0
  46. package/lib/plan-compiler.js +84 -7
  47. package/lib/public-api.js +7 -2
  48. package/lib/rejections.js +3 -1
  49. package/lib/schema-helpers.js +12 -0
  50. package/lib/schema-helpers.mjs +20 -0
  51. package/lib/schema-order.js +4 -2
  52. package/lib/standard-schema.js +1 -1
  53. package/lib/validator-core.js +35 -30
  54. package/lib/version.js +1 -1
  55. package/lite.js +7 -2
  56. package/package.json +32 -13
@@ -0,0 +1,233 @@
1
+ // The table backend: a schema as data for the interpreter in
2
+ // lib/kernels/table.mjs, instead of code. A module written here is the plan
3
+ // and three lines; the interpreter is shared by every such module on a page,
4
+ // so a page with many forms pays for each form about what its schema weighs.
5
+ // The module writer (./emit.mjs) writes faster code; this one is for where
6
+ // bytes count more than nanoseconds, a browser bundle.
7
+ //
8
+ // The schema is read as the front end reads it (normalized, its references
9
+ // resolved), and every keyword is run in the order the front end runs it,
10
+ // so the errors are those of ./emit.mjs. What the interpreter does not cover
11
+ // returns null, and the caller keeps the module writer: annotations
12
+ // (unevaluated*), branches (anyOf, oneOf), patternProperties, propertyNames,
13
+ // contains, dependentSchemas, dynamic references, custom keywords and
14
+ // formats, registries, and any option but richErrors, assertFormat and
15
+ // useDefaults.
16
+ import { front, needsOrder, orderSkeleton } from './front.mjs'
17
+ import { buildIndex } from './refs.mjs'
18
+ import { LEAVES } from '../kernels/leaves.mjs'
19
+ import { FORMAT_HINTS } from './emit-deps.mjs'
20
+ import * as KERNELS from '../kernels/index.mjs'
21
+ import ATA_VERSION from '../version.js'
22
+
23
+ const SKIP = new Set(['$id', '$anchor', '$dynamicAnchor', '$vocabulary', '$defs', 'definitions', 'minContains', 'maxContains', 'additionalItems', 'contentMediaType', 'contentEncoding', 'contentSchema', '$schema', 'then', 'else', 'default', 'title', 'description', 'examples', '$comment', 'readOnly', 'writeOnly', 'deprecated'])
24
+ const REFUSE = new Set(['anyOf', 'oneOf', 'patternProperties', 'propertyNames', 'contains', 'dependentSchemas', 'dependencies', 'unevaluatedProperties', 'unevaluatedItems', '$dynamicRef', '$recursiveRef', '$recursiveAnchor', 'errorMessage'])
25
+ const NAMES = { const: 'constK', enum: 'enumK' }
26
+ const OPTIONS = new Set(['richErrors', 'assertFormat', 'useDefaults'])
27
+ const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
28
+ const prim = (v) => v === null || typeof v !== 'object'
29
+ class Refused extends Error {}
30
+ const refuse = (why) => { throw new Refused(why) }
31
+
32
+ // The module source, or null where the interpreter does not cover the
33
+ // schema or an option.
34
+ export function tableModule (schema, opts = {}) {
35
+ const b = build(schema, opts, false)
36
+ return b === null ? null : b.module()
37
+ }
38
+
39
+ // The same plan as JSON, for a page that receives its schemas at run time:
40
+ // the server writes it, and ata-validator/plan's fromPlan reads it with the
41
+ // kernels it names. One writer for both, so the two cannot differ. Kernels
42
+ // are named in fixed places only (a step's handler, a leaf's descriptor,
43
+ // check and hint), never inside the schema's own values.
44
+ export const PLAN_VERSION = 1
45
+ // A plan carries the ata-validator that wrote it (ATA_VERSION): ata-validator/plan
46
+ // says so once when it reads a plan from another version, whose answers may differ.
47
+ export function tablePlan (schema, opts = {}) {
48
+ const b = build(schema, opts, true)
49
+ return b === null ? null : b.plan()
50
+ }
51
+
52
+ function build (schema, opts, json) {
53
+ for (const k of Object.keys(opts)) if (opts[k] !== undefined && !OPTIONS.has(k)) return null
54
+ const rich = opts.richErrors !== false
55
+ const assertFormat = opts.assertFormat !== false
56
+ let ir
57
+ try { ir = front(schema, { assertFormat }) } catch { return null }
58
+ if (ir.dynamic || ir.custom || ir.ctx) return null
59
+ const sorts = needsOrder(ir.schema)
60
+ const root = ir.schema
61
+ const index = buildIndex(root, null, null)
62
+ const uses = new Set([rich ? 'tableRich' : 'tablePlain'])
63
+ const consts = []
64
+ const hints = new Map()
65
+ const nodes = []; const memo = new Map()
66
+ const resolve = (ref, s) => { try { return index.resolve(ref, index.baseOf(s)) } catch { return refuse('unresolved $ref ' + ref) } }
67
+ const lit = (v) => JSON.stringify(v)
68
+ // A kernel as the module names it, or as the plan does, by its name.
69
+ const id = (name) => json ? lit(name) : name
70
+ // A step: its handler (an export of lib/kernels/table.mjs) and arguments.
71
+ const step = (h, ...a) => { uses.add(h); return `[${[id(h), ...a].join(',')}]` }
72
+
73
+ function node (s) {
74
+ if (memo.has(s)) return memo.get(s)
75
+ const i = nodes.length
76
+ memo.set(s, i); nodes.push(null)
77
+ nodes[i] = steps(s)
78
+ return i
79
+ }
80
+ // A subschema with no subschema of its own is written in place, as valibot
81
+ // writes a field: no index, no separate entry. Anything else, which may be
82
+ // shared or reached again, by index.
83
+ const CHILDREN = ['properties', 'additionalProperties', 'items', 'prefixItems', 'allOf', '$ref', 'not', 'if', 'then', 'else']
84
+ const leafish = (s) => typeof s === 'boolean' || (isObj(s) && !CHILDREN.some((k) => k in s && typeof s[k] === 'object' && s[k] !== null))
85
+ const ref = (s) => leafish(s) ? steps(s) : node(s)
86
+ // A name an object literal keeps in its place and as an own key: not an
87
+ // array index (those come first) and not __proto__ (which sets the prototype).
88
+ const safeName = (k) => k !== '__proto__' && !/^(0|[1-9][0-9]*)$/.test(k)
89
+ function steps (s) {
90
+ if (s === true) return '[]'
91
+ if (s === false) { uses.add('tFalse'); return `[[${id('tFalse')}]]` }
92
+ if (!isObj(s)) refuse('not a schema')
93
+ const out = []
94
+ let propsAt = -1; const apAt = []; const reqAt = []; let propNames = []
95
+ for (const k of Object.keys(s)) {
96
+ const n = s[k]
97
+ if (SKIP.has(k)) continue
98
+ if (REFUSE.has(k)) refuse(k)
99
+ if (k === 'type') out.push(step('tType', lit(n)))
100
+ else if (k === 'properties') {
101
+ if (!isObj(n)) refuse('properties')
102
+ if (!Object.keys(n).every(safeName)) refuse('a property name an object literal reorders')
103
+ propsAt = out.length; propNames = Object.keys(n)
104
+ out.push(step('tProps', `{${propNames.map((p) => `${lit(p)}:${ref(n[p])}`).join(',')}}`))
105
+ } else if (k === 'required') { if (Array.isArray(n) && n.length) { reqAt.push(out.length); out.push(n) } }
106
+ else if (k === 'dependentRequired') {
107
+ if (!isObj(n)) refuse(k)
108
+ out.push(step('tDepReq', `[${Object.keys(n).map((a) => `${lit(a)},${lit(n[a])}`).join(',')}]`))
109
+ } else if (k === 'additionalProperties') {
110
+ // The names it knows are those of the node's properties step, which
111
+ // may come later in the schema: filled in below.
112
+ if (n === false) { apAt.push(out.length); uses.add('tClosed'); out.push(`[${id('tClosed')},`) }
113
+ else if (n !== true) { apAt.push(out.length); uses.add('tAddl'); out.push(`[${id('tAddl')},${ref(n)},`) }
114
+ } else if (k === 'items') { if (n !== true) out.push(step('tItems', ref(n), Array.isArray(s.prefixItems) ? s.prefixItems.length : 0)) }
115
+ else if (k === 'prefixItems') out.push(step('tTuple', `[${n.map(ref).join(',')}]`))
116
+ else if (k === 'allOf') out.push(step('tAll', `[${n.map(ref).join(',')}]`))
117
+ else if (k === '$ref') out.push(step('tRef', ref(resolve(n, s))))
118
+ else if (k === 'not') out.push(step('tNot', ref(n)))
119
+ else if (k === 'if') out.push(step('tIf', ref(n), 'then' in s ? ref(s.then) : -1, 'else' in s ? ref(s.else) : -1))
120
+ else if (k === 'format' && !assertFormat) continue
121
+ else if (LEAVES[k]) {
122
+ const K = LEAVES[k]
123
+ if (k === 'format') {
124
+ if (typeof n !== 'string' || K.prepare(n) === null) continue
125
+ // A format with a smaller check of the same answers (lib/kernels/formats-small.mjs)
126
+ // takes it: a plan is for a bundle where bytes count.
127
+ const base = 'fmt_' + n.replace(/-/g, '_')
128
+ const fn = base + '_s' in KERNELS ? base + '_s' : base
129
+ if (!(fn in KERNELS)) refuse('format ' + n)
130
+ const D = rich ? 'formatK' : 'formatP'
131
+ uses.add(fn); uses.add(D)
132
+ let hint = json ? 'null' : 'void 0'
133
+ // A plan names the format whose hint it takes (ata-validator/plan makes it).
134
+ if (rich && FORMAT_HINTS[n] && json) hint = lit(n)
135
+ else if (rich && FORMAT_HINTS[n]) {
136
+ if (!hints.has(n)) { const h = 'H' + consts.length; consts.push(`const ${h}=(v)=>{const t=(${FORMAT_HINTS[n].toString()})(v);return t?{text:t,kind:"format"}:null}`); hints.set(n, h) }
137
+ hint = hints.get(n)
138
+ }
139
+ out.push(step('tLeaf', id(D), lit(n), id(fn), lit(K.code(n)), hint))
140
+ continue
141
+ }
142
+ const name = NAMES[k] || k
143
+ if (!(name in KERNELS) || KERNELS[name] !== K || K.kw !== k) refuse('leaf ' + k)
144
+ // The plain view where the rich descriptor carries a hint.
145
+ // The plain view of the descriptor (its kw, check and message, the same
146
+ // functions) where there is one; uniqueItems has none.
147
+ const view = k === 'enum' ? 'enumP' : k === 'const' ? 'constP' : name + 'P'
148
+ let D = !rich && view in KERNELS ? view : name
149
+ if (D !== name && (KERNELS[D].params !== K.params || KERNELS[D].msg !== K.msg || KERNELS[D].ok !== K.ok)) refuse('plain view ' + k)
150
+ // Primitive values only: the === check (enumPrimP and the like), so the
151
+ // bundle carries no deep equality. A plan sent as data keeps the
152
+ // general one, which ata-validator/plan reads.
153
+ if (!json && (k === 'enum' || k === 'const') && (k === 'enum' ? Array.isArray(n) && n.every(prim) : prim(n))) {
154
+ const P = k + 'Prim' + (rich ? 'K' : 'P')
155
+ if (KERNELS[P].params !== K.params || KERNELS[P].msg !== K.msg || KERNELS[P].kw !== k) refuse('primitive view ' + k)
156
+ D = P
157
+ }
158
+ uses.add(D)
159
+ out.push(step('tLeaf', id(D), lit(n)))
160
+ } else refuse('keyword ' + k)
161
+ }
162
+ for (const j of apAt) out[j] += propsAt + ']'
163
+ // A required name the properties step lists is written as its position there.
164
+ // Required names that are the properties step's own, in its order, as a
165
+ // mask of their positions; otherwise the names.
166
+ for (const j of reqAt) {
167
+ const pos = out[j].map((r) => typeof r === 'string' ? propNames.indexOf(r) : -1)
168
+ const inOrder = propsAt !== -1 && propNames.length <= 31 && pos.every((i, x) => i !== -1 && (x === 0 || i > pos[x - 1]))
169
+ out[j] = inOrder ? step('tReq', pos.reduce((m, i) => m | (1 << i), 0), propsAt) : step('tReq', lit(out[j]))
170
+ }
171
+ return `[${out.join(',')}]`
172
+ }
173
+
174
+ // Defaults, by the front end's fill rules (./front.mjs fillProc).
175
+ const fills = []; const fillMemo = new Map(); const fillStack = new Set(); const reach = new Map()
176
+ const reachesDefault = (n) => {
177
+ if (!isObj(n)) return false
178
+ if (reach.has(n)) return reach.get(n)
179
+ reach.set(n, false)
180
+ const props = isObj(n.properties) ? Object.values(n.properties) : []
181
+ let yes = props.some((p) => isObj(p) && p.default !== undefined)
182
+ const below = [...props, typeof n.$ref === 'string' ? resolve(n.$ref, n) : null, ...(Array.isArray(n.allOf) ? n.allOf : []), ...(Array.isArray(n.prefixItems) ? n.prefixItems : []), n.items, n.additionalProperties, ...(isObj(n.patternProperties) ? Object.values(n.patternProperties) : []), ...(isObj(n.dependentSchemas) ? Object.values(n.dependentSchemas) : [])]
183
+ for (const b of below) if (!yes && reachesDefault(b)) yes = true
184
+ reach.set(n, yes)
185
+ return yes
186
+ }
187
+ function fill (n) {
188
+ if (!isObj(n) || !reachesDefault(n)) return -1
189
+ if (fillMemo.has(n)) return fillMemo.get(n)
190
+ if (fillStack.has(n)) refuse('a cycle of defaults')
191
+ if (reachesDefault(n.additionalProperties)) refuse('defaults under additionalProperties')
192
+ fillStack.add(n)
193
+ const i = fills.length; fills.push(null); fillMemo.set(n, i)
194
+ const props = isObj(n.properties) ? n.properties : {}
195
+ const defs = []
196
+ for (const k of Object.keys(props)) if (isObj(props[k]) && props[k].default !== undefined) defs.push(lit(k), lit(props[k].default))
197
+ const inner = []
198
+ for (const k of Object.keys(props)) { const c = fill(props[k]); if (c !== -1) inner.push(lit(k), c) }
199
+ const tuple = Array.isArray(n.prefixItems) ? n.prefixItems.map(fill) : []
200
+ const each = fill(n.items)
201
+ const deps = []
202
+ if (isObj(n.dependentSchemas)) for (const k of Object.keys(n.dependentSchemas)) { const c = fill(n.dependentSchemas[k]); if (c !== -1) deps.push(lit(k), c) }
203
+ const here = []
204
+ if (typeof n.$ref === 'string') { const c = fill(resolve(n.$ref, n)); if (c !== -1) here.push(c) }
205
+ if (Array.isArray(n.allOf)) for (const sub of n.allOf) { const c = fill(sub); if (c !== -1) here.push(c) }
206
+ fillStack.delete(n)
207
+ fills[i] = `[[${defs.join(',')}],[${inner.join(',')}],[${tuple.join(',')}],${each},[${deps.join(',')}],[${here.join(',')}]]`
208
+ return i
209
+ }
210
+
211
+ try {
212
+ node(root)
213
+ if (opts.useDefaults !== false && fill(root) > 0) refuse('fill root')
214
+ } catch (e) {
215
+ if (e instanceof Refused) return null
216
+ throw e
217
+ }
218
+ if (fills.length) uses.add('tableFill')
219
+ if (sorts) uses.add('ordered')
220
+ const P = `[${nodes.join(',')}]`; const F = `[${fills.join(',')}]`
221
+ if (json) return { plan: () => ({ v: PLAN_VERSION, ata: ATA_VERSION, rich, P: JSON.parse(P), F: JSON.parse(F), rel: rich && ir.relate, sk: sorts ? orderSkeleton(ir.schema) : null, uses: [...uses].sort() }) }
222
+ // Trailing arguments left out where they are empty.
223
+ const a = ['P', fills.length ? F : '[]', fills.length ? 'tableFill' : 'null']
224
+ if (rich) a.push(ir.relate ? '1' : '0')
225
+ if (sorts) a.push('(e)=>ordered(SK,e)')
226
+ while (a.length > 1 && (a[a.length - 1] === 'null' || a[a.length - 1] === '[]' || a[a.length - 1] === '0')) a.pop()
227
+ const make = `${rich ? 'tableRich' : 'tablePlain'}(${a.join(',')})`
228
+ const sk = sorts ? `const SK=JSON.parse(${JSON.stringify(JSON.stringify(orderSkeleton(ir.schema)))})\n` : ''
229
+ return { module: () => `import {${[...uses].sort().join(',')}} from "ata-validator/kernels"
230
+ ${consts.join('\n')}${consts.length ? '\n' : ''}${sk}const P=${P}
231
+ export const{isValid,validate}=${make}
232
+ ` }
233
+ }
@@ -8,8 +8,18 @@ const { compileFunction } = require('./compile-fn')
8
8
  // they are 45 percent of the generator's source, and the module is read on
9
9
  // the first call that compiles errors. Everything here was written as part
10
10
  // of js-compiler.js and reads its helpers from that module's _internal.
11
- const core = require('./js-compiler')
12
- const { ownHead, plainFlag, hasConstraints, assertEmitted, prepareForCodegen, sharedCodegenGate, codegenSafe, isSimplePN, hasUnresolvableRef, needsBaseTracking, _cpLen, sharedRt, DECLINE, bindRt, compileSafe, emitGuardState, withPlain, REF_NEUTRAL_SIBLINGS, resolveCrossSchemaRef, enumCondition, enumOperand, emitDeq, emitConstant, ownGuard, ownKeyExpr, multipleOfBad, compilePatternInline, useSafeEngine, reFlags, FORMAT_CODEGEN, PROTO_NAMES, setOwn, nestedGenCode, compileToJSCodegen, SKIP_VALUE_KEYS, skipString, CYCLE_DEPTH, cyclicDefNames, sharedDefNames, reFlagArg, hoistOnce, PTR_ESC_HELPER, unevalContributions, emitUq, uqSources, safeReClosure, fastPrefixCheck, replaceTopLevel, refTargetFor, genCode, addLocalAnnotations, addTopApplicatorAnnotations, protoIs, ANNOT_APPLICATORS, SIZE_SKIPS, emitRootGuard, emitGuardedRun, keyLoopEligible, SAME_KEYS_HELPER, seqTag, numLit, userFormatFn, bindUserFormat, formatNameOf } = core._internal
11
+ // Read at the first compile, not at load, and from a fresh require: the two
12
+ // modules require each other, and a loader that evaluates every require before
13
+ // the module body (esm.sh's conversion to ES modules does) handed this file
14
+ // js-compiler's exports before they existed, an object js-compiler then
15
+ // replaces. The destructure threw and ata did not load there.
16
+ let ownHead, plainFlag, hasConstraints, assertEmitted, prepareForCodegen, sharedCodegenGate, codegenSafe, isSimplePN, hasUnresolvableRef, needsBaseTracking, _cpLen, sharedRt, DECLINE, bindRt, compileSafe, emitGuardState, withPlain, REF_NEUTRAL_SIBLINGS, resolveCrossSchemaRef, enumCondition, enumOperand, emitDeq, emitConstant, ownGuard, ownKeyExpr, multipleOfBad, compilePatternInline, useSafeEngine, reFlags, FORMAT_CODEGEN, PROTO_NAMES, setOwn, nestedGenCode, compileToJSCodegen, SKIP_VALUE_KEYS, skipString, CYCLE_DEPTH, cyclicDefNames, sharedDefNames, reFlagArg, hoistOnce, PTR_ESC_HELPER, unevalContributions, emitUq, uqSources, safeReClosure, fastPrefixCheck, replaceTopLevel, refTargetFor, genCode, addLocalAnnotations, addTopApplicatorAnnotations, protoIs, ANNOT_APPLICATORS, SIZE_SKIPS, emitRootGuard, emitGuardedRun, keyLoopEligible, SAME_KEYS_HELPER, seqTag, numLit, userFormatFn, bindUserFormat, formatNameOf
17
+ let _bound = false
18
+ function bindCore () {
19
+ if (_bound) return
20
+ ({ ownHead, plainFlag, hasConstraints, assertEmitted, prepareForCodegen, sharedCodegenGate, codegenSafe, isSimplePN, hasUnresolvableRef, needsBaseTracking, _cpLen, sharedRt, DECLINE, bindRt, compileSafe, emitGuardState, withPlain, REF_NEUTRAL_SIBLINGS, resolveCrossSchemaRef, enumCondition, enumOperand, emitDeq, emitConstant, ownGuard, ownKeyExpr, multipleOfBad, compilePatternInline, useSafeEngine, reFlags, FORMAT_CODEGEN, PROTO_NAMES, setOwn, nestedGenCode, compileToJSCodegen, SKIP_VALUE_KEYS, skipString, CYCLE_DEPTH, cyclicDefNames, sharedDefNames, reFlagArg, hoistOnce, PTR_ESC_HELPER, unevalContributions, emitUq, uqSources, safeReClosure, fastPrefixCheck, replaceTopLevel, refTargetFor, genCode, addLocalAnnotations, addTopApplicatorAnnotations, protoIs, ANNOT_APPLICATORS, SIZE_SKIPS, emitRootGuard, emitGuardedRun, keyLoopEligible, SAME_KEYS_HELPER, seqTag, numLit, userFormatFn, bindUserFormat, formatNameOf } = require('./js-compiler')._internal)
21
+ _bound = true
22
+ }
13
23
 
14
24
 
15
25
  function emitPtrEsc(ctx) {
@@ -738,7 +748,9 @@ function emitBranchCollapse (branches, keyword, v, pathExpr, lines, ctx, schemaP
738
748
  // inside it reports there, not into the combined function's lists.
739
749
  ctx.inBranchFn = (ctx.inBranchFn || 0) + 1
740
750
  try {
741
- genCodeE(sub, '_bv', '_bpth', subLines, ctx, subSp)
751
+ // Hoisted, so isolated: a flag an enclosing branch declared for its
752
+ // own `_bv` is out of scope here and names another object.
753
+ isolatedE(ctx, () => genCodeE(sub, '_bv', '_bpth', subLines, ctx, subSp))
742
754
  } finally {
743
755
  ctx.inBranchFn--
744
756
  }
@@ -857,7 +869,8 @@ function emitBranchCollapse (branches, keyword, v, pathExpr, lines, ctx, schemaP
857
869
  if (sub === true) return 'function(){return true}'
858
870
  if (sub === false) return 'function(){return false}'
859
871
  const bl = []
860
- nestedGenCode(sub, '_bv', bl, ctx)
872
+ // Hoisted, so isolated (see isolatedE): no enclosing `_bv` flag here.
873
+ isolatedE(ctx, () => nestedGenCode(sub, '_bv', bl, ctx))
861
874
  return bl.length === 0 ? 'function(){return true}' : `function(_bv){${bl.join(';')};return true}`
862
875
  })
863
876
  // Only while the verdicts are small: they are a second copy of the
@@ -2163,7 +2176,8 @@ function emitPropFnC (prop, v, pathExpr, lines, ctx, schemaPrefix) {
2163
2176
  const bodyLines = []
2164
2177
  let hoisted
2165
2178
  try {
2166
- genGuardedC(prop, '_dv', '_p', bodyLines, ctx, schemaPrefix)
2179
+ // Hoisted, so isolated (see isolatedE): every such function takes `_dv`.
2180
+ isolatedE(ctx, () => genGuardedC(prop, '_dv', '_p', bodyLines, ctx, schemaPrefix))
2167
2181
  } finally {
2168
2182
  hoisted = ctx.hoisted
2169
2183
  ctx.hoisted = outerHoisted
@@ -2210,7 +2224,8 @@ function emitDefFnC(key, target, cyclic, v, pathExpr, lines, ctx, schemaPrefix)
2210
2224
  let hoisted
2211
2225
  try {
2212
2226
  ctx.inDefC = (ctx.inDefC || 0) + 1
2213
- genCodeC(target, '_dv', '_p', bodyLines, ctx, SP_PLACEHOLDER)
2227
+ // Hoisted, so isolated (see isolatedE): every definition takes `_dv`.
2228
+ isolatedE(ctx, () => genCodeC(target, '_dv', '_p', bodyLines, ctx, SP_PLACEHOLDER))
2214
2229
  } finally {
2215
2230
  ctx.inDefC--
2216
2231
  hoisted = ctx.hoisted
@@ -3648,4 +3663,7 @@ function genIfC(schema, v, pathExpr, lines, ctx, schemaPrefix) {
3648
3663
  lines.push(`}`)
3649
3664
  }
3650
3665
 
3651
- module.exports = { compileToJSCodegenWithErrors, compileToJSCombined }
3666
+ module.exports = {
3667
+ compileToJSCodegenWithErrors: (...a) => { bindCore(); return compileToJSCodegenWithErrors(...a) },
3668
+ compileToJSCombined: (...a) => { bindCore(); return compileToJSCombined(...a) },
3669
+ }
@@ -1753,9 +1753,13 @@ function refStringsOf(node) {
1753
1753
  // the schema to the interpreted engine. Written as it came, a string value
1754
1754
  // was source, so `minimum: '0||(process.exitCode=7)'` ran.
1755
1755
  const NUMERIC_KEYWORDS = ['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf', 'minLength', 'maxLength', 'minItems', 'maxItems', 'minProperties', 'maxProperties', 'minContains', 'maxContains']
1756
+ const NUMERIC_KEYWORD_SET = new Set(NUMERIC_KEYWORDS)
1757
+ // By the node's own keys, usually a handful, rather than thirteen lookups
1758
+ // that mostly miss: the lookups cost a schema compile about 2%.
1756
1759
  function hasNonNumericBound (node) {
1757
- for (let i = 0; i < NUMERIC_KEYWORDS.length; i++) {
1758
- const v = node[NUMERIC_KEYWORDS[i]]
1760
+ for (const k in node) {
1761
+ if (!NUMERIC_KEYWORD_SET.has(k)) continue
1762
+ const v = node[k]
1759
1763
  // v - v is 0 for a finite number and NaN for NaN and the infinities.
1760
1764
  if (v !== undefined && (typeof v !== 'number' || v - v !== 0)) return true
1761
1765
  }
@@ -0,0 +1,114 @@
1
+ // Generated by scripts/gen-kernels-cjs.js from lib/branch-collapse.js. Do not edit.
2
+
3
+ // Branch collapse: when no branch of an anyOf or oneOf matches, listing every
4
+ // branch's errors tells a reader that nothing fit without telling them which
5
+ // branch they meant. This scores the branches, reports the one that came
6
+ // closest, and keeps its errors under `branchErrors` for the pretty renderer.
7
+ //
8
+ // There is one implementation, and it is `__ataCollapse` below. A standalone
9
+ // module imports nothing, so the generated code cannot require this file; it
10
+ // carries a copy emitted by `embedSource()` from these very functions instead
11
+ // of a second hand-written one. That is why the internals are written in the
12
+ // positional form the generated code calls, and why `__ataCollapse` may close
13
+ // over nothing but `__ataScore` and the severity table: whatever it reaches
14
+ // has to be in the embed too.
15
+
16
+ // How much a failing keyword says about intent. A branch that fails on `type`
17
+ // was probably not the branch the author meant; one that fails on `minLength`
18
+ // probably was, and is the better thing to show. The error count dominates, so
19
+ // a branch with one complaint always beats a branch with three.
20
+ const __ATA_SEVERITY = {
21
+ type: 10,
22
+ const: 8,
23
+ enum: 8,
24
+ required: 5,
25
+ format: 3,
26
+ minLength: 3,
27
+ maxLength: 3,
28
+ minimum: 3,
29
+ maximum: 3,
30
+ pattern: 3,
31
+ additionalProperties: 2,
32
+ unevaluatedProperties: 2,
33
+ unevaluatedItems: 2,
34
+ };
35
+
36
+ function __ataScore (errs) {
37
+ if (!errs || !errs.length) return 0;
38
+ let s = 0;
39
+ for (const e of errs) s += __ATA_SEVERITY[e.keyword] || 4;
40
+ return errs.length * 100 + s; // primary: count, secondary: severity
41
+ }
42
+
43
+ // `br` is one entry per branch in declaration order: {valid, errors} and a
44
+ // `title`, or the titles in `titles` when given (the generated code passes
45
+ // each branch's result as it is rather than copying it to add one).
46
+ // Returns the single error to report, or null when the keyword is satisfied.
47
+ // oneOf passed by more than one branch; generated code builds it from a count.
48
+ function __ataMulti (passIdx, total, pp, sp, o) {
49
+ const multi = {
50
+ code: 'ATA4002',
51
+ keyword: 'oneOf',
52
+ instancePath: pp || '',
53
+ path: pp || '',
54
+ schemaPath: sp,
55
+ message: 'value matched ' + passIdx.length + ' of ' + total + ' oneOf variants, expected exactly one',
56
+ params: { passingSchemas: passIdx },
57
+ };
58
+ if (o !== null) Object.defineProperty(multi, '_o', { value: o });
59
+ return multi;
60
+ }
61
+
62
+ function __ataCollapse (kw, br, pp, sp, o, titles) {
63
+ let passN = 0;
64
+ for (let i = 0; i < br.length; i++) if (br[i].valid) passN++;
65
+ const pass = { length: passN };
66
+ if (kw === 'oneOf') {
67
+ if (pass.length === 1) return null;
68
+ if (pass.length > 1) {
69
+ const passIdx = [];
70
+ for (let i = 0; i < br.length; i++) if (br[i].valid) passIdx.push(i);
71
+ return __ataMulti(passIdx, br.length, pp, sp, o);
72
+ }
73
+ } else if (pass.length >= 1) {
74
+ return null;
75
+ }
76
+ let bi = 0;
77
+ let bs = Infinity;
78
+ for (let i = 0; i < br.length; i++) {
79
+ const s = __ataScore(br[i].errors);
80
+ if (s < bs) { bs = s; bi = i; }
81
+ }
82
+ const best = br[bi];
83
+ // The ordering key, when there is one, is not enumerable: the error is
84
+ // otherwise in the shape it is handed out in, and a caller that reads it
85
+ // as it comes (the combined function's one-pass result) does not copy it.
86
+ const none = {
87
+ code: kw === 'oneOf' ? 'ATA4001' : 'ATA4003',
88
+ keyword: kw,
89
+ instancePath: pp || '',
90
+ path: pp || '',
91
+ schemaPath: sp,
92
+ message: 'value matched 0 of ' + br.length + ' ' + kw + ' variants',
93
+ params: { variants: br.length, closest: bi, closestName: (titles !== undefined ? titles[bi] : best.title) || ('variant ' + (bi + 1)) },
94
+ branchErrors: best.errors,
95
+ };
96
+ if (o !== null) Object.defineProperty(none, '_o', { value: o });
97
+ return none;
98
+ }
99
+
100
+ // The named-argument form the interpreter and the tests call.
101
+ function collapseBranches ({ keyword, branchResults, parentPath, parentSchemaPath, ordinal }) {
102
+ return __ataCollapse(keyword, branchResults, parentPath, parentSchemaPath, ordinal === undefined ? null : ordinal);
103
+ }
104
+
105
+ // The four declarations as source, for the generated code to carry. Derived
106
+ // from the functions above rather than written out again, so a fix to one
107
+ // cannot miss the other. `tests/test_branch_collapse.js` runs both.
108
+ function embedSource () {
109
+ return 'const __ATA_SEVERITY=' + JSON.stringify(__ATA_SEVERITY) + ';' +
110
+ 'const __ataScore=' + __ataScore.toString() + ';' +
111
+ 'const __ataMulti=' + __ataMulti.toString() + ';' +
112
+ 'const __ataCollapse=' + __ataCollapse.toString() + ';';
113
+ }
114
+ export { __ataCollapse };
@@ -0,0 +1,70 @@
1
+ // Generated by scripts/gen-kernels-custom.js from lib/interpreter-core.js. Do not edit.
2
+ const T_STRING = 1;
3
+ const T_NUMBER = 2;
4
+ const T_INTEGER = 4;
5
+ const T_BOOLEAN = 8;
6
+ const T_NULL = 16;
7
+ const T_OBJECT = 32;
8
+ const T_ARRAY = 64;
9
+ const T_ANY = 127;
10
+ // The value a context-reading keyword is given, read from the document being
11
+ // validated; the interpreter keeps that document on itself (ctxInterp).
12
+ let ctxInterp = null;
13
+ function typeBit(name) {
14
+ switch (name) {
15
+ case 'string': return T_STRING;
16
+ case 'number': return T_NUMBER;
17
+ case 'integer': return T_INTEGER;
18
+ case 'boolean': return T_BOOLEAN;
19
+ case 'null': return T_NULL;
20
+ case 'object': return T_OBJECT;
21
+ case 'array': return T_ARRAY;
22
+ default: return T_ANY; // unknown type names match everything
23
+ }
24
+ }
25
+ function dataBits(d) {
26
+ switch (typeof d) {
27
+ case 'string': return T_STRING;
28
+ case 'number':
29
+ if (!isFinite(d)) return 0;
30
+ return Number.isInteger(d) ? T_NUMBER | T_INTEGER : T_NUMBER;
31
+ case 'boolean': return T_BOOLEAN;
32
+ case 'object':
33
+ if (d === null) return T_NULL;
34
+ return Array.isArray(d) ? T_ARRAY : T_OBJECT;
35
+ default: return 0;
36
+ }
37
+ }
38
+ function orderCustom(ops) {
39
+ const out = ops.filter((op) => !op.post);
40
+ for (const op of ops.slice()) {
41
+ if (op.before === null) continue;
42
+ const at = out.indexOf(op);
43
+ const target = out.findIndex((o) => o.keyword === op.before);
44
+ if (at < 0 || target < 0 || at < target) continue;
45
+ out.splice(at, 1);
46
+ out.splice(target, 0, op);
47
+ }
48
+ for (const op of ops) if (op.post) out.push(op);
49
+ return out;
50
+ }
51
+ function dataCtx(instancePath, schemaPath, keyword) {
52
+ const root = ctxInterp !== null ? ctxInterp._ctxRoot : undefined;
53
+ if (instancePath === '') return { instancePath, parentData: undefined, parentDataProperty: undefined, rootData: root, schemaPath: schemaPath + '/' + keyword };
54
+ const cut = instancePath.lastIndexOf('/');
55
+ let parent = root;
56
+ if (cut > 0) {
57
+ const segs = instancePath.slice(1, cut).split('/');
58
+ for (let i = 0; i < segs.length && parent !== null && typeof parent === 'object'; i++) parent = parent[segs[i].replace(/~1/g, '/').replace(/~0/g, '~')];
59
+ }
60
+ let key = instancePath.slice(cut + 1).replace(/~1/g, '/').replace(/~0/g, '~');
61
+ if (Array.isArray(parent) && /^(0|[1-9][0-9]*)$/.test(key)) key = +key;
62
+ return { instancePath, parentData: parent, parentDataProperty: key, rootData: root, schemaPath: schemaPath + '/' + keyword };
63
+ }
64
+ function reread(ctx, data) {
65
+ const p = ctx.parentData;
66
+ return p !== null && typeof p === 'object' && ctx.parentDataProperty !== undefined ? p[ctx.parentDataProperty] : data;
67
+ }
68
+ const ctxRoot = () => ctxInterp;
69
+ const setCtxRoot = (holder) => { ctxInterp = holder; };
70
+ export { typeBit, dataBits, orderCustom, dataCtx, reread, ctxRoot, setCtxRoot };
@@ -0,0 +1,6 @@
1
+ // The shared default pass, for a schema whose defaults the IR does not
2
+ // specialize (a cycle, or a default behind patternProperties). A module of
3
+ // its own: it reads lib/defaults.js, and a module that imports it only from
4
+ // here leaves it out of a bundle when no default needs it.
5
+ import defaults from '../defaults.js'
6
+ export const buildDefaultsApplier = /* @__PURE__ */ (() => defaults.buildDefaultsApplier)()
@@ -0,0 +1,40 @@
1
+ // The uri, uri-reference and email formats as regular expressions, for a
2
+ // bundle where bytes count more than nanoseconds: the table backend's plans
3
+ // (lib/ir/table.mjs) name these. They accept exactly what the scanners in
4
+ // ./formats.mjs accept (_uri, _urif, generated from lib/js-compiler.js),
5
+ // RFC 3986 as the current engine reads it; tests/test_formats_small.js holds
6
+ // the two to the same answers on every string of up to five characters over
7
+ // an alphabet that covers each character class, on generated and mutated
8
+ // URIs and addresses, and on the official suite's format tests.
9
+ //
10
+ // U: unreserved and sub-delims; X: a percent-encoded octet.
11
+ const U = "A-Za-z0-9\\-._~!$&'()*+,;="
12
+ const X = '%[0-9A-Fa-f]{2}'
13
+ // An IP literal: IPv6 (the same expression as the email check's), with a zone
14
+ // (%25 and at least one character), or IPvFuture.
15
+ const IP6 = '(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|::(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?|::(?:(?:[0-9A-Fa-f]{1,4}:){0,5})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){0}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){0}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,4})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){1}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){1}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,3})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){2}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){2}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,2})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){3}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){3}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,1})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){4}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){4}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,0})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){5}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,0}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){6}[0-9A-Fa-f]{1,4}::))'
16
+ const LIT = '\\[(?:' + IP6 + '(?:%25(?:[' + U + ']|' + X + ')+)?|[vV][0-9A-Fa-f]+\\.[' + U + ':]+)\\]'
17
+ // authority: userinfo@ once, then an IP literal or a reg-name, then a port.
18
+ const AUTH = '(?:(?:[' + U + ':]|' + X + ')*@)?(?:' + LIT + '|(?:[' + U + ']|' + X + ')*)(?::[0-9]*)?'
19
+ const PATH = '(?:[' + U + ':@/]|' + X + ')*'
20
+ const TAIL = '(?:\\?(?:[' + U + ':@/?]|' + X + ')*)?(?:#(?:[' + U + ':@/?]|' + X + ')*)?$'
21
+ const SCHEME = '[A-Za-z][A-Za-z0-9+.\\-]*:'
22
+ // uri: a scheme, then an authority and a path that is empty or starts with
23
+ // "/", or a path that does not start with "//".
24
+ const URI = /* @__PURE__ */ new RegExp('^' + SCHEME + '(?://' + AUTH + '(?:/' + PATH + ')?|(?!//)' + PATH + ')' + TAIL)
25
+ // uri-reference: a uri, or a relative reference whose first segment, when the
26
+ // path does not start with "/", has no ":".
27
+ const REF = /* @__PURE__ */ new RegExp('^(?:' + SCHEME + '(?://' + AUTH + '(?:/' + PATH + ')?|(?!//)' + PATH + ')|//' + AUTH + '(?:/' + PATH + ')?|/(?!/)' + PATH + '|(?:[' + U + '@]|' + X + ')+(?:/' + PATH + ')?|)' + TAIL)
28
+ export const fmt_uri_s = (s) => URI.test(s)
29
+ export const fmt_uri_reference_s = (s) => REF.test(s)
30
+
31
+ // email: the address split at its last "@"; the local part (at most 64
32
+ // characters) a dot-atom or a quoted string, the domain (at most 253) a
33
+ // hostname of labels of 1 to 63 letters, digits and inner hyphens, or an
34
+ // IPv4 or "IPv6:" literal. The dot-atom's characters are the scanner's mask.
35
+ const A = "[!#$%&'*+\\-/0-9=?A-Z^_`a-z{|}~]"
36
+ const LOCAL = /* @__PURE__ */ new RegExp('^(?:' + A + '+(?:\\.' + A + '+)*|"(?:[ !#-\\[\\]-~]|\\\\[ -~])*")$')
37
+ const V4 = '(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)'
38
+ const LABEL = '[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?'
39
+ const DOMAIN = /* @__PURE__ */ new RegExp('^(?:\\[(?:[iI][pP][vV]6:' + IP6 + '|' + V4 + ')\\]|' + LABEL + '(?:\\.' + LABEL + ')*)$')
40
+ export const fmt_email_s = (s) => { const a = s.lastIndexOf('@'); return a > 0 && a <= 64 && s.length - a <= 254 && LOCAL.test(s.slice(0, a)) && DOMAIN.test(s.slice(a + 1)) }
@@ -0,0 +1,29 @@
1
+ // Generated by scripts/gen-kernels-formats.js from lib/js-compiler.js. Do not edit.
2
+ function _em(_s){{const _n0=_s.length;let _at=-1,_qi,_qc,_pd=46;if(_s.charCodeAt(0)===34){_at=_s.lastIndexOf('@');if(_at<2||_s.charCodeAt(_at-1)!==34)return false;for(_qi=1;_qi<_at-1;_qi++){_qc=_s.charCodeAt(_qi);if(_qc===92){_qc=_s.charCodeAt(++_qi);if(_qc<32||_qc>126||_qi>=_at-1)return false}else if(_qc<32||_qc>126||_qc===34)return false}_pd=0}else for(_qi=0;_qi<_n0;_qi++){_qc=_s.charCodeAt(_qi);if(_qc===64){_at=_qi;break}if(_qc===46?_pd===46:!((_qc<64?_qc<32?0:2751458554:_qc<96?3355443198:_qc<128?2147483647:0)>>>_qc&1))return false;_pd=_qc}if(_at<1||_at>64||_at===_n0-1||_pd===46)return false;if(_s.charCodeAt(_at+1)===91){if(_s.charCodeAt(_n0-1)!==93||_n0-_at<4)return false;const _in=_s.slice(_at+2,-1);if(/^ipv6:/i.test(_in)){const _i6=_in.slice(5);if(_i6.length>45||!/^(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|::(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?|::(?:(?:[0-9A-Fa-f]{1,4}:){0,5})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){0}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){0}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,4})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){1}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){1}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,3})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){2}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){2}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,2})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){3}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){3}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,1})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){4}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){4}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,0})?(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[0-9A-Fa-f]{1,4}:){5}[0-9A-Fa-f]{1,4}::(?:(?:[0-9A-Fa-f]{1,4}:){0,0}[0-9A-Fa-f]{1,4})?|(?:[0-9A-Fa-f]{1,4}:){6}[0-9A-Fa-f]{1,4}::)$/.test(_i6))return false}else if(_in.length>15||!/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/.test(_in))return false}else{if(_s.length-(_at+1)>253)return false;let _ll=0,_pv=46;for(let _i=_at+1;_i<_s.length;_i++){const _c=_s.charCodeAt(_i);if(_c===46){if(_ll===0||_pv===45)return false;_ll=0}else if(!((_c<64?_c<32?0:67051520:_c<96?134217726:_c<128?134217726:0)>>>_c&1)||_c===45&&_pv===46||++_ll>63)return false;_pv=_c}if(_ll===0||_pv===45)return false}}return true}
3
+ const _ip4=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/
4
+ const _ip6f=/^(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}$/
5
+ let _init_uriS
6
+ const _init_uri = () => { const _ufa=/^[A-Za-z][A-Za-z0-9+.\-]*:(?:\/\/[!$&-.0-9;=A-Z_a-z~]*(?::[0-9]*)?(?:[\/?][!$&-;=?-Z_a-z~]*)?|(?!\/\/)[!$&-;=?-Z_a-z~]*)(?:#[!$&-;=?-Z_a-z~]*)?$/;const _uriw=(function __ataUri(ip6){const C=new Uint8Array(128);for(let i=48;i<58;i++)C[i]=3;for(let i=65;i<91;i++)C[i]=3;for(let i=97;i<123;i++)C[i]=3;C[43]=3;C[45]=3;C[46]=3;C[95]=1;C[126]=1;C[33]=1;C[36]=1;C[38]=1;C[39]=1;C[40]=1;C[41]=1;C[42]=1;C[44]=1;C[59]=1;C[61]=1;const H=new Uint8Array(128);for(let i=48;i<58;i++)H[i]=1;for(let i=65;i<71;i++)H[i]=1;for(let i=97;i<103;i++)H[i]=1;function pct(s,i){const a=s.charCodeAt(i+1),b=s.charCodeAt(i+2);return a<128&&b<128&&H[a]===1&&H[b]===1;}const P=new Uint8Array(128);for(let i=0;i<128;i++)P[i]=C[i]&1;P[58]=1;P[64]=1;P[47]=1;const Q=new Uint8Array(P);Q[63]=1;const S=new Uint8Array(P);S[58]=0;function literal(s,from,to){if(from>=to)return false;const f=s.charCodeAt(from);if(f===118||f===86){let i=from+1,h=0;for(;i<to;i++){const c=s.charCodeAt(i);if(c<128&&H[c]===1)h++;else break;}if(h===0||s.charCodeAt(i)!==46||i+1>=to)return false;for(i++;i<to;i++){const c=s.charCodeAt(i);if(!(c<128&&((C[c]&1)===1||c===58)))return false;}return true;}let z=-1;for(let i=from;i<to;i++)if(s.charCodeAt(i)===37){z=i;break;}if(z===-1)return ip6(s.slice(from,to));if(s.charCodeAt(z+1)!==50||s.charCodeAt(z+2)!==53||z+3>=to)return false;for(let i=z+3;i<to;i++){const c=s.charCodeAt(i);if(c===37){if(!pct(s,i))return false;i+=2;continue;}if(!(c<128&&(C[c]&1)===1))return false;}return ip6(s.slice(from,z));}return function(s,mode){const n=s.length;const wide=(mode&2)!==0;if((mode&1)===0&&!(s.charCodeAt(0)===47&&s.charCodeAt(1)===47)){let k=0;for(;k<n;k++){const c=s.charCodeAt(k);if(c>127||S[c]===0)break;}if(k===n)return true;}let i=0,c=s.charCodeAt(0),scheme=false;if((c>=65&&c<=90)||(c>=97&&c<=122)){let j=1;while(j<n){c=s.charCodeAt(j);if(c===58||c>127||(C[c]&2)===0)break;j++;}if(j<n&&c===58){scheme=true;i=j+1;}}if(!scheme&&(mode&1)!==0)return false;let auth=false;if(s.charCodeAt(i)===47&&s.charCodeAt(i+1)===47){auth=true;const st=i+2;let end=n,at=-1,br=false,brAt=false,colon=-1;for(let k=st;k<n;k++){c=s.charCodeAt(k);if(c===47||c===63||c===35){end=k;break;}if(c<128){if((C[c]&1)===1)continue;if(c===37){if(!pct(s,k))return false;k+=2;continue;}if(c===58){if(colon===-1)colon=k;continue;}if(c===64){if(at!==-1)return false;at=k;brAt=br;colon=-1;continue;}if(c===91||c===93){br=true;continue;}return false;}if(!wide)return false;}if(brAt)return false;const hs=at===-1?st:at+1;if(s.charCodeAt(hs)===91){let close=-1;for(let k=hs+1;k<end;k++)if(s.charCodeAt(k)===93){close=k;break;}if(close===-1||!literal(s,hs+1,close))return false;if(close+1<end){if(s.charCodeAt(close+1)!==58)return false;for(let k=close+2;k<end;k++){c=s.charCodeAt(k);if(c<48||c>57)return false;}}}else{if(br)return false;if(colon!==-1)for(let k=colon+1;k<end;k++){c=s.charCodeAt(k);if(c<48||c>57)return false;}}i=end;}if(!scheme&&!auth&&s.charCodeAt(i)!==47){for(;i<n;i++){c=s.charCodeAt(i);if(c===47||c===63||c===35)break;if(c===58)return false;if(c===37){if(!pct(s,i))return false;i+=2;continue;}if(c<128?P[c]===0:!wide)return false;}}for(;i<n;i++){c=s.charCodeAt(i);if(c<128?P[c]===0:!wide){if(c===63||c===35)break;if(c===37){const a=s.charCodeAt(i+1),b=s.charCodeAt(i+2);if(!(a<128&&b<128&&H[a]===1&&H[b]===1))return false;i+=2;continue;}return false;}}if(i>=n)return true;if(c===63){for(i++;i<n;i++){c=s.charCodeAt(i);if(c<128?Q[c]===0:!wide){if(c===35)break;if(c===37){if(!pct(s,i))return false;i+=2;continue;}return false;}}if(i>=n)return true;}for(i++;i<n;i++){c=s.charCodeAt(i);if(c<128?Q[c]===0:!wide){if(c===37){if(!pct(s,i))return false;i+=2;continue;}return false;}}return true;};})(function(_s){{const _n=_s.length;if(_n<2||_n>45)return false;let _end=_n,_g=0;const _dot=_s.indexOf('.');if(_dot!==-1){const _lc=_s.lastIndexOf(':',_dot);if(_lc===-1)return false;{const _f=_lc+1,_t=_n,_ln=_t-_f;if(_ln<7||_ln>15)return false;let _o=0,_val=0,_dg=0;for(let _i=_f;_i<=_t;_i++){const _c=_i<_t?_s.charCodeAt(_i):46;if(_c===46){if(_dg===0||_val>255)return false;_o++;_val=0;_dg=0;if(_o>4)return false}else if(_c>=48&&_c<=57){if(_dg===1&&_val===0)return false;_val=_val*10+(_c-48);_dg++;if(_dg>3)return false}else return false}if(_o!==4)return false}_end=_lc+1;_g=2}let _cp=false,_dg2=0,_i2=0;if(_s.charCodeAt(0)===58&&_s.charCodeAt(1)!==58)return false;while(_i2<_end){const _c2=_s.charCodeAt(_i2);if(_c2===58){if(_dg2>0){_g++;_dg2=0}if(_i2+1<_n&&_s.charCodeAt(_i2+1)===58){if(_cp)return false;_cp=true;_i2+=2;if(_i2<_n&&_s.charCodeAt(_i2)===58)return false;continue}_i2++;if(_i2===_end&&_end===_n)return false;continue}if((_c2>=48&&_c2<=57)||(_c2>=97&&_c2<=102)||(_c2>=65&&_c2<=70)){if(++_dg2>4)return false;_i2++;continue}return false}if(_dg2>0)_g++;if(_g>8)return false;if(_cp){if(_g>=8)return false}else if(_g!==8)return false}return true});function _uri(_s){if(_ufa.test(_s))return true;return _uriw(_s,1)}function _urif(_s,_m){if((_m&1)===1&&_ufa.test(_s))return true;return _uriw(_s,_m)}; return { _uri, _urif } }
7
+ function _uri (a, b) { return (_init_uriS || (_init_uriS = _init_uri()))._uri(a, b) }
8
+ function _urif (a, b) { return (_init_uriS || (_init_uriS = _init_uri()))._urif(a, b) }
9
+ let _init_uuS
10
+ const _init_uu = () => { const _uuH=new Uint8Array(128),_uuM=new Uint8Array(36).fill(1);for(let _i=48;_i<58;_i++)_uuH[_i]=1;for(let _i=97;_i<103;_i++)_uuH[_i]=1;for(let _i=65;_i<71;_i++)_uuH[_i]=1;_uuH[45]=2;_uuM[8]=_uuM[13]=_uuM[18]=_uuM[23]=2;function _uu(_s){if(_s.length!==36)return false;let _b=0;for(let _i=0;_i<36;_i++)_b|=_uuH[_s.charCodeAt(_i)]^_uuM[_i];return _b===0}; return { _uu } }
11
+ function _uu (a, b) { return (_init_uuS || (_init_uuS = _init_uu()))._uu(a, b) }
12
+ export function fmt_date (s) { {if(s.length!==10)return false;for(let _i=0;_i<10;_i++){const _c=s.charCodeAt(_i);if(_i===4||_i===7){if(_c!==45)return false}else if(_c<48||_c>57)return false}const _m=(s.charCodeAt(5)-48)*10+(s.charCodeAt(6)-48),_d=(s.charCodeAt(8)-48)*10+(s.charCodeAt(9)-48);if(_m<1||_m>12||_d<1)return false;const _y=(s.charCodeAt(0)-48)*1000+(s.charCodeAt(1)-48)*100+(s.charCodeAt(2)-48)*10+(s.charCodeAt(3)-48);const _dim=_m===2?(((_y%4===0&&_y%100!==0)||_y%400===0)?29:28):((_m===4||_m===6||_m===9||_m===11)?30:31);if(_d>_dim)return false}; return true }
13
+ export function fmt_date_time (s) { {const _n=s.length;if(_n<20)return false;if(s.charCodeAt(4)!==45||s.charCodeAt(7)!==45)return false;const _sep=s.charCodeAt(10);if(_sep!==84&&_sep!==116)return false;if(s.charCodeAt(13)!==58||s.charCodeAt(16)!==58)return false;const _y0=s.charCodeAt(0)-48,_y1=s.charCodeAt(1)-48,_y2=s.charCodeAt(2)-48,_y3=s.charCodeAt(3)-48;if((_y0>>>0)>9||(_y1>>>0)>9||(_y2>>>0)>9||(_y3>>>0)>9)return false;const _y=_y0*1000+_y1*100+_y2*10+_y3;const _mo0=s.charCodeAt(5)-48,_mo1=s.charCodeAt(6)-48;if((_mo0>>>0)>9||(_mo1>>>0)>9)return false;const _mo=_mo0*10+_mo1;if(_mo<1||_mo>12)return false;const _dm=_mo===2?(((_y%4===0&&_y%100!==0)||_y%400===0)?29:28):(_mo===4||_mo===6||_mo===9||_mo===11?30:31);const _d0=s.charCodeAt(8)-48,_d1=s.charCodeAt(9)-48;if((_d0>>>0)>9||(_d1>>>0)>9)return false;const _d=_d0*10+_d1;if(_d<1||_d>_dm)return false;const _h0=s.charCodeAt(11)-48,_h1=s.charCodeAt(12)-48;if((_h0>>>0)>9||(_h1>>>0)>9||_h0*10+_h1>23)return false;const _mi0=s.charCodeAt(14)-48,_mi1=s.charCodeAt(15)-48;if((_mi0>>>0)>5||(_mi1>>>0)>9)return false;const _se0=s.charCodeAt(17)-48,_se1=s.charCodeAt(18)-48;if((_se0>>>0)>6||(_se1>>>0)>9||_se0*10+_se1>60)return false;let _i2=19;if(s.charCodeAt(19)===46){_i2=20;const _st=_i2;while(_i2<_n){const _c2=s.charCodeAt(_i2);if(_c2<48||_c2>57)break;_i2++}if(_i2===_st)return false}const _tz=s.charCodeAt(_i2);let _dtoff=0;if(_tz===90||_tz===122){if(_i2!==_n-1)return false}else{if(_tz!==43&&_tz!==45)return false;if(_n-_i2!==6)return false;const _oh=s.charCodeAt(_i2+1),_oh2=s.charCodeAt(_i2+2),_om=s.charCodeAt(_i2+4),_om2=s.charCodeAt(_i2+5);if(_oh<48||_oh>57||_oh2<48||_oh2>57||_om<48||_om>57||_om2<48||_om2>57)return false;if(s.charCodeAt(_i2+3)!==58)return false;const _ohv=(_oh-48)*10+(_oh2-48),_omv=(_om-48)*10+(_om2-48);if(_ohv>23||_omv>59)return false;_dtoff=(_tz===43?1:-1)*(_ohv*60+_omv)}if(_se0*10+_se1===60){const _dtu=(((_h0*10+_h1)*60+(_mi0*10+_mi1)-_dtoff)%1440+1440)%1440;if(_dtu!==1439)return false}}; return true }
14
+ export function fmt_duration (s) { if(!/^P(?:\d+W|(?:\d+Y(?:\d+M(?:\d+D)?)?|\d+M(?:\d+D)?|\d+D)(?:T(?:\d+H(?:\d+M(?:\d+S)?)?|\d+M(?:\d+S)?|\d+S))?|T(?:\d+H(?:\d+M(?:\d+S)?)?|\d+M(?:\d+S)?|\d+S))$/.test(s))return false; return true }
15
+ export function fmt_email (s) { if(!_em(s))return false; return true }
16
+ export function fmt_hostname (s) { {if(s.length-(0)>253)return false;let _ll=0,_pv=46;for(let _i=0;_i<s.length;_i++){const _c=s.charCodeAt(_i);if(_c===46){if(_ll===0||_pv===45)return false;_ll=0}else if(!((_c<64?_c<32?0:67051520:_c<96?134217726:_c<128?134217726:0)>>>_c&1)||_c===45&&_pv===46||++_ll>63)return false;_pv=_c}if(_ll===0||_pv===45)return false}; return true }
17
+ export function fmt_idn_email (s) { {const _at=s.lastIndexOf('@');if(_at<=0||_at===s.length-1)return false;const _lp=s.slice(0,_at),_dm=s.slice(_at+1);if(_lp.charCodeAt(0)===34){if(_lp.length<2||_lp.charCodeAt(_lp.length-1)!==34||_dm.length===0)return false}else{if(_lp.charCodeAt(0)===46||_lp.charCodeAt(_lp.length-1)===46)return false;if(_lp.indexOf('..')!==-1)return false;if(_dm.charCodeAt(0)===91){if(_dm.charCodeAt(_dm.length-1)!==93||_dm.length<=2)return false}else{if(_dm.charCodeAt(0)===46||_dm.charCodeAt(_dm.length-1)===46)return false;if(_dm.indexOf('..')!==-1)return false;if(_dm.charCodeAt(0)===45||_dm.charCodeAt(_dm.length-1)===45||_dm.indexOf('-.')!==-1||_dm.indexOf('.-')!==-1)return false;for(let _di=0;_di<_dm.length;_di++){const _dc=_dm.charCodeAt(_di);if(_dc<=32||_dc===127||_dc===64)return false}}}}; return true }
18
+ export function fmt_ipv4 (s) { if(!_ip4.test(s))return false; return true }
19
+ export function fmt_ipv6 (s) { _ip6:{if(s.length>=15&&_ip6f.test(s))break _ip6;const _n=s.length;if(_n<2||_n>45)return false;let _end=_n,_g=0;const _dot=s.indexOf('.');if(_dot!==-1){const _lc=s.lastIndexOf(':',_dot);if(_lc===-1)return false;{const _f=_lc+1,_t=_n,_ln=_t-_f;if(_ln<7||_ln>15)return false;let _o=0,_val=0,_dg=0;for(let _i=_f;_i<=_t;_i++){const _c=_i<_t?s.charCodeAt(_i):46;if(_c===46){if(_dg===0||_val>255)return false;_o++;_val=0;_dg=0;if(_o>4)return false}else if(_c>=48&&_c<=57){if(_dg===1&&_val===0)return false;_val=_val*10+(_c-48);_dg++;if(_dg>3)return false}else return false}if(_o!==4)return false}_end=_lc+1;_g=2}let _cp=false,_dg2=0,_i2=0;if(s.charCodeAt(0)===58&&s.charCodeAt(1)!==58)return false;while(_i2<_end){const _c2=s.charCodeAt(_i2);if(_c2===58){if(_dg2>0){_g++;_dg2=0}if(_i2+1<_n&&s.charCodeAt(_i2+1)===58){if(_cp)return false;_cp=true;_i2+=2;if(_i2<_n&&s.charCodeAt(_i2)===58)return false;continue}_i2++;if(_i2===_end&&_end===_n)return false;continue}if((_c2>=48&&_c2<=57)||(_c2>=97&&_c2<=102)||(_c2>=65&&_c2<=70)){if(++_dg2>4)return false;_i2++;continue}return false}if(_dg2>0)_g++;if(_g>8)return false;if(_cp){if(_g>=8)return false}else if(_g!==8)return false}; return true }
20
+ export function fmt_iri (s) { if(!_urif(s,3))return false; return true }
21
+ export function fmt_iri_reference (s) { if(!_urif(s,2))return false; return true }
22
+ export function fmt_json_pointer (s) { {let _ok=s==='';if(!_ok&&s.charCodeAt(0)===47){_ok=true;for(let _i=0;_i<s.length;_i++){if(s.charCodeAt(_i)!==126)continue;const _n=s.charCodeAt(_i+1);if(_n!==48&&_n!==49){_ok=false;break}}}if(!_ok)return false}; return true }
23
+ export function fmt_regex (s) { {try{new RegExp(s,'u')}catch(_er){return false}}; return true }
24
+ export function fmt_relative_json_pointer (s) { {let _i=0;while(_i<s.length){const _c=s.charCodeAt(_i);if(_c<48||_c>57)break;_i++}let _ok=_i>0&&!(_i>1&&s.charCodeAt(0)===48);if(_ok){const _r=s.slice(_i);if(_r!=='#'){_ok=_r==='';if(!_ok&&_r.charCodeAt(0)===47){_ok=true;for(let _j=0;_j<_r.length;_j++){if(_r.charCodeAt(_j)!==126)continue;const _n=_r.charCodeAt(_j+1);if(_n!==48&&_n!==49){_ok=false;break}}}}}if(!_ok)return false}; return true }
25
+ export function fmt_time (s) { {const _n=s.length;if(_n<8)return false;const _h1=s.charCodeAt(0)-48,_h2=s.charCodeAt(1)-48;if((_h1>>>0)>9||(_h2>>>0)>9||_h1*10+_h2>23)return false;if(s.charCodeAt(2)!==58||s.charCodeAt(5)!==58)return false;const _m1=s.charCodeAt(3)-48,_m2=s.charCodeAt(4)-48;if((_m1>>>0)>5||(_m2>>>0)>9)return false;const _s1=s.charCodeAt(6)-48,_s2=s.charCodeAt(7)-48;if((_s1>>>0)>6||(_s2>>>0)>9||_s1*10+_s2>60)return false;let _ti=8;if(_ti<_n&&s.charCodeAt(_ti)===46){_ti++;const _tf=_ti;while(_ti<_n){const _tc=s.charCodeAt(_ti)-48;if((_tc>>>0)>9)break;_ti++}if(_ti===_tf)return false}if(_ti===_n)return false;const _tz=s.charCodeAt(_ti);let _off=0;if(_tz===90||_tz===122){if(_ti!==_n-1)return false}else{if(_tz!==43&&_tz!==45)return false;if(_n-_ti!==6||s.charCodeAt(_ti+3)!==58)return false;if((s.charCodeAt(_ti+1)-48>>>0)>9||(s.charCodeAt(_ti+2)-48>>>0)>9||(s.charCodeAt(_ti+4)-48>>>0)>9||(s.charCodeAt(_ti+5)-48>>>0)>9)return false;const _oh=(s.charCodeAt(_ti+1)-48)*10+(s.charCodeAt(_ti+2)-48),_om=(s.charCodeAt(_ti+4)-48)*10+(s.charCodeAt(_ti+5)-48);if(_oh>23||_om>59)return false;_off=(_tz===43?1:-1)*(_oh*60+_om)}if(_s1*10+_s2===60){const _u=(((_h1*10+_h2)*60+(_m1*10+_m2)-_off)%1440+1440)%1440;if(_u!==1439)return false}}; return true }
26
+ export function fmt_uri (s) { if(!_uri(s))return false; return true }
27
+ export function fmt_uri_reference (s) { if(!_urif(s,0))return false; return true }
28
+ export function fmt_uri_template (s) { {let _i=0;while(_i<s.length){const _c=s.charCodeAt(_i);if(_c===125)return false;if(_c!==123&&(_c<=32||_c===127))return false;if(_c===37){const _h1=s.charCodeAt(_i+1),_h2=s.charCodeAt(_i+2);if(!((_h1>=48&&_h1<=57)||(_h1>=97&&_h1<=102)||(_h1>=65&&_h1<=70))||!((_h2>=48&&_h2<=57)||(_h2>=97&&_h2<=102)||(_h2>=65&&_h2<=70)))return false;_i+=3;continue}if(_c!==123){_i++;continue}const _ute=s.indexOf('}',_i+1);if(_ute===-1)return false;const _x=s.slice(_i+1,_ute);if(_x===''||_x.indexOf('{')!==-1)return false;if(!/^(?:[+#./;?&=,!@|]?)(?:[A-Za-z0-9_]|%[0-9A-Fa-f]{2})+(?:\.(?:[A-Za-z0-9_]|%[0-9A-Fa-f]{2})+)*(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[A-Za-z0-9_]|%[0-9A-Fa-f]{2})+(?:\.(?:[A-Za-z0-9_]|%[0-9A-Fa-f]{2})+)*(?::[1-9][0-9]{0,3}|\*)?)*$/.test(_x))return false;_i=_ute+1}}; return true }
29
+ export function fmt_uuid (s) { if(!_uu(s))return false; return true }
@@ -0,0 +1,11 @@
1
+ // ata-validator/kernels: what a module written by the IR backend
2
+ // (lib/ir/emit.mjs) imports. Each name is an export of its own, so a bundle
3
+ // keeps one copy of the helpers its modules use, however many modules there
4
+ // are, and none of the rest.
5
+ export * from './rt.mjs'
6
+ export * from './kernels.mjs'
7
+ export * from './formats.mjs'
8
+ export * from './fill.mjs'
9
+ export * from './table.mjs'
10
+ export * from './formats-small.mjs'
11
+ export * from './order.mjs'