(
s,
o,
{ strictArrays: i = !0, strictObjects: a = !0, realm: u = new Hp(), trace: _ = !0 } = {}
)
| 44295 | } |
| 44296 | const Kp = class JSONPointerTypeError extends Wp {} |
| 44297 | const Gp = class JSONPointerKeyError extends Wp {}, |
| 44298 | es_evaluate = ( |
| 44299 | s, |
| 44300 | o, |
| 44301 | { strictArrays: i = !0, strictObjects: a = !0, realm: u = new Hp(), trace: _ = !0 } = {} |
| 44302 | ) => { |
| 44303 | const { result: w, tree: x, trace: C } = es_parse(o, { trace: !!_ }), |
| 44304 | j = |
| 44305 | 'object' == typeof _ && null !== _ |
| 44306 | ? new Vp(_, { |
| 44307 | jsonPointer: o, |
| 44308 | referenceTokens: x, |
| 44309 | strictArrays: i, |
| 44310 | strictObjects: a, |
| 44311 | realm: u, |
| 44312 | value: s, |
| 44313 | }) |
| 44314 | : null |
| 44315 | try { |
| 44316 | let _ |
| 44317 | if (!w.success) { |
| 44318 | let i = `Invalid JSON Pointer: "${o}". Syntax error at position ${w.maxMatched}` |
| 44319 | throw ( |
| 44320 | (i += C ? `, expected ${C.inferExpectations()}` : ''), |
| 44321 | new Wp(i, { jsonPointer: o, currentValue: s, realm: u.name }) |
| 44322 | ) |
| 44323 | } |
| 44324 | return x.reduce((s, w, C) => { |
| 44325 | if (u.isArray(s)) { |
| 44326 | if (array_dash(w)) { |
| 44327 | if (i) |
| 44328 | throw new Jp( |
| 44329 | `Invalid array index "-" at position ${C} in "${o}". The "-" token always refers to a nonexistent element during evaluation`, |
| 44330 | { |
| 44331 | jsonPointer: o, |
| 44332 | referenceTokens: x, |
| 44333 | referenceToken: w, |
| 44334 | referenceTokenPosition: C, |
| 44335 | currentValue: s, |
| 44336 | realm: u.name, |
| 44337 | } |
| 44338 | ) |
| 44339 | return ( |
| 44340 | (_ = u.evaluate(s, String(u.sizeOf(s)))), |
| 44341 | null == j || j.step({ referenceToken: w, input: s, output: _ }), |
| 44342 | _ |
| 44343 | ) |
| 44344 | } |
| 44345 | if (!array_index(w)) |
| 44346 | throw new Jp( |
| 44347 | `Invalid array index "${w}" at position ${C} in "${o}": index MUST be "0", or digits without a leading "0"`, |
| 44348 | { |
| 44349 | jsonPointer: o, |
| 44350 | referenceTokens: x, |
| 44351 | referenceToken: w, |
| 44352 | referenceTokenPosition: C, |
| 44353 | currentValue: s, |
| 44354 | realm: u.name, |
no test coverage detected