scribe-widget 1.0.0 → 1.0.1

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.
@@ -668,9 +668,9 @@ function requireReact_development() {
668
668
  case REACT_LAZY_TYPE: {
669
669
  var lazyComponent = type2;
670
670
  var payload = lazyComponent._payload;
671
- var init = lazyComponent._init;
671
+ var init2 = lazyComponent._init;
672
672
  try {
673
- return getComponentNameFromType(init(payload));
673
+ return getComponentNameFromType(init2(payload));
674
674
  } catch (x) {
675
675
  return null;
676
676
  }
@@ -929,14 +929,14 @@ function requireReact_development() {
929
929
  function escapeUserProvidedKey(text) {
930
930
  return text.replace(userProvidedKeyEscapeRegex, "$&/");
931
931
  }
932
- function getElementKey(element, index2) {
932
+ function getElementKey(element, index) {
933
933
  if (typeof element === "object" && element !== null && element.key != null) {
934
934
  {
935
935
  checkKeyStringCoercion(element.key);
936
936
  }
937
937
  return escape2("" + element.key);
938
938
  }
939
- return index2.toString(36);
939
+ return index.toString(36);
940
940
  }
941
941
  function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
942
942
  var type2 = typeof children;
@@ -1370,9 +1370,9 @@ function requireReact_development() {
1370
1370
  var dispatcher = resolveDispatcher();
1371
1371
  return dispatcher.useState(initialState);
1372
1372
  }
1373
- function useReducer(reducer, initialArg, init) {
1373
+ function useReducer(reducer, initialArg, init2) {
1374
1374
  var dispatcher = resolveDispatcher();
1375
- return dispatcher.useReducer(reducer, initialArg, init);
1375
+ return dispatcher.useReducer(reducer, initialArg, init2);
1376
1376
  }
1377
1377
  function useRef(initialValue) {
1378
1378
  var dispatcher = resolveDispatcher();
@@ -1662,9 +1662,9 @@ function requireReact_development() {
1662
1662
  case REACT_LAZY_TYPE: {
1663
1663
  var lazyComponent = type2;
1664
1664
  var payload = lazyComponent._payload;
1665
- var init = lazyComponent._init;
1665
+ var init2 = lazyComponent._init;
1666
1666
  try {
1667
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1667
+ return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
1668
1668
  } catch (x) {
1669
1669
  }
1670
1670
  }
@@ -2374,9 +2374,9 @@ function requireReactJsxRuntime_development() {
2374
2374
  case REACT_LAZY_TYPE: {
2375
2375
  var lazyComponent = type2;
2376
2376
  var payload = lazyComponent._payload;
2377
- var init = lazyComponent._init;
2377
+ var init2 = lazyComponent._init;
2378
2378
  try {
2379
- return getComponentNameFromType(init(payload));
2379
+ return getComponentNameFromType(init2(payload));
2380
2380
  } catch (x) {
2381
2381
  return null;
2382
2382
  }
@@ -2624,9 +2624,9 @@ function requireReactJsxRuntime_development() {
2624
2624
  case REACT_LAZY_TYPE: {
2625
2625
  var lazyComponent = type2;
2626
2626
  var payload = lazyComponent._payload;
2627
- var init = lazyComponent._init;
2627
+ var init2 = lazyComponent._init;
2628
2628
  try {
2629
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2629
+ return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
2630
2630
  } catch (x) {
2631
2631
  }
2632
2632
  }
@@ -3383,9 +3383,9 @@ function requireScheduler_development() {
3383
3383
  var enableProfiling = false;
3384
3384
  var frameYieldMs = 5;
3385
3385
  function push(heap, node) {
3386
- var index2 = heap.length;
3386
+ var index = heap.length;
3387
3387
  heap.push(node);
3388
- siftUp(heap, node, index2);
3388
+ siftUp(heap, node, index);
3389
3389
  }
3390
3390
  function peek(heap) {
3391
3391
  return heap.length === 0 ? null : heap[0];
@@ -3403,42 +3403,42 @@ function requireScheduler_development() {
3403
3403
  return first;
3404
3404
  }
3405
3405
  function siftUp(heap, node, i3) {
3406
- var index2 = i3;
3407
- while (index2 > 0) {
3408
- var parentIndex = index2 - 1 >>> 1;
3406
+ var index = i3;
3407
+ while (index > 0) {
3408
+ var parentIndex = index - 1 >>> 1;
3409
3409
  var parent = heap[parentIndex];
3410
3410
  if (compare(parent, node) > 0) {
3411
3411
  heap[parentIndex] = node;
3412
- heap[index2] = parent;
3413
- index2 = parentIndex;
3412
+ heap[index] = parent;
3413
+ index = parentIndex;
3414
3414
  } else {
3415
3415
  return;
3416
3416
  }
3417
3417
  }
3418
3418
  }
3419
3419
  function siftDown(heap, node, i3) {
3420
- var index2 = i3;
3420
+ var index = i3;
3421
3421
  var length = heap.length;
3422
3422
  var halfLength = length >>> 1;
3423
- while (index2 < halfLength) {
3424
- var leftIndex = (index2 + 1) * 2 - 1;
3423
+ while (index < halfLength) {
3424
+ var leftIndex = (index + 1) * 2 - 1;
3425
3425
  var left = heap[leftIndex];
3426
3426
  var rightIndex = leftIndex + 1;
3427
3427
  var right = heap[rightIndex];
3428
3428
  if (compare(left, node) < 0) {
3429
3429
  if (rightIndex < length && compare(right, left) < 0) {
3430
- heap[index2] = right;
3430
+ heap[index] = right;
3431
3431
  heap[rightIndex] = node;
3432
- index2 = rightIndex;
3432
+ index = rightIndex;
3433
3433
  } else {
3434
- heap[index2] = left;
3434
+ heap[index] = left;
3435
3435
  heap[leftIndex] = node;
3436
- index2 = leftIndex;
3436
+ index = leftIndex;
3437
3437
  }
3438
3438
  } else if (rightIndex < length && compare(right, node) < 0) {
3439
- heap[index2] = right;
3439
+ heap[index] = right;
3440
3440
  heap[rightIndex] = node;
3441
- index2 = rightIndex;
3441
+ index = rightIndex;
3442
3442
  } else {
3443
3443
  return;
3444
3444
  }
@@ -11318,9 +11318,9 @@ function requireReactDom_development() {
11318
11318
  case REACT_LAZY_TYPE: {
11319
11319
  var lazyComponent = type2;
11320
11320
  var payload = lazyComponent._payload;
11321
- var init = lazyComponent._init;
11321
+ var init2 = lazyComponent._init;
11322
11322
  try {
11323
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
11323
+ return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
11324
11324
  } catch (x) {
11325
11325
  }
11326
11326
  }
@@ -11424,9 +11424,9 @@ function requireReactDom_development() {
11424
11424
  case REACT_LAZY_TYPE: {
11425
11425
  var lazyComponent = type2;
11426
11426
  var payload = lazyComponent._payload;
11427
- var init = lazyComponent._init;
11427
+ var init2 = lazyComponent._init;
11428
11428
  try {
11429
- return getComponentNameFromType(init(payload));
11429
+ return getComponentNameFromType(init2(payload));
11430
11430
  } catch (x) {
11431
11431
  return null;
11432
11432
  }
@@ -14013,7 +14013,7 @@ function requireReactDom_development() {
14013
14013
  {
14014
14014
  var map = /* @__PURE__ */ new Map();
14015
14015
  var lane = 1;
14016
- for (var index3 = 0; index3 < TotalLanes; index3++) {
14016
+ for (var index2 = 0; index2 < TotalLanes; index2++) {
14017
14017
  var label = getLabelForLane(lane);
14018
14018
  map.set(lane, label);
14019
14019
  lane *= 2;
@@ -14516,9 +14516,9 @@ function requireReactDom_development() {
14516
14516
  var entanglements = root2.entanglements;
14517
14517
  var lanes = nextLanes & entangledLanes;
14518
14518
  while (lanes > 0) {
14519
- var index3 = pickArbitraryLaneIndex(lanes);
14520
- var lane = 1 << index3;
14521
- nextLanes |= entanglements[index3];
14519
+ var index2 = pickArbitraryLaneIndex(lanes);
14520
+ var lane = 1 << index2;
14521
+ nextLanes |= entanglements[index2];
14522
14522
  lanes &= ~lane;
14523
14523
  }
14524
14524
  }
@@ -14528,9 +14528,9 @@ function requireReactDom_development() {
14528
14528
  var eventTimes = root2.eventTimes;
14529
14529
  var mostRecentEventTime = NoTimestamp;
14530
14530
  while (lanes > 0) {
14531
- var index3 = pickArbitraryLaneIndex(lanes);
14532
- var lane = 1 << index3;
14533
- var eventTime = eventTimes[index3];
14531
+ var index2 = pickArbitraryLaneIndex(lanes);
14532
+ var lane = 1 << index2;
14533
+ var eventTime = eventTimes[index2];
14534
14534
  if (eventTime > mostRecentEventTime) {
14535
14535
  mostRecentEventTime = eventTime;
14536
14536
  }
@@ -14589,12 +14589,12 @@ function requireReactDom_development() {
14589
14589
  var expirationTimes = root2.expirationTimes;
14590
14590
  var lanes = pendingLanes;
14591
14591
  while (lanes > 0) {
14592
- var index3 = pickArbitraryLaneIndex(lanes);
14593
- var lane = 1 << index3;
14594
- var expirationTime = expirationTimes[index3];
14592
+ var index2 = pickArbitraryLaneIndex(lanes);
14593
+ var lane = 1 << index2;
14594
+ var expirationTime = expirationTimes[index2];
14595
14595
  if (expirationTime === NoTimestamp) {
14596
14596
  if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) {
14597
- expirationTimes[index3] = computeExpirationTime(lane, currentTime);
14597
+ expirationTimes[index2] = computeExpirationTime(lane, currentTime);
14598
14598
  }
14599
14599
  } else if (expirationTime <= currentTime) {
14600
14600
  root2.expiredLanes |= lane;
@@ -14704,8 +14704,8 @@ function requireReactDom_development() {
14704
14704
  root2.pingedLanes = NoLanes;
14705
14705
  }
14706
14706
  var eventTimes = root2.eventTimes;
14707
- var index3 = laneToIndex(updateLane);
14708
- eventTimes[index3] = eventTime;
14707
+ var index2 = laneToIndex(updateLane);
14708
+ eventTimes[index2] = eventTime;
14709
14709
  }
14710
14710
  function markRootSuspended(root2, suspendedLanes) {
14711
14711
  root2.suspendedLanes |= suspendedLanes;
@@ -14713,9 +14713,9 @@ function requireReactDom_development() {
14713
14713
  var expirationTimes = root2.expirationTimes;
14714
14714
  var lanes = suspendedLanes;
14715
14715
  while (lanes > 0) {
14716
- var index3 = pickArbitraryLaneIndex(lanes);
14717
- var lane = 1 << index3;
14718
- expirationTimes[index3] = NoTimestamp;
14716
+ var index2 = pickArbitraryLaneIndex(lanes);
14717
+ var lane = 1 << index2;
14718
+ expirationTimes[index2] = NoTimestamp;
14719
14719
  lanes &= ~lane;
14720
14720
  }
14721
14721
  }
@@ -14735,11 +14735,11 @@ function requireReactDom_development() {
14735
14735
  var expirationTimes = root2.expirationTimes;
14736
14736
  var lanes = noLongerPendingLanes;
14737
14737
  while (lanes > 0) {
14738
- var index3 = pickArbitraryLaneIndex(lanes);
14739
- var lane = 1 << index3;
14740
- entanglements[index3] = NoLanes;
14741
- eventTimes[index3] = NoTimestamp;
14742
- expirationTimes[index3] = NoTimestamp;
14738
+ var index2 = pickArbitraryLaneIndex(lanes);
14739
+ var lane = 1 << index2;
14740
+ entanglements[index2] = NoLanes;
14741
+ eventTimes[index2] = NoTimestamp;
14742
+ expirationTimes[index2] = NoTimestamp;
14743
14743
  lanes &= ~lane;
14744
14744
  }
14745
14745
  }
@@ -14748,14 +14748,14 @@ function requireReactDom_development() {
14748
14748
  var entanglements = root2.entanglements;
14749
14749
  var lanes = rootEntangledLanes;
14750
14750
  while (lanes) {
14751
- var index3 = pickArbitraryLaneIndex(lanes);
14752
- var lane = 1 << index3;
14751
+ var index2 = pickArbitraryLaneIndex(lanes);
14752
+ var lane = 1 << index2;
14753
14753
  if (
14754
14754
  // Is this one of the newly entangled lanes?
14755
14755
  lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes?
14756
- entanglements[index3] & entangledLanes
14756
+ entanglements[index2] & entangledLanes
14757
14757
  ) {
14758
- entanglements[index3] |= entangledLanes;
14758
+ entanglements[index2] |= entangledLanes;
14759
14759
  }
14760
14760
  lanes &= ~lane;
14761
14761
  }
@@ -14811,9 +14811,9 @@ function requireReactDom_development() {
14811
14811
  }
14812
14812
  var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
14813
14813
  while (lanes > 0) {
14814
- var index3 = laneToIndex(lanes);
14815
- var lane = 1 << index3;
14816
- var updaters = pendingUpdatersLaneMap[index3];
14814
+ var index2 = laneToIndex(lanes);
14815
+ var lane = 1 << index2;
14816
+ var updaters = pendingUpdatersLaneMap[index2];
14817
14817
  updaters.add(fiber);
14818
14818
  lanes &= ~lane;
14819
14819
  }
@@ -14825,9 +14825,9 @@ function requireReactDom_development() {
14825
14825
  var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
14826
14826
  var memoizedUpdaters = root2.memoizedUpdaters;
14827
14827
  while (lanes > 0) {
14828
- var index3 = laneToIndex(lanes);
14829
- var lane = 1 << index3;
14830
- var updaters = pendingUpdatersLaneMap[index3];
14828
+ var index2 = laneToIndex(lanes);
14829
+ var lane = 1 << index2;
14830
+ var updaters = pendingUpdatersLaneMap[index2];
14831
14831
  if (updaters.size > 0) {
14832
14832
  updaters.forEach(function(fiber) {
14833
14833
  var alternate = fiber.alternate;
@@ -15435,7 +15435,7 @@ function requireReactDom_development() {
15435
15435
  startText = null;
15436
15436
  fallbackText = null;
15437
15437
  }
15438
- function getData() {
15438
+ function getData2() {
15439
15439
  if (fallbackText) {
15440
15440
  return fallbackText;
15441
15441
  }
@@ -15905,7 +15905,7 @@ function requireReactDom_development() {
15905
15905
  isComposing = initialize(nativeEventTarget);
15906
15906
  } else if (eventType === "onCompositionEnd") {
15907
15907
  if (isComposing) {
15908
- fallbackData = getData();
15908
+ fallbackData = getData2();
15909
15909
  }
15910
15910
  }
15911
15911
  }
@@ -15950,7 +15950,7 @@ function requireReactDom_development() {
15950
15950
  function getFallbackBeforeInputChars(domEventName, nativeEvent) {
15951
15951
  if (isComposing) {
15952
15952
  if (domEventName === "compositionend" || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) {
15953
- var chars = getData();
15953
+ var chars = getData2();
15954
15954
  reset();
15955
15955
  isComposing = false;
15956
15956
  return chars;
@@ -18670,36 +18670,36 @@ function requireReactDom_development() {
18670
18670
  {
18671
18671
  fiberStack = [];
18672
18672
  }
18673
- var index2 = -1;
18673
+ var index = -1;
18674
18674
  function createCursor(defaultValue) {
18675
18675
  return {
18676
18676
  current: defaultValue
18677
18677
  };
18678
18678
  }
18679
18679
  function pop(cursor, fiber) {
18680
- if (index2 < 0) {
18680
+ if (index < 0) {
18681
18681
  {
18682
18682
  error2("Unexpected pop.");
18683
18683
  }
18684
18684
  return;
18685
18685
  }
18686
18686
  {
18687
- if (fiber !== fiberStack[index2]) {
18687
+ if (fiber !== fiberStack[index]) {
18688
18688
  error2("Unexpected Fiber popped.");
18689
18689
  }
18690
18690
  }
18691
- cursor.current = valueStack[index2];
18692
- valueStack[index2] = null;
18691
+ cursor.current = valueStack[index];
18692
+ valueStack[index] = null;
18693
18693
  {
18694
- fiberStack[index2] = null;
18694
+ fiberStack[index] = null;
18695
18695
  }
18696
- index2--;
18696
+ index--;
18697
18697
  }
18698
18698
  function push(cursor, value, fiber) {
18699
- index2++;
18700
- valueStack[index2] = cursor.current;
18699
+ index++;
18700
+ valueStack[index] = cursor.current;
18701
18701
  {
18702
- fiberStack[index2] = fiber;
18702
+ fiberStack[index] = fiber;
18703
18703
  }
18704
18704
  cursor.current = value;
18705
18705
  }
@@ -18946,7 +18946,7 @@ function requireReactDom_development() {
18946
18946
  treeForkProvider = workInProgress2;
18947
18947
  treeForkCount = totalChildren;
18948
18948
  }
18949
- function pushTreeId(workInProgress2, totalChildren, index3) {
18949
+ function pushTreeId(workInProgress2, totalChildren, index2) {
18950
18950
  warnIfNotHydrating();
18951
18951
  idStack[idStackIndex++] = treeContextId;
18952
18952
  idStack[idStackIndex++] = treeContextOverflow;
@@ -18956,7 +18956,7 @@ function requireReactDom_development() {
18956
18956
  var baseOverflow = treeContextOverflow;
18957
18957
  var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
18958
18958
  var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
18959
- var slot = index3 + 1;
18959
+ var slot = index2 + 1;
18960
18960
  var length = getBitLength(totalChildren) + baseLength;
18961
18961
  if (length > 30) {
18962
18962
  var numberOfOverflowBits = baseLength - baseLength % 5;
@@ -19727,8 +19727,8 @@ function requireReactDom_development() {
19727
19727
  }
19728
19728
  function resolveLazy(lazyType) {
19729
19729
  var payload = lazyType._payload;
19730
- var init = lazyType._init;
19731
- return init(payload);
19730
+ var init2 = lazyType._init;
19731
+ return init2(payload);
19732
19732
  }
19733
19733
  function ChildReconciler(shouldTrackSideEffects) {
19734
19734
  function deleteChild(returnFiber, childToDelete) {
@@ -19880,8 +19880,8 @@ function requireReactDom_development() {
19880
19880
  }
19881
19881
  case REACT_LAZY_TYPE: {
19882
19882
  var payload = newChild._payload;
19883
- var init = newChild._init;
19884
- return createChild(returnFiber, init(payload), lanes);
19883
+ var init2 = newChild._init;
19884
+ return createChild(returnFiber, init2(payload), lanes);
19885
19885
  }
19886
19886
  }
19887
19887
  if (isArray(newChild) || getIteratorFn(newChild)) {
@@ -19924,8 +19924,8 @@ function requireReactDom_development() {
19924
19924
  }
19925
19925
  case REACT_LAZY_TYPE: {
19926
19926
  var payload = newChild._payload;
19927
- var init = newChild._init;
19928
- return updateSlot(returnFiber, oldFiber, init(payload), lanes);
19927
+ var init2 = newChild._init;
19928
+ return updateSlot(returnFiber, oldFiber, init2(payload), lanes);
19929
19929
  }
19930
19930
  }
19931
19931
  if (isArray(newChild) || getIteratorFn(newChild)) {
@@ -19960,8 +19960,8 @@ function requireReactDom_development() {
19960
19960
  }
19961
19961
  case REACT_LAZY_TYPE:
19962
19962
  var payload = newChild._payload;
19963
- var init = newChild._init;
19964
- return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes);
19963
+ var init2 = newChild._init;
19964
+ return updateFromMap(existingChildren, returnFiber, newIdx, init2(payload), lanes);
19965
19965
  }
19966
19966
  if (isArray(newChild) || getIteratorFn(newChild)) {
19967
19967
  var _matchedFiber3 = existingChildren.get(newIdx) || null;
@@ -20002,8 +20002,8 @@ function requireReactDom_development() {
20002
20002
  break;
20003
20003
  case REACT_LAZY_TYPE:
20004
20004
  var payload = child._payload;
20005
- var init = child._init;
20006
- warnOnInvalidKey(init(payload), knownKeys, returnFiber);
20005
+ var init2 = child._init;
20006
+ warnOnInvalidKey(init2(payload), knownKeys, returnFiber);
20007
20007
  break;
20008
20008
  }
20009
20009
  }
@@ -20334,8 +20334,8 @@ function requireReactDom_development() {
20334
20334
  return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes));
20335
20335
  case REACT_LAZY_TYPE:
20336
20336
  var payload = newChild._payload;
20337
- var init = newChild._init;
20338
- return reconcileChildFibers2(returnFiber, currentFirstChild, init(payload), lanes);
20337
+ var init2 = newChild._init;
20338
+ return reconcileChildFibers2(returnFiber, currentFirstChild, init2(payload), lanes);
20339
20339
  }
20340
20340
  if (isArray(newChild)) {
20341
20341
  return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes);
@@ -21484,11 +21484,11 @@ function requireReactDom_development() {
21484
21484
  function basicStateReducer(state, action) {
21485
21485
  return typeof action === "function" ? action(state) : action;
21486
21486
  }
21487
- function mountReducer(reducer, initialArg, init) {
21487
+ function mountReducer(reducer, initialArg, init2) {
21488
21488
  var hook = mountWorkInProgressHook();
21489
21489
  var initialState;
21490
- if (init !== void 0) {
21491
- initialState = init(initialArg);
21490
+ if (init2 !== void 0) {
21491
+ initialState = init2(initialArg);
21492
21492
  } else {
21493
21493
  initialState = initialArg;
21494
21494
  }
@@ -21505,7 +21505,7 @@ function requireReactDom_development() {
21505
21505
  var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
21506
21506
  return [hook.memoizedState, dispatch];
21507
21507
  }
21508
- function updateReducer(reducer, initialArg, init) {
21508
+ function updateReducer(reducer, initialArg, init2) {
21509
21509
  var hook = updateWorkInProgressHook();
21510
21510
  var queue = hook.queue;
21511
21511
  if (queue === null) {
@@ -21606,7 +21606,7 @@ function requireReactDom_development() {
21606
21606
  var dispatch = queue.dispatch;
21607
21607
  return [hook.memoizedState, dispatch];
21608
21608
  }
21609
- function rerenderReducer(reducer, initialArg, init) {
21609
+ function rerenderReducer(reducer, initialArg, init2) {
21610
21610
  var hook = updateWorkInProgressHook();
21611
21611
  var queue = hook.queue;
21612
21612
  if (queue === null) {
@@ -22302,13 +22302,13 @@ function requireReactDom_development() {
22302
22302
  ReactCurrentDispatcher$1.current = prevDispatcher;
22303
22303
  }
22304
22304
  },
22305
- useReducer: function(reducer, initialArg, init) {
22305
+ useReducer: function(reducer, initialArg, init2) {
22306
22306
  currentHookNameInDev = "useReducer";
22307
22307
  mountHookTypesDev();
22308
22308
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22309
22309
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
22310
22310
  try {
22311
- return mountReducer(reducer, initialArg, init);
22311
+ return mountReducer(reducer, initialArg, init2);
22312
22312
  } finally {
22313
22313
  ReactCurrentDispatcher$1.current = prevDispatcher;
22314
22314
  }
@@ -22406,13 +22406,13 @@ function requireReactDom_development() {
22406
22406
  ReactCurrentDispatcher$1.current = prevDispatcher;
22407
22407
  }
22408
22408
  },
22409
- useReducer: function(reducer, initialArg, init) {
22409
+ useReducer: function(reducer, initialArg, init2) {
22410
22410
  currentHookNameInDev = "useReducer";
22411
22411
  updateHookTypesDev();
22412
22412
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22413
22413
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
22414
22414
  try {
22415
- return mountReducer(reducer, initialArg, init);
22415
+ return mountReducer(reducer, initialArg, init2);
22416
22416
  } finally {
22417
22417
  ReactCurrentDispatcher$1.current = prevDispatcher;
22418
22418
  }
@@ -22510,13 +22510,13 @@ function requireReactDom_development() {
22510
22510
  ReactCurrentDispatcher$1.current = prevDispatcher;
22511
22511
  }
22512
22512
  },
22513
- useReducer: function(reducer, initialArg, init) {
22513
+ useReducer: function(reducer, initialArg, init2) {
22514
22514
  currentHookNameInDev = "useReducer";
22515
22515
  updateHookTypesDev();
22516
22516
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22517
22517
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
22518
22518
  try {
22519
- return updateReducer(reducer, initialArg, init);
22519
+ return updateReducer(reducer, initialArg, init2);
22520
22520
  } finally {
22521
22521
  ReactCurrentDispatcher$1.current = prevDispatcher;
22522
22522
  }
@@ -22614,13 +22614,13 @@ function requireReactDom_development() {
22614
22614
  ReactCurrentDispatcher$1.current = prevDispatcher;
22615
22615
  }
22616
22616
  },
22617
- useReducer: function(reducer, initialArg, init) {
22617
+ useReducer: function(reducer, initialArg, init2) {
22618
22618
  currentHookNameInDev = "useReducer";
22619
22619
  updateHookTypesDev();
22620
22620
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22621
22621
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
22622
22622
  try {
22623
- return rerenderReducer(reducer, initialArg, init);
22623
+ return rerenderReducer(reducer, initialArg, init2);
22624
22624
  } finally {
22625
22625
  ReactCurrentDispatcher$1.current = prevDispatcher;
22626
22626
  }
@@ -22726,14 +22726,14 @@ function requireReactDom_development() {
22726
22726
  ReactCurrentDispatcher$1.current = prevDispatcher;
22727
22727
  }
22728
22728
  },
22729
- useReducer: function(reducer, initialArg, init) {
22729
+ useReducer: function(reducer, initialArg, init2) {
22730
22730
  currentHookNameInDev = "useReducer";
22731
22731
  warnInvalidHookAccess();
22732
22732
  mountHookTypesDev();
22733
22733
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22734
22734
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
22735
22735
  try {
22736
- return mountReducer(reducer, initialArg, init);
22736
+ return mountReducer(reducer, initialArg, init2);
22737
22737
  } finally {
22738
22738
  ReactCurrentDispatcher$1.current = prevDispatcher;
22739
22739
  }
@@ -22847,14 +22847,14 @@ function requireReactDom_development() {
22847
22847
  ReactCurrentDispatcher$1.current = prevDispatcher;
22848
22848
  }
22849
22849
  },
22850
- useReducer: function(reducer, initialArg, init) {
22850
+ useReducer: function(reducer, initialArg, init2) {
22851
22851
  currentHookNameInDev = "useReducer";
22852
22852
  warnInvalidHookAccess();
22853
22853
  updateHookTypesDev();
22854
22854
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22855
22855
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
22856
22856
  try {
22857
- return updateReducer(reducer, initialArg, init);
22857
+ return updateReducer(reducer, initialArg, init2);
22858
22858
  } finally {
22859
22859
  ReactCurrentDispatcher$1.current = prevDispatcher;
22860
22860
  }
@@ -22968,14 +22968,14 @@ function requireReactDom_development() {
22968
22968
  ReactCurrentDispatcher$1.current = prevDispatcher;
22969
22969
  }
22970
22970
  },
22971
- useReducer: function(reducer, initialArg, init) {
22971
+ useReducer: function(reducer, initialArg, init2) {
22972
22972
  currentHookNameInDev = "useReducer";
22973
22973
  warnInvalidHookAccess();
22974
22974
  updateHookTypesDev();
22975
22975
  var prevDispatcher = ReactCurrentDispatcher$1.current;
22976
22976
  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
22977
22977
  try {
22978
- return rerenderReducer(reducer, initialArg, init);
22978
+ return rerenderReducer(reducer, initialArg, init2);
22979
22979
  } finally {
22980
22980
  ReactCurrentDispatcher$1.current = prevDispatcher;
22981
22981
  }
@@ -24207,9 +24207,9 @@ function requireReactDom_development() {
24207
24207
  if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
24208
24208
  var lazyComponent = outerMemoType;
24209
24209
  var payload = lazyComponent._payload;
24210
- var init = lazyComponent._init;
24210
+ var init2 = lazyComponent._init;
24211
24211
  try {
24212
- outerMemoType = init(payload);
24212
+ outerMemoType = init2(payload);
24213
24213
  } catch (x) {
24214
24214
  outerMemoType = null;
24215
24215
  }
@@ -24598,8 +24598,8 @@ function requireReactDom_development() {
24598
24598
  var props = workInProgress2.pendingProps;
24599
24599
  var lazyComponent = elementType;
24600
24600
  var payload = lazyComponent._payload;
24601
- var init = lazyComponent._init;
24602
- var Component = init(payload);
24601
+ var init2 = lazyComponent._init;
24602
+ var Component = init2(payload);
24603
24603
  workInProgress2.type = Component;
24604
24604
  var resolvedTag = workInProgress2.tag = resolveLazyComponentTag(Component);
24605
24605
  var resolvedProps = resolveDefaultProps(Component, props);
@@ -25245,13 +25245,13 @@ function requireReactDom_development() {
25245
25245
  }
25246
25246
  }
25247
25247
  }
25248
- function validateSuspenseListNestedChild(childSlot, index3) {
25248
+ function validateSuspenseListNestedChild(childSlot, index2) {
25249
25249
  {
25250
25250
  var isAnArray = isArray(childSlot);
25251
25251
  var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === "function";
25252
25252
  if (isAnArray || isIterable) {
25253
25253
  var type2 = isAnArray ? "array" : "iterable";
25254
- error2("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>", type2, index3, type2);
25254
+ error2("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>", type2, index2, type2);
25255
25255
  return false;
25256
25256
  }
25257
25257
  }
@@ -30651,10 +30651,10 @@ function requireReactDom_development() {
30651
30651
  var setErrorHandler = null;
30652
30652
  var setSuspenseHandler = null;
30653
30653
  {
30654
- var copyWithDeleteImpl = function(obj, path, index3) {
30655
- var key = path[index3];
30654
+ var copyWithDeleteImpl = function(obj, path, index2) {
30655
+ var key = path[index2];
30656
30656
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
30657
- if (index3 + 1 === path.length) {
30657
+ if (index2 + 1 === path.length) {
30658
30658
  if (isArray(updated)) {
30659
30659
  updated.splice(key, 1);
30660
30660
  } else {
@@ -30662,17 +30662,17 @@ function requireReactDom_development() {
30662
30662
  }
30663
30663
  return updated;
30664
30664
  }
30665
- updated[key] = copyWithDeleteImpl(obj[key], path, index3 + 1);
30665
+ updated[key] = copyWithDeleteImpl(obj[key], path, index2 + 1);
30666
30666
  return updated;
30667
30667
  };
30668
30668
  var copyWithDelete = function(obj, path) {
30669
30669
  return copyWithDeleteImpl(obj, path, 0);
30670
30670
  };
30671
- var copyWithRenameImpl = function(obj, oldPath, newPath, index3) {
30672
- var oldKey = oldPath[index3];
30671
+ var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
30672
+ var oldKey = oldPath[index2];
30673
30673
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
30674
- if (index3 + 1 === oldPath.length) {
30675
- var newKey = newPath[index3];
30674
+ if (index2 + 1 === oldPath.length) {
30675
+ var newKey = newPath[index2];
30676
30676
  updated[newKey] = updated[oldKey];
30677
30677
  if (isArray(updated)) {
30678
30678
  updated.splice(oldKey, 1);
@@ -30685,7 +30685,7 @@ function requireReactDom_development() {
30685
30685
  obj[oldKey],
30686
30686
  oldPath,
30687
30687
  newPath,
30688
- index3 + 1
30688
+ index2 + 1
30689
30689
  );
30690
30690
  }
30691
30691
  return updated;
@@ -30704,13 +30704,13 @@ function requireReactDom_development() {
30704
30704
  }
30705
30705
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
30706
30706
  };
30707
- var copyWithSetImpl = function(obj, path, index3, value) {
30708
- if (index3 >= path.length) {
30707
+ var copyWithSetImpl = function(obj, path, index2, value) {
30708
+ if (index2 >= path.length) {
30709
30709
  return value;
30710
30710
  }
30711
- var key = path[index3];
30711
+ var key = path[index2];
30712
30712
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
30713
- updated[key] = copyWithSetImpl(obj[key], path, index3 + 1, value);
30713
+ updated[key] = copyWithSetImpl(obj[key], path, index2 + 1, value);
30714
30714
  return updated;
30715
30715
  };
30716
30716
  var copyWithSet = function(obj, path, value) {
@@ -32700,8 +32700,8 @@ var scope = {};
32700
32700
  var util = {};
32701
32701
  Object.defineProperty(util, "__esModule", { value: true });
32702
32702
  util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
32703
- const codegen_1$o = codegen;
32704
- const code_1$9 = code$1;
32703
+ const codegen_1$v = codegen;
32704
+ const code_1$a = code$1;
32705
32705
  function toHash(arr) {
32706
32706
  const hash = {};
32707
32707
  for (const item of arr)
@@ -32754,9 +32754,9 @@ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword2, $data) {
32754
32754
  if (typeof schema == "number" || typeof schema == "boolean")
32755
32755
  return schema;
32756
32756
  if (typeof schema == "string")
32757
- return (0, codegen_1$o._)`${schema}`;
32757
+ return (0, codegen_1$v._)`${schema}`;
32758
32758
  }
32759
- return (0, codegen_1$o._)`${topSchemaRef}${schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}`;
32759
+ return (0, codegen_1$v._)`${topSchemaRef}${schemaPath}${(0, codegen_1$v.getProperty)(keyword2)}`;
32760
32760
  }
32761
32761
  util.schemaRefOrVal = schemaRefOrVal;
32762
32762
  function unescapeFragment(str) {
@@ -32788,20 +32788,20 @@ function eachItem(xs, f) {
32788
32788
  util.eachItem = eachItem;
32789
32789
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
32790
32790
  return (gen, from, to, toName) => {
32791
- const res = to === void 0 ? from : to instanceof codegen_1$o.Name ? (from instanceof codegen_1$o.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$o.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
32792
- return toName === codegen_1$o.Name && !(res instanceof codegen_1$o.Name) ? resultToName(gen, res) : res;
32791
+ const res = to === void 0 ? from : to instanceof codegen_1$v.Name ? (from instanceof codegen_1$v.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$v.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
32792
+ return toName === codegen_1$v.Name && !(res instanceof codegen_1$v.Name) ? resultToName(gen, res) : res;
32793
32793
  };
32794
32794
  }
32795
32795
  util.mergeEvaluated = {
32796
32796
  props: makeMergeEvaluated({
32797
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$o._)`${to} !== true && ${from} !== undefined`, () => {
32798
- gen.if((0, codegen_1$o._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$o._)`${to} || {}`).code((0, codegen_1$o._)`Object.assign(${to}, ${from})`));
32797
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true && ${from} !== undefined`, () => {
32798
+ gen.if((0, codegen_1$v._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$v._)`${to} || {}`).code((0, codegen_1$v._)`Object.assign(${to}, ${from})`));
32799
32799
  }),
32800
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$o._)`${to} !== true`, () => {
32800
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true`, () => {
32801
32801
  if (from === true) {
32802
32802
  gen.assign(to, true);
32803
32803
  } else {
32804
- gen.assign(to, (0, codegen_1$o._)`${to} || {}`);
32804
+ gen.assign(to, (0, codegen_1$v._)`${to} || {}`);
32805
32805
  setEvaluated(gen, to, from);
32806
32806
  }
32807
32807
  }),
@@ -32809,8 +32809,8 @@ util.mergeEvaluated = {
32809
32809
  resultToName: evaluatedPropsToName
32810
32810
  }),
32811
32811
  items: makeMergeEvaluated({
32812
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$o._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$o._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
32813
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$o._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$o._)`${to} > ${from} ? ${to} : ${from}`)),
32812
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$v._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
32813
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$v._)`${to} > ${from} ? ${to} : ${from}`)),
32814
32814
  mergeValues: (from, to) => from === true ? true : Math.max(from, to),
32815
32815
  resultToName: (gen, items2) => gen.var("items", items2)
32816
32816
  })
@@ -32818,21 +32818,21 @@ util.mergeEvaluated = {
32818
32818
  function evaluatedPropsToName(gen, ps) {
32819
32819
  if (ps === true)
32820
32820
  return gen.var("props", true);
32821
- const props = gen.var("props", (0, codegen_1$o._)`{}`);
32821
+ const props = gen.var("props", (0, codegen_1$v._)`{}`);
32822
32822
  if (ps !== void 0)
32823
32823
  setEvaluated(gen, props, ps);
32824
32824
  return props;
32825
32825
  }
32826
32826
  util.evaluatedPropsToName = evaluatedPropsToName;
32827
32827
  function setEvaluated(gen, props, ps) {
32828
- Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$o._)`${props}${(0, codegen_1$o.getProperty)(p)}`, true));
32828
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$v._)`${props}${(0, codegen_1$v.getProperty)(p)}`, true));
32829
32829
  }
32830
32830
  util.setEvaluated = setEvaluated;
32831
32831
  const snippets = {};
32832
32832
  function useFunc(gen, f) {
32833
32833
  return gen.scopeValue("func", {
32834
32834
  ref: f,
32835
- code: snippets[f.code] || (snippets[f.code] = new code_1$9._Code(f.code))
32835
+ code: snippets[f.code] || (snippets[f.code] = new code_1$a._Code(f.code))
32836
32836
  });
32837
32837
  }
32838
32838
  util.useFunc = useFunc;
@@ -32842,11 +32842,11 @@ var Type;
32842
32842
  Type2[Type2["Str"] = 1] = "Str";
32843
32843
  })(Type || (util.Type = Type = {}));
32844
32844
  function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
32845
- if (dataProp instanceof codegen_1$o.Name) {
32845
+ if (dataProp instanceof codegen_1$v.Name) {
32846
32846
  const isNumber = dataPropType === Type.Num;
32847
- return jsPropertySyntax ? isNumber ? (0, codegen_1$o._)`"[" + ${dataProp} + "]"` : (0, codegen_1$o._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$o._)`"/" + ${dataProp}` : (0, codegen_1$o._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
32847
+ return jsPropertySyntax ? isNumber ? (0, codegen_1$v._)`"[" + ${dataProp} + "]"` : (0, codegen_1$v._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$v._)`"/" + ${dataProp}` : (0, codegen_1$v._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
32848
32848
  }
32849
- return jsPropertySyntax ? (0, codegen_1$o.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
32849
+ return jsPropertySyntax ? (0, codegen_1$v.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
32850
32850
  }
32851
32851
  util.getErrorPath = getErrorPath;
32852
32852
  function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
@@ -32858,51 +32858,45 @@ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
32858
32858
  it.self.logger.warn(msg);
32859
32859
  }
32860
32860
  util.checkStrictMode = checkStrictMode;
32861
- var names = {};
32862
- var hasRequiredNames;
32863
- function requireNames() {
32864
- if (hasRequiredNames) return names;
32865
- hasRequiredNames = 1;
32866
- Object.defineProperty(names, "__esModule", { value: true });
32867
- const codegen_12 = codegen;
32868
- const names$1 = {
32869
- // validation function arguments
32870
- data: new codegen_12.Name("data"),
32871
- // data passed to validation function
32872
- // args passed from referencing schema
32873
- valCxt: new codegen_12.Name("valCxt"),
32874
- // validation/data context - should not be used directly, it is destructured to the names below
32875
- instancePath: new codegen_12.Name("instancePath"),
32876
- parentData: new codegen_12.Name("parentData"),
32877
- parentDataProperty: new codegen_12.Name("parentDataProperty"),
32878
- rootData: new codegen_12.Name("rootData"),
32879
- // root data - same as the data passed to the first/top validation function
32880
- dynamicAnchors: new codegen_12.Name("dynamicAnchors"),
32881
- // used to support recursiveRef and dynamicRef
32882
- // function scoped variables
32883
- vErrors: new codegen_12.Name("vErrors"),
32884
- // null or array of validation errors
32885
- errors: new codegen_12.Name("errors"),
32886
- // counter of validation errors
32887
- this: new codegen_12.Name("this"),
32888
- // "globals"
32889
- self: new codegen_12.Name("self"),
32890
- scope: new codegen_12.Name("scope"),
32891
- // JTD serialize/parse name for JSON string and position
32892
- json: new codegen_12.Name("json"),
32893
- jsonPos: new codegen_12.Name("jsonPos"),
32894
- jsonLen: new codegen_12.Name("jsonLen"),
32895
- jsonPart: new codegen_12.Name("jsonPart")
32896
- };
32897
- names.default = names$1;
32898
- return names;
32899
- }
32861
+ var names$1 = {};
32862
+ Object.defineProperty(names$1, "__esModule", { value: true });
32863
+ const codegen_1$u = codegen;
32864
+ const names = {
32865
+ // validation function arguments
32866
+ data: new codegen_1$u.Name("data"),
32867
+ // data passed to validation function
32868
+ // args passed from referencing schema
32869
+ valCxt: new codegen_1$u.Name("valCxt"),
32870
+ // validation/data context - should not be used directly, it is destructured to the names below
32871
+ instancePath: new codegen_1$u.Name("instancePath"),
32872
+ parentData: new codegen_1$u.Name("parentData"),
32873
+ parentDataProperty: new codegen_1$u.Name("parentDataProperty"),
32874
+ rootData: new codegen_1$u.Name("rootData"),
32875
+ // root data - same as the data passed to the first/top validation function
32876
+ dynamicAnchors: new codegen_1$u.Name("dynamicAnchors"),
32877
+ // used to support recursiveRef and dynamicRef
32878
+ // function scoped variables
32879
+ vErrors: new codegen_1$u.Name("vErrors"),
32880
+ // null or array of validation errors
32881
+ errors: new codegen_1$u.Name("errors"),
32882
+ // counter of validation errors
32883
+ this: new codegen_1$u.Name("this"),
32884
+ // "globals"
32885
+ self: new codegen_1$u.Name("self"),
32886
+ scope: new codegen_1$u.Name("scope"),
32887
+ // JTD serialize/parse name for JSON string and position
32888
+ json: new codegen_1$u.Name("json"),
32889
+ jsonPos: new codegen_1$u.Name("jsonPos"),
32890
+ jsonLen: new codegen_1$u.Name("jsonLen"),
32891
+ jsonPart: new codegen_1$u.Name("jsonPart")
32892
+ };
32893
+ names$1.default = names;
32900
32894
  (function(exports$12) {
32901
32895
  Object.defineProperty(exports$12, "__esModule", { value: true });
32902
32896
  exports$12.extendErrors = exports$12.resetErrorsCount = exports$12.reportExtraError = exports$12.reportError = exports$12.keyword$DataError = exports$12.keywordError = void 0;
32903
32897
  const codegen_12 = codegen;
32904
32898
  const util_12 = util;
32905
- const names_12 = requireNames();
32899
+ const names_12 = names$1;
32906
32900
  exports$12.keywordError = {
32907
32901
  message: ({ keyword: keyword2 }) => (0, codegen_12.str)`must pass "${keyword2}" keyword validation`
32908
32902
  };
@@ -33014,55 +33008,49 @@ function requireNames() {
33014
33008
  keyValues.push([E.propertyName, propertyName]);
33015
33009
  }
33016
33010
  })(errors);
33017
- var hasRequiredBoolSchema;
33018
- function requireBoolSchema() {
33019
- if (hasRequiredBoolSchema) return boolSchema;
33020
- hasRequiredBoolSchema = 1;
33021
- Object.defineProperty(boolSchema, "__esModule", { value: true });
33022
- boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
33023
- const errors_12 = errors;
33024
- const codegen_12 = codegen;
33025
- const names_12 = requireNames();
33026
- const boolError = {
33027
- message: "boolean schema is false"
33028
- };
33029
- function topBoolOrEmptySchema(it) {
33030
- const { gen, schema, validateName } = it;
33031
- if (schema === false) {
33032
- falseSchemaError(it, false);
33033
- } else if (typeof schema == "object" && schema.$async === true) {
33034
- gen.return(names_12.default.data);
33035
- } else {
33036
- gen.assign((0, codegen_12._)`${validateName}.errors`, null);
33037
- gen.return(true);
33038
- }
33011
+ Object.defineProperty(boolSchema, "__esModule", { value: true });
33012
+ boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
33013
+ const errors_1$3 = errors;
33014
+ const codegen_1$t = codegen;
33015
+ const names_1$6 = names$1;
33016
+ const boolError = {
33017
+ message: "boolean schema is false"
33018
+ };
33019
+ function topBoolOrEmptySchema(it) {
33020
+ const { gen, schema, validateName } = it;
33021
+ if (schema === false) {
33022
+ falseSchemaError(it, false);
33023
+ } else if (typeof schema == "object" && schema.$async === true) {
33024
+ gen.return(names_1$6.default.data);
33025
+ } else {
33026
+ gen.assign((0, codegen_1$t._)`${validateName}.errors`, null);
33027
+ gen.return(true);
33039
33028
  }
33040
- boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
33041
- function boolOrEmptySchema(it, valid) {
33042
- const { gen, schema } = it;
33043
- if (schema === false) {
33044
- gen.var(valid, false);
33045
- falseSchemaError(it);
33046
- } else {
33047
- gen.var(valid, true);
33048
- }
33049
- }
33050
- boolSchema.boolOrEmptySchema = boolOrEmptySchema;
33051
- function falseSchemaError(it, overrideAllErrors) {
33052
- const { gen, data } = it;
33053
- const cxt = {
33054
- gen,
33055
- keyword: "false schema",
33056
- data,
33057
- schema: false,
33058
- schemaCode: false,
33059
- schemaValue: false,
33060
- params: {},
33061
- it
33062
- };
33063
- (0, errors_12.reportError)(cxt, boolError, void 0, overrideAllErrors);
33029
+ }
33030
+ boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
33031
+ function boolOrEmptySchema(it, valid) {
33032
+ const { gen, schema } = it;
33033
+ if (schema === false) {
33034
+ gen.var(valid, false);
33035
+ falseSchemaError(it);
33036
+ } else {
33037
+ gen.var(valid, true);
33064
33038
  }
33065
- return boolSchema;
33039
+ }
33040
+ boolSchema.boolOrEmptySchema = boolOrEmptySchema;
33041
+ function falseSchemaError(it, overrideAllErrors) {
33042
+ const { gen, data } = it;
33043
+ const cxt = {
33044
+ gen,
33045
+ keyword: "false schema",
33046
+ data,
33047
+ schema: false,
33048
+ schemaCode: false,
33049
+ schemaValue: false,
33050
+ params: {},
33051
+ it
33052
+ };
33053
+ (0, errors_1$3.reportError)(cxt, boolError, void 0, overrideAllErrors);
33066
33054
  }
33067
33055
  var dataType = {};
33068
33056
  var rules = {};
@@ -33091,35 +33079,29 @@ function getRules() {
33091
33079
  }
33092
33080
  rules.getRules = getRules;
33093
33081
  var applicability = {};
33094
- var hasRequiredApplicability;
33095
- function requireApplicability() {
33096
- if (hasRequiredApplicability) return applicability;
33097
- hasRequiredApplicability = 1;
33098
- Object.defineProperty(applicability, "__esModule", { value: true });
33099
- applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
33100
- function schemaHasRulesForType({ schema, self: self2 }, type2) {
33101
- const group = self2.RULES.types[type2];
33102
- return group && group !== true && shouldUseGroup(schema, group);
33103
- }
33104
- applicability.schemaHasRulesForType = schemaHasRulesForType;
33105
- function shouldUseGroup(schema, group) {
33106
- return group.rules.some((rule) => shouldUseRule(schema, rule));
33107
- }
33108
- applicability.shouldUseGroup = shouldUseGroup;
33109
- function shouldUseRule(schema, rule) {
33110
- var _a2;
33111
- return schema[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema[kwd] !== void 0));
33112
- }
33113
- applicability.shouldUseRule = shouldUseRule;
33114
- return applicability;
33082
+ Object.defineProperty(applicability, "__esModule", { value: true });
33083
+ applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
33084
+ function schemaHasRulesForType({ schema, self: self2 }, type2) {
33085
+ const group = self2.RULES.types[type2];
33086
+ return group && group !== true && shouldUseGroup(schema, group);
33087
+ }
33088
+ applicability.schemaHasRulesForType = schemaHasRulesForType;
33089
+ function shouldUseGroup(schema, group) {
33090
+ return group.rules.some((rule) => shouldUseRule(schema, rule));
33115
33091
  }
33092
+ applicability.shouldUseGroup = shouldUseGroup;
33093
+ function shouldUseRule(schema, rule) {
33094
+ var _a2;
33095
+ return schema[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema[kwd] !== void 0));
33096
+ }
33097
+ applicability.shouldUseRule = shouldUseRule;
33116
33098
  Object.defineProperty(dataType, "__esModule", { value: true });
33117
33099
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
33118
33100
  const rules_1 = rules;
33119
- const applicability_1 = requireApplicability();
33120
- const errors_1 = errors;
33121
- const codegen_1$n = codegen;
33122
- const util_1$m = util;
33101
+ const applicability_1$1 = applicability;
33102
+ const errors_1$2 = errors;
33103
+ const codegen_1$s = codegen;
33104
+ const util_1$q = util;
33123
33105
  var DataType;
33124
33106
  (function(DataType2) {
33125
33107
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -33151,7 +33133,7 @@ dataType.getJSONTypes = getJSONTypes;
33151
33133
  function coerceAndCheckDataType(it, types2) {
33152
33134
  const { gen, data, opts } = it;
33153
33135
  const coerceTo = coerceToTypes(types2, opts.coerceTypes);
33154
- const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
33136
+ const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1$1.schemaHasRulesForType)(it, types2[0]));
33155
33137
  if (checkTypes) {
33156
33138
  const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
33157
33139
  gen.if(wrongType, () => {
@@ -33170,12 +33152,12 @@ function coerceToTypes(types2, coerceTypes) {
33170
33152
  }
33171
33153
  function coerceData(it, types2, coerceTo) {
33172
33154
  const { gen, data, opts } = it;
33173
- const dataType2 = gen.let("dataType", (0, codegen_1$n._)`typeof ${data}`);
33174
- const coerced = gen.let("coerced", (0, codegen_1$n._)`undefined`);
33155
+ const dataType2 = gen.let("dataType", (0, codegen_1$s._)`typeof ${data}`);
33156
+ const coerced = gen.let("coerced", (0, codegen_1$s._)`undefined`);
33175
33157
  if (opts.coerceTypes === "array") {
33176
- gen.if((0, codegen_1$n._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$n._)`${data}[0]`).assign(dataType2, (0, codegen_1$n._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
33158
+ gen.if((0, codegen_1$s._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$s._)`${data}[0]`).assign(dataType2, (0, codegen_1$s._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
33177
33159
  }
33178
- gen.if((0, codegen_1$n._)`${coerced} !== undefined`);
33160
+ gen.if((0, codegen_1$s._)`${coerced} !== undefined`);
33179
33161
  for (const t of coerceTo) {
33180
33162
  if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
33181
33163
  coerceSpecificType(t);
@@ -33184,63 +33166,63 @@ function coerceData(it, types2, coerceTo) {
33184
33166
  gen.else();
33185
33167
  reportTypeError(it);
33186
33168
  gen.endIf();
33187
- gen.if((0, codegen_1$n._)`${coerced} !== undefined`, () => {
33169
+ gen.if((0, codegen_1$s._)`${coerced} !== undefined`, () => {
33188
33170
  gen.assign(data, coerced);
33189
33171
  assignParentData(it, coerced);
33190
33172
  });
33191
33173
  function coerceSpecificType(t) {
33192
33174
  switch (t) {
33193
33175
  case "string":
33194
- gen.elseIf((0, codegen_1$n._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$n._)`"" + ${data}`).elseIf((0, codegen_1$n._)`${data} === null`).assign(coerced, (0, codegen_1$n._)`""`);
33176
+ gen.elseIf((0, codegen_1$s._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$s._)`"" + ${data}`).elseIf((0, codegen_1$s._)`${data} === null`).assign(coerced, (0, codegen_1$s._)`""`);
33195
33177
  return;
33196
33178
  case "number":
33197
- gen.elseIf((0, codegen_1$n._)`${dataType2} == "boolean" || ${data} === null
33198
- || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$n._)`+${data}`);
33179
+ gen.elseIf((0, codegen_1$s._)`${dataType2} == "boolean" || ${data} === null
33180
+ || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$s._)`+${data}`);
33199
33181
  return;
33200
33182
  case "integer":
33201
- gen.elseIf((0, codegen_1$n._)`${dataType2} === "boolean" || ${data} === null
33202
- || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$n._)`+${data}`);
33183
+ gen.elseIf((0, codegen_1$s._)`${dataType2} === "boolean" || ${data} === null
33184
+ || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$s._)`+${data}`);
33203
33185
  return;
33204
33186
  case "boolean":
33205
- gen.elseIf((0, codegen_1$n._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$n._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
33187
+ gen.elseIf((0, codegen_1$s._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$s._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
33206
33188
  return;
33207
33189
  case "null":
33208
- gen.elseIf((0, codegen_1$n._)`${data} === "" || ${data} === 0 || ${data} === false`);
33190
+ gen.elseIf((0, codegen_1$s._)`${data} === "" || ${data} === 0 || ${data} === false`);
33209
33191
  gen.assign(coerced, null);
33210
33192
  return;
33211
33193
  case "array":
33212
- gen.elseIf((0, codegen_1$n._)`${dataType2} === "string" || ${dataType2} === "number"
33213
- || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$n._)`[${data}]`);
33194
+ gen.elseIf((0, codegen_1$s._)`${dataType2} === "string" || ${dataType2} === "number"
33195
+ || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$s._)`[${data}]`);
33214
33196
  }
33215
33197
  }
33216
33198
  }
33217
33199
  function assignParentData({ gen, parentData, parentDataProperty }, expr) {
33218
- gen.if((0, codegen_1$n._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$n._)`${parentData}[${parentDataProperty}]`, expr));
33200
+ gen.if((0, codegen_1$s._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$s._)`${parentData}[${parentDataProperty}]`, expr));
33219
33201
  }
33220
33202
  function checkDataType(dataType2, data, strictNums, correct = DataType.Correct) {
33221
- const EQ2 = correct === DataType.Correct ? codegen_1$n.operators.EQ : codegen_1$n.operators.NEQ;
33203
+ const EQ2 = correct === DataType.Correct ? codegen_1$s.operators.EQ : codegen_1$s.operators.NEQ;
33222
33204
  let cond;
33223
33205
  switch (dataType2) {
33224
33206
  case "null":
33225
- return (0, codegen_1$n._)`${data} ${EQ2} null`;
33207
+ return (0, codegen_1$s._)`${data} ${EQ2} null`;
33226
33208
  case "array":
33227
- cond = (0, codegen_1$n._)`Array.isArray(${data})`;
33209
+ cond = (0, codegen_1$s._)`Array.isArray(${data})`;
33228
33210
  break;
33229
33211
  case "object":
33230
- cond = (0, codegen_1$n._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
33212
+ cond = (0, codegen_1$s._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
33231
33213
  break;
33232
33214
  case "integer":
33233
- cond = numCond((0, codegen_1$n._)`!(${data} % 1) && !isNaN(${data})`);
33215
+ cond = numCond((0, codegen_1$s._)`!(${data} % 1) && !isNaN(${data})`);
33234
33216
  break;
33235
33217
  case "number":
33236
33218
  cond = numCond();
33237
33219
  break;
33238
33220
  default:
33239
- return (0, codegen_1$n._)`typeof ${data} ${EQ2} ${dataType2}`;
33221
+ return (0, codegen_1$s._)`typeof ${data} ${EQ2} ${dataType2}`;
33240
33222
  }
33241
- return correct === DataType.Correct ? cond : (0, codegen_1$n.not)(cond);
33242
- function numCond(_cond = codegen_1$n.nil) {
33243
- return (0, codegen_1$n.and)((0, codegen_1$n._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$n._)`isFinite(${data})` : codegen_1$n.nil);
33223
+ return correct === DataType.Correct ? cond : (0, codegen_1$s.not)(cond);
33224
+ function numCond(_cond = codegen_1$s.nil) {
33225
+ return (0, codegen_1$s.and)((0, codegen_1$s._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$s._)`isFinite(${data})` : codegen_1$s.nil);
33244
33226
  }
33245
33227
  }
33246
33228
  dataType.checkDataType = checkDataType;
@@ -33249,35 +33231,35 @@ function checkDataTypes(dataTypes, data, strictNums, correct) {
33249
33231
  return checkDataType(dataTypes[0], data, strictNums, correct);
33250
33232
  }
33251
33233
  let cond;
33252
- const types2 = (0, util_1$m.toHash)(dataTypes);
33234
+ const types2 = (0, util_1$q.toHash)(dataTypes);
33253
33235
  if (types2.array && types2.object) {
33254
- const notObj = (0, codegen_1$n._)`typeof ${data} != "object"`;
33255
- cond = types2.null ? notObj : (0, codegen_1$n._)`!${data} || ${notObj}`;
33236
+ const notObj = (0, codegen_1$s._)`typeof ${data} != "object"`;
33237
+ cond = types2.null ? notObj : (0, codegen_1$s._)`!${data} || ${notObj}`;
33256
33238
  delete types2.null;
33257
33239
  delete types2.array;
33258
33240
  delete types2.object;
33259
33241
  } else {
33260
- cond = codegen_1$n.nil;
33242
+ cond = codegen_1$s.nil;
33261
33243
  }
33262
33244
  if (types2.number)
33263
33245
  delete types2.integer;
33264
33246
  for (const t in types2)
33265
- cond = (0, codegen_1$n.and)(cond, checkDataType(t, data, strictNums, correct));
33247
+ cond = (0, codegen_1$s.and)(cond, checkDataType(t, data, strictNums, correct));
33266
33248
  return cond;
33267
33249
  }
33268
33250
  dataType.checkDataTypes = checkDataTypes;
33269
33251
  const typeError = {
33270
33252
  message: ({ schema }) => `must be ${schema}`,
33271
- params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$n._)`{type: ${schema}}` : (0, codegen_1$n._)`{type: ${schemaValue}}`
33253
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$s._)`{type: ${schema}}` : (0, codegen_1$s._)`{type: ${schemaValue}}`
33272
33254
  };
33273
33255
  function reportTypeError(it) {
33274
33256
  const cxt = getTypeErrorContext(it);
33275
- (0, errors_1.reportError)(cxt, typeError);
33257
+ (0, errors_1$2.reportError)(cxt, typeError);
33276
33258
  }
33277
33259
  dataType.reportTypeError = reportTypeError;
33278
33260
  function getTypeErrorContext(it) {
33279
33261
  const { gen, data, schema } = it;
33280
- const schemaCode = (0, util_1$m.schemaRefOrVal)(it, schema, "type");
33262
+ const schemaCode = (0, util_1$q.schemaRefOrVal)(it, schema, "type");
33281
33263
  return {
33282
33264
  gen,
33283
33265
  keyword: "type",
@@ -33291,376 +33273,352 @@ function getTypeErrorContext(it) {
33291
33273
  };
33292
33274
  }
33293
33275
  var defaults = {};
33294
- var hasRequiredDefaults;
33295
- function requireDefaults() {
33296
- if (hasRequiredDefaults) return defaults;
33297
- hasRequiredDefaults = 1;
33298
- Object.defineProperty(defaults, "__esModule", { value: true });
33299
- defaults.assignDefaults = void 0;
33300
- const codegen_12 = codegen;
33301
- const util_12 = util;
33302
- function assignDefaults(it, ty) {
33303
- const { properties: properties2, items: items2 } = it.schema;
33304
- if (ty === "object" && properties2) {
33305
- for (const key in properties2) {
33306
- assignDefault(it, key, properties2[key].default);
33307
- }
33308
- } else if (ty === "array" && Array.isArray(items2)) {
33309
- items2.forEach((sch, i3) => assignDefault(it, i3, sch.default));
33310
- }
33276
+ Object.defineProperty(defaults, "__esModule", { value: true });
33277
+ defaults.assignDefaults = void 0;
33278
+ const codegen_1$r = codegen;
33279
+ const util_1$p = util;
33280
+ function assignDefaults(it, ty) {
33281
+ const { properties: properties2, items: items2 } = it.schema;
33282
+ if (ty === "object" && properties2) {
33283
+ for (const key in properties2) {
33284
+ assignDefault(it, key, properties2[key].default);
33285
+ }
33286
+ } else if (ty === "array" && Array.isArray(items2)) {
33287
+ items2.forEach((sch, i3) => assignDefault(it, i3, sch.default));
33311
33288
  }
33312
- defaults.assignDefaults = assignDefaults;
33313
- function assignDefault(it, prop, defaultValue) {
33314
- const { gen, compositeRule, data, opts } = it;
33315
- if (defaultValue === void 0)
33316
- return;
33317
- const childData = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(prop)}`;
33318
- if (compositeRule) {
33319
- (0, util_12.checkStrictMode)(it, `default is ignored for: ${childData}`);
33320
- return;
33321
- }
33322
- let condition = (0, codegen_12._)`${childData} === undefined`;
33323
- if (opts.useDefaults === "empty") {
33324
- condition = (0, codegen_12._)`${condition} || ${childData} === null || ${childData} === ""`;
33325
- }
33326
- gen.if(condition, (0, codegen_12._)`${childData} = ${(0, codegen_12.stringify)(defaultValue)}`);
33289
+ }
33290
+ defaults.assignDefaults = assignDefaults;
33291
+ function assignDefault(it, prop, defaultValue) {
33292
+ const { gen, compositeRule, data, opts } = it;
33293
+ if (defaultValue === void 0)
33294
+ return;
33295
+ const childData = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)(prop)}`;
33296
+ if (compositeRule) {
33297
+ (0, util_1$p.checkStrictMode)(it, `default is ignored for: ${childData}`);
33298
+ return;
33299
+ }
33300
+ let condition = (0, codegen_1$r._)`${childData} === undefined`;
33301
+ if (opts.useDefaults === "empty") {
33302
+ condition = (0, codegen_1$r._)`${condition} || ${childData} === null || ${childData} === ""`;
33327
33303
  }
33328
- return defaults;
33304
+ gen.if(condition, (0, codegen_1$r._)`${childData} = ${(0, codegen_1$r.stringify)(defaultValue)}`);
33329
33305
  }
33330
33306
  var keyword = {};
33331
33307
  var code = {};
33332
- var hasRequiredCode;
33333
- function requireCode() {
33334
- if (hasRequiredCode) return code;
33335
- hasRequiredCode = 1;
33336
- Object.defineProperty(code, "__esModule", { value: true });
33337
- code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
33338
- const codegen_12 = codegen;
33339
- const util_12 = util;
33340
- const names_12 = requireNames();
33341
- const util_22 = util;
33342
- function checkReportMissingProp(cxt, prop) {
33343
- const { gen, data, it } = cxt;
33344
- gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
33345
- cxt.setParams({ missingProperty: (0, codegen_12._)`${prop}` }, true);
33346
- cxt.error();
33347
- });
33348
- }
33349
- code.checkReportMissingProp = checkReportMissingProp;
33350
- function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
33351
- return (0, codegen_12.or)(...properties2.map((prop) => (0, codegen_12.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_12._)`${missing} = ${prop}`)));
33352
- }
33353
- code.checkMissingProp = checkMissingProp;
33354
- function reportMissingProp(cxt, missing) {
33355
- cxt.setParams({ missingProperty: missing }, true);
33308
+ Object.defineProperty(code, "__esModule", { value: true });
33309
+ code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
33310
+ const codegen_1$q = codegen;
33311
+ const util_1$o = util;
33312
+ const names_1$5 = names$1;
33313
+ const util_2$1 = util;
33314
+ function checkReportMissingProp(cxt, prop) {
33315
+ const { gen, data, it } = cxt;
33316
+ gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
33317
+ cxt.setParams({ missingProperty: (0, codegen_1$q._)`${prop}` }, true);
33356
33318
  cxt.error();
33357
- }
33358
- code.reportMissingProp = reportMissingProp;
33359
- function hasPropFunc(gen) {
33360
- return gen.scopeValue("func", {
33361
- // eslint-disable-next-line @typescript-eslint/unbound-method
33362
- ref: Object.prototype.hasOwnProperty,
33363
- code: (0, codegen_12._)`Object.prototype.hasOwnProperty`
33364
- });
33365
- }
33366
- code.hasPropFunc = hasPropFunc;
33367
- function isOwnProperty(gen, data, property) {
33368
- return (0, codegen_12._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
33369
- }
33370
- code.isOwnProperty = isOwnProperty;
33371
- function propertyInData(gen, data, property, ownProperties) {
33372
- const cond = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(property)} !== undefined`;
33373
- return ownProperties ? (0, codegen_12._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
33374
- }
33375
- code.propertyInData = propertyInData;
33376
- function noPropertyInData(gen, data, property, ownProperties) {
33377
- const cond = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(property)} === undefined`;
33378
- return ownProperties ? (0, codegen_12.or)(cond, (0, codegen_12.not)(isOwnProperty(gen, data, property))) : cond;
33379
- }
33380
- code.noPropertyInData = noPropertyInData;
33381
- function allSchemaProperties(schemaMap) {
33382
- return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
33383
- }
33384
- code.allSchemaProperties = allSchemaProperties;
33385
- function schemaProperties(it, schemaMap) {
33386
- return allSchemaProperties(schemaMap).filter((p) => !(0, util_12.alwaysValidSchema)(it, schemaMap[p]));
33387
- }
33388
- code.schemaProperties = schemaProperties;
33389
- function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
33390
- const dataAndSchema = passSchema ? (0, codegen_12._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
33391
- const valCxt = [
33392
- [names_12.default.instancePath, (0, codegen_12.strConcat)(names_12.default.instancePath, errorPath)],
33393
- [names_12.default.parentData, it.parentData],
33394
- [names_12.default.parentDataProperty, it.parentDataProperty],
33395
- [names_12.default.rootData, names_12.default.rootData]
33396
- ];
33397
- if (it.opts.dynamicRef)
33398
- valCxt.push([names_12.default.dynamicAnchors, names_12.default.dynamicAnchors]);
33399
- const args = (0, codegen_12._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
33400
- return context !== codegen_12.nil ? (0, codegen_12._)`${func}.call(${context}, ${args})` : (0, codegen_12._)`${func}(${args})`;
33401
- }
33402
- code.callValidateCode = callValidateCode;
33403
- const newRegExp = (0, codegen_12._)`new RegExp`;
33404
- function usePattern({ gen, it: { opts } }, pattern2) {
33405
- const u = opts.unicodeRegExp ? "u" : "";
33406
- const { regExp } = opts.code;
33407
- const rx = regExp(pattern2, u);
33408
- return gen.scopeValue("pattern", {
33409
- key: rx.toString(),
33410
- ref: rx,
33411
- code: (0, codegen_12._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_22.useFunc)(gen, regExp)}(${pattern2}, ${u})`
33319
+ });
33320
+ }
33321
+ code.checkReportMissingProp = checkReportMissingProp;
33322
+ function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
33323
+ return (0, codegen_1$q.or)(...properties2.map((prop) => (0, codegen_1$q.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$q._)`${missing} = ${prop}`)));
33324
+ }
33325
+ code.checkMissingProp = checkMissingProp;
33326
+ function reportMissingProp(cxt, missing) {
33327
+ cxt.setParams({ missingProperty: missing }, true);
33328
+ cxt.error();
33329
+ }
33330
+ code.reportMissingProp = reportMissingProp;
33331
+ function hasPropFunc(gen) {
33332
+ return gen.scopeValue("func", {
33333
+ // eslint-disable-next-line @typescript-eslint/unbound-method
33334
+ ref: Object.prototype.hasOwnProperty,
33335
+ code: (0, codegen_1$q._)`Object.prototype.hasOwnProperty`
33336
+ });
33337
+ }
33338
+ code.hasPropFunc = hasPropFunc;
33339
+ function isOwnProperty(gen, data, property) {
33340
+ return (0, codegen_1$q._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
33341
+ }
33342
+ code.isOwnProperty = isOwnProperty;
33343
+ function propertyInData(gen, data, property, ownProperties) {
33344
+ const cond = (0, codegen_1$q._)`${data}${(0, codegen_1$q.getProperty)(property)} !== undefined`;
33345
+ return ownProperties ? (0, codegen_1$q._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
33346
+ }
33347
+ code.propertyInData = propertyInData;
33348
+ function noPropertyInData(gen, data, property, ownProperties) {
33349
+ const cond = (0, codegen_1$q._)`${data}${(0, codegen_1$q.getProperty)(property)} === undefined`;
33350
+ return ownProperties ? (0, codegen_1$q.or)(cond, (0, codegen_1$q.not)(isOwnProperty(gen, data, property))) : cond;
33351
+ }
33352
+ code.noPropertyInData = noPropertyInData;
33353
+ function allSchemaProperties(schemaMap) {
33354
+ return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
33355
+ }
33356
+ code.allSchemaProperties = allSchemaProperties;
33357
+ function schemaProperties(it, schemaMap) {
33358
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$o.alwaysValidSchema)(it, schemaMap[p]));
33359
+ }
33360
+ code.schemaProperties = schemaProperties;
33361
+ function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
33362
+ const dataAndSchema = passSchema ? (0, codegen_1$q._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
33363
+ const valCxt = [
33364
+ [names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, errorPath)],
33365
+ [names_1$5.default.parentData, it.parentData],
33366
+ [names_1$5.default.parentDataProperty, it.parentDataProperty],
33367
+ [names_1$5.default.rootData, names_1$5.default.rootData]
33368
+ ];
33369
+ if (it.opts.dynamicRef)
33370
+ valCxt.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
33371
+ const args = (0, codegen_1$q._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
33372
+ return context !== codegen_1$q.nil ? (0, codegen_1$q._)`${func}.call(${context}, ${args})` : (0, codegen_1$q._)`${func}(${args})`;
33373
+ }
33374
+ code.callValidateCode = callValidateCode;
33375
+ const newRegExp = (0, codegen_1$q._)`new RegExp`;
33376
+ function usePattern({ gen, it: { opts } }, pattern2) {
33377
+ const u = opts.unicodeRegExp ? "u" : "";
33378
+ const { regExp } = opts.code;
33379
+ const rx = regExp(pattern2, u);
33380
+ return gen.scopeValue("pattern", {
33381
+ key: rx.toString(),
33382
+ ref: rx,
33383
+ code: (0, codegen_1$q._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
33384
+ });
33385
+ }
33386
+ code.usePattern = usePattern;
33387
+ function validateArray(cxt) {
33388
+ const { gen, data, keyword: keyword2, it } = cxt;
33389
+ const valid = gen.name("valid");
33390
+ if (it.allErrors) {
33391
+ const validArr = gen.let("valid", true);
33392
+ validateItems(() => gen.assign(validArr, false));
33393
+ return validArr;
33394
+ }
33395
+ gen.var(valid, true);
33396
+ validateItems(() => gen.break());
33397
+ return valid;
33398
+ function validateItems(notValid) {
33399
+ const len = gen.const("len", (0, codegen_1$q._)`${data}.length`);
33400
+ gen.forRange("i", 0, len, (i3) => {
33401
+ cxt.subschema({
33402
+ keyword: keyword2,
33403
+ dataProp: i3,
33404
+ dataPropType: util_1$o.Type.Num
33405
+ }, valid);
33406
+ gen.if((0, codegen_1$q.not)(valid), notValid);
33412
33407
  });
33413
33408
  }
33414
- code.usePattern = usePattern;
33415
- function validateArray(cxt) {
33416
- const { gen, data, keyword: keyword2, it } = cxt;
33417
- const valid = gen.name("valid");
33418
- if (it.allErrors) {
33419
- const validArr = gen.let("valid", true);
33420
- validateItems(() => gen.assign(validArr, false));
33421
- return validArr;
33422
- }
33423
- gen.var(valid, true);
33424
- validateItems(() => gen.break());
33425
- return valid;
33426
- function validateItems(notValid) {
33427
- const len = gen.const("len", (0, codegen_12._)`${data}.length`);
33428
- gen.forRange("i", 0, len, (i3) => {
33429
- cxt.subschema({
33430
- keyword: keyword2,
33431
- dataProp: i3,
33432
- dataPropType: util_12.Type.Num
33433
- }, valid);
33434
- gen.if((0, codegen_12.not)(valid), notValid);
33435
- });
33409
+ }
33410
+ code.validateArray = validateArray;
33411
+ function validateUnion(cxt) {
33412
+ const { gen, schema, keyword: keyword2, it } = cxt;
33413
+ if (!Array.isArray(schema))
33414
+ throw new Error("ajv implementation error");
33415
+ const alwaysValid = schema.some((sch) => (0, util_1$o.alwaysValidSchema)(it, sch));
33416
+ if (alwaysValid && !it.opts.unevaluated)
33417
+ return;
33418
+ const valid = gen.let("valid", false);
33419
+ const schValid = gen.name("_valid");
33420
+ gen.block(() => schema.forEach((_sch, i3) => {
33421
+ const schCxt = cxt.subschema({
33422
+ keyword: keyword2,
33423
+ schemaProp: i3,
33424
+ compositeRule: true
33425
+ }, schValid);
33426
+ gen.assign(valid, (0, codegen_1$q._)`${valid} || ${schValid}`);
33427
+ const merged = cxt.mergeValidEvaluated(schCxt, schValid);
33428
+ if (!merged)
33429
+ gen.if((0, codegen_1$q.not)(valid));
33430
+ }));
33431
+ cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
33432
+ }
33433
+ code.validateUnion = validateUnion;
33434
+ Object.defineProperty(keyword, "__esModule", { value: true });
33435
+ keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
33436
+ const codegen_1$p = codegen;
33437
+ const names_1$4 = names$1;
33438
+ const code_1$9 = code;
33439
+ const errors_1$1 = errors;
33440
+ function macroKeywordCode(cxt, def2) {
33441
+ const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
33442
+ const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
33443
+ const schemaRef = useKeyword(gen, keyword2, macroSchema);
33444
+ if (it.opts.validateSchema !== false)
33445
+ it.self.validateSchema(macroSchema, true);
33446
+ const valid = gen.name("valid");
33447
+ cxt.subschema({
33448
+ schema: macroSchema,
33449
+ schemaPath: codegen_1$p.nil,
33450
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
33451
+ topSchemaRef: schemaRef,
33452
+ compositeRule: true
33453
+ }, valid);
33454
+ cxt.pass(valid, () => cxt.error(true));
33455
+ }
33456
+ keyword.macroKeywordCode = macroKeywordCode;
33457
+ function funcKeywordCode(cxt, def2) {
33458
+ var _a2;
33459
+ const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
33460
+ checkAsyncKeyword(it, def2);
33461
+ const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
33462
+ const validateRef = useKeyword(gen, keyword2, validate2);
33463
+ const valid = gen.let("valid");
33464
+ cxt.block$data(valid, validateKeyword);
33465
+ cxt.ok((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid);
33466
+ function validateKeyword() {
33467
+ if (def2.errors === false) {
33468
+ assignValid();
33469
+ if (def2.modifying)
33470
+ modifyData(cxt);
33471
+ reportErrs(() => cxt.error());
33472
+ } else {
33473
+ const ruleErrs = def2.async ? validateAsync() : validateSync();
33474
+ if (def2.modifying)
33475
+ modifyData(cxt);
33476
+ reportErrs(() => addErrs(cxt, ruleErrs));
33436
33477
  }
33437
33478
  }
33438
- code.validateArray = validateArray;
33439
- function validateUnion(cxt) {
33440
- const { gen, schema, keyword: keyword2, it } = cxt;
33441
- if (!Array.isArray(schema))
33442
- throw new Error("ajv implementation error");
33443
- const alwaysValid = schema.some((sch) => (0, util_12.alwaysValidSchema)(it, sch));
33444
- if (alwaysValid && !it.opts.unevaluated)
33445
- return;
33446
- const valid = gen.let("valid", false);
33447
- const schValid = gen.name("_valid");
33448
- gen.block(() => schema.forEach((_sch, i3) => {
33449
- const schCxt = cxt.subschema({
33450
- keyword: keyword2,
33451
- schemaProp: i3,
33452
- compositeRule: true
33453
- }, schValid);
33454
- gen.assign(valid, (0, codegen_12._)`${valid} || ${schValid}`);
33455
- const merged = cxt.mergeValidEvaluated(schCxt, schValid);
33456
- if (!merged)
33457
- gen.if((0, codegen_12.not)(valid));
33458
- }));
33459
- cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
33479
+ function validateAsync() {
33480
+ const ruleErrs = gen.let("ruleErrs", null);
33481
+ gen.try(() => assignValid((0, codegen_1$p._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1$p._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1$p._)`${e}.errors`), () => gen.throw(e)));
33482
+ return ruleErrs;
33460
33483
  }
33461
- code.validateUnion = validateUnion;
33462
- return code;
33463
- }
33464
- var hasRequiredKeyword;
33465
- function requireKeyword() {
33466
- if (hasRequiredKeyword) return keyword;
33467
- hasRequiredKeyword = 1;
33468
- Object.defineProperty(keyword, "__esModule", { value: true });
33469
- keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
33470
- const codegen_12 = codegen;
33471
- const names_12 = requireNames();
33472
- const code_12 = requireCode();
33473
- const errors_12 = errors;
33474
- function macroKeywordCode(cxt, def2) {
33475
- const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
33476
- const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
33477
- const schemaRef = useKeyword(gen, keyword2, macroSchema);
33478
- if (it.opts.validateSchema !== false)
33479
- it.self.validateSchema(macroSchema, true);
33480
- const valid = gen.name("valid");
33481
- cxt.subschema({
33482
- schema: macroSchema,
33483
- schemaPath: codegen_12.nil,
33484
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
33485
- topSchemaRef: schemaRef,
33486
- compositeRule: true
33487
- }, valid);
33488
- cxt.pass(valid, () => cxt.error(true));
33484
+ function validateSync() {
33485
+ const validateErrs = (0, codegen_1$p._)`${validateRef}.errors`;
33486
+ gen.assign(validateErrs, null);
33487
+ assignValid(codegen_1$p.nil);
33488
+ return validateErrs;
33489
33489
  }
33490
- keyword.macroKeywordCode = macroKeywordCode;
33491
- function funcKeywordCode(cxt, def2) {
33492
- var _a2;
33493
- const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
33494
- checkAsyncKeyword(it, def2);
33495
- const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
33496
- const validateRef = useKeyword(gen, keyword2, validate2);
33497
- const valid = gen.let("valid");
33498
- cxt.block$data(valid, validateKeyword);
33499
- cxt.ok((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid);
33500
- function validateKeyword() {
33501
- if (def2.errors === false) {
33502
- assignValid();
33503
- if (def2.modifying)
33504
- modifyData(cxt);
33505
- reportErrs(() => cxt.error());
33506
- } else {
33507
- const ruleErrs = def2.async ? validateAsync() : validateSync();
33508
- if (def2.modifying)
33509
- modifyData(cxt);
33510
- reportErrs(() => addErrs(cxt, ruleErrs));
33511
- }
33512
- }
33513
- function validateAsync() {
33514
- const ruleErrs = gen.let("ruleErrs", null);
33515
- gen.try(() => assignValid((0, codegen_12._)`await `), (e) => gen.assign(valid, false).if((0, codegen_12._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_12._)`${e}.errors`), () => gen.throw(e)));
33516
- return ruleErrs;
33517
- }
33518
- function validateSync() {
33519
- const validateErrs = (0, codegen_12._)`${validateRef}.errors`;
33520
- gen.assign(validateErrs, null);
33521
- assignValid(codegen_12.nil);
33522
- return validateErrs;
33523
- }
33524
- function assignValid(_await = def2.async ? (0, codegen_12._)`await ` : codegen_12.nil) {
33525
- const passCxt = it.opts.passContext ? names_12.default.this : names_12.default.self;
33526
- const passSchema = !("compile" in def2 && !$data || def2.schema === false);
33527
- gen.assign(valid, (0, codegen_12._)`${_await}${(0, code_12.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
33528
- }
33529
- function reportErrs(errors2) {
33530
- var _a3;
33531
- gen.if((0, codegen_12.not)((_a3 = def2.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors2);
33532
- }
33490
+ function assignValid(_await = def2.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
33491
+ const passCxt = it.opts.passContext ? names_1$4.default.this : names_1$4.default.self;
33492
+ const passSchema = !("compile" in def2 && !$data || def2.schema === false);
33493
+ gen.assign(valid, (0, codegen_1$p._)`${_await}${(0, code_1$9.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
33533
33494
  }
33534
- keyword.funcKeywordCode = funcKeywordCode;
33535
- function modifyData(cxt) {
33536
- const { gen, data, it } = cxt;
33537
- gen.if(it.parentData, () => gen.assign(data, (0, codegen_12._)`${it.parentData}[${it.parentDataProperty}]`));
33538
- }
33539
- function addErrs(cxt, errs) {
33540
- const { gen } = cxt;
33541
- gen.if((0, codegen_12._)`Array.isArray(${errs})`, () => {
33542
- gen.assign(names_12.default.vErrors, (0, codegen_12._)`${names_12.default.vErrors} === null ? ${errs} : ${names_12.default.vErrors}.concat(${errs})`).assign(names_12.default.errors, (0, codegen_12._)`${names_12.default.vErrors}.length`);
33543
- (0, errors_12.extendErrors)(cxt);
33544
- }, () => cxt.error());
33545
- }
33546
- function checkAsyncKeyword({ schemaEnv }, def2) {
33547
- if (def2.async && !schemaEnv.$async)
33548
- throw new Error("async keyword in sync schema");
33549
- }
33550
- function useKeyword(gen, keyword2, result) {
33551
- if (result === void 0)
33552
- throw new Error(`keyword "${keyword2}" failed to compile`);
33553
- return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_12.stringify)(result) });
33554
- }
33555
- function validSchemaType(schema, schemaType, allowUndefined = false) {
33556
- return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
33557
- }
33558
- keyword.validSchemaType = validSchemaType;
33559
- function validateKeywordUsage({ schema, opts, self: self2, errSchemaPath }, def2, keyword2) {
33560
- if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
33561
- throw new Error("ajv implementation error");
33562
- }
33563
- const deps = def2.dependencies;
33564
- if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
33565
- throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
33566
- }
33567
- if (def2.validateSchema) {
33568
- const valid = def2.validateSchema(schema[keyword2]);
33569
- if (!valid) {
33570
- const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self2.errorsText(def2.validateSchema.errors);
33571
- if (opts.validateSchema === "log")
33572
- self2.logger.error(msg);
33573
- else
33574
- throw new Error(msg);
33575
- }
33495
+ function reportErrs(errors2) {
33496
+ var _a3;
33497
+ gen.if((0, codegen_1$p.not)((_a3 = def2.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors2);
33498
+ }
33499
+ }
33500
+ keyword.funcKeywordCode = funcKeywordCode;
33501
+ function modifyData(cxt) {
33502
+ const { gen, data, it } = cxt;
33503
+ gen.if(it.parentData, () => gen.assign(data, (0, codegen_1$p._)`${it.parentData}[${it.parentDataProperty}]`));
33504
+ }
33505
+ function addErrs(cxt, errs) {
33506
+ const { gen } = cxt;
33507
+ gen.if((0, codegen_1$p._)`Array.isArray(${errs})`, () => {
33508
+ gen.assign(names_1$4.default.vErrors, (0, codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${errs} : ${names_1$4.default.vErrors}.concat(${errs})`).assign(names_1$4.default.errors, (0, codegen_1$p._)`${names_1$4.default.vErrors}.length`);
33509
+ (0, errors_1$1.extendErrors)(cxt);
33510
+ }, () => cxt.error());
33511
+ }
33512
+ function checkAsyncKeyword({ schemaEnv }, def2) {
33513
+ if (def2.async && !schemaEnv.$async)
33514
+ throw new Error("async keyword in sync schema");
33515
+ }
33516
+ function useKeyword(gen, keyword2, result) {
33517
+ if (result === void 0)
33518
+ throw new Error(`keyword "${keyword2}" failed to compile`);
33519
+ return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1$p.stringify)(result) });
33520
+ }
33521
+ function validSchemaType(schema, schemaType, allowUndefined = false) {
33522
+ return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
33523
+ }
33524
+ keyword.validSchemaType = validSchemaType;
33525
+ function validateKeywordUsage({ schema, opts, self: self2, errSchemaPath }, def2, keyword2) {
33526
+ if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
33527
+ throw new Error("ajv implementation error");
33528
+ }
33529
+ const deps = def2.dependencies;
33530
+ if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
33531
+ throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
33532
+ }
33533
+ if (def2.validateSchema) {
33534
+ const valid = def2.validateSchema(schema[keyword2]);
33535
+ if (!valid) {
33536
+ const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self2.errorsText(def2.validateSchema.errors);
33537
+ if (opts.validateSchema === "log")
33538
+ self2.logger.error(msg);
33539
+ else
33540
+ throw new Error(msg);
33576
33541
  }
33577
33542
  }
33578
- keyword.validateKeywordUsage = validateKeywordUsage;
33579
- return keyword;
33580
33543
  }
33544
+ keyword.validateKeywordUsage = validateKeywordUsage;
33581
33545
  var subschema = {};
33582
- var hasRequiredSubschema;
33583
- function requireSubschema() {
33584
- if (hasRequiredSubschema) return subschema;
33585
- hasRequiredSubschema = 1;
33586
- Object.defineProperty(subschema, "__esModule", { value: true });
33587
- subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
33588
- const codegen_12 = codegen;
33589
- const util_12 = util;
33590
- function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
33591
- if (keyword2 !== void 0 && schema !== void 0) {
33592
- throw new Error('both "keyword" and "schema" passed, only one allowed');
33593
- }
33594
- if (keyword2 !== void 0) {
33595
- const sch = it.schema[keyword2];
33596
- return schemaProp === void 0 ? {
33597
- schema: sch,
33598
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}`,
33599
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`
33600
- } : {
33601
- schema: sch[schemaProp],
33602
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}${(0, codegen_12.getProperty)(schemaProp)}`,
33603
- errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_12.escapeFragment)(schemaProp)}`
33604
- };
33605
- }
33606
- if (schema !== void 0) {
33607
- if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
33608
- throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
33609
- }
33610
- return {
33611
- schema,
33612
- schemaPath,
33613
- topSchemaRef,
33614
- errSchemaPath
33615
- };
33616
- }
33617
- throw new Error('either "keyword" or "schema" must be passed');
33546
+ Object.defineProperty(subschema, "__esModule", { value: true });
33547
+ subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
33548
+ const codegen_1$o = codegen;
33549
+ const util_1$n = util;
33550
+ function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
33551
+ if (keyword2 !== void 0 && schema !== void 0) {
33552
+ throw new Error('both "keyword" and "schema" passed, only one allowed');
33553
+ }
33554
+ if (keyword2 !== void 0) {
33555
+ const sch = it.schema[keyword2];
33556
+ return schemaProp === void 0 ? {
33557
+ schema: sch,
33558
+ schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}`,
33559
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`
33560
+ } : {
33561
+ schema: sch[schemaProp],
33562
+ schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}${(0, codegen_1$o.getProperty)(schemaProp)}`,
33563
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_1$n.escapeFragment)(schemaProp)}`
33564
+ };
33618
33565
  }
33619
- subschema.getSubschema = getSubschema;
33620
- function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
33621
- if (data !== void 0 && dataProp !== void 0) {
33622
- throw new Error('both "data" and "dataProp" passed, only one allowed');
33566
+ if (schema !== void 0) {
33567
+ if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
33568
+ throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
33623
33569
  }
33624
- const { gen } = it;
33625
- if (dataProp !== void 0) {
33626
- const { errorPath, dataPathArr, opts } = it;
33627
- const nextData = gen.let("data", (0, codegen_12._)`${it.data}${(0, codegen_12.getProperty)(dataProp)}`, true);
33628
- dataContextProps(nextData);
33629
- subschema2.errorPath = (0, codegen_12.str)`${errorPath}${(0, util_12.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
33630
- subschema2.parentDataProperty = (0, codegen_12._)`${dataProp}`;
33631
- subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
33632
- }
33633
- if (data !== void 0) {
33634
- const nextData = data instanceof codegen_12.Name ? data : gen.let("data", data, true);
33635
- dataContextProps(nextData);
33636
- if (propertyName !== void 0)
33637
- subschema2.propertyName = propertyName;
33638
- }
33639
- if (dataTypes)
33640
- subschema2.dataTypes = dataTypes;
33641
- function dataContextProps(_nextData) {
33642
- subschema2.data = _nextData;
33643
- subschema2.dataLevel = it.dataLevel + 1;
33644
- subschema2.dataTypes = [];
33645
- it.definedProperties = /* @__PURE__ */ new Set();
33646
- subschema2.parentData = it.data;
33647
- subschema2.dataNames = [...it.dataNames, _nextData];
33648
- }
33649
- }
33650
- subschema.extendSubschemaData = extendSubschemaData;
33651
- function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
33652
- if (compositeRule !== void 0)
33653
- subschema2.compositeRule = compositeRule;
33654
- if (createErrors !== void 0)
33655
- subschema2.createErrors = createErrors;
33656
- if (allErrors !== void 0)
33657
- subschema2.allErrors = allErrors;
33658
- subschema2.jtdDiscriminator = jtdDiscriminator;
33659
- subschema2.jtdMetadata = jtdMetadata;
33660
- }
33661
- subschema.extendSubschemaMode = extendSubschemaMode;
33662
- return subschema;
33570
+ return {
33571
+ schema,
33572
+ schemaPath,
33573
+ topSchemaRef,
33574
+ errSchemaPath
33575
+ };
33576
+ }
33577
+ throw new Error('either "keyword" or "schema" must be passed');
33663
33578
  }
33579
+ subschema.getSubschema = getSubschema;
33580
+ function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
33581
+ if (data !== void 0 && dataProp !== void 0) {
33582
+ throw new Error('both "data" and "dataProp" passed, only one allowed');
33583
+ }
33584
+ const { gen } = it;
33585
+ if (dataProp !== void 0) {
33586
+ const { errorPath, dataPathArr, opts } = it;
33587
+ const nextData = gen.let("data", (0, codegen_1$o._)`${it.data}${(0, codegen_1$o.getProperty)(dataProp)}`, true);
33588
+ dataContextProps(nextData);
33589
+ subschema2.errorPath = (0, codegen_1$o.str)`${errorPath}${(0, util_1$n.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
33590
+ subschema2.parentDataProperty = (0, codegen_1$o._)`${dataProp}`;
33591
+ subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
33592
+ }
33593
+ if (data !== void 0) {
33594
+ const nextData = data instanceof codegen_1$o.Name ? data : gen.let("data", data, true);
33595
+ dataContextProps(nextData);
33596
+ if (propertyName !== void 0)
33597
+ subschema2.propertyName = propertyName;
33598
+ }
33599
+ if (dataTypes)
33600
+ subschema2.dataTypes = dataTypes;
33601
+ function dataContextProps(_nextData) {
33602
+ subschema2.data = _nextData;
33603
+ subschema2.dataLevel = it.dataLevel + 1;
33604
+ subschema2.dataTypes = [];
33605
+ it.definedProperties = /* @__PURE__ */ new Set();
33606
+ subschema2.parentData = it.data;
33607
+ subschema2.dataNames = [...it.dataNames, _nextData];
33608
+ }
33609
+ }
33610
+ subschema.extendSubschemaData = extendSubschemaData;
33611
+ function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
33612
+ if (compositeRule !== void 0)
33613
+ subschema2.compositeRule = compositeRule;
33614
+ if (createErrors !== void 0)
33615
+ subschema2.createErrors = createErrors;
33616
+ if (allErrors !== void 0)
33617
+ subschema2.allErrors = allErrors;
33618
+ subschema2.jtdDiscriminator = jtdDiscriminator;
33619
+ subschema2.jtdMetadata = jtdMetadata;
33620
+ }
33621
+ subschema.extendSubschemaMode = extendSubschemaMode;
33664
33622
  var resolve$2 = {};
33665
33623
  var fastDeepEqual = function equal2(a, b) {
33666
33624
  if (a === b) return true;
@@ -33775,7 +33733,7 @@ function escapeJsonPtr(str) {
33775
33733
  var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
33776
33734
  Object.defineProperty(resolve$2, "__esModule", { value: true });
33777
33735
  resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
33778
- const util_1$l = util;
33736
+ const util_1$m = util;
33779
33737
  const equal$3 = fastDeepEqual;
33780
33738
  const traverse = jsonSchemaTraverseExports;
33781
33739
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -33834,7 +33792,7 @@ function countKeys(schema) {
33834
33792
  if (SIMPLE_INLINED.has(key))
33835
33793
  continue;
33836
33794
  if (typeof schema[key] == "object") {
33837
- (0, util_1$l.eachItem)(schema[key], (sch) => count += countKeys(sch));
33795
+ (0, util_1$m.eachItem)(schema[key], (sch) => count += countKeys(sch));
33838
33796
  }
33839
33797
  if (count === Infinity)
33840
33798
  return Infinity;
@@ -33922,512 +33880,506 @@ function getSchemaRefs(schema, baseId) {
33922
33880
  }
33923
33881
  }
33924
33882
  resolve$2.getSchemaRefs = getSchemaRefs;
33925
- var hasRequiredValidate;
33926
- function requireValidate() {
33927
- if (hasRequiredValidate) return validate;
33928
- hasRequiredValidate = 1;
33929
- Object.defineProperty(validate, "__esModule", { value: true });
33930
- validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
33931
- const boolSchema_1 = requireBoolSchema();
33932
- const dataType_12 = dataType;
33933
- const applicability_12 = requireApplicability();
33934
- const dataType_2 = dataType;
33935
- const defaults_1 = requireDefaults();
33936
- const keyword_1 = requireKeyword();
33937
- const subschema_1 = requireSubschema();
33938
- const codegen_12 = codegen;
33939
- const names_12 = requireNames();
33940
- const resolve_12 = resolve$2;
33941
- const util_12 = util;
33942
- const errors_12 = errors;
33943
- function validateFunctionCode(it) {
33944
- if (isSchemaObj(it)) {
33945
- checkKeywords(it);
33946
- if (schemaCxtHasRules(it)) {
33947
- topSchemaObjCode(it);
33948
- return;
33949
- }
33883
+ Object.defineProperty(validate, "__esModule", { value: true });
33884
+ validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
33885
+ const boolSchema_1 = boolSchema;
33886
+ const dataType_1$1 = dataType;
33887
+ const applicability_1 = applicability;
33888
+ const dataType_2 = dataType;
33889
+ const defaults_1 = defaults;
33890
+ const keyword_1 = keyword;
33891
+ const subschema_1 = subschema;
33892
+ const codegen_1$n = codegen;
33893
+ const names_1$3 = names$1;
33894
+ const resolve_1$2 = resolve$2;
33895
+ const util_1$l = util;
33896
+ const errors_1 = errors;
33897
+ function validateFunctionCode(it) {
33898
+ if (isSchemaObj(it)) {
33899
+ checkKeywords(it);
33900
+ if (schemaCxtHasRules(it)) {
33901
+ topSchemaObjCode(it);
33902
+ return;
33950
33903
  }
33951
- validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
33952
33904
  }
33953
- validate.validateFunctionCode = validateFunctionCode;
33954
- function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
33955
- if (opts.code.es5) {
33956
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${names_12.default.valCxt}`, schemaEnv.$async, () => {
33957
- gen.code((0, codegen_12._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
33958
- destructureValCxtES5(gen, opts);
33959
- gen.code(body);
33960
- });
33961
- } else {
33962
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
33963
- }
33964
- }
33965
- function destructureValCxt(opts) {
33966
- return (0, codegen_12._)`{${names_12.default.instancePath}="", ${names_12.default.parentData}, ${names_12.default.parentDataProperty}, ${names_12.default.rootData}=${names_12.default.data}${opts.dynamicRef ? (0, codegen_12._)`, ${names_12.default.dynamicAnchors}={}` : codegen_12.nil}}={}`;
33967
- }
33968
- function destructureValCxtES5(gen, opts) {
33969
- gen.if(names_12.default.valCxt, () => {
33970
- gen.var(names_12.default.instancePath, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.instancePath}`);
33971
- gen.var(names_12.default.parentData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentData}`);
33972
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentDataProperty}`);
33973
- gen.var(names_12.default.rootData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.rootData}`);
33974
- if (opts.dynamicRef)
33975
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.dynamicAnchors}`);
33976
- }, () => {
33977
- gen.var(names_12.default.instancePath, (0, codegen_12._)`""`);
33978
- gen.var(names_12.default.parentData, (0, codegen_12._)`undefined`);
33979
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`undefined`);
33980
- gen.var(names_12.default.rootData, names_12.default.data);
33981
- if (opts.dynamicRef)
33982
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`{}`);
33983
- });
33984
- }
33985
- function topSchemaObjCode(it) {
33986
- const { schema, opts, gen } = it;
33987
- validateFunction(it, () => {
33988
- if (opts.$comment && schema.$comment)
33989
- commentKeyword(it);
33990
- checkNoDefault(it);
33991
- gen.let(names_12.default.vErrors, null);
33992
- gen.let(names_12.default.errors, 0);
33993
- if (opts.unevaluated)
33994
- resetEvaluated(it);
33995
- typeAndKeywords(it);
33996
- returnResults(it);
33905
+ validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
33906
+ }
33907
+ validate.validateFunctionCode = validateFunctionCode;
33908
+ function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
33909
+ if (opts.code.es5) {
33910
+ gen.func(validateName, (0, codegen_1$n._)`${names_1$3.default.data}, ${names_1$3.default.valCxt}`, schemaEnv.$async, () => {
33911
+ gen.code((0, codegen_1$n._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
33912
+ destructureValCxtES5(gen, opts);
33913
+ gen.code(body);
33997
33914
  });
33998
- return;
33999
- }
34000
- function resetEvaluated(it) {
34001
- const { gen, validateName } = it;
34002
- it.evaluated = gen.const("evaluated", (0, codegen_12._)`${validateName}.evaluated`);
34003
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_12._)`${it.evaluated}.props`, (0, codegen_12._)`undefined`));
34004
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_12._)`${it.evaluated}.items`, (0, codegen_12._)`undefined`));
34005
- }
34006
- function funcSourceUrl(schema, opts) {
34007
- const schId = typeof schema == "object" && schema[opts.schemaId];
34008
- return schId && (opts.code.source || opts.code.process) ? (0, codegen_12._)`/*# sourceURL=${schId} */` : codegen_12.nil;
34009
- }
34010
- function subschemaCode(it, valid) {
34011
- if (isSchemaObj(it)) {
34012
- checkKeywords(it);
34013
- if (schemaCxtHasRules(it)) {
34014
- subSchemaObjCode(it, valid);
34015
- return;
34016
- }
34017
- }
34018
- (0, boolSchema_1.boolOrEmptySchema)(it, valid);
34019
- }
34020
- function schemaCxtHasRules({ schema, self: self2 }) {
34021
- if (typeof schema == "boolean")
34022
- return !schema;
34023
- for (const key in schema)
34024
- if (self2.RULES.all[key])
34025
- return true;
34026
- return false;
34027
- }
34028
- function isSchemaObj(it) {
34029
- return typeof it.schema != "boolean";
33915
+ } else {
33916
+ gen.func(validateName, (0, codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
34030
33917
  }
34031
- function subSchemaObjCode(it, valid) {
34032
- const { schema, gen, opts } = it;
33918
+ }
33919
+ function destructureValCxt(opts) {
33920
+ return (0, codegen_1$n._)`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${opts.dynamicRef ? (0, codegen_1$n._)`, ${names_1$3.default.dynamicAnchors}={}` : codegen_1$n.nil}}={}`;
33921
+ }
33922
+ function destructureValCxtES5(gen, opts) {
33923
+ gen.if(names_1$3.default.valCxt, () => {
33924
+ gen.var(names_1$3.default.instancePath, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`);
33925
+ gen.var(names_1$3.default.parentData, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`);
33926
+ gen.var(names_1$3.default.parentDataProperty, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`);
33927
+ gen.var(names_1$3.default.rootData, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`);
33928
+ if (opts.dynamicRef)
33929
+ gen.var(names_1$3.default.dynamicAnchors, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`);
33930
+ }, () => {
33931
+ gen.var(names_1$3.default.instancePath, (0, codegen_1$n._)`""`);
33932
+ gen.var(names_1$3.default.parentData, (0, codegen_1$n._)`undefined`);
33933
+ gen.var(names_1$3.default.parentDataProperty, (0, codegen_1$n._)`undefined`);
33934
+ gen.var(names_1$3.default.rootData, names_1$3.default.data);
33935
+ if (opts.dynamicRef)
33936
+ gen.var(names_1$3.default.dynamicAnchors, (0, codegen_1$n._)`{}`);
33937
+ });
33938
+ }
33939
+ function topSchemaObjCode(it) {
33940
+ const { schema, opts, gen } = it;
33941
+ validateFunction(it, () => {
34033
33942
  if (opts.$comment && schema.$comment)
34034
33943
  commentKeyword(it);
34035
- updateContext(it);
34036
- checkAsyncSchema(it);
34037
- const errsCount = gen.const("_errs", names_12.default.errors);
34038
- typeAndKeywords(it, errsCount);
34039
- gen.var(valid, (0, codegen_12._)`${errsCount} === ${names_12.default.errors}`);
34040
- }
34041
- function checkKeywords(it) {
34042
- (0, util_12.checkUnknownRules)(it);
34043
- checkRefsAndKeywords(it);
34044
- }
34045
- function typeAndKeywords(it, errsCount) {
34046
- if (it.opts.jtd)
34047
- return schemaKeywords(it, [], false, errsCount);
34048
- const types2 = (0, dataType_12.getSchemaTypes)(it.schema);
34049
- const checkedTypes = (0, dataType_12.coerceAndCheckDataType)(it, types2);
34050
- schemaKeywords(it, types2, !checkedTypes, errsCount);
34051
- }
34052
- function checkRefsAndKeywords(it) {
34053
- const { schema, errSchemaPath, opts, self: self2 } = it;
34054
- if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_12.schemaHasRulesButRef)(schema, self2.RULES)) {
34055
- self2.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
33944
+ checkNoDefault(it);
33945
+ gen.let(names_1$3.default.vErrors, null);
33946
+ gen.let(names_1$3.default.errors, 0);
33947
+ if (opts.unevaluated)
33948
+ resetEvaluated(it);
33949
+ typeAndKeywords(it);
33950
+ returnResults(it);
33951
+ });
33952
+ return;
33953
+ }
33954
+ function resetEvaluated(it) {
33955
+ const { gen, validateName } = it;
33956
+ it.evaluated = gen.const("evaluated", (0, codegen_1$n._)`${validateName}.evaluated`);
33957
+ gen.if((0, codegen_1$n._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1$n._)`${it.evaluated}.props`, (0, codegen_1$n._)`undefined`));
33958
+ gen.if((0, codegen_1$n._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1$n._)`${it.evaluated}.items`, (0, codegen_1$n._)`undefined`));
33959
+ }
33960
+ function funcSourceUrl(schema, opts) {
33961
+ const schId = typeof schema == "object" && schema[opts.schemaId];
33962
+ return schId && (opts.code.source || opts.code.process) ? (0, codegen_1$n._)`/*# sourceURL=${schId} */` : codegen_1$n.nil;
33963
+ }
33964
+ function subschemaCode(it, valid) {
33965
+ if (isSchemaObj(it)) {
33966
+ checkKeywords(it);
33967
+ if (schemaCxtHasRules(it)) {
33968
+ subSchemaObjCode(it, valid);
33969
+ return;
34056
33970
  }
34057
33971
  }
34058
- function checkNoDefault(it) {
34059
- const { schema, opts } = it;
34060
- if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
34061
- (0, util_12.checkStrictMode)(it, "default is ignored in the schema root");
34062
- }
33972
+ (0, boolSchema_1.boolOrEmptySchema)(it, valid);
33973
+ }
33974
+ function schemaCxtHasRules({ schema, self: self2 }) {
33975
+ if (typeof schema == "boolean")
33976
+ return !schema;
33977
+ for (const key in schema)
33978
+ if (self2.RULES.all[key])
33979
+ return true;
33980
+ return false;
33981
+ }
33982
+ function isSchemaObj(it) {
33983
+ return typeof it.schema != "boolean";
33984
+ }
33985
+ function subSchemaObjCode(it, valid) {
33986
+ const { schema, gen, opts } = it;
33987
+ if (opts.$comment && schema.$comment)
33988
+ commentKeyword(it);
33989
+ updateContext(it);
33990
+ checkAsyncSchema(it);
33991
+ const errsCount = gen.const("_errs", names_1$3.default.errors);
33992
+ typeAndKeywords(it, errsCount);
33993
+ gen.var(valid, (0, codegen_1$n._)`${errsCount} === ${names_1$3.default.errors}`);
33994
+ }
33995
+ function checkKeywords(it) {
33996
+ (0, util_1$l.checkUnknownRules)(it);
33997
+ checkRefsAndKeywords(it);
33998
+ }
33999
+ function typeAndKeywords(it, errsCount) {
34000
+ if (it.opts.jtd)
34001
+ return schemaKeywords(it, [], false, errsCount);
34002
+ const types2 = (0, dataType_1$1.getSchemaTypes)(it.schema);
34003
+ const checkedTypes = (0, dataType_1$1.coerceAndCheckDataType)(it, types2);
34004
+ schemaKeywords(it, types2, !checkedTypes, errsCount);
34005
+ }
34006
+ function checkRefsAndKeywords(it) {
34007
+ const { schema, errSchemaPath, opts, self: self2 } = it;
34008
+ if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1$l.schemaHasRulesButRef)(schema, self2.RULES)) {
34009
+ self2.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
34063
34010
  }
34064
- function updateContext(it) {
34065
- const schId = it.schema[it.opts.schemaId];
34066
- if (schId)
34067
- it.baseId = (0, resolve_12.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
34011
+ }
34012
+ function checkNoDefault(it) {
34013
+ const { schema, opts } = it;
34014
+ if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
34015
+ (0, util_1$l.checkStrictMode)(it, "default is ignored in the schema root");
34068
34016
  }
34069
- function checkAsyncSchema(it) {
34070
- if (it.schema.$async && !it.schemaEnv.$async)
34071
- throw new Error("async schema in sync schema");
34017
+ }
34018
+ function updateContext(it) {
34019
+ const schId = it.schema[it.opts.schemaId];
34020
+ if (schId)
34021
+ it.baseId = (0, resolve_1$2.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
34022
+ }
34023
+ function checkAsyncSchema(it) {
34024
+ if (it.schema.$async && !it.schemaEnv.$async)
34025
+ throw new Error("async schema in sync schema");
34026
+ }
34027
+ function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
34028
+ const msg = schema.$comment;
34029
+ if (opts.$comment === true) {
34030
+ gen.code((0, codegen_1$n._)`${names_1$3.default.self}.logger.log(${msg})`);
34031
+ } else if (typeof opts.$comment == "function") {
34032
+ const schemaPath = (0, codegen_1$n.str)`${errSchemaPath}/$comment`;
34033
+ const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
34034
+ gen.code((0, codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
34072
34035
  }
34073
- function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
34074
- const msg = schema.$comment;
34075
- if (opts.$comment === true) {
34076
- gen.code((0, codegen_12._)`${names_12.default.self}.logger.log(${msg})`);
34077
- } else if (typeof opts.$comment == "function") {
34078
- const schemaPath = (0, codegen_12.str)`${errSchemaPath}/$comment`;
34079
- const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
34080
- gen.code((0, codegen_12._)`${names_12.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
34081
- }
34036
+ }
34037
+ function returnResults(it) {
34038
+ const { gen, schemaEnv, validateName, ValidationError: ValidationError3, opts } = it;
34039
+ if (schemaEnv.$async) {
34040
+ gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === 0`, () => gen.return(names_1$3.default.data), () => gen.throw((0, codegen_1$n._)`new ${ValidationError3}(${names_1$3.default.vErrors})`));
34041
+ } else {
34042
+ gen.assign((0, codegen_1$n._)`${validateName}.errors`, names_1$3.default.vErrors);
34043
+ if (opts.unevaluated)
34044
+ assignEvaluated(it);
34045
+ gen.return((0, codegen_1$n._)`${names_1$3.default.errors} === 0`);
34082
34046
  }
34083
- function returnResults(it) {
34084
- const { gen, schemaEnv, validateName, ValidationError: ValidationError3, opts } = it;
34085
- if (schemaEnv.$async) {
34086
- gen.if((0, codegen_12._)`${names_12.default.errors} === 0`, () => gen.return(names_12.default.data), () => gen.throw((0, codegen_12._)`new ${ValidationError3}(${names_12.default.vErrors})`));
34087
- } else {
34088
- gen.assign((0, codegen_12._)`${validateName}.errors`, names_12.default.vErrors);
34089
- if (opts.unevaluated)
34090
- assignEvaluated(it);
34091
- gen.return((0, codegen_12._)`${names_12.default.errors} === 0`);
34092
- }
34093
- }
34094
- function assignEvaluated({ gen, evaluated, props, items: items2 }) {
34095
- if (props instanceof codegen_12.Name)
34096
- gen.assign((0, codegen_12._)`${evaluated}.props`, props);
34097
- if (items2 instanceof codegen_12.Name)
34098
- gen.assign((0, codegen_12._)`${evaluated}.items`, items2);
34099
- }
34100
- function schemaKeywords(it, types2, typeErrors, errsCount) {
34101
- const { gen, schema, data, allErrors, opts, self: self2 } = it;
34102
- const { RULES } = self2;
34103
- if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_12.schemaHasRulesButRef)(schema, RULES))) {
34104
- gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
34047
+ }
34048
+ function assignEvaluated({ gen, evaluated, props, items: items2 }) {
34049
+ if (props instanceof codegen_1$n.Name)
34050
+ gen.assign((0, codegen_1$n._)`${evaluated}.props`, props);
34051
+ if (items2 instanceof codegen_1$n.Name)
34052
+ gen.assign((0, codegen_1$n._)`${evaluated}.items`, items2);
34053
+ }
34054
+ function schemaKeywords(it, types2, typeErrors, errsCount) {
34055
+ const { gen, schema, data, allErrors, opts, self: self2 } = it;
34056
+ const { RULES } = self2;
34057
+ if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(schema, RULES))) {
34058
+ gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
34059
+ return;
34060
+ }
34061
+ if (!opts.jtd)
34062
+ checkStrictTypes(it, types2);
34063
+ gen.block(() => {
34064
+ for (const group of RULES.rules)
34065
+ groupKeywords(group);
34066
+ groupKeywords(RULES.post);
34067
+ });
34068
+ function groupKeywords(group) {
34069
+ if (!(0, applicability_1.shouldUseGroup)(schema, group))
34105
34070
  return;
34106
- }
34107
- if (!opts.jtd)
34108
- checkStrictTypes(it, types2);
34109
- gen.block(() => {
34110
- for (const group of RULES.rules)
34111
- groupKeywords(group);
34112
- groupKeywords(RULES.post);
34113
- });
34114
- function groupKeywords(group) {
34115
- if (!(0, applicability_12.shouldUseGroup)(schema, group))
34116
- return;
34117
- if (group.type) {
34118
- gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
34119
- iterateKeywords(it, group);
34120
- if (types2.length === 1 && types2[0] === group.type && typeErrors) {
34121
- gen.else();
34122
- (0, dataType_2.reportTypeError)(it);
34123
- }
34124
- gen.endIf();
34125
- } else {
34126
- iterateKeywords(it, group);
34071
+ if (group.type) {
34072
+ gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
34073
+ iterateKeywords(it, group);
34074
+ if (types2.length === 1 && types2[0] === group.type && typeErrors) {
34075
+ gen.else();
34076
+ (0, dataType_2.reportTypeError)(it);
34127
34077
  }
34128
- if (!allErrors)
34129
- gen.if((0, codegen_12._)`${names_12.default.errors} === ${errsCount || 0}`);
34078
+ gen.endIf();
34079
+ } else {
34080
+ iterateKeywords(it, group);
34130
34081
  }
34082
+ if (!allErrors)
34083
+ gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${errsCount || 0}`);
34131
34084
  }
34132
- function iterateKeywords(it, group) {
34133
- const { gen, schema, opts: { useDefaults } } = it;
34134
- if (useDefaults)
34135
- (0, defaults_1.assignDefaults)(it, group.type);
34136
- gen.block(() => {
34137
- for (const rule of group.rules) {
34138
- if ((0, applicability_12.shouldUseRule)(schema, rule)) {
34139
- keywordCode(it, rule.keyword, rule.definition, group.type);
34140
- }
34085
+ }
34086
+ function iterateKeywords(it, group) {
34087
+ const { gen, schema, opts: { useDefaults } } = it;
34088
+ if (useDefaults)
34089
+ (0, defaults_1.assignDefaults)(it, group.type);
34090
+ gen.block(() => {
34091
+ for (const rule of group.rules) {
34092
+ if ((0, applicability_1.shouldUseRule)(schema, rule)) {
34093
+ keywordCode(it, rule.keyword, rule.definition, group.type);
34141
34094
  }
34142
- });
34143
- }
34144
- function checkStrictTypes(it, types2) {
34145
- if (it.schemaEnv.meta || !it.opts.strictTypes)
34146
- return;
34147
- checkContextTypes(it, types2);
34148
- if (!it.opts.allowUnionTypes)
34149
- checkMultipleTypes(it, types2);
34150
- checkKeywordTypes(it, it.dataTypes);
34095
+ }
34096
+ });
34097
+ }
34098
+ function checkStrictTypes(it, types2) {
34099
+ if (it.schemaEnv.meta || !it.opts.strictTypes)
34100
+ return;
34101
+ checkContextTypes(it, types2);
34102
+ if (!it.opts.allowUnionTypes)
34103
+ checkMultipleTypes(it, types2);
34104
+ checkKeywordTypes(it, it.dataTypes);
34105
+ }
34106
+ function checkContextTypes(it, types2) {
34107
+ if (!types2.length)
34108
+ return;
34109
+ if (!it.dataTypes.length) {
34110
+ it.dataTypes = types2;
34111
+ return;
34151
34112
  }
34152
- function checkContextTypes(it, types2) {
34153
- if (!types2.length)
34154
- return;
34155
- if (!it.dataTypes.length) {
34156
- it.dataTypes = types2;
34157
- return;
34113
+ types2.forEach((t) => {
34114
+ if (!includesType(it.dataTypes, t)) {
34115
+ strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
34158
34116
  }
34159
- types2.forEach((t) => {
34160
- if (!includesType(it.dataTypes, t)) {
34161
- strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
34162
- }
34163
- });
34164
- narrowSchemaTypes(it, types2);
34165
- }
34166
- function checkMultipleTypes(it, ts) {
34167
- if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
34168
- strictTypesError(it, "use allowUnionTypes to allow union type keyword");
34169
- }
34170
- }
34171
- function checkKeywordTypes(it, ts) {
34172
- const rules2 = it.self.RULES.all;
34173
- for (const keyword2 in rules2) {
34174
- const rule = rules2[keyword2];
34175
- if (typeof rule == "object" && (0, applicability_12.shouldUseRule)(it.schema, rule)) {
34176
- const { type: type2 } = rule.definition;
34177
- if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
34178
- strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
34179
- }
34180
- }
34181
- }
34182
- }
34183
- function hasApplicableType(schTs, kwdT) {
34184
- return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
34185
- }
34186
- function includesType(ts, t) {
34187
- return ts.includes(t) || t === "integer" && ts.includes("number");
34188
- }
34189
- function narrowSchemaTypes(it, withTypes) {
34190
- const ts = [];
34191
- for (const t of it.dataTypes) {
34192
- if (includesType(withTypes, t))
34193
- ts.push(t);
34194
- else if (withTypes.includes("integer") && t === "number")
34195
- ts.push("integer");
34196
- }
34197
- it.dataTypes = ts;
34198
- }
34199
- function strictTypesError(it, msg) {
34200
- const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
34201
- msg += ` at "${schemaPath}" (strictTypes)`;
34202
- (0, util_12.checkStrictMode)(it, msg, it.opts.strictTypes);
34203
- }
34204
- class KeywordCxt {
34205
- constructor(it, def2, keyword2) {
34206
- (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
34207
- this.gen = it.gen;
34208
- this.allErrors = it.allErrors;
34209
- this.keyword = keyword2;
34210
- this.data = it.data;
34211
- this.schema = it.schema[keyword2];
34212
- this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
34213
- this.schemaValue = (0, util_12.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
34214
- this.schemaType = def2.schemaType;
34215
- this.parentSchema = it.schema;
34216
- this.params = {};
34217
- this.it = it;
34218
- this.def = def2;
34219
- if (this.$data) {
34220
- this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
34221
- } else {
34222
- this.schemaCode = this.schemaValue;
34223
- if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
34224
- throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
34225
- }
34226
- }
34227
- if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
34228
- this.errsCount = it.gen.const("_errs", names_12.default.errors);
34117
+ });
34118
+ narrowSchemaTypes(it, types2);
34119
+ }
34120
+ function checkMultipleTypes(it, ts) {
34121
+ if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
34122
+ strictTypesError(it, "use allowUnionTypes to allow union type keyword");
34123
+ }
34124
+ }
34125
+ function checkKeywordTypes(it, ts) {
34126
+ const rules2 = it.self.RULES.all;
34127
+ for (const keyword2 in rules2) {
34128
+ const rule = rules2[keyword2];
34129
+ if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
34130
+ const { type: type2 } = rule.definition;
34131
+ if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
34132
+ strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
34229
34133
  }
34230
34134
  }
34231
- result(condition, successAction, failAction) {
34232
- this.failResult((0, codegen_12.not)(condition), successAction, failAction);
34233
- }
34234
- failResult(condition, successAction, failAction) {
34235
- this.gen.if(condition);
34236
- if (failAction)
34237
- failAction();
34238
- else
34239
- this.error();
34240
- if (successAction) {
34241
- this.gen.else();
34242
- successAction();
34243
- if (this.allErrors)
34244
- this.gen.endIf();
34245
- } else {
34246
- if (this.allErrors)
34247
- this.gen.endIf();
34248
- else
34249
- this.gen.else();
34135
+ }
34136
+ }
34137
+ function hasApplicableType(schTs, kwdT) {
34138
+ return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
34139
+ }
34140
+ function includesType(ts, t) {
34141
+ return ts.includes(t) || t === "integer" && ts.includes("number");
34142
+ }
34143
+ function narrowSchemaTypes(it, withTypes) {
34144
+ const ts = [];
34145
+ for (const t of it.dataTypes) {
34146
+ if (includesType(withTypes, t))
34147
+ ts.push(t);
34148
+ else if (withTypes.includes("integer") && t === "number")
34149
+ ts.push("integer");
34150
+ }
34151
+ it.dataTypes = ts;
34152
+ }
34153
+ function strictTypesError(it, msg) {
34154
+ const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
34155
+ msg += ` at "${schemaPath}" (strictTypes)`;
34156
+ (0, util_1$l.checkStrictMode)(it, msg, it.opts.strictTypes);
34157
+ }
34158
+ class KeywordCxt {
34159
+ constructor(it, def2, keyword2) {
34160
+ (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
34161
+ this.gen = it.gen;
34162
+ this.allErrors = it.allErrors;
34163
+ this.keyword = keyword2;
34164
+ this.data = it.data;
34165
+ this.schema = it.schema[keyword2];
34166
+ this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
34167
+ this.schemaValue = (0, util_1$l.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
34168
+ this.schemaType = def2.schemaType;
34169
+ this.parentSchema = it.schema;
34170
+ this.params = {};
34171
+ this.it = it;
34172
+ this.def = def2;
34173
+ if (this.$data) {
34174
+ this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
34175
+ } else {
34176
+ this.schemaCode = this.schemaValue;
34177
+ if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
34178
+ throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
34250
34179
  }
34251
34180
  }
34252
- pass(condition, failAction) {
34253
- this.failResult((0, codegen_12.not)(condition), void 0, failAction);
34181
+ if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
34182
+ this.errsCount = it.gen.const("_errs", names_1$3.default.errors);
34254
34183
  }
34255
- fail(condition) {
34256
- if (condition === void 0) {
34257
- this.error();
34258
- if (!this.allErrors)
34259
- this.gen.if(false);
34260
- return;
34261
- }
34262
- this.gen.if(condition);
34184
+ }
34185
+ result(condition, successAction, failAction) {
34186
+ this.failResult((0, codegen_1$n.not)(condition), successAction, failAction);
34187
+ }
34188
+ failResult(condition, successAction, failAction) {
34189
+ this.gen.if(condition);
34190
+ if (failAction)
34191
+ failAction();
34192
+ else
34263
34193
  this.error();
34194
+ if (successAction) {
34195
+ this.gen.else();
34196
+ successAction();
34197
+ if (this.allErrors)
34198
+ this.gen.endIf();
34199
+ } else {
34264
34200
  if (this.allErrors)
34265
34201
  this.gen.endIf();
34266
34202
  else
34267
34203
  this.gen.else();
34268
34204
  }
34269
- fail$data(condition) {
34270
- if (!this.$data)
34271
- return this.fail(condition);
34272
- const { schemaCode } = this;
34273
- this.fail((0, codegen_12._)`${schemaCode} !== undefined && (${(0, codegen_12.or)(this.invalid$data(), condition)})`);
34274
- }
34275
- error(append, errorParams, errorPaths) {
34276
- if (errorParams) {
34277
- this.setParams(errorParams);
34278
- this._error(append, errorPaths);
34279
- this.setParams({});
34280
- return;
34281
- }
34282
- this._error(append, errorPaths);
34283
- }
34284
- _error(append, errorPaths) {
34285
- (append ? errors_12.reportExtraError : errors_12.reportError)(this, this.def.error, errorPaths);
34286
- }
34287
- $dataError() {
34288
- (0, errors_12.reportError)(this, this.def.$dataError || errors_12.keyword$DataError);
34289
- }
34290
- reset() {
34291
- if (this.errsCount === void 0)
34292
- throw new Error('add "trackErrors" to keyword definition');
34293
- (0, errors_12.resetErrorsCount)(this.gen, this.errsCount);
34294
- }
34295
- ok(cond) {
34205
+ }
34206
+ pass(condition, failAction) {
34207
+ this.failResult((0, codegen_1$n.not)(condition), void 0, failAction);
34208
+ }
34209
+ fail(condition) {
34210
+ if (condition === void 0) {
34211
+ this.error();
34296
34212
  if (!this.allErrors)
34297
- this.gen.if(cond);
34298
- }
34299
- setParams(obj, assign) {
34300
- if (assign)
34301
- Object.assign(this.params, obj);
34302
- else
34303
- this.params = obj;
34213
+ this.gen.if(false);
34214
+ return;
34304
34215
  }
34305
- block$data(valid, codeBlock, $dataValid = codegen_12.nil) {
34306
- this.gen.block(() => {
34307
- this.check$data(valid, $dataValid);
34308
- codeBlock();
34309
- });
34216
+ this.gen.if(condition);
34217
+ this.error();
34218
+ if (this.allErrors)
34219
+ this.gen.endIf();
34220
+ else
34221
+ this.gen.else();
34222
+ }
34223
+ fail$data(condition) {
34224
+ if (!this.$data)
34225
+ return this.fail(condition);
34226
+ const { schemaCode } = this;
34227
+ this.fail((0, codegen_1$n._)`${schemaCode} !== undefined && (${(0, codegen_1$n.or)(this.invalid$data(), condition)})`);
34228
+ }
34229
+ error(append, errorParams, errorPaths) {
34230
+ if (errorParams) {
34231
+ this.setParams(errorParams);
34232
+ this._error(append, errorPaths);
34233
+ this.setParams({});
34234
+ return;
34310
34235
  }
34311
- check$data(valid = codegen_12.nil, $dataValid = codegen_12.nil) {
34312
- if (!this.$data)
34313
- return;
34314
- const { gen, schemaCode, schemaType, def: def2 } = this;
34315
- gen.if((0, codegen_12.or)((0, codegen_12._)`${schemaCode} === undefined`, $dataValid));
34316
- if (valid !== codegen_12.nil)
34317
- gen.assign(valid, true);
34318
- if (schemaType.length || def2.validateSchema) {
34319
- gen.elseIf(this.invalid$data());
34320
- this.$dataError();
34321
- if (valid !== codegen_12.nil)
34322
- gen.assign(valid, false);
34323
- }
34324
- gen.else();
34236
+ this._error(append, errorPaths);
34237
+ }
34238
+ _error(append, errorPaths) {
34239
+ (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
34240
+ }
34241
+ $dataError() {
34242
+ (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
34243
+ }
34244
+ reset() {
34245
+ if (this.errsCount === void 0)
34246
+ throw new Error('add "trackErrors" to keyword definition');
34247
+ (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
34248
+ }
34249
+ ok(cond) {
34250
+ if (!this.allErrors)
34251
+ this.gen.if(cond);
34252
+ }
34253
+ setParams(obj, assign) {
34254
+ if (assign)
34255
+ Object.assign(this.params, obj);
34256
+ else
34257
+ this.params = obj;
34258
+ }
34259
+ block$data(valid, codeBlock, $dataValid = codegen_1$n.nil) {
34260
+ this.gen.block(() => {
34261
+ this.check$data(valid, $dataValid);
34262
+ codeBlock();
34263
+ });
34264
+ }
34265
+ check$data(valid = codegen_1$n.nil, $dataValid = codegen_1$n.nil) {
34266
+ if (!this.$data)
34267
+ return;
34268
+ const { gen, schemaCode, schemaType, def: def2 } = this;
34269
+ gen.if((0, codegen_1$n.or)((0, codegen_1$n._)`${schemaCode} === undefined`, $dataValid));
34270
+ if (valid !== codegen_1$n.nil)
34271
+ gen.assign(valid, true);
34272
+ if (schemaType.length || def2.validateSchema) {
34273
+ gen.elseIf(this.invalid$data());
34274
+ this.$dataError();
34275
+ if (valid !== codegen_1$n.nil)
34276
+ gen.assign(valid, false);
34325
34277
  }
34326
- invalid$data() {
34327
- const { gen, schemaCode, schemaType, def: def2, it } = this;
34328
- return (0, codegen_12.or)(wrong$DataType(), invalid$DataSchema());
34329
- function wrong$DataType() {
34330
- if (schemaType.length) {
34331
- if (!(schemaCode instanceof codegen_12.Name))
34332
- throw new Error("ajv implementation error");
34333
- const st = Array.isArray(schemaType) ? schemaType : [schemaType];
34334
- return (0, codegen_12._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
34335
- }
34336
- return codegen_12.nil;
34337
- }
34338
- function invalid$DataSchema() {
34339
- if (def2.validateSchema) {
34340
- const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
34341
- return (0, codegen_12._)`!${validateSchemaRef}(${schemaCode})`;
34342
- }
34343
- return codegen_12.nil;
34344
- }
34345
- }
34346
- subschema(appl, valid) {
34347
- const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
34348
- (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
34349
- (0, subschema_1.extendSubschemaMode)(subschema2, appl);
34350
- const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
34351
- subschemaCode(nextContext, valid);
34352
- return nextContext;
34353
- }
34354
- mergeEvaluated(schemaCxt, toName) {
34355
- const { it, gen } = this;
34356
- if (!it.opts.unevaluated)
34357
- return;
34358
- if (it.props !== true && schemaCxt.props !== void 0) {
34359
- it.props = util_12.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
34360
- }
34361
- if (it.items !== true && schemaCxt.items !== void 0) {
34362
- it.items = util_12.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
34278
+ gen.else();
34279
+ }
34280
+ invalid$data() {
34281
+ const { gen, schemaCode, schemaType, def: def2, it } = this;
34282
+ return (0, codegen_1$n.or)(wrong$DataType(), invalid$DataSchema());
34283
+ function wrong$DataType() {
34284
+ if (schemaType.length) {
34285
+ if (!(schemaCode instanceof codegen_1$n.Name))
34286
+ throw new Error("ajv implementation error");
34287
+ const st = Array.isArray(schemaType) ? schemaType : [schemaType];
34288
+ return (0, codegen_1$n._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
34363
34289
  }
34290
+ return codegen_1$n.nil;
34364
34291
  }
34365
- mergeValidEvaluated(schemaCxt, valid) {
34366
- const { it, gen } = this;
34367
- if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
34368
- gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_12.Name));
34369
- return true;
34292
+ function invalid$DataSchema() {
34293
+ if (def2.validateSchema) {
34294
+ const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
34295
+ return (0, codegen_1$n._)`!${validateSchemaRef}(${schemaCode})`;
34370
34296
  }
34297
+ return codegen_1$n.nil;
34371
34298
  }
34372
34299
  }
34373
- validate.KeywordCxt = KeywordCxt;
34374
- function keywordCode(it, keyword2, def2, ruleType) {
34375
- const cxt = new KeywordCxt(it, def2, keyword2);
34376
- if ("code" in def2) {
34377
- def2.code(cxt, ruleType);
34378
- } else if (cxt.$data && def2.validate) {
34379
- (0, keyword_1.funcKeywordCode)(cxt, def2);
34380
- } else if ("macro" in def2) {
34381
- (0, keyword_1.macroKeywordCode)(cxt, def2);
34382
- } else if (def2.compile || def2.validate) {
34383
- (0, keyword_1.funcKeywordCode)(cxt, def2);
34384
- }
34300
+ subschema(appl, valid) {
34301
+ const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
34302
+ (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
34303
+ (0, subschema_1.extendSubschemaMode)(subschema2, appl);
34304
+ const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
34305
+ subschemaCode(nextContext, valid);
34306
+ return nextContext;
34385
34307
  }
34386
- const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
34387
- const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
34388
- function getData($data, { dataLevel, dataNames, dataPathArr }) {
34389
- let jsonPointer;
34390
- let data;
34391
- if ($data === "")
34392
- return names_12.default.rootData;
34393
- if ($data[0] === "/") {
34394
- if (!JSON_POINTER.test($data))
34395
- throw new Error(`Invalid JSON-pointer: ${$data}`);
34396
- jsonPointer = $data;
34397
- data = names_12.default.rootData;
34398
- } else {
34399
- const matches = RELATIVE_JSON_POINTER.exec($data);
34400
- if (!matches)
34401
- throw new Error(`Invalid JSON-pointer: ${$data}`);
34402
- const up = +matches[1];
34403
- jsonPointer = matches[2];
34404
- if (jsonPointer === "#") {
34405
- if (up >= dataLevel)
34406
- throw new Error(errorMsg("property/index", up));
34407
- return dataPathArr[dataLevel - up];
34408
- }
34409
- if (up > dataLevel)
34410
- throw new Error(errorMsg("data", up));
34411
- data = dataNames[dataLevel - up];
34412
- if (!jsonPointer)
34413
- return data;
34308
+ mergeEvaluated(schemaCxt, toName) {
34309
+ const { it, gen } = this;
34310
+ if (!it.opts.unevaluated)
34311
+ return;
34312
+ if (it.props !== true && schemaCxt.props !== void 0) {
34313
+ it.props = util_1$l.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
34414
34314
  }
34415
- let expr = data;
34416
- const segments = jsonPointer.split("/");
34417
- for (const segment of segments) {
34418
- if (segment) {
34419
- data = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)((0, util_12.unescapeJsonPointer)(segment))}`;
34420
- expr = (0, codegen_12._)`${expr} && ${data}`;
34421
- }
34315
+ if (it.items !== true && schemaCxt.items !== void 0) {
34316
+ it.items = util_1$l.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
34422
34317
  }
34423
- return expr;
34424
- function errorMsg(pointerType, up) {
34425
- return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
34318
+ }
34319
+ mergeValidEvaluated(schemaCxt, valid) {
34320
+ const { it, gen } = this;
34321
+ if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
34322
+ gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1$n.Name));
34323
+ return true;
34426
34324
  }
34427
34325
  }
34428
- validate.getData = getData;
34429
- return validate;
34430
34326
  }
34327
+ validate.KeywordCxt = KeywordCxt;
34328
+ function keywordCode(it, keyword2, def2, ruleType) {
34329
+ const cxt = new KeywordCxt(it, def2, keyword2);
34330
+ if ("code" in def2) {
34331
+ def2.code(cxt, ruleType);
34332
+ } else if (cxt.$data && def2.validate) {
34333
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
34334
+ } else if ("macro" in def2) {
34335
+ (0, keyword_1.macroKeywordCode)(cxt, def2);
34336
+ } else if (def2.compile || def2.validate) {
34337
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
34338
+ }
34339
+ }
34340
+ const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
34341
+ const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
34342
+ function getData($data, { dataLevel, dataNames, dataPathArr }) {
34343
+ let jsonPointer;
34344
+ let data;
34345
+ if ($data === "")
34346
+ return names_1$3.default.rootData;
34347
+ if ($data[0] === "/") {
34348
+ if (!JSON_POINTER.test($data))
34349
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
34350
+ jsonPointer = $data;
34351
+ data = names_1$3.default.rootData;
34352
+ } else {
34353
+ const matches = RELATIVE_JSON_POINTER.exec($data);
34354
+ if (!matches)
34355
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
34356
+ const up = +matches[1];
34357
+ jsonPointer = matches[2];
34358
+ if (jsonPointer === "#") {
34359
+ if (up >= dataLevel)
34360
+ throw new Error(errorMsg("property/index", up));
34361
+ return dataPathArr[dataLevel - up];
34362
+ }
34363
+ if (up > dataLevel)
34364
+ throw new Error(errorMsg("data", up));
34365
+ data = dataNames[dataLevel - up];
34366
+ if (!jsonPointer)
34367
+ return data;
34368
+ }
34369
+ let expr = data;
34370
+ const segments = jsonPointer.split("/");
34371
+ for (const segment of segments) {
34372
+ if (segment) {
34373
+ data = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)((0, util_1$l.unescapeJsonPointer)(segment))}`;
34374
+ expr = (0, codegen_1$n._)`${expr} && ${data}`;
34375
+ }
34376
+ }
34377
+ return expr;
34378
+ function errorMsg(pointerType, up) {
34379
+ return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
34380
+ }
34381
+ }
34382
+ validate.getData = getData;
34431
34383
  var validation_error = {};
34432
34384
  Object.defineProperty(validation_error, "__esModule", { value: true });
34433
34385
  let ValidationError$1 = class ValidationError2 extends Error {
@@ -34454,10 +34406,10 @@ Object.defineProperty(compile, "__esModule", { value: true });
34454
34406
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
34455
34407
  const codegen_1$m = codegen;
34456
34408
  const validation_error_1 = validation_error;
34457
- const names_1$2 = requireNames();
34409
+ const names_1$2 = names$1;
34458
34410
  const resolve_1 = resolve$2;
34459
34411
  const util_1$k = util;
34460
- const validate_1$1 = requireValidate();
34412
+ const validate_1$1 = validate;
34461
34413
  class SchemaEnv {
34462
34414
  constructor(env2) {
34463
34415
  var _a2;
@@ -35386,7 +35338,7 @@ uri$1.default = uri;
35386
35338
  (function(exports$12) {
35387
35339
  Object.defineProperty(exports$12, "__esModule", { value: true });
35388
35340
  exports$12.CodeGen = exports$12.Name = exports$12.nil = exports$12.stringify = exports$12.str = exports$12._ = exports$12.KeywordCxt = void 0;
35389
- var validate_12 = requireValidate();
35341
+ var validate_12 = validate;
35390
35342
  Object.defineProperty(exports$12, "KeywordCxt", { enumerable: true, get: function() {
35391
35343
  return validate_12.KeywordCxt;
35392
35344
  } });
@@ -36004,9 +35956,9 @@ var ref = {};
36004
35956
  Object.defineProperty(ref, "__esModule", { value: true });
36005
35957
  ref.callRef = ref.getValidate = void 0;
36006
35958
  const ref_error_1$1 = ref_error;
36007
- const code_1$8 = requireCode();
35959
+ const code_1$8 = code;
36008
35960
  const codegen_1$l = codegen;
36009
- const names_1$1 = requireNames();
35961
+ const names_1$1 = names$1;
36010
35962
  const compile_1$1 = compile;
36011
35963
  const util_1$j = util;
36012
35964
  const def$r = {
@@ -36227,7 +36179,7 @@ const def$o = {
36227
36179
  limitLength.default = def$o;
36228
36180
  var pattern = {};
36229
36181
  Object.defineProperty(pattern, "__esModule", { value: true });
36230
- const code_1$7 = requireCode();
36182
+ const code_1$7 = code;
36231
36183
  const codegen_1$h = codegen;
36232
36184
  const error$f = {
36233
36185
  message: ({ schemaCode }) => (0, codegen_1$h.str)`must match pattern "${schemaCode}"`,
@@ -36272,7 +36224,7 @@ const def$m = {
36272
36224
  limitProperties.default = def$m;
36273
36225
  var required = {};
36274
36226
  Object.defineProperty(required, "__esModule", { value: true });
36275
- const code_1$6 = requireCode();
36227
+ const code_1$6 = code;
36276
36228
  const codegen_1$f = codegen;
36277
36229
  const util_1$h = util;
36278
36230
  const error$d = {
@@ -36586,7 +36538,7 @@ Object.defineProperty(items, "__esModule", { value: true });
36586
36538
  items.validateTuple = void 0;
36587
36539
  const codegen_1$9 = codegen;
36588
36540
  const util_1$c = util;
36589
- const code_1$5 = requireCode();
36541
+ const code_1$5 = code;
36590
36542
  const def$f = {
36591
36543
  keyword: "items",
36592
36544
  type: "array",
@@ -36646,7 +36598,7 @@ var items2020 = {};
36646
36598
  Object.defineProperty(items2020, "__esModule", { value: true });
36647
36599
  const codegen_1$8 = codegen;
36648
36600
  const util_1$b = util;
36649
- const code_1$4 = requireCode();
36601
+ const code_1$4 = code;
36650
36602
  const additionalItems_1$1 = additionalItems;
36651
36603
  const error$7 = {
36652
36604
  message: ({ params: { len } }) => (0, codegen_1$8.str)`must NOT have more than ${len} items`,
@@ -36765,7 +36717,7 @@ var dependencies = {};
36765
36717
  exports$12.validateSchemaDeps = exports$12.validatePropertyDeps = exports$12.error = void 0;
36766
36718
  const codegen_12 = codegen;
36767
36719
  const util_12 = util;
36768
- const code_12 = requireCode();
36720
+ const code_12 = code;
36769
36721
  exports$12.error = {
36770
36722
  message: ({ params: { property, depsCount, deps } }) => {
36771
36723
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -36888,9 +36840,9 @@ const def$b = {
36888
36840
  propertyNames.default = def$b;
36889
36841
  var additionalProperties = {};
36890
36842
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
36891
- const code_1$3 = requireCode();
36843
+ const code_1$3 = code;
36892
36844
  const codegen_1$5 = codegen;
36893
- const names_1 = requireNames();
36845
+ const names_1 = names$1;
36894
36846
  const util_1$8 = util;
36895
36847
  const error$4 = {
36896
36848
  message: "must NOT have additional properties",
@@ -36988,8 +36940,8 @@ const def$a = {
36988
36940
  additionalProperties.default = def$a;
36989
36941
  var properties$1 = {};
36990
36942
  Object.defineProperty(properties$1, "__esModule", { value: true });
36991
- const validate_1 = requireValidate();
36992
- const code_1$2 = requireCode();
36943
+ const validate_1 = validate;
36944
+ const code_1$2 = code;
36993
36945
  const util_1$7 = util;
36994
36946
  const additionalProperties_1$1 = additionalProperties;
36995
36947
  const def$9 = {
@@ -37040,7 +36992,7 @@ const def$9 = {
37040
36992
  properties$1.default = def$9;
37041
36993
  var patternProperties = {};
37042
36994
  Object.defineProperty(patternProperties, "__esModule", { value: true });
37043
- const code_1$1 = requireCode();
36995
+ const code_1$1 = code;
37044
36996
  const codegen_1$4 = codegen;
37045
36997
  const util_1$6 = util;
37046
36998
  const util_2 = util;
@@ -37133,7 +37085,7 @@ const def$7 = {
37133
37085
  not.default = def$7;
37134
37086
  var anyOf = {};
37135
37087
  Object.defineProperty(anyOf, "__esModule", { value: true });
37136
- const code_1 = requireCode();
37088
+ const code_1 = code;
37137
37089
  const def$6 = {
37138
37090
  keyword: "anyOf",
37139
37091
  schemaType: "array",
@@ -37839,7 +37791,7 @@ const require$$3 = {
37839
37791
  module2.exports.Ajv = Ajv2;
37840
37792
  Object.defineProperty(exports$12, "__esModule", { value: true });
37841
37793
  exports$12.default = Ajv2;
37842
- var validate_12 = requireValidate();
37794
+ var validate_12 = validate;
37843
37795
  Object.defineProperty(exports$12, "KeywordCxt", { enumerable: true, get: function() {
37844
37796
  return validate_12.KeywordCxt;
37845
37797
  } });
@@ -48949,7 +48901,7 @@ class AudioFileManager {
48949
48901
  return [];
48950
48902
  }
48951
48903
  this.uploadPromises = [];
48952
- this.audioChunks.forEach((chunk, index2) => {
48904
+ this.audioChunks.forEach((chunk, index) => {
48953
48905
  const { fileName, fileBlob, status, audioFrames } = chunk;
48954
48906
  if (status != "success") {
48955
48907
  let failedFileBlob;
@@ -48966,8 +48918,8 @@ class AudioFileManager {
48966
48918
  var _a2;
48967
48919
  if (response.success) {
48968
48920
  this.successfulUploads.push(fileName);
48969
- this.audioChunks[index2] = {
48970
- ...this.audioChunks[index2],
48921
+ this.audioChunks[index] = {
48922
+ ...this.audioChunks[index],
48971
48923
  audioFrames: void 0,
48972
48924
  fileBlob: void 0,
48973
48925
  status: "success",
@@ -62634,8 +62586,8 @@ const concatArrays = (arrays) => {
62634
62586
  return out;
62635
62587
  }, [0]);
62636
62588
  const outArray = new Float32Array(sizes.at(-1));
62637
- arrays.forEach((arr, index2) => {
62638
- const place = sizes[index2];
62589
+ arrays.forEach((arr, index) => {
62590
+ const place = sizes[index];
62639
62591
  outArray.set(arr, place);
62640
62592
  });
62641
62593
  return outArray;
@@ -64532,7 +64484,7 @@ class ScribeWidget {
64532
64484
  }
64533
64485
  }
64534
64486
  let widgetInstance = null;
64535
- function initEkaScribe(config) {
64487
+ function init(config = {}) {
64536
64488
  if (widgetInstance) {
64537
64489
  widgetInstance.unmount();
64538
64490
  }
@@ -64540,24 +64492,17 @@ function initEkaScribe(config) {
64540
64492
  widgetInstance.mount();
64541
64493
  return widgetInstance;
64542
64494
  }
64543
- function getEkaScribe() {
64495
+ function getInstance() {
64544
64496
  return widgetInstance;
64545
64497
  }
64546
- if (typeof window !== "undefined") {
64547
- window.EkaScribe = {
64548
- init: initEkaScribe,
64549
- getInstance: getEkaScribe,
64550
- Widget: ScribeWidget
64551
- };
64552
- }
64553
- const index = {
64554
- init: initEkaScribe,
64555
- getInstance: getEkaScribe,
64498
+ const EkaScribe = {
64499
+ init,
64500
+ getInstance,
64556
64501
  Widget: ScribeWidget
64557
64502
  };
64558
64503
  export {
64559
64504
  ScribeWidget,
64560
- index as default,
64561
- getEkaScribe as getInstance,
64562
- initEkaScribe as init
64505
+ EkaScribe as default,
64506
+ getInstance,
64507
+ init
64563
64508
  };