@crowdin/app-project-module 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -689,11 +689,35 @@
689
689
  return isObject$3(schema.additionalItems);
690
690
  }
691
691
 
692
- /** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned. If a
693
- * `null` is provided, it is returned. If the string ends in a `.` then the string is returned because the user may be
694
- * in the middle of typing a float number. If a number ends in a pattern like `.0`, `.20`, `.030`, string is returned
695
- * because the user may be typing number that will end in a non-zero digit. Otherwise, the string is wrapped by
696
- * `Number()` and if that result is not `NaN`, that number will be returned, otherwise the string `value` will be.
692
+ /**
693
+ * Determines the locale-specific decimal separator.
694
+ * It uses the provided locale or the first locale in navigator.languages (if available) and falls back to "en".
695
+ *
696
+ * @param languages - Optional array of locales or a single locale string
697
+ * @returns The decimal separator character (typically '.' or ',').
698
+ */
699
+ function getDecimalSeparator(languages) {
700
+ var _a;
701
+ const locales = (typeof navigator !== 'undefined' ? navigator.languages : undefined);
702
+ if (locales) {
703
+ try {
704
+ const formatter = new Intl.NumberFormat(locales);
705
+ const parts = formatter.formatToParts(1.1);
706
+ return ((_a = parts.find((part) => part.type === 'decimal')) === null || _a === void 0 ? void 0 : _a.value) || '.';
707
+ }
708
+ catch (e) {
709
+ // Fallback
710
+ }
711
+ }
712
+ return '.';
713
+ }
714
+
715
+ /** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned.
716
+ * If a `null` is provided, it is returned. If the string ends in a `.` or the locale-specific separator then the
717
+ * string is returned because the user may be in the middle of typing a float number. If a number ends in a pattern
718
+ * like `.0`, `.20`, `.030`, string is returned because the user may be typing number that will end in a non-zero
719
+ * digit. Otherwise, the string is wrapped by `Number()` and if that result is not `NaN`, that number will be
720
+ * returned, otherwise the string `value` will be.
697
721
  *
698
722
  * @param value - The string or null value to convert to a number
699
723
  * @returns - The `value` converted to a number when appropriate, otherwise the `value`
@@ -705,34 +729,38 @@
705
729
  if (value === null) {
706
730
  return null;
707
731
  }
732
+ const separator = getDecimalSeparator();
733
+ // Normalize separator to standard '.' for pattern checking and parsing
734
+ const standardValue = typeof value === 'string' && separator !== '.' ? value.replace(separator, '.') : value;
708
735
  // oxlint-disable-next-line typescript/prefer-string-starts-ends-with -- regex test() coerces undefined to "undefined" safely; endsWith() throws on undefined values passed at runtime
709
- if (/\.$/.test(value)) {
736
+ if (/\.$/.test(standardValue)) {
710
737
  // '3.' can't really be considered a number even if it parses in js. The
711
738
  // user is most likely entering a float.
712
739
  return value;
713
740
  }
714
741
  // oxlint-disable-next-line typescript/prefer-string-starts-ends-with -- same as above
715
- if (/\.0$/.test(value)) {
742
+ if (/\.0$/.test(standardValue)) {
716
743
  // we need to return this as a string here, to allow for input like 3.07
717
744
  return value;
718
745
  }
719
- if (/\.\d*0$/.test(value)) {
746
+ if (/\.\d*0$/.test(standardValue)) {
720
747
  // It's a number, that's cool - but we need it as a string so it doesn't screw
721
748
  // with the user when entering dollar amounts or other values (such as those with
722
749
  // specific precision or number of significant digits)
723
750
  return value;
724
751
  }
725
- const n = Number(value);
752
+ const n = Number(standardValue);
726
753
  const valid = typeof n === 'number' && !Number.isNaN(n);
727
754
  return valid ? n : value;
728
755
  }
729
756
 
730
757
  /** Below are the list of all the keys into various elements of a RJSFSchema or UiSchema that are used by the various
731
- * utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG` and
732
- * `RJSF_ADDITIONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
733
- * utility.
758
+ * utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG`,
759
+ * `RJSF_REF_KEY`, and `RJSF_REF_CYCLE_KEY` Symbols that are added to a schema under certain conditions by the
760
+ * `retrieveSchema()` utility. Using Symbols keeps these internal markers invisible to JSON serialisation and
761
+ * JSON Schema validators (AJV, ATA, etc.), which only enumerate string-keyed properties.
734
762
  */
735
- const ADDITIONAL_PROPERTY_FLAG = '__additional_property';
763
+ const ADDITIONAL_PROPERTY_FLAG = Symbol('__additional_property');
736
764
  const ADDITIONAL_PROPERTIES_KEY = 'additionalProperties';
737
765
  const ALL_OF_KEY = 'allOf';
738
766
  const ANY_OF_KEY = 'anyOf';
@@ -753,7 +781,8 @@
753
781
  const REQUIRED_KEY = 'required';
754
782
  const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
755
783
  const REF_KEY = '$ref';
756
- const RJSF_REF_KEY = '__rjsf_ref';
784
+ const RJSF_REF_KEY = Symbol('__rjsf_ref');
785
+ const RJSF_REF_CYCLE_KEY = Symbol('__rjsf_ref_cycle');
757
786
  const SCHEMA_KEY = '$schema';
758
787
  const DEFAULT_ID_PREFIX = 'root';
759
788
  const DEFAULT_ID_SEPARATOR = '_';
@@ -767,8 +796,9 @@
767
796
  /** The name of the `layoutGridLookupMap` attribute in the form context
768
797
  */
769
798
  const LOOKUP_MAP_NAME = 'layoutGridLookupMap';
770
- const RJSF_ADDITIONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
771
- const ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema';
799
+ const RJSF_PREFIX_KEY = '__rjsf';
800
+ const RJSF_ADDITIONAL_PROPERTIES_FLAG = `${RJSF_PREFIX_KEY}_additionalProperties`;
801
+ const ROOT_SCHEMA_PREFIX = `${RJSF_PREFIX_KEY}_rootSchema`;
772
802
  const UI_FIELD_KEY = 'ui:field';
773
803
  const UI_WIDGET_KEY = 'ui:widget';
774
804
  const UI_OPTIONS_KEY = 'ui:options';
@@ -2636,14 +2666,14 @@
2636
2666
  }),
2637
2667
  });
2638
2668
 
2639
- var fastUri = {exports: {}};
2669
+ var fastUri$1 = {exports: {}};
2640
2670
 
2641
- var utils;
2642
- var hasRequiredUtils;
2671
+ var utils$1;
2672
+ var hasRequiredUtils$1;
2643
2673
 
2644
- function requireUtils () {
2645
- if (hasRequiredUtils) return utils;
2646
- hasRequiredUtils = 1;
2674
+ function requireUtils$1 () {
2675
+ if (hasRequiredUtils$1) return utils$1;
2676
+ hasRequiredUtils$1 = 1;
2647
2677
 
2648
2678
  /** @type {(value: string) => boolean} */
2649
2679
  const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
@@ -2660,6 +2690,9 @@
2660
2690
  /** @type {(value: string) => boolean} */
2661
2691
  const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
2662
2692
 
2693
+ /** @type {(value: string) => boolean} */
2694
+ const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/?]$/iu);
2695
+
2663
2696
  /**
2664
2697
  * @param {Array<string>} input
2665
2698
  * @returns {string}
@@ -2863,7 +2896,7 @@
2863
2896
  continue
2864
2897
  }
2865
2898
  } else if (input[0] === '/') {
2866
- if (input[1] === '.' || input[1] === '/') {
2899
+ if (input[1] === '.') {
2867
2900
  output.push('/');
2868
2901
  break
2869
2902
  }
@@ -2976,6 +3009,55 @@
2976
3009
  return output
2977
3010
  }
2978
3011
 
3012
+ /** Pre-built `%XX` strings for every byte. Avoids per-call hex math/concat. */
3013
+ const BYTE_HEX = new Array(256);
3014
+ {
3015
+ const HEX_DIGITS = '0123456789ABCDEF';
3016
+ for (let i = 0; i < 256; i++) {
3017
+ BYTE_HEX[i] = '%' + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 0xF];
3018
+ }
3019
+ }
3020
+
3021
+ /**
3022
+ * Mirrors the pass-through set of the deprecated `escape()` global:
3023
+ * `A-Z a-z 0-9 * + - . / @ _`. Keeps drop-in semantics for ASCII input.
3024
+ *
3025
+ * @param {number} cp
3026
+ * @returns {boolean}
3027
+ */
3028
+ function isEscapeSafe (cp) {
3029
+ return (
3030
+ (cp >= 0x30 && cp <= 0x39) ||
3031
+ (cp >= 0x41 && cp <= 0x5A) ||
3032
+ (cp >= 0x61 && cp <= 0x7A) ||
3033
+ cp === 0x2A || cp === 0x2B || cp === 0x2D || cp === 0x2E ||
3034
+ cp === 0x2F || cp === 0x40 || cp === 0x5F
3035
+ )
3036
+ }
3037
+
3038
+ /**
3039
+ * RFC 3986 percent-encode a non-ASCII Unicode code point as UTF-8 bytes.
3040
+ * Caller handles the ASCII branch inline for speed.
3041
+ *
3042
+ * @param {number} cp - Unicode code point (>= 0x80, <= 0x10FFFF)
3043
+ * @returns {string}
3044
+ */
3045
+ function percentEncodeNonAscii (cp) {
3046
+ if (cp < 0x800) {
3047
+ return BYTE_HEX[0xC0 | (cp >> 6)] +
3048
+ BYTE_HEX[0x80 | (cp & 0x3F)]
3049
+ }
3050
+ if (cp < 0x10000) {
3051
+ return BYTE_HEX[0xE0 | (cp >> 12)] +
3052
+ BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
3053
+ BYTE_HEX[0x80 | (cp & 0x3F)]
3054
+ }
3055
+ return BYTE_HEX[0xF0 | (cp >> 18)] +
3056
+ BYTE_HEX[0x80 | ((cp >> 12) & 0x3F)] +
3057
+ BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
3058
+ BYTE_HEX[0x80 | (cp & 0x3F)]
3059
+ }
3060
+
2979
3061
  /**
2980
3062
  * Normalizes path data without turning reserved escapes into live path syntax.
2981
3063
  * Valid escapes are uppercased, raw unsafe characters are escaped, and only
@@ -2988,7 +3070,8 @@
2988
3070
  let output = '';
2989
3071
 
2990
3072
  for (let i = 0; i < input.length; i++) {
2991
- if (input[i] === '%' && i + 2 < input.length) {
3073
+ const ch = input[i];
3074
+ if (ch === '%' && i + 2 < input.length) {
2992
3075
  const hex = input.slice(i + 1, i + 3);
2993
3076
  if (isHexPair(hex)) {
2994
3077
  const normalizedHex = hex.toUpperCase();
@@ -3005,10 +3088,82 @@
3005
3088
  }
3006
3089
  }
3007
3090
 
3008
- if (isPathCharacter(input[i])) {
3009
- output += input[i];
3091
+ if (isPathCharacter(ch)) {
3092
+ output += ch;
3010
3093
  } else {
3011
- output += escape(input[i]);
3094
+ const code = input.charCodeAt(i);
3095
+ if (code < 0x80) {
3096
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3097
+ } else if (code < 0xD800 || code > 0xDFFF) {
3098
+ output += percentEncodeNonAscii(code);
3099
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
3100
+ const low = input.charCodeAt(i + 1);
3101
+ if (low >= 0xDC00 && low <= 0xDFFF) {
3102
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00));
3103
+ i++;
3104
+ } else {
3105
+ output += percentEncodeNonAscii(0xFFFD);
3106
+ }
3107
+ } else {
3108
+ output += percentEncodeNonAscii(0xFFFD);
3109
+ }
3110
+ }
3111
+ }
3112
+
3113
+ return output
3114
+ }
3115
+
3116
+ /**
3117
+ * Normalizes the percent-encoding of a query or fragment component.
3118
+ *
3119
+ * Like `normalizePathEncoding`, but uses the query/fragment character set
3120
+ * (which additionally allows `?`) and decodes `.` since it has no dot-segment
3121
+ * meaning outside of a path.
3122
+ *
3123
+ * @param {string} input
3124
+ * @returns {string}
3125
+ */
3126
+ function normalizeQueryFragmentEncoding (input) {
3127
+ let output = '';
3128
+
3129
+ for (let i = 0; i < input.length; i++) {
3130
+ const ch = input[i];
3131
+ if (ch === '%' && i + 2 < input.length) {
3132
+ const hex = input.slice(i + 1, i + 3);
3133
+ if (isHexPair(hex)) {
3134
+ const normalizedHex = hex.toUpperCase();
3135
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3136
+
3137
+ if (isUnreserved(decoded)) {
3138
+ output += decoded;
3139
+ } else {
3140
+ output += '%' + normalizedHex;
3141
+ }
3142
+
3143
+ i += 2;
3144
+ continue
3145
+ }
3146
+ }
3147
+
3148
+ if (isQueryFragmentCharacter(ch)) {
3149
+ output += ch;
3150
+ } else {
3151
+ const code = input.charCodeAt(i);
3152
+ if (code < 0x80) {
3153
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3154
+ } else if (code < 0xD800 || code > 0xDFFF) {
3155
+ output += percentEncodeNonAscii(code);
3156
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
3157
+ const low = input.charCodeAt(i + 1);
3158
+ if (low >= 0xDC00 && low <= 0xDFFF) {
3159
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00));
3160
+ i++;
3161
+ } else {
3162
+ output += percentEncodeNonAscii(0xFFFD);
3163
+ }
3164
+ } else {
3165
+ output += percentEncodeNonAscii(0xFFFD);
3166
+ }
3012
3167
  }
3013
3168
  }
3014
3169
 
@@ -3025,7 +3180,8 @@
3025
3180
  let output = '';
3026
3181
 
3027
3182
  for (let i = 0; i < input.length; i++) {
3028
- if (input[i] === '%' && i + 2 < input.length) {
3183
+ const ch = input[i];
3184
+ if (ch === '%' && i + 2 < input.length) {
3029
3185
  const hex = input.slice(i + 1, i + 3);
3030
3186
  if (isHexPair(hex)) {
3031
3187
  output += '%' + hex.toUpperCase();
@@ -3034,7 +3190,22 @@
3034
3190
  }
3035
3191
  }
3036
3192
 
3037
- output += escape(input[i]);
3193
+ const code = input.charCodeAt(i);
3194
+ if (code < 0x80) {
3195
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3196
+ } else if (code < 0xD800 || code > 0xDFFF) {
3197
+ output += percentEncodeNonAscii(code);
3198
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
3199
+ const low = input.charCodeAt(i + 1);
3200
+ if (low >= 0xDC00 && low <= 0xDFFF) {
3201
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00));
3202
+ i++;
3203
+ } else {
3204
+ output += percentEncodeNonAscii(0xFFFD);
3205
+ }
3206
+ } else {
3207
+ output += percentEncodeNonAscii(0xFFFD);
3208
+ }
3038
3209
  }
3039
3210
 
3040
3211
  return output
@@ -3072,12 +3243,13 @@
3072
3243
 
3073
3244
  return uriTokens.length ? uriTokens.join('') : undefined
3074
3245
  }
3075
- utils = {
3246
+ utils$1 = {
3076
3247
  nonSimpleDomain,
3077
3248
  recomposeAuthority,
3078
3249
  reescapeHostDelimiters,
3079
3250
  normalizePercentEncoding,
3080
3251
  normalizePathEncoding,
3252
+ normalizeQueryFragmentEncoding,
3081
3253
  escapePreservingEscapes,
3082
3254
  removeDotSegments,
3083
3255
  isIPv4,
@@ -3085,17 +3257,17 @@
3085
3257
  normalizeIPv6,
3086
3258
  stringArrayToHexStripped
3087
3259
  };
3088
- return utils;
3260
+ return utils$1;
3089
3261
  }
3090
3262
 
3091
- var schemes;
3092
- var hasRequiredSchemes;
3263
+ var schemes$1;
3264
+ var hasRequiredSchemes$1;
3093
3265
 
3094
- function requireSchemes () {
3095
- if (hasRequiredSchemes) return schemes;
3096
- hasRequiredSchemes = 1;
3266
+ function requireSchemes$1 () {
3267
+ if (hasRequiredSchemes$1) return schemes$1;
3268
+ hasRequiredSchemes$1 = 1;
3097
3269
 
3098
- const { isUUID } = requireUtils();
3270
+ const { isUUID } = requireUtils$1();
3099
3271
  const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
3100
3272
 
3101
3273
  const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws',
@@ -3354,23 +3526,23 @@
3354
3526
  undefined
3355
3527
  }
3356
3528
 
3357
- schemes = {
3529
+ schemes$1 = {
3358
3530
  wsIsSecure,
3359
3531
  SCHEMES,
3360
3532
  isValidSchemeName,
3361
3533
  getSchemeHandler,
3362
3534
  };
3363
- return schemes;
3535
+ return schemes$1;
3364
3536
  }
3365
3537
 
3366
- var hasRequiredFastUri;
3538
+ var hasRequiredFastUri$1;
3367
3539
 
3368
- function requireFastUri () {
3369
- if (hasRequiredFastUri) return fastUri.exports;
3370
- hasRequiredFastUri = 1;
3540
+ function requireFastUri$1 () {
3541
+ if (hasRequiredFastUri$1) return fastUri$1.exports;
3542
+ hasRequiredFastUri$1 = 1;
3371
3543
 
3372
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
3373
- const { SCHEMES, getSchemeHandler } = requireSchemes();
3544
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, normalizeQueryFragmentEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils$1();
3545
+ const { SCHEMES, getSchemeHandler } = requireSchemes$1();
3374
3546
 
3375
3547
  /**
3376
3548
  * @template {import('./types/index').URIComponent|string} T
@@ -3395,7 +3567,12 @@
3395
3567
  */
3396
3568
  function resolve (baseURI, relativeURI, options) {
3397
3569
  const schemelessOptions = options ? Object.assign({ scheme: 'null' }, options) : { scheme: 'null' };
3398
- const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
3570
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3571
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3572
+ if (baseMalformed || relativeMalformed) {
3573
+ throw new Error(baseParsed.error || relativeParsed.error || 'URI is malformed.')
3574
+ }
3575
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3399
3576
  schemelessOptions.skipEscape = true;
3400
3577
  return serialize(resolved, schemelessOptions)
3401
3578
  }
@@ -3575,6 +3752,15 @@
3575
3752
  // with or without a scheme prefix, for the literal-backslash rejection below.
3576
3753
  const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
3577
3754
 
3755
+ // Captures the leading authority-introducer region after an optional scheme: a
3756
+ // run of forward slashes, backslashes, and the characters the WHATWG URL parser
3757
+ // removes before parsing (TAB U+0009, LF U+000A, CR U+000D). A valid introducer
3758
+ // is exactly "//". Node treats "\" as "/" on special schemes and strips those
3759
+ // characters first, so forms like "\\", "/\", "\/", "/<TAB>/", or a leading
3760
+ // "<TAB>//" reach an authority in Node while fast-uri's URI_PARSE folds them into
3761
+ // the path group (host confusion / SSRF / redirect bypass).
3762
+ const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
3763
+
3578
3764
  /**
3579
3765
  * @param {import('./types/index').URIComponent} parsed
3580
3766
  * @param {RegExpMatchArray} matches
@@ -3634,11 +3820,33 @@
3634
3820
  malformedAuthorityOrPort = true;
3635
3821
  }
3636
3822
 
3823
+ // Reject a malformed or whitespace-smuggled authority introducer. fast-uri
3824
+ // only recognizes a literal "//"; anything else in the leading separator run
3825
+ // (a backslash, or a "//" that appears only after removing the TAB/LF/CR that
3826
+ // Node strips) means the authority fast-uri parses differs from the one Node's
3827
+ // URL resolves. Reject rather than rewrite, mirroring the literal-backslash
3828
+ // guard above. Percent-encoded forms (%5C, %09) are untouched, valid data.
3829
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
3830
+ if (introducerMatch !== null) {
3831
+ const region = introducerMatch[1];
3832
+ const normalizedRegion = region.replace(/[\t\n\r]/g, '');
3833
+ // Two or more leading separators introduce an authority.
3834
+ if (normalizedRegion.length >= 2) {
3835
+ if (normalizedRegion.slice(0, 2) !== '//') {
3836
+ parsed.error = parsed.error || 'URI authority must not contain a literal backslash.';
3837
+ malformedAuthorityOrPort = true;
3838
+ } else if (region.length !== normalizedRegion.length) {
3839
+ parsed.error = parsed.error || 'URI authority introducer must not contain whitespace.';
3840
+ malformedAuthorityOrPort = true;
3841
+ }
3842
+ }
3843
+ }
3844
+
3637
3845
  const matches = uri.match(URI_PARSE);
3638
3846
 
3639
3847
  if (matches) {
3640
3848
  // store each component
3641
- parsed.scheme = matches[1];
3849
+ parsed.scheme = matches[1] === undefined ? undefined : matches[1].toLowerCase();
3642
3850
  parsed.userinfo = matches[3];
3643
3851
  parsed.host = matches[4];
3644
3852
  parsed.port = parseInt(matches[5], 10);
@@ -3711,12 +3919,11 @@
3711
3919
  if (parsed.path) {
3712
3920
  parsed.path = normalizePathEncoding(parsed.path);
3713
3921
  }
3922
+ if (parsed.query) {
3923
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
3924
+ }
3714
3925
  if (parsed.fragment) {
3715
- try {
3716
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3717
- } catch {
3718
- parsed.error = parsed.error || 'URI malformed';
3719
- }
3926
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
3720
3927
  }
3721
3928
  }
3722
3929
 
@@ -3777,7 +3984,7 @@
3777
3984
  }
3778
3985
  }
3779
3986
 
3780
- const fastUri$1 = {
3987
+ const fastUri = {
3781
3988
  SCHEMES,
3782
3989
  normalize,
3783
3990
  resolve,
@@ -3787,13 +3994,13 @@
3787
3994
  parse
3788
3995
  };
3789
3996
 
3790
- fastUri.exports = fastUri$1;
3791
- fastUri.exports.default = fastUri$1;
3792
- fastUri.exports.fastUri = fastUri$1;
3793
- return fastUri.exports;
3997
+ fastUri$1.exports = fastUri;
3998
+ fastUri$1.exports.default = fastUri;
3999
+ fastUri$1.exports.fastUri = fastUri;
4000
+ return fastUri$1.exports;
3794
4001
  }
3795
4002
 
3796
- var fastUriExports = requireFastUri();
4003
+ var fastUriExports = requireFastUri$1();
3797
4004
  var UriResolver = /*@__PURE__*/getDefaultExportFromCjs(fastUriExports);
3798
4005
 
3799
4006
  var jsonpointer$1 = {};
@@ -7888,7 +8095,7 @@
7888
8095
  */
7889
8096
  function mergeSchemas(obj1, obj2) {
7890
8097
  const acc = { ...obj1 }; // Prevent mutation of source object.
7891
- return Object.keys(obj2).reduce((accumulator, key) => {
8098
+ const result = Object.keys(obj2).reduce((accumulator, key) => {
7892
8099
  const left = obj1 ? obj1[key] : {}, right = obj2[key];
7893
8100
  if (obj1 && key in obj1 && isObject$3(right)) {
7894
8101
  accumulator[key] = mergeSchemas(left, right);
@@ -7907,6 +8114,13 @@
7907
8114
  }
7908
8115
  return accumulator;
7909
8116
  }, acc);
8117
+ // Copy own Symbol-keyed properties from obj2 (Object.keys skips them).
8118
+ for (const sym of Object.getOwnPropertySymbols(obj2)) {
8119
+ // To avoid issues with symbols, we cast them to GenericSymbolObjectType. If we make the mergeSchema function take
8120
+ // in GenericSymbolObjectType rather than GenericObjectType, it causes a bunch of type errors downstream
8121
+ result[sym] = obj2[sym];
8122
+ }
8123
+ return result;
7910
8124
  }
7911
8125
 
7912
8126
  /** `Object#toString` result references. */
@@ -9088,6 +9302,17 @@
9088
9302
  function retrieveSchema(validator, schema, rootSchema = {}, rawFormData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs = false) {
9089
9303
  return retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, undefined, undefined, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs)[0];
9090
9304
  }
9305
+ /** Converts boolean schemas to equivalent object schemas for APIs that operate on `StrictRJSFSchema` objects.
9306
+ *
9307
+ * @param schema - The schema or boolean schema to normalize
9308
+ * @returns - The original schema or an equivalent object schema
9309
+ */
9310
+ function normalizeBooleanSchema(schema) {
9311
+ if (typeof schema !== 'boolean') {
9312
+ return schema;
9313
+ }
9314
+ return (schema ? {} : { not: {} });
9315
+ }
9091
9316
  /** Resolves a conditional block (if/else/then) by removing the condition and merging the appropriate conditional branch
9092
9317
  * with the rest of the schema. If `expandAllBranches` is true, then the `retrieveSchemaInteral()` results for both
9093
9318
  * conditions will be returned.
@@ -9109,15 +9334,18 @@
9109
9334
  let schemas = [];
9110
9335
  if (expandAllBranches) {
9111
9336
  if (then && typeof then !== 'boolean') {
9112
- schemas = schemas.concat(retrieveSchemaInternal(validator, then, rootSchema, formData, expandAllBranches, recurseList, experimental_customMergeAllOf));
9337
+ const thenSchema = then;
9338
+ schemas = schemas.concat(retrieveSchemaInternal(validator, thenSchema, rootSchema, formData, expandAllBranches, recurseList, experimental_customMergeAllOf));
9113
9339
  }
9114
9340
  if (otherwise && typeof otherwise !== 'boolean') {
9115
- schemas = schemas.concat(retrieveSchemaInternal(validator, otherwise, rootSchema, formData, expandAllBranches, recurseList, experimental_customMergeAllOf));
9341
+ const otherwiseSchema = otherwise;
9342
+ schemas = schemas.concat(retrieveSchemaInternal(validator, otherwiseSchema, rootSchema, formData, expandAllBranches, recurseList, experimental_customMergeAllOf));
9116
9343
  }
9117
9344
  }
9118
9345
  else {
9119
- const conditionalSchema = conditionValue ? then : otherwise;
9120
- if (conditionalSchema && typeof conditionalSchema !== 'boolean') {
9346
+ const conditionalBranch = (conditionValue ? then : otherwise);
9347
+ if (conditionalBranch !== undefined) {
9348
+ const conditionalSchema = normalizeBooleanSchema(conditionalBranch);
9121
9349
  schemas = schemas.concat(retrieveSchemaInternal(validator, conditionalSchema, rootSchema, formData, expandAllBranches, recurseList, experimental_customMergeAllOf));
9122
9350
  }
9123
9351
  }
@@ -9234,9 +9462,13 @@
9234
9462
  * @param recurseList - List of $refs already resolved to prevent recursion
9235
9463
  * @param [baseURI] - The base URI to be used for resolving relative references
9236
9464
  * @param [resolveAnyOfOrOneOfRefs] - Optional flag indicating whether to resolved refs in anyOf/oneOf lists
9465
+ * @param [markCycleOnDetection=false] - When true and a recursive $ref is detected, the returned schema is tagged
9466
+ * with `__rjsf_ref_cycle: true` so that `SchemaField` can render a cycle indicator instead of recursing.
9467
+ * Should only be `true` when called from an **object-property** context, because object properties are always
9468
+ * rendered (creating an infinite loop), whereas array items and anyOf/oneOf branches are data-driven.
9237
9469
  * @returns - given schema will all references resolved or the original schema if no internal `$refs` were resolved
9238
9470
  */
9239
- function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveAnyOfOrOneOfRefs) {
9471
+ function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveAnyOfOrOneOfRefs, markCycleOnDetection = false) {
9240
9472
  if (!isObject$3(schema)) {
9241
9473
  return schema;
9242
9474
  }
@@ -9247,7 +9479,7 @@
9247
9479
  const { $ref, ...localSchema } = resolvedSchema;
9248
9480
  // Check for a recursive reference and stop the loop
9249
9481
  if (recurseList.includes($ref)) {
9250
- return resolvedSchema;
9482
+ return markCycleOnDetection ? { ...resolvedSchema, [RJSF_REF_CYCLE_KEY]: true } : resolvedSchema;
9251
9483
  }
9252
9484
  recurseList.push($ref);
9253
9485
  // Retrieve the referenced schema definition.
@@ -9261,7 +9493,11 @@
9261
9493
  const childrenLists = [];
9262
9494
  const updatedProps = transform(resolvedSchema[PROPERTIES_KEY], (acc, value, key) => {
9263
9495
  const childList = [...recurseList];
9264
- acc[key] = resolveAllReferences(value, rootSchema, childList, currentBaseURI, resolveAnyOfOrOneOfRefs);
9496
+ // Mark cycles only when NOT in resolveAnyOfOrOneOfRefs mode. When resolveAnyOfOrOneOfRefs=true
9497
+ // (e.g. from ObjectField), options are resolved against a shared recurseList that accumulates
9498
+ // refs across branches, causing false positives. In simple (non-anyOf) resolution, a $ref cycle
9499
+ // in an object property always causes an infinite render loop and must be caught.
9500
+ acc[key] = resolveAllReferences(value, rootSchema, childList, currentBaseURI, resolveAnyOfOrOneOfRefs, !resolveAnyOfOrOneOfRefs);
9265
9501
  childrenLists.push(childList);
9266
9502
  }, {});
9267
9503
  merge$1(recurseList, uniq(flattenDeep(childrenLists)));
@@ -9272,6 +9508,7 @@
9272
9508
  typeof resolvedSchema.items !== 'boolean') {
9273
9509
  resolvedSchema = {
9274
9510
  ...resolvedSchema,
9511
+ // Array items are only rendered when data exists, so a $ref cycle here does NOT cause an infinite render.
9275
9512
  items: resolveAllReferences(resolvedSchema.items, rootSchema, recurseList, currentBaseURI, resolveAnyOfOrOneOfRefs),
9276
9513
  };
9277
9514
  }
@@ -9321,7 +9558,7 @@
9321
9558
  const matchingProperties = getMatchingPatternProperties(schema, key);
9322
9559
  if (!isEmpty$1(matchingProperties)) {
9323
9560
  schema.properties[key] = retrieveSchema(validator, { [ALL_OF_KEY]: Object.values(matchingProperties) }, rootSchema, get(formData, [key]), experimental_customMergeAllOf);
9324
- set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
9561
+ schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
9325
9562
  return;
9326
9563
  }
9327
9564
  }
@@ -9329,7 +9566,7 @@
9329
9566
  let additionalProperties;
9330
9567
  if (typeof schema.additionalProperties !== 'boolean') {
9331
9568
  if (REF_KEY in schema.additionalProperties) {
9332
- additionalProperties = retrieveSchema(validator, { [REF_KEY]: get(schema.additionalProperties, [REF_KEY]) }, rootSchema, formData, experimental_customMergeAllOf);
9569
+ additionalProperties = retrieveSchema(validator, { [REF_KEY]: get(schema.additionalProperties, [REF_KEY]) }, rootSchema, get(formData, [key]), experimental_customMergeAllOf);
9333
9570
  }
9334
9571
  else if ('type' in schema.additionalProperties) {
9335
9572
  additionalProperties = { ...schema.additionalProperties };
@@ -9350,13 +9587,13 @@
9350
9587
  // The type of our new key should match the additionalProperties value;
9351
9588
  schema.properties[key] = additionalProperties;
9352
9589
  // Set our additional property flag so we know it was dynamically added
9353
- set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
9590
+ schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
9354
9591
  }
9355
9592
  else {
9356
9593
  // Invalid property
9357
9594
  schema.properties[key] = { type: 'null' };
9358
9595
  // Set our additional property flag so we know it was dynamically added
9359
- set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
9596
+ schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
9360
9597
  }
9361
9598
  });
9362
9599
  return schema;
@@ -9406,12 +9643,20 @@
9406
9643
  try {
9407
9644
  const withContainsSchemas = [];
9408
9645
  const withoutContainsSchemas = [];
9646
+ // Collect Symbol-keyed properties from allOf subschemas before merging; shallowAllOfMerge
9647
+ // (external library) only operates on string keys and will drop them.
9648
+ const allOfSymbols = {};
9409
9649
  (_a = resolvedSchema.allOf) === null || _a === void 0 ? void 0 : _a.forEach((allOfItem) => {
9410
9650
  if (typeof allOfItem === 'object' && allOfItem.contains) {
9411
9651
  withContainsSchemas.push(allOfItem);
9412
9652
  }
9413
9653
  else {
9414
9654
  withoutContainsSchemas.push(allOfItem);
9655
+ for (const sym of Object.getOwnPropertySymbols(allOfItem)) {
9656
+ if (!(sym in allOfSymbols)) {
9657
+ allOfSymbols[sym] = allOfItem[sym];
9658
+ }
9659
+ }
9415
9660
  }
9416
9661
  });
9417
9662
  if (withContainsSchemas.length) {
@@ -9420,6 +9665,10 @@
9420
9665
  resolvedSchema = experimental_customMergeAllOf
9421
9666
  ? experimental_customMergeAllOf(resolvedSchema)
9422
9667
  : mergeAllOf(resolvedSchema);
9668
+ // Re-apply collected Symbol properties that the merge dropped.
9669
+ for (const sym of Object.getOwnPropertySymbols(allOfSymbols)) {
9670
+ resolvedSchema[sym] = allOfSymbols[sym];
9671
+ }
9423
9672
  if (withContainsSchemas.length) {
9424
9673
  resolvedSchema.allOf = withContainsSchemas;
9425
9674
  }
@@ -9511,7 +9760,7 @@
9511
9760
  function relaxOptionsForScoring(options, resolveRefs = false, rootSchema) {
9512
9761
  return options.map((d) => {
9513
9762
  if (!isObject$3(d)) {
9514
- return (d ? {} : { not: {} });
9763
+ return normalizeBooleanSchema(d);
9515
9764
  }
9516
9765
  const schema = resolveRefs && rootSchema ? resolveAllReferences(d, rootSchema, []) : d;
9517
9766
  return schema.additionalProperties === false ? { ...schema, additionalProperties: true } : schema;
@@ -9636,7 +9885,7 @@
9636
9885
  */
9637
9886
  function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, oneOf, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
9638
9887
  const validSubschemas = oneOf.filter((subschema) => {
9639
- if (typeof subschema === 'boolean' || !subschema || !subschema.properties) {
9888
+ if (typeof subschema === 'boolean' || !(subschema === null || subschema === void 0 ? void 0 : subschema.properties)) {
9640
9889
  return false;
9641
9890
  }
9642
9891
  const { [dependencyKey]: conditionPropertySchema } = subschema.properties;
@@ -10088,14 +10337,14 @@
10088
10337
  return (Array.isArray(schema.enum) && schema.enum.length === 1) || CONST_KEY in schema;
10089
10338
  }
10090
10339
 
10091
- /** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is a non-empty array
10092
- * that only contains objects.
10340
+ /** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is an array that only
10341
+ * contains objects.
10093
10342
  *
10094
10343
  * @param schema - The schema in which to check for fixed items
10095
10344
  * @returns - True if there are fixed items in the schema, false otherwise
10096
10345
  */
10097
10346
  function isFixedItems(schema) {
10098
- return Array.isArray(schema.items) && schema.items.length > 0 && schema.items.every((item) => isObject$3(item));
10347
+ return Array.isArray(schema.items) && schema.items.every((item) => isObject$3(item));
10099
10348
  }
10100
10349
 
10101
10350
  /**
@@ -10321,27 +10570,28 @@
10321
10570
  const { optionsSchemaSelector = selectorField } = getUiOptions(uiSchema);
10322
10571
  selectorField = optionsSchemaSelector;
10323
10572
  }
10324
- return (altSchemas &&
10325
- altSchemas.map((aSchemaDef, index) => {
10326
- const { title } = getUiOptions(altUiSchemas === null || altUiSchemas === void 0 ? void 0 : altUiSchemas[index]);
10327
- const aSchema = aSchemaDef;
10328
- let value;
10329
- let label = title;
10330
- if (selectorField) {
10331
- const innerSchema = get(aSchema, [PROPERTIES_KEY, selectorField], {});
10332
- value = get(innerSchema, DEFAULT_KEY, get(innerSchema, CONST_KEY));
10333
- label = label || (innerSchema === null || innerSchema === void 0 ? void 0 : innerSchema.title) || aSchema.title || String(value);
10334
- }
10335
- else {
10336
- value = toConstant(aSchema);
10337
- label = label || aSchema.title || String(value);
10338
- }
10339
- return {
10340
- schema: aSchema,
10341
- label,
10342
- value,
10343
- };
10344
- }));
10573
+ return altSchemas === null || altSchemas === void 0 ? void 0 : altSchemas.map((aSchemaDef, index) => {
10574
+ var _a, _b, _c;
10575
+ const { title } = getUiOptions(altUiSchemas === null || altUiSchemas === void 0 ? void 0 : altUiSchemas[index]);
10576
+ const aSchema = aSchemaDef;
10577
+ let value;
10578
+ let label = title;
10579
+ if (selectorField) {
10580
+ const innerSchema = get(aSchema, [PROPERTIES_KEY, selectorField], {});
10581
+ value = get(innerSchema, DEFAULT_KEY, get(innerSchema, CONST_KEY));
10582
+ // Use nullish coalescing so that an explicitly empty string title is preserved
10583
+ label = (_b = (_a = label !== null && label !== void 0 ? label : innerSchema === null || innerSchema === void 0 ? void 0 : innerSchema.title) !== null && _a !== void 0 ? _a : aSchema.title) !== null && _b !== void 0 ? _b : String(value);
10584
+ }
10585
+ else {
10586
+ value = toConstant(aSchema);
10587
+ label = (_c = label !== null && label !== void 0 ? label : aSchema.title) !== null && _c !== void 0 ? _c : String(value);
10588
+ }
10589
+ return {
10590
+ schema: aSchema,
10591
+ label,
10592
+ value,
10593
+ };
10594
+ });
10345
10595
  }
10346
10596
 
10347
10597
  /** Checks to see if the `schema` combination represents a select
@@ -10509,11 +10759,12 @@
10509
10759
  * @returns - The resulting `formData` with all the defaults provided
10510
10760
  */
10511
10761
  function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
10512
- const { parentDefaults, rawFormData, rootSchema = {}, includeUndefinedValues = false, _recurseList = [], experimental_defaultFormStateBehavior = undefined, experimental_customMergeAllOf = undefined, required, shouldMergeDefaultsIntoFormData = false, initialDefaultsGenerated, } = computeDefaultsProps;
10762
+ const { parentDefaults, rawFormData, rootSchema = {}, includeUndefinedValues = false, _recurseList = [], experimental_defaultFormStateBehavior, experimental_customMergeAllOf, required, shouldMergeDefaultsIntoFormData = false, initialDefaultsGenerated, } = computeDefaultsProps;
10513
10763
  let formData = (isObject$3(rawFormData) ? rawFormData : {});
10514
10764
  const schema = isObject$3(rawSchema) ? rawSchema : {};
10515
- // Compute the defaults recursively: give highest priority to deepest nodes.
10765
+ // Compute the defaults recursively: give highest priority to deepest nodes unless nestedDefaultsPrecedence is ancestorWins.
10516
10766
  let defaults = parentDefaults;
10767
+ const preferParentDefaults = defaults && (experimental_defaultFormStateBehavior === null || experimental_defaultFormStateBehavior === void 0 ? void 0 : experimental_defaultFormStateBehavior.nestedDefaultsPrecedence) === 'ancestorWins';
10517
10768
  // If we get a new schema, then we need to recompute defaults again for the new schema found.
10518
10769
  let schemaToCompute = null;
10519
10770
  let experimental_dfsb_to_compute = experimental_defaultFormStateBehavior;
@@ -10528,13 +10779,25 @@
10528
10779
  !schema[ANY_OF_KEY] &&
10529
10780
  !schema[ONE_OF_KEY] &&
10530
10781
  !schema[REF_KEY]) {
10531
- // For object defaults, only override parent defaults that are defined in
10532
- // schema.default. Skip this for anyOf/oneOf/$ref schemas - they need special handling.
10533
- defaults = mergeObjects(defaults, schema.default);
10782
+ // For object defaults, merge defaults by precedence setting.
10783
+ // Skip this for anyOf/oneOf/$ref schemas - they need special handling.
10784
+ if (preferParentDefaults) {
10785
+ // Use schema.default as the base and only override values that are defined in parent defaults.
10786
+ defaults = mergeObjects(schema.default, defaults);
10787
+ }
10788
+ else {
10789
+ // Only override parent defaults that are defined in schema.default.
10790
+ defaults = mergeObjects(defaults, schema.default);
10791
+ }
10534
10792
  }
10535
- else if (DEFAULT_KEY in schema && !schema[ANY_OF_KEY] && !schema[ONE_OF_KEY] && !schema[REF_KEY]) {
10536
- // If the schema has a default value, then we should use it as the default.
10537
- // And if the schema does not have anyOf or oneOf, this is done because we need to merge the defaults with the formData.
10793
+ else if (DEFAULT_KEY in schema &&
10794
+ !preferParentDefaults &&
10795
+ !schema[ANY_OF_KEY] &&
10796
+ !schema[ONE_OF_KEY] &&
10797
+ !schema[REF_KEY]) {
10798
+ // If the schema has a default value and parentDefaults does not have precedence
10799
+ // And if the schema does not have anyOf or oneOf (since we need to merge the defaults with the formData)
10800
+ // Then we should use it as the default.
10538
10801
  defaults = schema.default;
10539
10802
  }
10540
10803
  else if (REF_KEY in schema) {
@@ -10568,7 +10831,9 @@
10568
10831
  const resolvedSchema = resolveDependencies(validator, schema, rootSchema, false, [], defaultFormData, experimental_customMergeAllOf);
10569
10832
  [schemaToCompute] = resolvedSchema; // pick the first element from resolve dependencies
10570
10833
  }
10571
- else if (isFixedItems(schema)) {
10834
+ else if (isFixedItems(schema) && !preferParentDefaults) {
10835
+ // If the schema contains fixed items and parentDefaults does not have precedence
10836
+ // Then construct defaults from defaults of array items.
10572
10837
  defaults = schema.items.map((itemSchema, idx) => computeDefaults(validator, itemSchema, {
10573
10838
  rootSchema,
10574
10839
  includeUndefinedValues,
@@ -10654,17 +10919,31 @@
10654
10919
  * @returns - valid formData that matches schema
10655
10920
  */
10656
10921
  function ensureFormDataMatchingSchema(validator, schema, rootSchema, formData, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
10657
- const isSelectField = !isConstant(schema) && isSelect(validator, schema, rootSchema, experimental_customMergeAllOf);
10922
+ const shouldRetrieveAllOf = (experimental_defaultFormStateBehavior === null || experimental_defaultFormStateBehavior === void 0 ? void 0 : experimental_defaultFormStateBehavior.allOf) === 'populateDefaults' && ALL_OF_KEY in schema;
10923
+ const schemaToMatch = shouldRetrieveAllOf
10924
+ ? retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf)
10925
+ : schema;
10926
+ const isSelectField = !isConstant(schemaToMatch) &&
10927
+ isSelect(validator, schemaToMatch, rootSchema, experimental_customMergeAllOf);
10658
10928
  let validFormData = formData;
10659
10929
  if (isSelectField) {
10660
- const getOptionsList = optionsList(schema);
10930
+ const getOptionsList = optionsList(schemaToMatch);
10661
10931
  const isValid = getOptionsList === null || getOptionsList === void 0 ? void 0 : getOptionsList.some((option) => deepEquals(option.value, formData));
10662
10932
  validFormData = isValid ? formData : undefined;
10663
10933
  }
10664
10934
  // Override the formData with the const if the constAsDefaults is set to always
10665
- const constTakesPrecedence = schema[CONST_KEY] && (experimental_defaultFormStateBehavior === null || experimental_defaultFormStateBehavior === void 0 ? void 0 : experimental_defaultFormStateBehavior.constAsDefaults) === 'always';
10935
+ const constTakesPrecedence = schemaToMatch[CONST_KEY] && (experimental_defaultFormStateBehavior === null || experimental_defaultFormStateBehavior === void 0 ? void 0 : experimental_defaultFormStateBehavior.constAsDefaults) === 'always';
10666
10936
  if (constTakesPrecedence) {
10667
- validFormData = schema.const;
10937
+ validFormData = schemaToMatch.const;
10938
+ }
10939
+ else if (isObject$3(validFormData) && isObject$3(schemaToMatch.properties)) {
10940
+ validFormData = Object.keys(schemaToMatch.properties).reduce((acc, key) => {
10941
+ const propertySchema = get(schemaToMatch, [PROPERTIES_KEY, key], {});
10942
+ if (key in acc && (shouldRetrieveAllOf || (isObject$3(propertySchema) && ALL_OF_KEY in propertySchema))) {
10943
+ acc[key] = ensureFormDataMatchingSchema(validator, propertySchema, rootSchema, get(acc, key), experimental_defaultFormStateBehavior, experimental_customMergeAllOf);
10944
+ }
10945
+ return acc;
10946
+ }, { ...validFormData });
10668
10947
  }
10669
10948
  return validFormData;
10670
10949
  }
@@ -10676,7 +10955,7 @@
10676
10955
  * @param defaults - Optional props for this function
10677
10956
  * @returns - The default value based on the schema type if they are defined for object or array schemas.
10678
10957
  */
10679
- function getObjectDefaults(validator, rawSchema, { rawFormData, rootSchema = {}, includeUndefinedValues = false, _recurseList = [], experimental_defaultFormStateBehavior = undefined, experimental_customMergeAllOf = undefined, required, shouldMergeDefaultsIntoFormData, initialDefaultsGenerated, } = {}, defaults) {
10958
+ function getObjectDefaults(validator, rawSchema, { rawFormData, rootSchema = {}, includeUndefinedValues = false, _recurseList = [], experimental_defaultFormStateBehavior, experimental_customMergeAllOf, required, shouldMergeDefaultsIntoFormData, initialDefaultsGenerated, } = {}, defaults) {
10680
10959
  {
10681
10960
  const formData = (isObject$3(rawFormData) ? rawFormData : {});
10682
10961
  const schema = rawSchema;
@@ -10766,7 +11045,7 @@
10766
11045
  * @param initialDefaults - Optional props for this function
10767
11046
  * @returns - The default value based on the schema type if they are defined for object or array schemas.
10768
11047
  */
10769
- function getArrayDefaults(validator, rawSchema, { rawFormData, rootSchema = {}, _recurseList = [], experimental_defaultFormStateBehavior = undefined, experimental_customMergeAllOf = undefined, required, requiredAsRoot = false, shouldMergeDefaultsIntoFormData, initialDefaultsGenerated, } = {}, initialDefaults) {
11048
+ function getArrayDefaults(validator, rawSchema, { rawFormData, rootSchema = {}, _recurseList = [], experimental_defaultFormStateBehavior, experimental_customMergeAllOf, required, requiredAsRoot = false, shouldMergeDefaultsIntoFormData, initialDefaultsGenerated, } = {}, initialDefaults) {
10770
11049
  var _a, _b;
10771
11050
  let defaults = initialDefaults;
10772
11051
  const schema = rawSchema;
@@ -10820,7 +11099,14 @@
10820
11099
  defaults = mergeDefaultsWithFormData(defaults, itemDefaults, mergeExtraDefaults);
10821
11100
  }
10822
11101
  }
11102
+ const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
10823
11103
  if (neverPopulate) {
11104
+ if (shouldMergeDefaultsIntoFormData && !required) {
11105
+ // Optional arrays with no existing data should be omitted entirely rather than defaulted to `[]`.
11106
+ // Required arrays still fall through to `defaults ?? emptyDefault` below so that `[]` is surfaced,
11107
+ // letting the validator report `minItems` violations instead of a missing-required-property error.
11108
+ return defaults;
11109
+ }
10824
11110
  return defaults !== null && defaults !== void 0 ? defaults : emptyDefault;
10825
11111
  }
10826
11112
  if (ignoreMinItemsFlagSet && !required) {
@@ -10829,7 +11115,6 @@
10829
11115
  return defaults || undefined;
10830
11116
  }
10831
11117
  let arrayDefault;
10832
- const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
10833
11118
  if (!schema.minItems ||
10834
11119
  isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) ||
10835
11120
  computeSkipPopulate(validator, schema, rootSchema) ||
@@ -10921,7 +11206,8 @@
10921
11206
  if (isObject$3(formData) || Array.isArray(formData)) {
10922
11207
  const { mergeDefaultsIntoFormData } = experimental_defaultFormStateBehavior || {};
10923
11208
  const defaultSupercedesUndefined = mergeDefaultsIntoFormData === 'useDefaultIfFormDataUndefined';
10924
- const result = mergeDefaultsWithFormData(defaults, formData, true, // set to true to add any additional default array entries.
11209
+ const matchingFormData = ensureFormDataMatchingSchema(validator, schema, rootSchema !== null && rootSchema !== void 0 ? rootSchema : schema, formData, experimental_defaultFormStateBehavior, experimental_customMergeAllOf);
11210
+ const result = mergeDefaultsWithFormData(defaults, matchingFormData, true, // set to true to add any additional default array entries.
10925
11211
  defaultSupercedesUndefined, true);
10926
11212
  return result;
10927
11213
  }
@@ -10977,7 +11263,7 @@
10977
11263
  let displayLabel = Boolean(label);
10978
11264
  if (displayLabel) {
10979
11265
  const schemaType = getSchemaType(schema);
10980
- const addedByAdditionalProperty = get(schema, ADDITIONAL_PROPERTY_FLAG, false);
11266
+ const addedByAdditionalProperty = Boolean(schema[ADDITIONAL_PROPERTY_FLAG]);
10981
11267
  if (schemaType === 'array') {
10982
11268
  displayLabel =
10983
11269
  addedByAdditionalProperty ||
@@ -10991,7 +11277,7 @@
10991
11277
  if (schemaType === 'boolean' && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
10992
11278
  displayLabel = false;
10993
11279
  }
10994
- if (uiSchema && uiSchema[UI_FIELD_KEY]) {
11280
+ if (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[UI_FIELD_KEY]) {
10995
11281
  displayLabel = false;
10996
11282
  }
10997
11283
  }
@@ -11441,6 +11727,17 @@
11441
11727
  }
11442
11728
  if (allOf) {
11443
11729
  localSchema = doMergeAllOf(localSchema, experimental_customMergeAllOf);
11730
+ // Schemas whose allOf entries contain if/then/else keywords may not fully merge: the merger
11731
+ // can only hoist one if/then/else triple to the parent level, so additional entries stay in
11732
+ // allOf. Process any that remain so their conditional properties are not silently dropped.
11733
+ // See: https://github.com/rjsf-team/react-jsonschema-form/issues/5142
11734
+ const remainingAllOf = localSchema.allOf;
11735
+ if (remainingAllOf) {
11736
+ for (let i = 0; i < remainingAllOf.length; i++) {
11737
+ // oxlint-disable-next-line no-param-reassign
11738
+ target = omit(remainingAllOf[i], source, target);
11739
+ }
11740
+ }
11444
11741
  }
11445
11742
  let filtered = handleAnyOf(localSchema, source, handleOneOf(localSchema.oneOf, localSchema, source, target));
11446
11743
  const type = getSchemaType(localSchema);
@@ -11787,7 +12084,7 @@
11787
12084
  * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
11788
12085
  */
11789
12086
  constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
11790
- if (rootSchema && rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
12087
+ if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema[SCHEMA_KEY]) === JSON_SCHEMA_DRAFT_2020_12) {
11791
12088
  this.rootSchema = makeAllReferencesAbsolute(rootSchema, get(rootSchema, ID_KEY, '#'));
11792
12089
  }
11793
12090
  else {
@@ -12768,7 +13065,7 @@
12768
13065
  */
12769
13066
  function getSubmitButtonOptions(uiSchema = {}) {
12770
13067
  const uiOptions = getUiOptions(uiSchema);
12771
- if (uiOptions && uiOptions[SUBMIT_BTN_OPTIONS_KEY]) {
13068
+ if (uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions[SUBMIT_BTN_OPTIONS_KEY]) {
12772
13069
  const options = uiOptions[SUBMIT_BTN_OPTIONS_KEY];
12773
13070
  return { ...DEFAULT_OPTIONS, ...options };
12774
13071
  }
@@ -12965,11 +13262,12 @@
12965
13262
  * @returns - The wrapper widget
12966
13263
  */
12967
13264
  function mergeWidgetOptions(AWidget) {
13265
+ var _a;
12968
13266
  let MergedWidget = get(AWidget, 'MergedWidget');
12969
13267
  // cache return value as property of widget for proper react reconciliation
12970
13268
  if (!MergedWidget) {
12971
13269
  // oxlint-disable-next-line typescript/no-deprecated
12972
- const defaultOptions = (AWidget.defaultProps && AWidget.defaultProps.options) || {};
13270
+ const defaultOptions = ((_a = AWidget.defaultProps) === null || _a === void 0 ? void 0 : _a.options) || {};
12973
13271
  MergedWidget = ({ options, ...props }) => jsxRuntimeExports.jsx(AWidget, { options: { ...defaultOptions, ...options }, ...props });
12974
13272
  set(AWidget, 'MergedWidget', MergedWidget);
12975
13273
  }
@@ -13056,12 +13354,14 @@
13056
13354
  }
13057
13355
  /** Stringifies the schema and returns the hash of the resulting string. Sorts schema fields
13058
13356
  * in consistent order before stringify to prevent different hash ids for the same schema.
13357
+ * Symbol-keyed properties (RJSF_REF_KEY, RJSF_REF_CYCLE_KEY, ADDITIONAL_PROPERTY_FLAG) are
13358
+ * automatically excluded by JSON.stringify, so no special filtering is needed.
13059
13359
  *
13060
13360
  * @param schema - The schema for which the hash is desired
13061
13361
  * @returns - The string obtained from the hash of the stringified schema
13062
13362
  */
13063
13363
  function hashForSchema(schema) {
13064
- return hashObject(schema);
13364
+ return hashString(sortedJSONStringify(schema));
13065
13365
  }
13066
13366
 
13067
13367
  /** Detects whether the `widget` exists for the `schema` with the associated `registryWidgets` and returns true if it
@@ -13203,7 +13503,7 @@
13203
13503
  }
13204
13504
  if (REF_KEY in rootSchema) {
13205
13505
  const resolvedSchema = schemaUtils.retrieveSchema(rootSchema);
13206
- return deepEquals(schemaToCompare, omit(resolvedSchema, RJSF_REF_KEY));
13506
+ return deepEquals(schemaToCompare, resolvedSchema);
13207
13507
  }
13208
13508
  return false;
13209
13509
  }
@@ -13221,6 +13521,23 @@
13221
13521
  return dateString ? new Date(dateString).toJSON() : undefined;
13222
13522
  }
13223
13523
 
13524
+ /** Logs a warning when a single-select enum widget has a schema default that is not one of its enum options.
13525
+ *
13526
+ * @param id - The field id used in the warning message
13527
+ * @param schema - The schema whose default value is checked
13528
+ * @param enumOptions - The enum options available to the widget
13529
+ * @param multiple - Whether the widget allows multiple selections
13530
+ */
13531
+ function logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple = false) {
13532
+ if (!multiple &&
13533
+ Array.isArray(enumOptions) &&
13534
+ schema.default !== undefined &&
13535
+ enumOptionsIndexForValue(schema.default, enumOptions, multiple) === undefined) {
13536
+ // oxlint-disable-next-line no-console
13537
+ console.error(`The schema default value "${schema.default}" is not one of the values in the enum options for "${id}"`);
13538
+ }
13539
+ }
13540
+
13224
13541
  /** Given a React JSON Schema Form registry or formContext object, return the value associated with `toLookup`. This
13225
13542
  * might be contained within the lookup map in the formContext. If no such value exists, return the `fallback`
13226
13543
  * value.
@@ -13387,20 +13704,21 @@
13387
13704
  * @returns - True if the schema specifies a value that must be true, false otherwise
13388
13705
  */
13389
13706
  function schemaRequiresTrueValue(schema) {
13707
+ var _a, _b, _c;
13390
13708
  // Check if const is a truthy value
13391
13709
  if (schema.const) {
13392
13710
  return true;
13393
13711
  }
13394
13712
  // Check if an enum has a single value of true
13395
- if (schema.enum && schema.enum.length === 1 && schema.enum[0] === true) {
13713
+ if (((_a = schema.enum) === null || _a === void 0 ? void 0 : _a.length) === 1 && schema.enum[0] === true) {
13396
13714
  return true;
13397
13715
  }
13398
13716
  // If anyOf has a single value, evaluate the subschema
13399
- if (schema.anyOf && schema.anyOf.length === 1) {
13717
+ if (((_b = schema.anyOf) === null || _b === void 0 ? void 0 : _b.length) === 1) {
13400
13718
  return schemaRequiresTrueValue(schema.anyOf[0]);
13401
13719
  }
13402
13720
  // If oneOf has a single value, evaluate the subschema
13403
- if (schema.oneOf && schema.oneOf.length === 1) {
13721
+ if (((_c = schema.oneOf) === null || _c === void 0 ? void 0 : _c.length) === 1) {
13404
13722
  return schemaRequiresTrueValue(schema.oneOf[0]);
13405
13723
  }
13406
13724
  // Evaluate each subschema in allOf, to see if one of them requires a true value
@@ -13411,6 +13729,25 @@
13411
13729
  return false;
13412
13730
  }
13413
13731
 
13732
+ /** Renders the description associated with the selected oneOf or anyOf option in a single-select widget. */
13733
+ function SelectedOptionDescription({ hideLabel, id, multiple, options, registry, uiSchema, value }) {
13734
+ var _a, _b;
13735
+ if (multiple || hideLabel) {
13736
+ return null;
13737
+ }
13738
+ const { label = true } = getUiOptions(uiSchema, registry.globalUiOptions);
13739
+ if (!label) {
13740
+ return null;
13741
+ }
13742
+ const option = (_a = options.enumOptions) === null || _a === void 0 ? void 0 : _a.find(({ value: enumValue }) => enumOptionsIsSelected(enumValue, value));
13743
+ const description = (_b = option === null || option === void 0 ? void 0 : option.schema) === null || _b === void 0 ? void 0 : _b.description;
13744
+ if (!description) {
13745
+ return null;
13746
+ }
13747
+ const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
13748
+ return (jsxRuntimeExports.jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: option.schema, uiSchema: uiSchema, registry: registry }));
13749
+ }
13750
+
13414
13751
  /** Implements a shallow equals comparison that uses Object.is() for comparing values.
13415
13752
  * This function compares objects by checking if all keys and their values are equal using Object.is().
13416
13753
  *
@@ -13763,7 +14100,7 @@
13763
14100
  * @param file - The `File` information to read
13764
14101
  * @returns - A promise that resolves to the read file.
13765
14102
  */
13766
- function processFile(file) {
14103
+ async function processFile(file) {
13767
14104
  const { name, size, type } = file;
13768
14105
  return new Promise((resolve, reject) => {
13769
14106
  const reader = new window.FileReader();
@@ -13795,7 +14132,7 @@
13795
14132
  * @param files - The list of files to read
13796
14133
  * @returns - The list of read files
13797
14134
  */
13798
- function processFiles(files) {
14135
+ async function processFiles(files) {
13799
14136
  return Promise.all(Array.from(files).map(processFile));
13800
14137
  }
13801
14138
  /** Extracts the file information from the data URLs
@@ -13989,6 +14326,8 @@
13989
14326
  TranslatableString["AddItemButton"] = "Add Item";
13990
14327
  /** Copy button title, used by IconButton */
13991
14328
  TranslatableString["CopyButton"] = "Copy";
14329
+ /** Expand cycle button title */
14330
+ TranslatableString["ExpandButton"] = "Expand Cycle";
13992
14331
  /** Move down button title, used by IconButton */
13993
14332
  TranslatableString["MoveDownButton"] = "Move down";
13994
14333
  /** Move up button title, used by IconButton */
@@ -14032,6 +14371,8 @@
14032
14371
  TranslatableString["KeyLabel"] = "%1 Key";
14033
14372
  /** Deprecated label, where %1 will be replaced by the label as provided by SchemaField */
14034
14373
  TranslatableString["DeprecatedLabel"] = "%1 (deprecated)";
14374
+ /** Cyclic schema message */
14375
+ TranslatableString["CycleDetected"] = "Circular reference ($ref cycle) detected for field \"%1\". You may choose to expand to the next cycle break";
14035
14376
  // Strings with replaceable parameters AND/OR that support markdown and html
14036
14377
  /** Invalid object field configuration as provided by the ObjectField.
14037
14378
  * NOTE: Use markdown notation rather than html tags.
@@ -14841,6 +15182,25 @@
14841
15182
  return (jsxRuntimeExports.jsx(Widget, { options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, id: fieldPathId.$id, name: name, onChange: onWidgetChange, onFocus: onFocus, onBlur: onBlur, label: label, hideLabel: !displayLabel, value: formData, required: required, disabled: disabled, readonly: readonly, hideError: hideError, registry: registry, autofocus: autofocus, rawErrors: rawErrors, htmlName: fieldPathId.name }));
14842
15183
  }
14843
15184
 
15185
+ /** The `CyclicSchemaField` component is used to render a field in the schema that is marked with RJSF_REF_CYCLE_KEY ===
15186
+ * true
15187
+ *
15188
+ * @param props - The `FieldProps` for this template
15189
+ */
15190
+ function CyclicSchemaField(props) {
15191
+ const [expanded, setExpanded] = reactExports.useState(false);
15192
+ const { name, registry, schema, uiSchema, fieldPathId } = props;
15193
+ const { globalUiOptions } = registry;
15194
+ const uiOptions = getUiOptions(uiSchema, globalUiOptions);
15195
+ const CyclicSchemaExpandTemplate = getTemplate('CyclicSchemaExpandTemplate', registry, uiOptions);
15196
+ if (!expanded) {
15197
+ return (jsxRuntimeExports.jsx(CyclicSchemaExpandTemplate, { registry: registry, schema: schema, uiSchema: uiSchema, name: name, fieldPathId: fieldPathId, onExpand: () => setExpanded(true) }));
15198
+ }
15199
+ const { fields } = registry;
15200
+ const { SchemaField } = fields;
15201
+ return jsxRuntimeExports.jsx(SchemaField, { ...props, schema: { ...schema, [RJSF_REF_CYCLE_KEY]: false } });
15202
+ }
15203
+
14844
15204
  /**
14845
15205
  * Get the schema for the type selection component.
14846
15206
  * @param title - The translated title for the type selection schema.
@@ -15987,85 +16347,60 @@
15987
16347
  *
15988
16348
  * @param props - The `FieldProps` for this template
15989
16349
  */
15990
- class AnyOfField extends reactExports.Component {
16350
+ function AnyOfField(props) {
16351
+ const { name, disabled = false, errorSchema = {}, formData, fieldPathId, onBlur, onChange, onFocus, options, readonly, registry, required = false, schema, uiSchema, } = props;
16352
+ const { schemaUtils } = registry;
16353
+ // Hash formData by value so the memo only invalidates when data actually changes, not on every
16354
+ // new object reference. hashObject(undefined) throws, so null is used as the fallback.
16355
+ const formDataHash = hashObject(formData ?? null);
16356
+ // retrievedOptions is purely derived from options — useMemo handles re-derivation automatically
16357
+ // when options, schemaUtils, or formData's value changes, with no render-phase dispatch needed.
16358
+ const retrievedOptions = reactExports.useMemo(() => options.map((opt) => schemaUtils.retrieveSchema(opt, formData)),
16359
+ // oxlint-disable-next-line react-hooks/exhaustive-deps -- formDataHash is the value-stable proxy for formData
16360
+ [options, schemaUtils, formDataHash]);
16361
+ const [selectedOption, setSelectedOption] = reactExports.useState(() => {
16362
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
16363
+ return schemaUtils.getClosestMatchingOption(formData, retrievedOptions, 0, discriminator);
16364
+ });
15991
16365
  /** Flag to skip the formData-change-driven option recalculation when the user just selected an option.
15992
- * Set to true in the setState callback of onOptionChange (after onChange is called), consumed and reset in
15993
- * componentDidUpdate. This prevents the matching-option recalculation from overriding a user's explicit choice
15994
- * when getDefaultFormState populates undefined properties that make deepEquals see a false formData change.
15995
- */
15996
- skipNextOptionRecalculation = false;
15997
- /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
15998
- *
15999
- * @param props - The `FieldProps` for this template
16366
+ * Set to true in onOptionChange (before onChange is called), consumed and reset in the update effect.
16367
+ * This prevents the matching-option recalculation from overriding a user's explicit choice when
16368
+ * getDefaultFormState populates undefined properties that make deepEquals see a false formData change.
16000
16369
  */
16001
- constructor(props) {
16002
- super(props);
16003
- const { formData, options, registry: { schemaUtils }, } = this.props;
16004
- // cache the retrieved options in state in case they have $refs to save doing it later
16005
- const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
16006
- this.state = {
16007
- retrievedOptions,
16008
- selectedOption: this.getMatchingOption(0, formData, retrievedOptions),
16009
- };
16010
- }
16011
- /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the
16012
- * currently selected option based on the overall `formData`
16013
- *
16014
- * @param prevProps - The previous `FieldProps` for this template
16015
- * @param prevState - The previous `AnyOfFieldState` for this template
16016
- */
16017
- componentDidUpdate(prevProps, prevState) {
16018
- const { formData, options, fieldPathId } = this.props;
16019
- const { selectedOption } = this.state;
16020
- let newState = this.state;
16021
- if (!deepEquals(prevProps.options, options)) {
16022
- const { registry: { schemaUtils }, } = this.props;
16023
- // re-cache the retrieved options in state in case they have $refs to save doing it later
16024
- const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
16025
- newState = { selectedOption, retrievedOptions };
16026
- }
16027
- if (!deepEquals(formData, prevProps.formData) && fieldPathId.$id === prevProps.fieldPathId.$id) {
16028
- if (this.skipNextOptionRecalculation) {
16029
- this.skipNextOptionRecalculation = false;
16370
+ const skipNextOptionRecalculation = reactExports.useRef(false);
16371
+ const prevFormDataRef = reactExports.useRef(formData);
16372
+ const prevFieldIdRef = reactExports.useRef(fieldPathId.$id);
16373
+ // Mirrors componentDidUpdate: re-match selectedOption when formData changes on the same field.
16374
+ // Runs after every render (no deps array) to compare against prev values stored in refs.
16375
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
16376
+ reactExports.useEffect(() => {
16377
+ const prevFormData = prevFormDataRef.current;
16378
+ const prevFieldId = prevFieldIdRef.current;
16379
+ prevFormDataRef.current = formData;
16380
+ prevFieldIdRef.current = fieldPathId.$id;
16381
+ if (!deepEquals(formData, prevFormData) && fieldPathId.$id === prevFieldId) {
16382
+ if (skipNextOptionRecalculation.current) {
16383
+ skipNextOptionRecalculation.current = false;
16384
+ return;
16030
16385
  }
16031
- else {
16032
- const { retrievedOptions } = newState;
16033
- const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
16034
- if (prevState && matchingOption !== selectedOption) {
16035
- newState = { selectedOption: matchingOption, retrievedOptions };
16036
- }
16386
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
16387
+ const matchingOption = schemaUtils.getClosestMatchingOption(formData, retrievedOptions, selectedOption, discriminator);
16388
+ if (matchingOption !== selectedOption) {
16389
+ setSelectedOption(matchingOption);
16037
16390
  }
16038
16391
  }
16039
- if (newState !== this.state) {
16040
- // oxlint-disable-next-line react/no-did-update-set-state -- guarded to prevent infinite loop
16041
- this.setState(newState);
16042
- }
16043
- }
16044
- /** Determines the best matching option for the given `formData` and `options`.
16045
- *
16046
- * @param formData - The new formData
16047
- * @param options - The list of options to choose from
16048
- * @return - The index of the `option` that best matches the `formData`
16049
- */
16050
- getMatchingOption(selectedOption, formData, options) {
16051
- const { schema, registry: { schemaUtils }, } = this.props;
16052
- const discriminator = getDiscriminatorFieldFromSchema(schema);
16053
- const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
16054
- return option;
16055
- }
16392
+ });
16393
+ const fieldId = `${fieldPathId.$id}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`;
16056
16394
  /** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
16057
16395
  * to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
16058
16396
  * the `onChange` handler.
16059
16397
  *
16060
16398
  * @param option - The new option value being selected
16061
16399
  */
16062
- onOptionChange = (option) => {
16063
- const { selectedOption, retrievedOptions } = this.state;
16064
- const { disabled = false, formData, onChange, readonly = false, registry, fieldPathId } = this.props;
16400
+ const onOptionChange = reactExports.useCallback((option) => {
16065
16401
  if (disabled || readonly) {
16066
16402
  return;
16067
16403
  }
16068
- const { schemaUtils } = registry;
16069
16404
  const intOption = option !== undefined ? parseInt(option, 10) : -1;
16070
16405
  if (intOption === selectedOption) {
16071
16406
  return;
@@ -16078,80 +16413,81 @@
16078
16413
  // so that only the root objects themselves are created without adding undefined children properties
16079
16414
  newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
16080
16415
  }
16081
- this.setState({ selectedOption: intOption }, () => {
16082
- this.skipNextOptionRecalculation = true;
16083
- onChange(newFormData, fieldPathId.path, undefined, this.getFieldId());
16084
- });
16085
- };
16086
- getFieldId() {
16087
- const { fieldPathId, schema } = this.props;
16088
- return `${fieldPathId.$id}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`;
16416
+ setSelectedOption(intOption);
16417
+ skipNextOptionRecalculation.current = true;
16418
+ onChange(newFormData, fieldPathId.path, undefined, fieldId);
16419
+ },
16420
+ // setSelectedOption is stable (guaranteed by useState); skipNextOptionRecalculation is a ref
16421
+ [selectedOption, retrievedOptions, disabled, readonly, schemaUtils, formData, fieldPathId, onChange, fieldId]);
16422
+ const { widgets, fields, translateString, globalUiOptions } = registry;
16423
+ const { SchemaField: SchemaFieldComponent } = fields;
16424
+ const MultiSchemaFieldTemplate = getTemplate('MultiSchemaFieldTemplate', registry, globalUiOptions);
16425
+ const isOptionalRender = shouldRenderOptionalField(registry, schema, required, uiSchema);
16426
+ const hasFormData = isFormDataAvailable(formData);
16427
+ const { widget = 'select', placeholder, autofocus, autocomplete, title = schema.title, ...uiOptions } = getUiOptions(uiSchema, globalUiOptions);
16428
+ const Widget = getWidget({ type: 'number' }, widget, widgets);
16429
+ const rawErrors = get(errorSchema, ERRORS_KEY, []);
16430
+ const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
16431
+ const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
16432
+ const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
16433
+ let optionSchema;
16434
+ if (option) {
16435
+ const { required: schemaRequired, type: schemaType } = schema;
16436
+ const parentProps = {};
16437
+ if (schemaRequired) {
16438
+ parentProps.required = schemaRequired;
16439
+ }
16440
+ // Propagate the parent schema type to options that don't define their own.
16441
+ // This is necessary when the parent constrains the type (e.g. { type: 'string',
16442
+ // oneOf: [{ pattern: '...' }, { pattern: '...' }] }) but the option sub-schemas
16443
+ // omit the type — without it, getSchemaType returns undefined and the option
16444
+ // renders as FallbackField instead of the correct widget (e.g. StringField).
16445
+ if (schemaType !== undefined && !('type' in option)) {
16446
+ parentProps.type = schemaType;
16447
+ }
16448
+ // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property
16449
+ optionSchema = Object.keys(parentProps).length > 0 ? mergeSchemas(parentProps, option) : option;
16450
+ }
16451
+ // First we will check to see if there is an anyOf/oneOf override for the UI schema
16452
+ let optionsUiSchema = [];
16453
+ if (ONE_OF_KEY in schema && uiSchema && ONE_OF_KEY in uiSchema) {
16454
+ if (Array.isArray(uiSchema[ONE_OF_KEY])) {
16455
+ optionsUiSchema = uiSchema[ONE_OF_KEY];
16456
+ }
16457
+ else {
16458
+ // oxlint-disable-next-line no-console
16459
+ console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
16460
+ }
16089
16461
  }
16090
- /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
16091
- */
16092
- render() {
16093
- const { name, disabled = false, errorSchema = {}, formData, onBlur, onFocus, readonly, required = false, registry, schema, uiSchema, } = this.props;
16094
- const { widgets, fields, translateString, globalUiOptions, schemaUtils } = registry;
16095
- const { SchemaField: SchemaFieldComponent } = fields;
16096
- const MultiSchemaFieldTemplate = getTemplate('MultiSchemaFieldTemplate', registry, globalUiOptions);
16097
- const isOptionalRender = shouldRenderOptionalField(registry, schema, required, uiSchema);
16098
- const hasFormData = isFormDataAvailable(formData);
16099
- const { selectedOption, retrievedOptions } = this.state;
16100
- const { widget = 'select', placeholder, autofocus, autocomplete, title = schema.title, ...uiOptions } = getUiOptions(uiSchema, globalUiOptions);
16101
- const Widget = getWidget({ type: 'number' }, widget, widgets);
16102
- const rawErrors = get(errorSchema, ERRORS_KEY, []);
16103
- const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
16104
- const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
16105
- const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
16106
- let optionSchema;
16107
- if (option) {
16108
- // merge top level required field
16109
- const { required: schemaRequired } = schema;
16110
- // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property
16111
- optionSchema = schemaRequired ? mergeSchemas({ required: schemaRequired }, option) : option;
16112
- }
16113
- // First we will check to see if there is an anyOf/oneOf override for the UI schema
16114
- let optionsUiSchema = [];
16115
- if (ONE_OF_KEY in schema && uiSchema && ONE_OF_KEY in uiSchema) {
16116
- if (Array.isArray(uiSchema[ONE_OF_KEY])) {
16117
- optionsUiSchema = uiSchema[ONE_OF_KEY];
16118
- }
16119
- else {
16120
- // oxlint-disable-next-line no-console
16121
- console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
16122
- }
16462
+ else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {
16463
+ if (Array.isArray(uiSchema[ANY_OF_KEY])) {
16464
+ optionsUiSchema = uiSchema[ANY_OF_KEY];
16123
16465
  }
16124
- else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {
16125
- if (Array.isArray(uiSchema[ANY_OF_KEY])) {
16126
- optionsUiSchema = uiSchema[ANY_OF_KEY];
16127
- }
16128
- else {
16129
- // oxlint-disable-next-line no-console
16130
- console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
16131
- }
16466
+ else {
16467
+ // oxlint-disable-next-line no-console
16468
+ console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
16132
16469
  }
16133
- // Then we pick the one that matches the selected option index, if one exists otherwise default to the main uiSchema
16134
- let optionUiSchema = uiSchema;
16135
- if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
16136
- optionUiSchema = optionsUiSchema[selectedOption];
16137
- }
16138
- const translateEnum = title
16139
- ? TranslatableString.TitleOptionPrefix
16140
- : TranslatableString.OptionPrefix;
16141
- const translateParams = title ? [title] : [];
16142
- const enumOptions = retrievedOptions.map((opt, index) => {
16143
- // Also see if there is an override title in the uiSchema for each option, otherwise use the title from the option
16144
- const { title: uiTitle = opt.title } = getUiOptions(optionsUiSchema[index]);
16145
- return {
16146
- label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
16147
- value: index,
16148
- };
16149
- });
16150
- const selector = !isOptionalRender || hasFormData ? (jsxRuntimeExports.jsx(Widget, { id: this.getFieldId(), name: `${name}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`, schema: { type: 'number', default: 0 }, onChange: this.onOptionChange, onBlur: onBlur, onFocus: onFocus, disabled: disabled || isEmpty$1(enumOptions), multiple: false, rawErrors: rawErrors, errorSchema: fieldErrorSchema, value: selectedOption >= 0 ? selectedOption : undefined, options: { enumOptions, ...uiOptions }, registry: registry, placeholder: placeholder, autocomplete: autocomplete, autofocus: autofocus, label: title ?? name, hideLabel: !displayLabel, readonly: readonly })) : undefined;
16151
- const optionsSchemaField = (optionSchema && optionSchema.type !== 'null' && (jsxRuntimeExports.jsx(SchemaFieldComponent, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }))) ||
16152
- null;
16153
- return (jsxRuntimeExports.jsx(MultiSchemaFieldTemplate, { schema: schema, registry: registry, uiSchema: uiSchema, selector: selector, optionSchemaField: optionsSchemaField }));
16154
16470
  }
16471
+ // Then we pick the one that matches the selected option index, if one exists otherwise default to the main uiSchema
16472
+ let optionUiSchema = uiSchema;
16473
+ if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
16474
+ optionUiSchema = optionsUiSchema[selectedOption];
16475
+ }
16476
+ const translateEnum = title
16477
+ ? TranslatableString.TitleOptionPrefix
16478
+ : TranslatableString.OptionPrefix;
16479
+ const translateParams = title ? [title] : [];
16480
+ const enumOptions = retrievedOptions.map((opt, index) => {
16481
+ const { title: uiTitle = opt.title } = getUiOptions(optionsUiSchema[index]);
16482
+ return {
16483
+ label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
16484
+ value: index,
16485
+ };
16486
+ });
16487
+ const selector = !isOptionalRender || hasFormData ? (jsxRuntimeExports.jsx(Widget, { id: fieldId, name: `${name}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`, schema: { type: 'number', default: 0 }, onChange: onOptionChange, onBlur: onBlur, onFocus: onFocus, disabled: disabled || isEmpty$1(enumOptions), multiple: false, rawErrors: rawErrors, errorSchema: fieldErrorSchema, value: selectedOption >= 0 ? selectedOption : undefined, options: { enumOptions, ...uiOptions }, registry: registry, placeholder: placeholder, autocomplete: autocomplete, autofocus: autofocus, label: title ?? name, hideLabel: !displayLabel, readonly: readonly })) : undefined;
16488
+ const optionsSchemaField = (optionSchema && optionSchema.type !== 'null' && (jsxRuntimeExports.jsx(SchemaFieldComponent, { ...props, schema: optionSchema, uiSchema: optionUiSchema }))) ||
16489
+ null;
16490
+ return (jsxRuntimeExports.jsx(MultiSchemaFieldTemplate, { schema: schema, registry: registry, uiSchema: uiSchema, selector: selector, optionSchemaField: optionsSchemaField }));
16155
16491
  }
16156
16492
 
16157
16493
  /** The `NullField` component is used to render a field in the schema is null. It also ensures that the `formData` is
@@ -16169,15 +16505,8 @@
16169
16505
  return null;
16170
16506
  }
16171
16507
 
16172
- // Matches a string that ends in a . character, optionally followed by a sequence of
16173
- // digits followed by any number of 0 characters up until the end of the line.
16174
- // Ensuring that there is at least one prefixed character is important so that
16175
- // you don't incorrectly match against "0".
16508
+ // Static matchers for standard '.' separator used during normalization inside handleChange
16176
16509
  const trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
16177
- // This is used for trimming the trailing 0 and . characters without affecting
16178
- // the rest of the string. Its possible to use one RegEx with groups for this
16179
- // functionality, but it is fairly complex compared to simply defining two
16180
- // different matchers.
16181
16510
  const trailingCharMatcher = /[0.]0*$/;
16182
16511
  /**
16183
16512
  * The NumberField class has some special handling for dealing with trailing
@@ -16200,6 +16529,8 @@
16200
16529
  const { registry, onChange, formData, value: initialValue } = props;
16201
16530
  const [lastValue, setLastValue] = reactExports.useState(initialValue);
16202
16531
  const { StringField } = registry.fields;
16532
+ const separator = getDecimalSeparator();
16533
+ const escapedSeparator = separator === '.' ? '\\.' : separator;
16203
16534
  let value = formData;
16204
16535
  /** Handle the change from the `StringField` to properly convert to a number
16205
16536
  *
@@ -16208,79 +16539,98 @@
16208
16539
  const handleChange = reactExports.useCallback((newValue, path, errorSchema, id) => {
16209
16540
  // Cache the original value in component state
16210
16541
  setLastValue(newValue);
16542
+ // Convert locale separator to standard '.' first
16543
+ const standardValue = typeof newValue === 'string' ? newValue.replace(separator, '.') : newValue;
16211
16544
  // Normalize decimals that don't start with a zero character in advance so
16212
16545
  // that the rest of the normalization logic is simpler
16213
- const normalizedValue = `${newValue}`.startsWith('.') ? `0${newValue}` : newValue;
16546
+ const normalizedValue = `${standardValue}`.startsWith('.') ? `0${standardValue}` : standardValue;
16214
16547
  // Check that the value is a string (this can happen if the widget used is a
16215
16548
  // <select>, due to an enum declaration etc) then, if the value ends in a
16216
16549
  // trailing decimal point or multiple zeroes, strip the trailing values
16217
- const processed = typeof normalizedValue === 'string' && normalizedValue.match(trailingCharMatcherWithPrefix)
16550
+ const processed = typeof normalizedValue === 'string' && trailingCharMatcherWithPrefix.exec(normalizedValue)
16218
16551
  ? asNumber(normalizedValue.replace(trailingCharMatcher, ''))
16219
16552
  : asNumber(normalizedValue);
16220
16553
  onChange(processed, path, errorSchema, id);
16221
- }, [onChange]);
16554
+ }, [onChange, separator]);
16222
16555
  if (typeof lastValue === 'string' && typeof value === 'number') {
16223
16556
  // Construct a regular expression that checks for a string that consists
16224
- // of the formData value suffixed with zero or one '.' characters and zero
16557
+ // of the formData value suffixed with zero or one locale separator characters and zero
16225
16558
  // or more '0' characters
16226
- const re = new RegExp(`^(${String(value).replace('.', '\\.')})?\\.?0*$`);
16559
+ const re = new RegExp(`^(${String(value).replace('.', escapedSeparator)})?${escapedSeparator}?0*$`);
16227
16560
  // If the cached "lastValue" is a match, use that instead of the formData
16228
16561
  // value to prevent the input value from changing in the UI
16229
16562
  if (lastValue.match(re)) {
16230
16563
  value = lastValue;
16231
16564
  }
16232
16565
  }
16233
- return jsxRuntimeExports.jsx(StringField, { ...props, formData: value, onChange: handleChange });
16234
- }
16235
-
16236
- var j;function B$2(z){if(!j)if(typeof document<"u")j=document.createElement("textarea");else return;var q="&"+z+";";j.innerHTML=q;var v=j.value;return v!==q?v:void 0}
16237
-
16238
- var b=32,R=9,B9=13,x=10,$0=96,A0=126,O0=91,e0=94,c=62,J9=35,G$=37,p$1=45,C0=61,N0=92,B0=42,z0=95,Z0=60,K$=64,p0=93,g0=33,S$=38,x0=58,g$=70,j9=102,m9=104,W9=119,h9=116,H$=112,x$=115,G6=160,K6=12,q6=44,E$=59,i9=63,d0=46,j0=47,S9=39,M9=34,A9=43,w0=124,g9=123,O$=125,$9=40,Z9=41,a9=30,D$=31,o=48,i=57,d=65,l$1=90,F0=97,H0=122,n9=128,i0=32,wZ={blockQuote:0,breakLine:1,breakThematic:2,codeBlock:3,codeInline:4,footnote:5,footnoteReference:6,frontmatter:7,gfmTask:8,heading:9,htmlBlock:10,htmlComment:11,htmlSelfClosing:12,image:13,link:14,orderedList:15,paragraph:16,ref:17,refCollection:18,table:19,text:20,textFormatted:21,unorderedList:22},v$1=wZ;function H6($){if(!U6($,"---"))return null;let Q=3;for(;Q<$.length&&($[Q]===" "||$[Q]===" ");)Q++;if(Q<$.length&&$[Q]==="\r"&&Q++,Q>=$.length||$[Q]!==`
16239
- `)return null;Q++;let Z=false;for(;Q<$.length;){let V=Q;for(;Q<$.length&&$[Q]!==`
16240
- `&&$[Q]!=="\r";)Q++;if(Q>=$.length)break;let Y=Q;if($[Q]==="\r"&&Q++,Q<$.length&&$[Q]===`
16241
- `&&Q++,U6($,"---",V))return {endPos:Q,hasValidYaml:Z};if(!Z){let G=EZ($,V,Y);if(G<Y){let K=$.charCodeAt(G);if(K>=F0&&K<=H0||K>=d&&K<=l$1||K>=o&&K<=i||K===z0){for(G++;G<Y&&(K=$.charCodeAt(G),K>=F0&&K<=H0||K>=d&&K<=l$1||K>=o&&K<=i||K===z0||K===p$1||K===d0);)G++;G<Y&&$.charCodeAt(G)===x0&&(G++,G>=Y?Z=true:(K=$.charCodeAt(G),(K===b||K===R)&&(Z=true)));}}}}return null}var RZ=/&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi,kZ={class:"className",for:"htmlFor",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",viewbox:"viewBox"};function c0($){var Q={};for(var Z in $){var V=Z.toLowerCase(),Y=kZ[V];if(Y)Q[Y]=$[Z];else {var G=Z.indexOf(":");G!==-1?Q[Z.slice(0,G)+Z[G+1].toUpperCase()+Z.slice(G+2)]=$[Z]:Q[Z]=$[Z];}}return Q}var O6=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;function s9($){return $.indexOf("&")===-1?$:$.replace(RZ,(Q,Z)=>{var V=B$2(Z);if(V)return V;if(Z[0]==="#"){var Y=Z[1]==="x"||Z[1]==="X"?parseInt(Z.slice(2),16):parseInt(Z.slice(1),10);return Y===0||Y>=55296&&Y<=57343||Y>1114111?"\uFFFD":Y<=65535?String.fromCharCode(Y):String.fromCharCode(55296+(Y-65536>>10),56320+(Y-65536&1023))}return Q})}var J6=/(javascript|vbscript|data(?!:image)):/i;function d9($){if(J6.test($))return null;if($.indexOf("%")===-1)return $;try{let Q=decodeURIComponent($).replace(/[^A-Za-z0-9/:]/g,"");if(J6.test(Q))return null}catch{return null}return $}var f0={},m0,L0;for(m0=[192,193,194,195,196,197,224,225,226,227,228,229,230,198],L0=0;L0<m0.length;L0++)f0[m0[L0]]="a";for(f0[231]=f0[199]="c",f0[240]=f0[208]="d",m0=[200,201,202,203,233,232,234,235],L0=0;L0<m0.length;L0++)f0[m0[L0]]="e";for(m0=[207,239,206,238,205,237,204,236],L0=0;L0<m0.length;L0++)f0[m0[L0]]="i";for(f0[209]=f0[241]="n",m0=[248,216,339,338,213,245,212,244,211,243,210,242],L0=0;L0<m0.length;L0++)f0[m0[L0]]="o";for(m0=[220,252,219,251,218,250,217,249],L0=0;L0<m0.length;L0++)f0[m0[L0]]="u";f0[376]=f0[255]=f0[221]=f0[253]="y";function E0($){for(var Q="",Z=-1,V=$.length,Y=0;Y<V;Y++){var G=$.charCodeAt(Y);if(G>=F0&&G<=H0||G>=o&&G<=i){Z<0&&(Z=Y);continue}if(G>=d&&G<=l$1){Z>=0&&(Q+=$.slice(Z,Y),Z=-1),Q+=String.fromCharCode(G+i0);continue}if(G===b||G===p$1){Z>=0&&(Q+=$.slice(Z,Y),Z=-1),Q+="-";continue}Z>=0&&(Q+=$.slice(Z,Y),Z=-1);var K=f0[G];K&&(Q+=K);}return Z>=0&&(Q+=$.slice(Z)),Q}function U6($,Q,Z){return $.startsWith(Q,Z)}var F6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","circle","ellipse","line","path","polygon","polyline","rect","use","stop","animate","set"]);function c9($){let Q=$.toLowerCase();if(F6.has(Q))return true;let Z=Q.indexOf(":");return Z!==-1?(Q=Q.slice(Z+1),F6.has(Q)):false}var v9=1,X6=2,p9=4,W6=8,LZ=16,Q9=32,_9=64,z6=1,SZ=2,gZ=3,xZ=4,D6=(function(){var $=new Uint8Array(128),Q;for($[R]=v9,$[x]=v9|X6,$[K6]=v9,$[B9]=v9|X6,$[b]=v9,Q=g0;Q<=j0;Q++)$[Q]=p9;for(Q=x0;Q<=K$;Q++)$[Q]=p9;for(Q=O0;Q<=$0;Q++)$[Q]=p9;for(Q=g9;Q<=A0;Q++)$[Q]=p9;for(Q=o;Q<=i;Q++)$[Q]=LZ;for(Q=d;Q<=l$1;Q++)$[Q]=W6;for(Q=F0;Q<=H0;Q++)$[Q]=W6;return $})();((function(){let $=new Uint8Array(128);return $[N0]=SZ,$[O0]=xZ,$[B0]=$[z0]=$[A0]=$[C0]=gZ,$[$0]=$[Z0]=$[K$]=$[p0]=$[x]=$[b]=$[g0]=z6,$[j9]=$[m9]=$[W9]=z6,$}))();var B6=/[\p{P}\p{S}]/u,j6=/\p{Zs}/u,u9=[];function f$($){var Q=$.indexOf("\r"),Z=$.indexOf("\0");if(Q===-1&&Z===-1)return $;var V=$.length;u9.length=0;var Y=0,G=0;for(Q===-1?G=Z:Z===-1?G=Q:G=Q<Z?Q:Z;G<V;G++){var K=$.charCodeAt(G);K===B9?(Y<G&&u9.push($.slice(Y,G)),G+1<V&&$.charCodeAt(G+1)===x&&G++,u9.push(`
16242
- `),Y=G+1):K===0&&(Y<G&&u9.push($.slice(Y,G)),u9.push("\uFFFD"),Y=G+1);}return Y<V&&u9.push($.slice(Y)),u9.join("")}function EZ($,Q,Z){let V=Z??$.length;for(;Q<V&&($[Q]===" "||$[Q]===" ");)Q++;return Q}function C$($){if(!$)return false;for(var Q in $)return true;return false}function M6($){return {attrs:{},children:[{type:v$1.text,text:$}],c:true,type:v$1.htmlBlock,tag:"header"}}function A6($){var Q=[];if(!$)return Q;for(var Z in $)Z.charCodeAt(0)===94&&Q.push({identifier:Z,footnote:$[Z].target});return Q}function t9($,Q,Z){for(var V=$,Y=Q.split("."),G=0;G<Y.length&&(V=V?.[Y[G]],V!==void 0);)G++;return V||Z}function v6($){for(var Q=false,Z=0;Z<$.length;Z++){var V=$.charCodeAt(Z);if(V<=b||V===M9||V===G$||V===Z0||V===c||V===O0||V===N0||V===p0||V===e0||V===$0||V>=123){Q=true;break}}if(!Q)return $;for(var Y="",Z=0;Z<$.length;Z++){var V=$.charCodeAt(Z);if(V===G$&&Z+2<$.length){var G=$.charCodeAt(Z+1),K=$.charCodeAt(Z+2);if((G>=o&&G<=i||G>=d&&G<=g$||G>=F0&&G<=j9)&&(K>=o&&K<=i||K>=d&&K<=g$||K>=F0&&K<=j9)){Y+=$[Z]+$[Z+1]+$[Z+2],Z+=2;continue}}Y+=encodeURI($[Z]);}return Y}function _6(...$){return $.filter(Boolean).join(" ")}var TZ=new Set(["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"]),B$=/<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;function m$($){return TZ.has($.toLowerCase())}function I6($){return B$.lastIndex=0,B$.test($)}function h$($){return B$.lastIndex=0,$.replace(B$,function(Q,Z,V,Y){return "&lt;"+Z+V+Y})}var f6=/^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/,C6=/^<[A-Z]/,u$=["script","pre","style","textarea"],U$=new Set(u$),fZ=/<(?:pre|script|style|textarea)\b/i,b6=/<(?:pre|script|style|textarea)\b/iy,P6=/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m,w6=/^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im,m6=new Uint8Array(128);(function(){for(var $=[$0,B0,z0,A0,C0,O0,g0,Z0,N0,D$,m9,W9,j9],Q=0;Q<$.length;Q++)m6[$[Q]]=1;})();var y6=/([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;function h6($){return U$.has($)}function u6($){return fZ.test($)}function p6($,Q,Z){for(var V=Q,Y=Z;V<Y&&($.charCodeAt(V)===b||$.charCodeAt(V)===R);)V++;if(V>=Y)return false;$.charCodeAt(V)===w0&&V++;for(var G=0;V<Y;){for(;V<Y&&($.charCodeAt(V)===b||$.charCodeAt(V)===R);)V++;if(V>=Y)break;if($.charCodeAt(V)===w0&&G>0){for(var K=V+1;K<Y&&($.charCodeAt(K)===b||$.charCodeAt(K)===R);)K++;if(K>=Y)return true}if($.charCodeAt(V)===x0&&V++,V>=Y||$.charCodeAt(V)!==p$1)return false;for(;V<Y&&$.charCodeAt(V)===p$1;)V++;for(V<Y&&$.charCodeAt(V)===x0&&V++,G++;V<Y&&($.charCodeAt(V)===b||$.charCodeAt(V)===R);)V++;if(V<Y)if($.charCodeAt(V)===w0)V++;else return false}return G>0}function N9($,Q){if($.charCodeAt(Q)!==Z0)return null;let Z=Q+1,V=$.length,Y=false;$.charCodeAt(Z)===j0&&(Z++,Y=true);let G=Z,K=$.charCodeAt(Z);if(!(K>=F0&&K<=H0||K>=d&&K<=l$1))return null;for(;Z<V&&($.charCodeAt(Z)>=F0&&$.charCodeAt(Z)<=H0||$.charCodeAt(Z)>=d&&$.charCodeAt(Z)<=l$1||$.charCodeAt(Z)>=o&&$.charCodeAt(Z)<=i||$.charCodeAt(Z)===p$1);)Z++;let q=$.slice(G,Z);if(!q)return null;let J=Z;for(;Z<V&&($.charCodeAt(Z)===b||$.charCodeAt(Z)===R||$.charCodeAt(Z)===x);)Z++;let U=$.slice(J,Z);if(Z===J&&Z<V){var W=$.charCodeAt(Z);if(W!==c&&W!==j0)return null}let X=Z,H={},z=false;for(;Z<V;){let E=$.charCodeAt(Z);if(E===c){let L=$.slice(X,Z);return {tag:q,attrs:H,selfClosing:false,end:Z+1,rawAttrs:L,whitespaceBeforeAttrs:U,isClosing:Y,hasSpaceBeforeSlash:z}}if(E===b||E===R||E===x){Z++;continue}if(E===j0&&Z+1<V&&$.charCodeAt(Z+1)===c){let L=$.slice(X,Z);return z=Z>X&&$.charCodeAt(Z-1)===b,{tag:q,attrs:H,selfClosing:true,end:Z+2,rawAttrs:L,whitespaceBeforeAttrs:U,isClosing:Y,hasSpaceBeforeSlash:z}}var D=Z,j=$.charCodeAt(Z);if(!(j>=F0&&j<=H0||j>=d&&j<=l$1||j===z0||j===x0))return null;for(Z++;Z<V;){var F=$.charCodeAt(Z);if(F>=F0&&F<=H0||F>=d&&F<=l$1||F>=o&&F<=i||F===z0||F===d0||F===x0||F===p$1)Z++;else break}for(var B=$.slice(D,Z);Z<V&&($.charCodeAt(Z)===b||$.charCodeAt(Z)===R);)Z++;if($.charCodeAt(Z)!==C0){H[B]="";continue}for(Z++;Z<V&&($.charCodeAt(Z)===b||$.charCodeAt(Z)===R);)Z++;var M=$.charCodeAt(Z);if(M===M9||M===S9){Z++;for(var A=Z;Z<V&&$.charCodeAt(Z)!==M;)Z++;if(Z>=V)return null;if(H[B]=$.slice(A,Z),Z++,Z<V){var k=$.charCodeAt(Z);if(k!==b&&k!==R&&k!==x&&k!==c&&k!==j0)return null}}else if(M===g9){var _=1,A=Z;for(Z++;Z<V&&_>0;){var F=$.charCodeAt(Z);F===g9?_++:F===O$&&_--,Z++;}H[B]=$.slice(A,Z);}else {for(var A=Z;Z<V;){var O=$.charCodeAt(Z);if(O===b||O===R||O===c||O===x||O===M9||O===S9||O===C0||O===Z0||O===$0)break;Z++;}if(Z===A)return null;H[B]=$.slice(A,Z);}}return null}function d6($,Q,Z){if(!Z.optimizeForStreaming&&$.indexOf("[")===-1)return false;for(var V=0,Y=$.length,G=false,K=false;V<Y;){for(var q=$.indexOf(`
16243
- `,V),J=q<0?Y:q,U=V,W=0;U<J&&W<4;)if($.charCodeAt(U)===b)W++,U++;else if($.charCodeAt(U)===R)W+=4,U++;else break;if(U>=J){G=false,V=q<0?Y:q+1;continue}if(W<4){var X=$.charCodeAt(U);if(X===$0||X===A0){for(var H=X,z=0,D=U;D<J&&$.charCodeAt(D)===H;)z++,D++;if(z>=3){var j=true;if(H===$0){for(var F=D;F<J;F++)if($.charCodeAt(F)===$0){j=false;break}}if(j){G=false;for(var B=q<0?Y:q+1;B<Y;){for(var M=B,A=0;M<Y&&A<4;){var k=$.charCodeAt(M);if(k===b)A++,M++;else if(k===R)A+=4,M++;else break}if(A<4&&M<Y&&$.charCodeAt(M)===H){for(var _=0;M<Y&&$.charCodeAt(M)===H;)_++,M++;if(_>=z){for(;M<Y&&($.charCodeAt(M)===b||$.charCodeAt(M)===R);)M++;if(M>=Y||$.charCodeAt(M)===x){V=M>=Y?Y:M+1;break}}}for(;B<Y&&$.charCodeAt(B)!==x;)B++;B<Y&&B++;}B>=Y&&(V=Y,K=true);continue}}}}for(var O=U;O<J&&$.charCodeAt(O)===c;){O++,O<J&&$.charCodeAt(O)===b&&O++;for(var E=0;O<J&&E<4;)if($.charCodeAt(O)===b)E++,O++;else if($.charCodeAt(O)===R)E+=4,O++;else break;if(E>=4)break;G=false;}if(!G&&W<4&&O<J&&$.charCodeAt(O)===O0&&!(O+1<Y&&$.charCodeAt(O+1)===e0)){var L=c6($,O,Q);if(L){V=L,G=false;continue}}var y=$.charCodeAt(U);if(y===J9&&W<4)G=false;else if(W<4&&(y===p$1||y===B0||y===z0)){for(var I=U,f=0;I<J;){var w=$.charCodeAt(I);if(w===y)f++;else if(w!==b&&w!==R)break;I++;}G=!(f>=3&&I>=J);}else G=true;V=q<0?Y:q+1;}return K}function c6($,Q,Z){let V=$.length;if($.charCodeAt(Q)!==O0)return null;let Y=Q+1<V&&$.charCodeAt(Q+1)===e0,G=Q+1;for(;G<V;){var K=$.charCodeAt(G);if(K===p0){G++;break}if(K===O0)return null;K===N0&&G+1<V&&G++,G++;}if(G>V||$.charCodeAt(G-1)!==p0)return null;let q=$.slice(Q+1,G-1);if(q.length>999)return null;let J=j$(q);if(!J||G>=V||$.charCodeAt(G)!==x0)return null;G++;let U=false;for(;G<V;){let T=$.charCodeAt(G);if(T===b||T===R)G++;else if(T===x&&!U)U=true,G++;else break}if(Y){let T=$.indexOf(`
16244
- `,G),m=T<0?V:T,C=$.slice(G,m).trim();return Z[J]={target:C,title:void 0},T<0?V:T+1}var W;if(G<V&&$.charCodeAt(G)===Z0){G++;for(var X=G;G<V&&$.charCodeAt(G)!==c&&$.charCodeAt(G)!==x;)$.charCodeAt(G)===N0&&G+1<V&&G++,G++;if(G>=V||$.charCodeAt(G)!==c)return null;W=$.slice(X,G),G++;for(var H=$.indexOf(`
16245
- `,G),z=H<0?V:H,D=G;D<z&&($.charCodeAt(D)===b||$.charCodeAt(D)===R);)D++;if(D<z){if(D===G)return null;var j=$.charCodeAt(D);if(j!==M9&&j!==S9&&j!==$9)return null}}else {for(var X=G,F=0;G<V;){var K=$.charCodeAt(G);if(K===$9)F++;else if(K===Z9){if(F===0)break;F--;}else {if(K===b||K===R||K===x)break;K===N0&&G+1<V&&G++;}G++;}if(W=$.slice(X,G),!W)return null}for(;G<V&&($.charCodeAt(G)===b||$.charCodeAt(G)===R);)G++;var B=$.indexOf(`
16246
- `,G),M=B<0?V:B,A,k=false,_=G,O=G;if(G===M&&G<V)for(O=G+1;O<V&&($.charCodeAt(O)===b||$.charCodeAt(O)===R);)O++;if(O<V){var E=$.charCodeAt(O);if(E===M9||E===S9||E===$9){for(var L=E===$9?41:E,y=O+1,I=y;y<V;){var f=$.charCodeAt(y);if(f===L){for(var w=y+1;w<V&&($.charCodeAt(w)===b||$.charCodeAt(w)===R);)w++;(w>=V||$.charCodeAt(w)===x)&&(A=$.slice(I,y),k=true,_=w<V?w+1:V);break}if(f===N0&&y+1<V){y+=2;continue}if(f===x&&y+1<V&&$.charCodeAt(y+1)===x)break;y++;}if(!k&&O===G)return null}}if(k)return Z[J]||(Z[J]={target:$$(W),title:A!==void 0?s9($$(A)):A}),_;for(;G<M&&($.charCodeAt(G)===b||$.charCodeAt(G)===R);)G++;return G<M?null:(Z[J]||(Z[J]={target:$$(W),title:A}),B<0?V:B+1)}var u0=new Uint8Array(D6);for(u0[D$]=v9,u0[J9]|=Q9,u0[c]|=Q9,u0[p$1]|=Q9|_9,u0[A9]|=Q9,u0[B0]|=Q9|_9,u0[z0]|=Q9|_9,u0[$0]|=Q9|_9,u0[A0]|=Q9|_9,u0[Z0]|=Q9|_9,u0[O0]|=_9,u0[g0]|=_9,u0[w0]|=Q9,q$=o;q$<=i;q$++)u0[q$]|=Q9;var q$;function R6($){if($.indexOf("[")<0&&$.indexOf("]")<0)return false;for(var Q=0;Q<$.length;Q++){if($.charCodeAt(Q)===N0){Q++;continue}if($.charCodeAt(Q)===O0||$.charCodeAt(Q)===p0)return true}return false}function j$($){var Q=$.replace(/\s+/g," ").trim();return Q.indexOf("\u1E9E")!==-1?Q.replace(/\u1E9E/g,"ss").toLowerCase():Q.toLowerCase()}function c$($){return $<n9?u0[$]:$===G6?v9:0}function $$($){return $.indexOf("\\")===-1?$:$.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}var l6=null,r6=-1,o6=-1;function G0($,Q){if(Q===r6&&$===l6)return o6;var Z=$.indexOf(`
16247
- `,Q);return Z<0?$.length:Z}function t($,Q){let Z=G0($,Q);return Z<$.length?Z+1:Z}function J$($,Q,Z){for(;Q<Z;){let V=$.charCodeAt(Q);if(V!==b&&V!==R)break;Q++;}return Q}function k6($,Q){let Z=t($,Q);for(;Z<$.length;){let V=G0($,Z);if(l0($,Z,V))return Z;Z=t($,Z);}return $.length}function P9($,Q,Z,V){let Y=0;for(;Q+Y<Z&&$.charCodeAt(Q+Y)===V;)Y++;return Y}var Y0=0,Q0=0;function v0($,Q,Z){for(Y0=0,Q0=0;Q+Q0<Z;){let V=$.charCodeAt(Q+Q0);if(V===R)Y0+=4-Y0%4;else if(V===b)Y0++;else break;Q0++;}}function l0($,Q,Z){return J$($,Q,Z)>=Z}function i6($,Q,Z,V){let Y=G0($,Q);if(v0($,Q,Y),Y0>3)return null;let G=Q+Q0;if($.charCodeAt(G)!==J9)return null;let K=P9($,G,Y,35);if(K<1||K>6||(G+=K,G<Y&&$.charCodeAt(G)!==b&&$.charCodeAt(G)!==R))return null;G=J$($,G,Y);for(var q=Y;q>G&&$.charCodeAt(q-1)===b;)q--;for(var J=q;q>G&&$.charCodeAt(q-1)===J9;)q--;if(q<J)if(q===G||$.charCodeAt(q-1)===b)for(;q>G&&$.charCodeAt(q-1)===b;)q--;else q=J;let U=$.slice(G,q),W=h0(U,0,U.length,Z,V),H=(V?.slugify||E0)(U);return {node:{type:v$1.heading,level:K,children:W,id:H},end:t($,Y)}}function CZ($,Q,Z){var V=$.charCodeAt(Q);if(V!==C0&&V!==p$1)return false;for(var Y=Q;Y<Z&&$.charCodeAt(Y)===V;)Y++;for(;Y<Z&&($.charCodeAt(Y)===b||$.charCodeAt(Y)===R);)Y++;return Y>=Z}function T9($,Q){let Z=G0($,Q);if(v0($,Q,Z),Y0>3)return null;let V=Q+Q0,Y=$.charCodeAt(V);if(Y!==p$1&&Y!==B0&&Y!==z0)return null;let G=0;for(;V<Z;){let K=$.charCodeAt(V);if(K===Y)G++;else if(K!==b&&K!==R)return null;V++;}return G<3?null:{node:{type:v$1.breakThematic},end:t($,Z)}}function mZ($,Q,Z){let V=G0($,Q);if(v0($,Q,V),Y0>3)return null;let Y=Y0,K=Q+Q0,q=$.charCodeAt(K);if(q!==$0&&q!==A0)return null;let J=P9($,K,V,q);if(J<3)return null;K+=J;let U=J$($,K,V),W=V;if(q===$0){for(let y=U;y<V;y++)if($.charCodeAt(y)===$0)return null}for(;W>U&&($.charCodeAt(W-1)===b||$.charCodeAt(W-1)===R);)W--;let X=$.slice(U,W),H="",z="",D=X.indexOf(" ");D===-1?H=X:(H=X.slice(0,D),z=X.slice(D+1).trim()),H=$$(H);var j=void 0;if(z){y6.lastIndex=0;for(var F;(F=y6.exec(z))!==null;)j||(j={}),j[F[1]]=F[2]!==void 0?F[2]:F[3];}let B=t($,V),M=B,A=$.length;for(;M<$.length;){let y=G0($,M);if(v0($,M,y),Y0<4){let I=M+Q0;var k=P9($,I,y,q);if(k>=J){let f=I+k;if(l0($,f,y)){A=t($,y);break}}}M=t($,y);}var _;if(Y===0)_=M>B&&$.charCodeAt(M-1)===x?$.slice(B,M-1):$.slice(B,M);else {_="";for(var O=B;O<M;){var E=G0($,O);v0($,O,E);var L=Math.min(Q0,Y);_+=$.slice(O+L,E)+`
16248
- `,O=t($,E);}_.length>0&&_.charCodeAt(_.length-1)===x&&(_=_.slice(0,-1));}return {node:{type:v$1.codeBlock,lang:H||void 0,text:_,infoString:z||void 0,attrs:j},end:A}}function hZ($,Q){let Z=G0($,Q);if(v0($,Q,Z),Y0<4)return null;let V="",Y=Q;for(;Y<$.length;){let z=G0($,Y);if(v0($,Y,z),l0($,Y,z)){for(var G=0,K=t($,z);K<$.length;){var q=G0($,K);if(l0($,K,q)){G++,K=t($,q);continue}if(v0($,K,q),Y0>=4){for(var J=0;J<=G;J++)V+=`
16249
- `;Y=K;break}break}if(Y!==K)break;continue}if(Y0<4)break;let D=0,j=0;var U=0;for(let F=Y;F<z&&j<4;F++){if($.charCodeAt(F)===R){var W=4-j%4;j+W>4&&(U=j+W-4),j+=W;}else j++;D++;}var X="";if(U>0)for(var H=0;H<U;H++)X+=" ";X+=$.slice(Y+D,z),V+=X+`
16250
- `,Y=t($,z);}for(;V.length>0&&V.charCodeAt(V.length-1)===x;)V=V.slice(0,-1);for(;V.length>0&&V.charCodeAt(V.length-1)===x;)V=V.slice(0,-1);return V?{node:{type:v$1.codeBlock,lang:void 0,text:V,infoString:void 0,attrs:void 0},end:Y}:null}function uZ($,Q,Z,V){let Y=G0($,Q);if(v0($,Q,Y),Y0>3)return null;let G=Q+Q0;if($.charCodeAt(G)!==c)return null;let K="",q=Q,J,U=false,W=false,X=false;for(;q<$.length;){let g=G0($,q);v0($,q,g);let X0=q+Q0;if($.charCodeAt(X0)===c){let J0=X0+1;var H=Y0+1,z=false;if(J0<g){var D=$.charCodeAt(J0);D===b?(J0++,H++,z=true):D===R&&(z=true);}for(var j="",F=false,B=J0;B<g;B++)if($.charCodeAt(B)===R){F=true;break}if(F){var M=H;if(z&&J0<g&&$.charCodeAt(J0)===R){for(var A=4-M%4,k=0;k<A-1;k++)j+=" ";M+=A,J0++;}for(var _=J0;_<g;_++)if($.charCodeAt(_)===R){for(var O=4-M%4,E=0;E<O;E++)j+=" ";M+=O;}else j+=$[_],M++;}else j=$.slice(J0,g);if(!K&&!J){let P=j.match(/^\[!([A-Za-z]+)\]\s*$/);if(P){J=P[1].toUpperCase(),q=t($,g);continue}}K+=j+`
16251
- `;var L=j.trimStart();L.startsWith("```")||L.startsWith("~~~")?X=!X:j.startsWith(" ")||j.startsWith(" ")?X=true:L.length>0&&!X&&(X=false),W=L.length>0,q=t($,g);}else if(K&&!l0($,q,g)&&W){if(Y0<4){var y=q+Q0,I=y<g?$.charCodeAt(y):0;if(I===J9||I===c||I===$0||I===A0||I===Z0||(I===p$1||I===B0||I===z0)&&T9($,q)||(I===p$1||I===B0||I===A9)&&y+1<g&&($.charCodeAt(y+1)===b||$.charCodeAt(y+1)===R))break;if(I>=o&&I<=i){for(var f=y;f<g&&$.charCodeAt(f)>=o&&$.charCodeAt(f)<=i;)f++;if(f<g&&($.charCodeAt(f)===d0||$.charCodeAt(f)===Z9))break}}if(X)break;K+=$.slice(q,g)+`
16252
- `,U=true,q=t($,g);}else break}if(!K&&!J)return null;var{inBlockQuote:w,g:T}=Z;Z.inBlockQuote=true,U&&(Z.g=true);let m=b9(K||"",Z,V);return Z.inBlockQuote=w,Z.g=T,{node:{type:v$1.blockQuote,children:m,alert:J||void 0},end:q}}function a6($,Q,Z){for(var V=0,Y=Q;Y<Z;Y++)$.charCodeAt(Y)===R?V+=4-V%4:V++;return V}function x9($,Q,Z){if(v0($,Q,Z),Y0>3)return null;var V=Q+Q0;if(V>=Z)return null;var Y=$.charCodeAt(V),G=Y0,K=V;if(Y===p$1||Y===B0||Y===A9){if(K=V+1,K<Z&&$.charCodeAt(K)!==b&&$.charCodeAt(K)!==R&&$.charCodeAt(K)!==x)return null}else if(Y>=o&&Y<=i){for(var q=V;q<Z&&q-V<9;){var J=$.charCodeAt(q);if(J<o||J>i)break;q++;}if(q>V&&q<Z){var U=$.charCodeAt(q);if(U===d0||U===Z9){if(K=q+1,K<Z&&$.charCodeAt(K)!==b&&$.charCodeAt(K)!==R&&$.charCodeAt(K)!==x)return null}else return null}else return null}else return null;var W=K,X=a6($,Q,K),H=0,z=W,D=X;if(W>=Z)return {ordered:Y>=o&&Y<=i,marker:Y>=o&&Y<=i?$[q]:$[V],start:Y>=o&&Y<=i?parseInt($.slice(V,q),10):void 0,contentStart:W,contentCol:X+1,markerCol:G,isEmpty:true};for(;z<Z&&($.charCodeAt(z)===b||$.charCodeAt(z)===R);){if($.charCodeAt(z)===R){var j=4-D%4;D+=j;}else D++;z++,H++;}var F=z>=Z,B=D-X;return F||B>4?(D=X+1,z=W+1,H=1):H===0&&(D=X+1,z=W,H=1),{ordered:Y>=o&&Y<=i,marker:Y>=o&&Y<=i?$[q]:$[V],start:Y>=o&&Y<=i?parseInt($.slice(V,q),10):void 0,contentStart:z,contentCol:D,markerCol:G,isEmpty:F}}var M$=0;function pZ($,Q,Z,V){var Y=0,G=Q;for(M$=0;G<Z&&Y<V;){var K=$.charCodeAt(G);if(K===R){var q=4-Y%4;if(Y+q>V){M$=Y+q-V,G++,Y=V;break}Y+=q;}else if(K===b)Y++;else break;G++;}return G}function L6($,Q,Z,V){var Y=G0($,Q),G=x9($,Q,Y);if(!G)return null;var K=[],q=Q,J=G.contentCol,U="",W=G.isEmpty,X=false,H=false;if(!G.isEmpty){for(var z=false,D=G.contentStart;D<Y;D++)if($.charCodeAt(D)===R){z=true;break}if(z){var j="",F=a6($,Q,G.contentStart),B=F-G.contentCol;if(B>0)for(var M=0;M<B;M++)j+=" ";for(var A=G.contentStart;A<Y;A++)if($.charCodeAt(A)===R){for(var k=4-F%4,_=0;_<k;_++)j+=" ";F+=k;}else j+=$[A],F++;U=j+`
16253
- `;}else U=$.slice(G.contentStart,Y)+`
16254
- `;}for(q=t($,Y);q<$.length;){var O=G0($,q);v0($,q,O);var E=$.charCodeAt(q+Q0);if(Y0<J&&(E===p$1||E===B0||E===z0)&&Y0<=3&&T9($,q))break;var L=x9($,q,O);if(L&&L.ordered===G.ordered&&L.marker===G.marker&&L.markerCol<J){K.push({contentCol:J,raw:U,hasBlankAfter:X,isEmpty:W}),X&&(H=true),J=L.contentCol,W=L.isEmpty,X=false,U=L.isEmpty?"":$.slice(L.contentStart,O)+`
16255
- `,q=t($,O);continue}if(l0($,q,O)){U+=`
16256
- `,q=t($,O);for(var y=false,I=0;I<U.length;I++){var f=U.charCodeAt(I);if(f!==x&&f!==B9&&f!==b&&f!==R){y=true;break}}if(W&&!y)if(q<$.length){var w=G0($,q),T=x9($,q,w);if(!T||T.ordered!==G.ordered||T.marker!==G.marker)break;X=true;}else break;if(q<$.length){var m=G0($,q);v0($,q,m);var C=$.charCodeAt(q+Q0);if((C===p$1||C===B0||C===z0)&&Y0<=3&&T9($,q))break;var g=x9($,q,m);if(g&&g.ordered===G.ordered&&g.marker===G.marker&&g.markerCol<J){X=true;continue}if(!l0($,q,m)&&Y0<J)break}continue}if(Y0>=J){var X0=pZ($,q,O,J);if(M$>0){for(var J0="",P=J,a=0;a<M$;a++)J0+=" ",P++;for(var r=X0;r<O;r++)if($.charCodeAt(r)===R){for(var y0=4-P%4,R0=0;R0<y0;R0++)J0+=" ";P+=y0;}else J0+=$[r],P++;U+=J0+`
16257
- `;}else U+=$.slice(X0,O)+`
16258
- `;q=t($,O);continue}for(var U0=false,u=0;u<U.length;u++){var n=U.charCodeAt(u);if(n!==x&&n!==B9&&n!==b&&n!==R){U0=true;break}}if(!X&&U0&&!W){var D0=q+Q0,s=$.charCodeAt(D0),M0=s===J9||s===c||s===Z0||s===$0||s===A0||(s===p$1||s===B0||s===z0||s===A9)&&(T9($,q)!==null||x9($,q,O)!==null)||s>=o&&s<=i&&x9($,q,O)!==null;if(!M0){U+=""+$.slice(D0,O)+`
16259
- `,q=t($,O);continue}}break}if(K.push({contentCol:J,raw:U,hasBlankAfter:X,isEmpty:W}),K.length===0)return null;var _0=H;if(!_0)for(var K0=0;K0<K.length;K0++){if(K[K0].hasBlankAfter&&K0<K.length-1){_0=true;break}if(!K[K0].isEmpty){for(var b0=K[K0].raw,V0=b0.length,W0=0,h=false,N=false,e=false,I0=false,a0=0,n0=0,P0=-1;W0<V0;){var S=b0.indexOf(`
16260
- `,W0);if(S<0&&(S=V0),I0){v0(b0,W0,S);for(var S0=b0.slice(W0+Q0,S),q0=0;q0<S0.length&&S0.charCodeAt(q0)===a0;)q0++;q0>=n0&&S0.slice(q0).trim()===""&&(I0=false),W0=S<V0?S+1:V0;continue}if(l0(b0,W0,S)){P0>=0?e=true:h&&(N=true),W0=S<V0?S+1:V0;continue}if(v0(b0,W0,S),P0>=0){if(Y0>=P0){W0=S<V0?S+1:V0;continue}var s0=x9(b0,W0,S);if(s0&&s0.markerCol<P0&&s0.contentCol<=P0){W0=S<V0?S+1:V0;continue}if(s0){W0=S<V0?S+1:V0;continue}P0=-1,e&&(N=true,e=false);}var z9=b0.slice(W0+Q0,S),w9=z9.charCodeAt(0);if((w9===$0||w9===A0)&&Y0<=3){for(var H9=0;H9<z9.length&&z9.charCodeAt(H9)===w9;)H9++;if(H9>=3){if(N&&h){_0=true;break}I0=true,a0=w9,n0=H9,h=true,W0=S<V0?S+1:V0;continue}}var U9=Y0<=3?x9(b0,W0,S):null;if(U9&&h){if(N){_0=true;break}P0=U9.contentCol,e=false,W0=S<V0?S+1:V0,h=true;continue}if(N){_0=true;break}h=true,W0=S<V0?S+1:V0;}if(_0)break}}for(var O9=[],f9=0;f9<K.length;f9++){for(var Z$=K[f9],D9=Z$.raw,V9=D9.length;V9>0&&D9.charCodeAt(V9-1)===x;)V9--;var Y9=V9<D9.length?D9.slice(0,V9):D9,G9=null;if(Y9.length>=3&&Y9.charCodeAt(0)===O0){var F9=Y9[1];(F9===" "||F9==="x"||F9==="X")&&Y9.charCodeAt(2)===p0&&(G9={type:v$1.gfmTask,completed:F9==="x"||F9==="X"},Y9=Y9.slice(3));}var k0;if(Z$.isEmpty&&Y9.trim()==="")k0=[];else if(_0){var y9=Z.inList;Z.inList=true,k0=b9(Y9,Z,V),Z.inList=y9;}else {var X9=Z.inList;if(Z.inList=true,k0=b9(Y9,Z,V),Z.inList=X9,k0.length===1&&k0[0].type===v$1.paragraph)k0=k0[0].children;else {for(var K9=[],R9=0;R9<k0.length;R9++)if(k0[R9].type===v$1.paragraph)for(var r9=k0[R9].children,q9=0;q9<r9.length;q9++)K9.push(r9[q9]);else K9.push(k0[R9]);k0=K9;}}G9?O9.push([G9,{type:v$1.text,text:" "},...k0]):O9.push(k0);}return {node:{type:G.ordered?v$1.orderedList:v$1.unorderedList,start:G.ordered?G.start:void 0,items:O9},end:q}}var A$=new Set(["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]);function I9($,Q,Z){let V={};for(let[K,q]of Object.entries($)){let J=K,U=K.toLowerCase();if(U==="style"&&typeof q=="string"){let W={},X=[],H=0,z=0;for(let j=0;j<q.length;j++){let F=q.charCodeAt(j);F===$9?H++:F===Z9?H--:F===E$&&H===0&&(X.push(q.slice(z,j)),z=j+1);}z<q.length&&X.push(q.slice(z));let D=false;X.forEach(j=>{let F=j.indexOf(":");if(F===-1)return;let B=j.slice(0,F).trim(),M=j.slice(F+1).trim();if(B&&M){if(/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(M)){D=true;return}let A=B.indexOf("-")!==-1?B.replace(/-([a-z])/g,(k,_)=>_.toUpperCase()):B;W[A]=M;}}),!D&&Object.keys(W).length>0&&(V[J]=W);}else if((U==="href"||U==="src")&&Z?.sanitizer){let W=Z.sanitizer(q,Q,U);W!==null&&(V[J]=W);}else if(q==="")V[J]=true;else if(q.length>=2&&q.charCodeAt(0)===g9&&q.charCodeAt(q.length-1)===O$){var Y=q.slice(1,-1);if(Y.length>0){var G=Y.charCodeAt(0);if(G===O0||G===g9)try{V[J]=JSON.parse(Y);continue}catch{}}if(Y==="true"){V[J]=true;continue}if(Y==="false"){V[J]=false;continue}if(Z?.evalUnserializableExpressions)try{V[J]=(0,eval)("("+Y+")");continue}catch{}V[J]=Y;}else V[J]=q;}return V}function E9($,Q,Z){let V=Q.length;if(V===0)return Z;var Y=Q.charCodeAt(0),G=Y>=d&&Y<=l$1||Y>=F0&&Y<=H0;if(!G){for(var K=String.fromCharCode(Y),q=$.length-V,J=Z;J<=q;){var U=$.indexOf(K,J);if(U===-1||U>q)return -1;for(var W=true,X=1;X<V;X++){var H=$.charCodeAt(U+X),z=Q.charCodeAt(X);if(H>=d&&H<=l$1&&(H+=i0),z>=d&&z<=l$1&&(z+=i0),H!==z){W=false;break}}if(W)return U;J=U+1;}return -1}Y>=d&&Y<=l$1&&(Y+=i0);for(let j=Z;j<=$.length-V;j++){var D=$.charCodeAt(j);if(D>=d&&D<=l$1&&(D+=i0),D!==Y)continue;let F=true;for(let B=1;B<V;B++){let M=$.charCodeAt(j+B),A=Q.charCodeAt(B);if(M>=d&&M<=l$1&&(M+=i0),A>=d&&A<=l$1&&(A+=i0),M!==A){F=false;break}}if(F)return j}return -1}function dZ($,Q,Z){let V=Q.length;var Y=Q.charCodeAt(0);Y>=d&&Y<=l$1&&(Y+=i0);for(let K=Math.min(Z,$.length-V);K>=0;K--){var G=$.charCodeAt(K);if(G>=d&&G<=l$1&&(G+=i0),G!==Y)continue;let q=true;for(let J=1;J<V;J++){let U=$.charCodeAt(K+J),W=Q.charCodeAt(J);if(U>=d&&U<=l$1&&(U+=i0),W>=d&&W<=l$1&&(W+=i0),U!==W){q=false;break}}if(q)return K}return -1}var v$=-1;function p$($,Q,Z){let V=Z.toLowerCase(),Y="<"+V,G="</"+V,K=1,q=Q,J=$.length;for(v$=-1;q<J&&K>0;){let X=E9($,Y,q),H=E9($,G,q);if(H===-1)return -1;if(X!==-1&&X<H){let z=N9($,X);z?(z.tag.toLowerCase()===V&&!z.isClosing&&!z.selfClosing&&!c9(z.tag)&&K++,q=z.end):q=X+1;}else {var U=H+G.length,W=U<J?$.charCodeAt(U):62;if((W===c||W===b||W===R||W===x)&&(K--,K===0)){v$=H;let z=H+G.length;for(;z<J&&$.charCodeAt(z)!==c;)z++;return z+1}q=H+1;}}return -1}function n6($,Q,Z,V){if(V.ignoreHTMLBlocks||V.disableParsingRawHTML)return null;var Y=G0($,Q);if(v0($,Q,Y),Y0>3&&!Z.inHTML)return null;var G=Q+Q0;if($.charCodeAt(G)!==Z0)return null;var K=$.indexOf(">",G+1);if(K!==-1&&K<Y){var q=$.slice(G+1,K);if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(q)||/^[^\s@]+@[^\s@]+$/.test(q))return null}var J=cZ($,G);if(J>=1&&J<=5){var U=$.length;if(J===1){for(var W=$.length,X=0;X<u$.length;X++){var H=E9($,"</"+u$[X]+">",G);H>=0&&H<W&&(W=H);}if(W<$.length){var z=$.indexOf(">",W);U=z>=0?t($,z+1):$.length;}}else {var D=J===2?"-->":J===3?"?>":J===4?">":"]]>",j=$.indexOf(D,G);j>=0&&(U=t($,j+D.length));}var F=$.slice(G,U);if(J>=2)return {node:{type:v$1.htmlComment,text:F,h:false,raw:true},end:U};var B="div",M=F.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);M&&(B=M[1]);var A=N9($,G),k={},_;A&&!A.isClosing&&(k=I9(A.attrs,B,V),_=A.whitespaceBeforeAttrs+A.rawAttrs);var O=[],E=B.toLowerCase(),L="</"+E,y=E9(F,L,0),I=F,f="";if(A&&A.isClosing)for(I=F.slice(A.end-G);I.length>0&&I.charCodeAt(I.length-1)===x;)I=I.slice(0,-1);else if(A&&!A.isClosing){var w=A.end-G;if(y!==-1)for(I=F.slice(w),I.charCodeAt(0)===x&&(I=I.slice(1));I.length>0&&I.charCodeAt(I.length-1)===x;)I=I.slice(0,-1);else for(I=F;I.length>0&&I.charCodeAt(I.length-1)===x;)I=I.slice(0,-1);if(y!==-1){var T=F.slice(w,y);f=T.trim();}}var m=A?A.isClosing:false;return {node:{type:v$1.htmlBlock,tag:B,attrs:k,f:_,children:O,a:I,text:f,c:true,b:m},end:U}}if(J===6||J===7){var C=k6($,Q),g=C<$.length?C:$.length,X0=$.slice(G,g),J0=C<$.length?t($,C):$.length,P=N9($,G);if(P){var a=P.tag,r=a.toLowerCase(),y0=P.isClosing;if(y0){var R0=$.slice(P.end,g);return {node:{type:v$1.htmlBlock,tag:a,attrs:{},children:[],a:R0,text:R0,c:true,b:true},end:J0}}if(P.selfClosing||c9(a))return {node:{type:v$1.htmlBlock,tag:a,attrs:I9(P.attrs,a,V),f:P.whitespaceBeforeAttrs+P.rawAttrs,children:[],a:"",text:"",c:false,b:false},end:P.end<$.length&&$.charCodeAt(P.end)===x?P.end+1:P.end};var U0=Z.d||0,u=$.slice(G,g),n=-1,D0=-1;if(U0<10){for(var s="</"+r,M0=P.end-G,_0=1,K0=M0;K0<u.length&&_0>0;){var b0=E9(u,"<"+r,K0),V0=E9(u,s,K0);if(V0===-1)break;if(b0!==-1&&b0<V0){var W0=b0+r.length+1;if(W0<u.length){var h=u.charCodeAt(W0);(h===b||h===R||h===x||h===c||h===j0)&&_0++;}K0=b0+1;}else {var N=V0+s.length;if(N<u.length){var e=u.charCodeAt(N);if((e===c||e===b||e===R||e===x)&&(_0--,_0===0)){n=V0;for(var I0=N;I0<u.length&&u.charCodeAt(I0)!==c;)I0++;D0=I0+1;break}}else if(_0--,_0===0){n=V0,D0=u.length;break}K0=V0+1;}}var a0=false;if(n===-1&&J===6&&!P.isClosing){var n0=p$($,P.end,r);if(n0!==-1){for(var P0=v$,S=P.end,S0=false,q0=false,s0=false,z9=0,w9=false,H9=false,U9=S;U9<P0;){var O9=$.charCodeAt(U9);if(O9===x)H9&&(S0=true),w9||z9++,H9=true,U9++;else if(O9===b||O9===R)U9++;else {if(!w9&&(w9=true,z9>=2&&O9===Z0)){s0=true;break}if(H9=false,O9===Z0){var f9=$.charCodeAt(U9+1)|32;if((f9===H$||f9===x$||f9===h9)&&(b6.lastIndex=U9,b6.test($))){q0=true;break}}U9++;}}if(S0&&!s0&&!q0){var Z$=G0($,n0);g=Z$,J0=t($,Z$),u=$.slice(G,g),X0=$.slice(G,g),n=P0-G,D0=n0-G,a0=true;}}}}var D9=P.rawAttrs.indexOf(`
16261
- `)!==-1||P.whitespaceBeforeAttrs.indexOf(`
16262
- `)!==-1,V9=false;if(n!==-1){var Y9=u.slice(D0).trim();V9=Y9.length===0;}var G9=false,F9=g,k0=J0;if(n!==-1){var y9=G+D0,X9=G0($,y9-1);if(y9<X9){for(var K9=y9;K9<X9&&($.charCodeAt(K9)===b||$.charCodeAt(K9)===R);)K9++;if(K9<X9&&$.charCodeAt(K9)===Z0){var R9=N9($,K9);R9&&!R9.isClosing&&(G9=true,F9=y9,k0=y9,V9=true);}}if(!G9){var r9=t($,X9);if(r9<g){for(var q9=r9;q9<g&&($.charCodeAt(q9)===b||$.charCodeAt(q9)===R);)q9++;if(q9<g&&$.charCodeAt(q9)===Z0){var ZZ=N9($,q9);ZZ&&(G9=true,F9=X9,k0=r9,V9=true);}}}if(!G9&&Z.inHTML){G9=true,F9=X9,k0=t($,X9);var QZ=$.slice(y9,X9).trim();V9=QZ.length===0;}}var o9=[],t0="";if(n!==-1){t0=u.slice(P.end-G,n);var k9=t0.trim();if(k9){var{inline:VZ,inHTML:YZ,d:GZ}=Z;Z.inHTML=true,Z.d=U0+1;var KZ=r==="p";if(KZ)Z.inline=true,o9=h0(k9,0,k9.length,Z,V);else {var a$=t0.indexOf(`
16263
-
16264
- `)!==-1,n$=P6.test(k9),b$=w6.test(k9),qZ=a$||n$||Z.inHTML&&b$,JZ=t0.length>=2&&t0.charCodeAt(0)===x&&t0.charCodeAt(t0.length-1)===x&&!a$;JZ&&!n$&&!b$?o9=[{type:v$1.text,text:k9}]:qZ||b$?(Z.inline=false,o9=b9(t0,Z,V)):(Z.inline=true,o9=h0(k9,0,k9.length,Z,V));}Z.inline=VZ,Z.inHTML=YZ,Z.d=GZ;}}var s$=false;if(J===6&&n!==-1&&!Z.inHTML&&!D9){var P$=t0,UZ=/<[a-zA-Z][^>]*>/.test(P$),FZ=/\n\n/.test(P$)||/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(P$);UZ&&!FZ&&(s$=true);}var XZ=!a0&&(Z.inHTML||J===7||D9||!V9||s$);if(XZ){var o0,t$=false;if(n!==-1&&G9){var e$=false;if(Z.inHTML&&D0<u.length){for(var F$=D0;F$<u.length&&u.charCodeAt(F$)!==x;)F$++;var w$=u.slice(D0,F$).trim();e$=w$.length>1&&w$.charCodeAt(0)===Z0&&w$.charCodeAt(1)!==j0;}o0=e$?u.slice(P.end-G):t0,t$=true;}else (J===7||Z.inHTML)&&n!==-1?(o0=u.slice(P.end-G),o0.charCodeAt(0)===x&&(o0=o0.slice(1))):G9?o0=$.slice(G,F9):D9?o0=X0:(o0=u.slice(P.end-G),o0.charCodeAt(0)===x&&(o0=o0.slice(1)));var $6={type:v$1.htmlBlock,tag:a,attrs:I9(P.attrs,a,V),f:P.whitespaceBeforeAttrs+P.rawAttrs,children:o9,a:o0,text:o0,c:true,b:false};return t$&&($6.k=true),{node:$6,end:k0}}return {node:{type:v$1.htmlBlock,tag:a,attrs:I9(P.attrs,a,V),f:P.whitespaceBeforeAttrs+P.rawAttrs,children:o9,a:a0?"":t0,text:t0,c:false,b:false},end:k0}}var X$=X0.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/),WZ=X$?X$[2]:"div",Z6=X$?X$[1]==="/":false,y$=X0;if(Z6){var Q6=X0.indexOf(">");Q6!==-1&&(y$=X0.slice(Q6+1));}return {node:{type:v$1.htmlBlock,tag:WZ,attrs:{},children:[],a:y$,text:y$,c:true,b:Z6},end:J0}}var T0=N9($,G);if(!T0)return null;var L9=T0.tag,R$=L9.toLowerCase(),V6=L9.charCodeAt(0),W$=V6>=d&&V6<=l$1;if(!W$&&!A$.has(R$)&&!U$.has(R$)&&!R$.includes("-"))return null;if(T0.isClosing)return {node:{type:v$1.htmlSelfClosing,tag:L9,attrs:{},a:$.slice(G,T0.end),b:true},end:T0.end};var C9=p$($,T0.end,L9),Q$=[];if(C9!==-1){var zZ=v$,z$=$.slice(T0.end,zZ),V$=z$.trim();if(V$){var HZ=z$.indexOf(`
16265
-
16266
- `)!==-1,OZ=P6.test(V$),DZ=w6.test(V$),BZ=Z.inline,jZ=Z.inHTML,MZ=Z.d;Z.inHTML=true,Z.d=(Z.d||0)+1,HZ||OZ||DZ?(Z.inline=false,Q$=b9(z$,Z,V)):(Z.inline=true,Q$=h0(V$,0,V$.length,Z,V)),Z.inline=BZ,Z.inHTML=jZ,Z.d=MZ;}var AZ=G0($,C9),vZ=$.slice(C9,AZ).trim(),k$=vZ?C9:t($,C9),Y6=W$?$.slice(G,C9):$.slice(G,k$);return {node:{type:v$1.htmlBlock,tag:L9,attrs:I9(T0.attrs,L9,V),f:T0.whitespaceBeforeAttrs+T0.rawAttrs,children:Q$,a:Y6,text:W$?z$:Y6,c:true,b:false},end:k$}}var Y$=k6($,T0.end),_Z=Y$<$.length?t($,Y$):Y$,L$=$.slice(T0.end,Y$);if(L$.trim()){var{inline:IZ,inHTML:NZ,d:bZ}=Z;Z.inline=false,Z.inHTML=true,Z.d=(Z.d||0)+1,Q$=b9(L$,Z,V),Z.inline=IZ,Z.inHTML=NZ,Z.d=bZ;}var PZ=$.slice(T0.end,Y$);return {node:{type:v$1.htmlBlock,tag:L9,attrs:I9(T0.attrs,L9,V),f:T0.whitespaceBeforeAttrs+T0.rawAttrs,children:Q$,a:PZ,text:L$,c:true,b:false},end:_Z}}function cZ($,Q){if($.charCodeAt(Q)!==Z0)return 0;var Z=Q+1,V=$.length;if($.charCodeAt(Z)===g0&&$.charCodeAt(Z+1)===p$1&&$.charCodeAt(Z+2)===p$1)return 2;if($.charCodeAt(Z)===i9)return 3;if($.charCodeAt(Z)===g0){var Y=$.charCodeAt(Z+1);if(Y>=d&&Y<=l$1)return 4;if($.slice(Z+1,Z+8)==="[CDATA[")return 5}for(var G=$.charCodeAt(Z)===j0,K=G?Z+1:Z,q=K;q<V;){var J=$.charCodeAt(q);if(J>=d&&J<=l$1||J>=F0&&J<=H0||J>=o&&J<=i||J===p$1)q++;else break}if(q===K)return 0;var U=$.slice(K,q);if(U$.has(U.toLowerCase())){if(G)return 0;var W=$.charCodeAt(q);return W===b||W===R||W===c||W===x||q>=V?1:0}if(A$.has(U.toLowerCase())){if(G){for(var X=q;X<V&&($.charCodeAt(X)===b||$.charCodeAt(X)===R);)X++;return X<V&&$.charCodeAt(X)===c?6:0}var H=q<V?$.charCodeAt(q):-1;return H===b||H===R||H===c||H===x||H===j0||H===-1?6:0}if(G){for(var F=q;F<V&&($.charCodeAt(F)===b||$.charCodeAt(F)===R);)F++;if(F<V&&$.charCodeAt(F)===c){var B=G0($,Q),M=$.slice(F+1,B).trim();if(M==="")return 7}}else {var z=G0($,Q),D=N9($,Q);if(D&&D.end<=z){var j=$.slice(D.end,z).trim();if(j==="")return 7}}return 0}function S6($,Q,Z){for(var V=0,Y=$.length;V<Y&&($.charCodeAt(V)===b||$.charCodeAt(V)===R);)V++;for(;Y>V&&($.charCodeAt(Y-1)===b||$.charCodeAt(Y-1)===R);)Y--;V<Y&&$.charCodeAt(V)===w0&&V++,Y>V&&$.charCodeAt(Y-1)===w0&&(Y-2<V||$.charCodeAt(Y-2)!==N0)&&Y--;for(var G=[],K=V,q=false,J=[],U=V;U<Y;){var W=$.charCodeAt(U);if(W===N0&&U+1<Y){$.charCodeAt(U+1)===w0?(q||(q=true,J=[]),J.push($.slice(K,U)),J.push("|"),U+=2,K=U):U+=2;continue}if(W===$0){for(var X=0;U<Y&&$.charCodeAt(U)===$0;)X++,U++;for(var H=false;U<Y&&!H;){for(var z=0;U<Y&&$.charCodeAt(U)===$0;)z++,U++;z===X?H=true:z===0&&U++;}continue}if(W===w0){var D=q?(J.push($.slice(K,U)),J.join("")):$.slice(K,U);G.push(D.trim()),U++,K=U,q=false,J=[];continue}U++;}var j=q?(J.push($.slice(K,Y)),J.join("")):$.slice(K,Y);return G.push(j.trim()),G.map(function(F){var B=F.indexOf("\\|")!==-1?F.replace(/\\\|/g,"|"):F;return h0(B,0,B.length,Q,Z)})}function g6($,Q,Z,V){let Y=G0($,Q);var G=$.indexOf("|",Q);if(G<0||G>=Y)return null;let K=t($,Y);if(K>=$.length)return null;let q=G0($,K);if(!p6($,K,q))return null;let J=$.slice(Q,Y),U=$.slice(K,q);for(var W=[],X=0,H=U.length;X<H&&(U.charCodeAt(X)===b||U.charCodeAt(X)===R);)X++;for(X<H&&U.charCodeAt(X)===w0&&X++;X<H;){for(;X<H&&(U.charCodeAt(X)===b||U.charCodeAt(X)===R);)X++;if(X>=H||U.charCodeAt(X)===w0)break;var z=U.charCodeAt(X)===x0;for(z&&X++;X<H&&U.charCodeAt(X)===p$1;)X++;var D=X<H&&U.charCodeAt(X)===x0;for(D&&X++,W.push(z&&D?"center":D?"right":z?"left":null);X<H&&(U.charCodeAt(X)===b||U.charCodeAt(X)===R);)X++;X<H&&U.charCodeAt(X)===w0&&X++;}let j=S6(J,Z,V);if(W.length!==j.length)return null;let F=[],B=t($,q);for(;B<$.length;){let E=G0($,B),L=$.slice(B,E);if(l0($,B,E))break;if(v0($,B,E),Y0<4){var M=$.charCodeAt(B+Q0);if(M===c||M===J9||(M===p$1||M===B0||M===z0)&&T9($,B))break;if(M===$0||M===A0){for(var A=B+Q0,k=0;A<E&&$.charCodeAt(A)===M;)k++,A++;if(k>=3)break}}F.push(S6(L,Z,V)),B=t($,E);}if(V.optimizeForStreaming&&F.length===0)return null;for(var _=j.length,O=0;O<F.length;O++)if(F[O].length<_)for(;F[O].length<_;)F[O].push([]);else F[O].length>_&&(F[O].length=_);return {node:{type:v$1.table,header:j,cells:F,align:W},end:B}}function lZ($,Q,Z){var V=G0($,Q);if(v0($,Q,V),Y0>3)return null;var Y=Q+Q0;if($.charCodeAt(Y)!==O0)return null;if(Y+1<$.length&&$.charCodeAt(Y+1)===e0){var G=rZ($,Y,Z);return G||null}Z.refs||(Z.refs={});var K=c6($,Y,Z.refs);return K===null?null:{node:{type:v$1.refCollection},end:K}}function rZ($,Q,Z){var V=$.length;if($.charCodeAt(Q)!==O0||Q+1>=V||$.charCodeAt(Q+1)!==e0)return null;for(var Y=Q+2,G=Y;Y<V&&$.charCodeAt(Y)!==p0;){if($.charCodeAt(Y)===x)return null;Y++;}if(Y>=V)return null;var K=("^"+$.slice(G,Y)).toLowerCase();if(Y++,Y>=V||$.charCodeAt(Y)!==x0)return null;for(Y++;Y<V&&($.charCodeAt(Y)===b||$.charCodeAt(Y)===R);)Y++;if(Y<V&&$.charCodeAt(Y)===x)for(Y++;Y<V&&($.charCodeAt(Y)===b||$.charCodeAt(Y)===R);)Y++;var q=$.indexOf(`
16267
- `,Y);q<0&&(q=V);for(var J=$.slice(Y,q).trim(),U=q<V?q+1:V;U<V;){var W=G0($,U);if(v0($,U,W),Y0>=2&&!l0($,U,W))J+=`
16268
- `+$.slice(U,W),U=t($,W);else if(l0($,U,W)){var X=t($,W);if(X<V){var H=G0($,X);if(v0($,X,H),Y0>=2){J+=`
16269
- `,U=t($,W);continue}}break}else break}return Z.refs[K]||(Z.refs[K]={target:J,title:void 0}),{node:{type:v$1.footnote},end:U}}function oZ($,Q,Z,V){let Y=Q,G=0,K=0,q=-1;for(;Y<$.length;){let f=q>=0?q:G0($,Y);if(q=-1,l0($,Y,f))break;if(v0($,Y,f),Y0<4&&K>0&&!Z.g){let T=$.charCodeAt(Y+Q0);if(T===C0||T===p$1){let m=Y+Q0;for(;m<f&&$.charCodeAt(m)===T;)m++;for(;m<f&&($.charCodeAt(m)===b||$.charCodeAt(m)===R);)m++;if(m>=f){G=T===C0?1:2,Y=t($,f);break}}}K=f;let w=t($,f);if(w<$.length){if($.charCodeAt(w)===a9){var J=G0($,w);Y=t($,J),K=J;continue}let T=G0($,w);if(q=T,v0($,w,T),Y0<4){let m=$.charCodeAt(w+Q0);if(m===c){Y=w;break}if(m===J9&&i6($,w,Z,V)){Y=w;break}if(m===$0||m===A0){for(var U=w+Q0,W=0;U<T&&$.charCodeAt(U)===m;)W++,U++;if(W>=3){Y=w;break}}if(m===Z0){var X=w+Q0+1,H=X<T?$.charCodeAt(X):0,z=H===g0||H===i9;if(!z&&H===j0){for(var D=X+1,j=D;j<T&&($.charCodeAt(j)>=d&&$.charCodeAt(j)<=l$1||$.charCodeAt(j)>=F0&&$.charCodeAt(j)<=H0||$.charCodeAt(j)>=o&&$.charCodeAt(j)<=i||$.charCodeAt(j)===p$1);)j++;j>D&&(z=A$.has($.slice(D,j).toLowerCase()));}else if(!z){for(var F=X;F<T&&($.charCodeAt(F)>=d&&$.charCodeAt(F)<=l$1||$.charCodeAt(F)>=F0&&$.charCodeAt(F)<=H0||$.charCodeAt(F)>=o&&$.charCodeAt(F)<=i||$.charCodeAt(F)===p$1);)F++;if(F>X){var B=$.slice(X,F).toLowerCase();z=A$.has(B)||U$.has(B);}}if(z&&n6($,w,Z,V)){Y=w;break}}if(m===p$1||m===B0||m===A9){let C=w+Q0+1;if(C<T&&($.charCodeAt(C)===b||$.charCodeAt(C)===R)){var M=J$($,C,T);if(M<T&&!T9($,w)){Y=w;break}}}if(m>=o&&m<=i){let C=w+Q0;for(;C<T&&$.charCodeAt(C)>=o&&$.charCodeAt(C)<=i;)C++;if(C<T&&($.charCodeAt(C)===d0||$.charCodeAt(C)===Z9)&&C-(w+Q0)===1&&$.charCodeAt(w+Q0)===49){var A=C+1;if(A<T&&($.charCodeAt(A)===b||$.charCodeAt(A)===R)){var k=J$($,A,T);if(k<T){Y=w;break}}}}if(m===w0){let C=t($,T);if(C<$.length){let g=G0($,C);if(p6($,C,g)){Y=w;break}}}if((m===p$1||m===B0||m===z0)&&T9($,w)){if(m!==p$1){Y=w;break}let g=w+Q0;for(;g<T&&$.charCodeAt(g)===p$1;)g++;for(;g<T&&($.charCodeAt(g)===b||$.charCodeAt(g)===R);)g++;if(g<T){Y=w;break}}}}Y=t($,f);}for(var _=G?K:Y;_>Q&&($.charCodeAt(_-1)===x||$.charCodeAt(_-1)===B9||$.charCodeAt(_-1)===b||$.charCodeAt(_-1)===R);)_--;for(var O=Q;O<_&&($.charCodeAt(O)===b||$.charCodeAt(O)===R);)O++;if(O>=_)return null;for(var E=false,L=O;L<_;L++)if($.charCodeAt(L)===a9){E=true;break}var y=E?$.slice(O,_).replace(/\u001E/g,""):$.slice(O,_);if(!y)return null;let I=iZ(y,0,y.length,Z,V);if(G){let w=(V?.slugify||E0)(y);return {node:{type:v$1.heading,level:G,children:I,id:w},end:Y}}return {node:{type:v$1.paragraph,children:I},end:Y}}function iZ($,Q,Z,V,Y){var G=$.indexOf(`
16270
- `,Q);if(G<0||G>=Z)return h0($,Q,Z,V,Y);for(var K="",q=Q,J=Q;J<Z;){var U=$.charCodeAt(J);if(U===$0){var W=I$($,J,Z);if(W>J){for(var X=false,H=J;H<W;H++)if($.charCodeAt(H)===x){X=true;break}X&&(K+=$.slice(q,J),K+=$.slice(J,W).replace(/\n/g," "),q=W),J=W;continue}}if(U===Z0){var z=s6($,J,Z);if(z>J){J=z;continue}}if(U===x){var D=false,j=0;if(J>Q&&$.charCodeAt(J-1)===N0)D=true,j=1;else {for(var F=0,B=J-1;B>=Q&&$.charCodeAt(B)===b;)F++,B--;F>=2&&(D=true,j=F);}if(D)K+=$.slice(q,J-j),K+="";else {for(var M=J;M>q&&$.charCodeAt(M-1)===b;)M--;K+=$.slice(q,M)+`
16271
- `;}for(J++;J<Z&&$.charCodeAt(J)===b;)J++;q=J;continue}J++;}return q<Z&&(K+=$.slice(q,Z)),h0(K,0,K.length,V,Y)}function aZ($,Q,Z){if($.charCodeAt(Q)!==$0)return null;let V=P9($,Q,Z,96),Y=Q+V;for(;Y<Z;){let G=$.indexOf("`",Y);if(G<0||G>=Z)return null;let K=P9($,G,Z,96);if(K===V){let q=$.slice(Q+V,G);return q=q.replace(/\n/g," "),q.length>0&&q[0]===" "&&q[q.length-1]===" "&&q.trim().length>0&&(q=q.slice(1,-1)),{node:{type:v$1.codeInline,text:q},end:G+K}}Y=G+K;}return null}function I$($,Q,Z){if($.charCodeAt(Q)!==$0)return Q;let V=P9($,Q,Z,96),Y=Q+V;for(;Y<Z;){let G=$.indexOf("`",Y);if(G<0||G>=Z)return Q;let K=P9($,G,Z,96);if(K===V)return G+K;Y=G+K;}return Q}function s6($,Q,Z){if($.charCodeAt(Q)!==Z0)return Q;if(Q+1<Z&&$.charCodeAt(Q+1)===j0){let U=Q+2;for(;U<Z&&$.charCodeAt(U)!==c;)U++;return U<Z?U+1:Q}if(Q+3<Z&&$.charCodeAt(Q+1)===g0&&$.charCodeAt(Q+2)===p$1&&$.charCodeAt(Q+3)===p$1){let U=$.indexOf("-->",Q+4);return U>=0?U+3:Q}let V=Q+1,Y=V;for(;V<Z;){let U=$.charCodeAt(V);if(U>=d&&U<=l$1||U>=F0&&U<=H0||U>=o&&U<=i||U===p$1)V++;else break}if(V===Y)return Q;let G=$.slice(Y,V).toLowerCase(),K=false;for(;V<Z;){let U=$.charCodeAt(V);if(U===c){V++;break}if(U===j0&&V+1<Z&&$.charCodeAt(V+1)===c){V+=2,K=true;break}if(U===M9||U===S9){var q=U;for(V++;V<Z&&$.charCodeAt(V)!==q;)V++;V<Z&&V++;continue}if(U===x)return Q;V++;}if(K||c9(G))return V;let J=1;for(;V<Z&&J>0;)if($.charCodeAt(V)===Z0)if(V+1<Z&&$.charCodeAt(V+1)===j0){let U=V+2,W=U;for(;W<Z&&($.charCodeAt(W)>=d&&$.charCodeAt(W)<=l$1||$.charCodeAt(W)>=F0&&$.charCodeAt(W)<=H0);)W++;if($.slice(U,W).toLowerCase()===G){for(;W<Z&&$.charCodeAt(W)!==c;)W++;if(W<Z&&W++,J--,J===0)return W}V=W;}else {let U=V+1,W=U;for(;W<Z&&($.charCodeAt(W)>=d&&$.charCodeAt(W)<=l$1||$.charCodeAt(W)>=F0&&$.charCodeAt(W)<=H0);)W++;$.slice(U,W).toLowerCase()===G&&J++,V++;}else V++;return V}function nZ($,Q,Z,V,Y){if($.charCodeAt(Q)!==A0||Q+1>=Z||$.charCodeAt(Q+1)!==A0)return null;let G=Q+2;for(;G+1<Z;){let K=$.charCodeAt(G);if(K===$0){let q=I$($,G,Z);if(q>G){G=q;continue}}if(K===A0&&$.charCodeAt(G+1)===A0){let q=$.slice(Q+2,G),J=h0(q,0,q.length,V,Y);return {node:{type:v$1.textFormatted,tag:"del",children:J},end:G+2}}K===N0&&G+1<Z&&G++,G++;}return null}function sZ($,Q,Z,V,Y){if($.charCodeAt(Q)!==C0||Q+1>=Z||$.charCodeAt(Q+1)!==C0)return null;let G=Q+2;for(;G+1<Z;){let K=$.charCodeAt(G);if(K===$0){let q=I$($,G,Z);if(q>G){G=q;continue}}if(K===C0&&$.charCodeAt(G+1)===C0&&G>Q+2){let q=$.slice(Q+2,G),J=h0(q,0,q.length,V,Y);return {node:{type:v$1.textFormatted,tag:"mark",children:J},end:G+2}}K===N0&&G+1<Z&&G++,G++;}return null}function x6($,Q,Z){return $<n9?!!(c$($)&p9):B6.test(Q[Z])}function E6($,Q,Z){return $<n9?!!(c$($)&v9):j6.test(Q[Z])}function tZ($,Q,Z){var V=$.charCodeAt(Q);if(V!==B0&&V!==z0)return null;var Y=P9($,Q,Z,V);if(Y===0)return null;var G=Q>0?$.charCodeAt(Q-1):32,K=Q+Y<Z?$.charCodeAt(Q+Y):32,q=E6(G,$,Q-1),J=E6(K,$,Q+Y),U=Q>0?x6(G,$,Q-1):false,W=Q+Y<Z?x6(K,$,Q+Y):false,X=!J&&(!W||q||U),H=!q&&(!U||J||W),z,D;return V===B0?(z=X,D=H):(z=X&&(!H||U),D=H&&(!X||W)),{len:Y,canOpen:z,canClose:D}}function eZ($,Q,Z,V){if(Q.length!==0){for(var Y=[],G=0;G<12;G++)Y[G]=-1;for(var K=0;K<Q.length;){var q=Q[K];if(!q.active||!q.canClose){K++;continue}for(var J=q.ch===B0?0:1,U=J*6+q.len%3*2+(q.canOpen?1:0),W=Y[U]!==void 0?Y[U]:-1,X=-1,H=K-1;H>W;H--){var z=Q[H];if(!(!z.active||z.ch!==q.ch||!z.canOpen)&&!((q.canOpen||z.canClose)&&(z.len+q.len)%3===0&&z.len%3!==0)){X=H;break}}if(X<0){Y[U]=K-1,!q.canOpen&&(q.active=false),K++;continue}var D=Q[X],j=D.len>=2&&q.len>=2,F=j?2:1;D.len-=F,q.len-=F;var B=$[D.idx],M=$[q.idx];B.text=B.text.slice(0,B.text.length-F),M.text=M.text.slice(F);var A=D.idx+1,k=q.idx,_=$.slice(A,k),O={type:v$1.textFormatted,tag:j?"strong":"em",children:_};$.splice(A,k-A,O);for(var E=k-A-1,L=0;L<Q.length;L++)Q[L].idx>D.idx&&(Q[L].idx-=E);for(var y=X+1;y<K;y++)Q[y].active=false;if(D.len===0&&(D.active=false,B.text==="")){$.splice(D.idx,1);for(var I=0;I<Q.length;I++)Q[I].idx>D.idx?Q[I].idx--:Q[I].idx===D.idx&&(Q[I].idx=-1);}if(q.len===0){q.active=false;var f=q.idx;if(M.text===""){$.splice(f,1);for(var w=0;w<Q.length;w++)Q[w].idx>f?Q[w].idx--:Q[w].idx===f&&(Q[w].idx=-1);}}else continue;K++;}for(var T=0,m=0;m<$.length;m++){var C=$[m];if(C.type===v$1.text){var g=C;if(g.text==="")continue;if(T>0&&$[T-1].type===v$1.text){$[T-1].text+=g.text;continue}}$[T++]=C;}$.length=T;}}function T6($,Q,Z,V,Y){let G=$.charCodeAt(Q)===g0,K=G?Q+1:Q;if($.charCodeAt(K)!==O0)return null;var q=$.indexOf("]",K+1);if(q<0||q>=Z)return null;for(var J=K+1,U=-1,W=1;J<Z&&W>0;){var X=$.charCodeAt(J);if(X===N0&&J+1<Z){J+=2;continue}if(X===$0){var H=I$($,J,Z);if(H>J){J=H;continue}}if(X===Z0){var z=t6($,J,Z);if(z){J=z.end;continue}var D=s6($,J,Z);if(D>J){J=D;continue}}X===O0?W++:X===p0&&W--,J++;}if(W!==0)return null;var j=J-1,F=$.slice(K+1,j),B=J<Z?$.charCodeAt(J):0,M=false;if(B===$9){var A=true;for(J++;J<Z&&($.charCodeAt(J)===b||$.charCodeAt(J)===x);)J++;var k="",_=J;if(J<Z&&$.charCodeAt(J)===Z0){for(J++,_=J;_<Z&&$.charCodeAt(_)!==c;){if($.charCodeAt(_)===N0&&_+1<Z){_+=2;continue}if($.charCodeAt(_)===x){A=false;break}_++;}A&&(_>=Z||$.charCodeAt(_)!==c)&&(A=false),A&&(k=$.slice(J,_),_++);}else if(A)if(V.e!==void 0&&J>=V.e)A=false;else {for(var O=0,E=false;_<Z;){var L=$.charCodeAt(_);if(L===N0&&_+1<Z){_+=2;continue}if(L===$9)O++;else if(L===Z9){if(E=true,O===0)break;O--;}else if(L===b||L===x)break;_++;}_>=Z&&!E&&(V.e===void 0||J<V.e)&&(V.e=J),k=$.slice(J,_);}if(A){for(J=_;J<Z&&($.charCodeAt(J)===b||$.charCodeAt(J)===x);)J++;var y;if(J<Z){var I=$.charCodeAt(J);if(I===M9||I===S9||I===$9){var f=I===$9?41:I;J++;for(var w=J;J<Z&&$.charCodeAt(J)!==f;)$.charCodeAt(J)===N0&&J+1<Z&&J++,J++;J>=Z?A=false:(y=$.slice(w,J),J++);}}if(A){for(;J<Z&&($.charCodeAt(J)===b||$.charCodeAt(J)===x);)J++;(J>=Z||$.charCodeAt(J)!==Z9)&&(A=false);}}if(A){J++,k=$$(k),y!==void 0&&(y=s9($$(y)));var T=Y?.sanitizer||d9,m=T(k,G?"img":"a",G?"src":"href"),C=m===null?null:k;if(G){var g=h0(F,0,F.length,V,Y),X0=_$(g);return {node:{type:v$1.image,target:C,alt:X0,title:y},end:J}}else {var J0=V.inAnchor;V.inAnchor=true;var P=J0?[{type:v$1.text,text:F}]:h0(F,0,F.length,V,Y);return V.inAnchor=J0,!V.inAnchor&&d$(P)?null:{node:{type:v$1.link,target:C,title:y,children:P},end:J}}}else J=j+1,M=true;}var a="",r=J;if(!M&&B===O0){var y0=J+1;r=y0;for(var R0=false;r<Z&&$.charCodeAt(r)!==p0;){if($.charCodeAt(r)===N0&&r+1<Z){r+=2;continue}if($.charCodeAt(r)===O0){R0=true;break}r++;}if(R0||r>=Z)return null;var U0=$.slice(y0,r);if(U0.trim())a=j$(U0);else {if(R6(F))return null;a=j$(F);}r=r+1;}else {if(R6(F))return null;a=j$(F);}var u=V.refs[a];if(!u)return null;if(G)return {node:{type:v$1.image,target:u.target,alt:_$(h0(F,0,F.length,V,Y)),title:u.title},end:r};var n=V.inAnchor;V.inAnchor=true;var P=n?[{type:v$1.text,text:F}]:h0(F,0,F.length,V,Y);return V.inAnchor=n,!V.inAnchor&&d$(P)?null:{node:{type:v$1.link,target:u.target,title:u.title,children:P},end:r}}function t6($,Q,Z){if($.charCodeAt(Q)!==Z0)return null;for(var V=Q+1;V<Z;){var Y=$.charCodeAt(V);if(Y===c)break;if(Y===b||Y===x||Y===B9||Y===Z0)return null;V++;}if(V>=Z||$.charCodeAt(V)!==c)return null;var G=$.slice(Q+1,V),K=G.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);return K?{node:{type:v$1.link,target:G,title:void 0,children:[{type:v$1.text,text:G}]},end:V+1}:G.indexOf("@")!==-1&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(G)?{node:{type:v$1.link,target:"mailto:"+G,title:void 0,children:[{type:v$1.text,text:G}]},end:V+1}:null}function $5($,Q,Z,V){if($.charCodeAt(Q)!==O0||Q+1>=Z||$.charCodeAt(Q+1)!==e0)return null;let Y=Q+2;for(;Y<Z&&$.charCodeAt(Y)!==p0&&$.charCodeAt(Y)!==x;)Y++;if(Y>=Z||$.charCodeAt(Y)!==p0)return null;let G=$.slice(Q+2,Y);return G?{node:{type:v$1.footnoteReference,target:"#"+E0(G),text:G},end:Y+1}:null}function Z5($,Q,Z,V){if(V.disableBareUrls)return null;var Y="",G=false,K=$.charCodeAt(Q);if(K===m9||K===72?Q+8<=Z&&$.charCodeAt(Q+1)===h9&&$.charCodeAt(Q+2)===h9&&$.charCodeAt(Q+3)===H$&&($.charCodeAt(Q+4)===x$&&$.charCodeAt(Q+5)===x0&&$.charCodeAt(Q+6)===j0&&$.charCodeAt(Q+7)===j0?Y="https://":$.charCodeAt(Q+4)===x0&&$.charCodeAt(Q+5)===j0&&$.charCodeAt(Q+6)===j0&&(Y="http://")):K===j9||K===70?Q+6<=Z&&$.charCodeAt(Q+1)===h9&&$.charCodeAt(Q+2)===H$&&$.charCodeAt(Q+3)===x0&&$.charCodeAt(Q+4)===j0&&$.charCodeAt(Q+5)===j0&&(Y="ftp://"):(K===W9||K===87)&&Q+4<=Z&&$.charCodeAt(Q+1)===W9&&$.charCodeAt(Q+2)===W9&&$.charCodeAt(Q+3)===d0&&(Y="www.",G=true),!Y)return null;let q=Q+Y.length;for(;q<Z;){let O=$.charCodeAt(q);if(O===b||O===x||O===R||O===B9||O===Z0||O===c)break;q++;}for(var J=0,U=0,W=Q;W<q;W++){var X=$.charCodeAt(W);X===$9?J++:X===Z9&&U++;}let H=q;for(;H>Q+Y.length;){let O=$.charCodeAt(H-1);if(O===d0||O===q6||O===x0||O===g0||O===i9||O===Z9||O===B0||O===z0||O===A0){if(O===Z9){if(J>=U)break;U--;}H--;}else if(O===E$){for(var z=H-2;z>Q&&($.charCodeAt(z)>=d&&$.charCodeAt(z)<=l$1||$.charCodeAt(z)>=F0&&$.charCodeAt(z)<=H0||$.charCodeAt(z)>=o&&$.charCodeAt(z)<=i);)z--;z>=Q&&$.charCodeAt(z)===S$?H=z:H--;}else break}if(H<=Q+Y.length)return null;var D=Q+(G?4:Y.length),j=$.indexOf("/",D);if((j<0||j>H)&&(j=H),G&&$.indexOf(".",D)===-1)return null;for(var F=-1,B=-1,M=j-1;M>=D;M--)if($.charCodeAt(M)===d0)if(F<0)F=M;else {B=M;break}for(var A=B>=0?B+1:D,M=A;M<j;M++)if($.charCodeAt(M)===z0)return null;var k=$.slice(Q,H),_=G?"http://"+k:k;return {node:{type:v$1.link,target:_,title:void 0,children:[{type:v$1.text,text:k}]},end:H}}function Q5($,Q,Z,V){if(V.disableBareUrls)return null;for(var Y=Q,G=Y;Y<Z;){var K=$.charCodeAt(Y);if(K>=d&&K<=l$1||K>=F0&&K<=H0||K>=o&&K<=i||K===d0||K===g0||K===J9||K===36||K===G$||K===S$||K===S9||K===B0||K===A9||K===j0||K===C0||K===i9||K===e0||K===z0||K===$0||K===g9||K===w0||K===O$||K===A0||K===p$1)Y++;else break}if(Y===G||Y>=Z||$.charCodeAt(Y)!==K$)return null;Y++;for(var q=Y,J=-1,U=Y;Y<Z;){var K=$.charCodeAt(Y);if(K>=d&&K<=l$1||K>=F0&&K<=H0||K>=o&&K<=i)Y++;else if((K===p$1||K===z0)&&Y>q)Y++;else if(K===d0){if(Y===q)break;var W=$.charCodeAt(Y-1);if(W===p$1||W===z0||Y-U>63)break;if(Y+1<Z){var X=$.charCodeAt(Y+1);if(X>=d&&X<=l$1||X>=F0&&X<=H0||X>=o&&X<=i)J=Y,U=Y+1,Y++;else break}else break}else break}if(Y-U>63||J<0)return null;var H=$.charCodeAt(Y-1);if(!(H>=d&&H<=l$1||H>=F0&&H<=H0||H>=o&&H<=i)||Y<=J+1)return null;for(var z=-1,D=J-1;D>=q;D--)if($.charCodeAt(D)===d0){z=D;break}for(var j=z>=0?z+1:q,D=j;D<Y;D++)if($.charCodeAt(D)===z0)return null;var F=$.slice(Q,Y);return {node:{type:v$1.link,target:"mailto:"+F,title:void 0,children:[{type:v$1.text,text:F}]},end:Y}}function d$($){for(var Q=0;Q<$.length;Q++)if($[Q].type===v$1.link||"children"in $[Q]&&Array.isArray($[Q].children)&&d$($[Q].children))return true;return false}function _$($){for(var Q="",Z=0;Z<$.length;Z++){var V=$[Z];V.type===v$1.text?Q+=V.text:V.type===v$1.breakLine?Q+=" ":V.type===v$1.codeInline?Q+=V.text:"children"in V&&Array.isArray(V.children)?Q+=_$(V.children):V.type===v$1.image?Q+=V.alt||"":V.type===v$1.link&&(Q+=_$(V.children));}return Q}function l9($){let Q=$.includes("&")?s9($):$;return {type:v$1.text,text:Q}}function V5($,Q,Z,V,Y){if($.charCodeAt(Q)!==Z0)return null;var G=Q+1;if(G>=Z)return null;var K=$.charCodeAt(G);if(K===g0&&G+1<Z&&$.charCodeAt(G+1)===p$1&&G+2<Z&&$.charCodeAt(G+2)===p$1){var q=G+3;if(q<Z&&$.charCodeAt(q)===c)return {node:{type:v$1.htmlComment,text:"",h:true},end:q+1};if(q+1<Z&&$.charCodeAt(q)===p$1&&$.charCodeAt(q+1)===c)return {node:{type:v$1.htmlComment,text:"-",h:true},end:q+2};var J=$.indexOf("-->",q);return J!==-1&&J<=Z-3?{node:{type:v$1.htmlComment,text:$.slice(Q+4,J),h:false},end:J+3}:null}if(K===i9){var U=$.indexOf("?>",G+1);return U!==-1&&U<Z?{node:{type:v$1.htmlSelfClosing,tag:"?",attrs:{},a:$.slice(Q,U+2),b:false},end:U+2}:null}if(K===g0&&G+1<Z){var W=$.charCodeAt(G+1);if(W===O0&&$.slice(G+1,G+8)==="[CDATA["){var X=$.indexOf("]]>",G+8);return X!==-1&&X<Z?{node:{type:v$1.htmlSelfClosing,tag:"![CDATA[",attrs:{},a:$.slice(Q,X+3),b:false},end:X+3}:null}if(W>=d&&W<=l$1){var H=$.indexOf(">",G+2);return H!==-1&&H<Z?{node:{type:v$1.htmlSelfClosing,tag:"!"+$.slice(G+1,H),attrs:{},a:$.slice(Q,H+1),b:false},end:H+1}:null}}if(K===j0){var z=G+1;if(z>=Z)return null;var D=$.charCodeAt(z);if(!(D>=d&&D<=l$1||D>=F0&&D<=H0))return null;for(z++;z<Z;){var j=$.charCodeAt(z);if(j>=d&&j<=l$1||j>=F0&&j<=H0||j>=o&&j<=i||j===p$1)z++;else break}for(;z<Z&&($.charCodeAt(z)===b||$.charCodeAt(z)===R||$.charCodeAt(z)===x);)z++;if(z<Z&&$.charCodeAt(z)===c){var F=$.slice(G+1,z).trim();return {node:{type:v$1.htmlSelfClosing,tag:F,attrs:{},a:$.slice(Q,z+1),b:true},end:z+1}}return null}if(!(K>=d&&K<=l$1||K>=F0&&K<=H0))return null;var B=N9($,Q);if(!B)return null;var M=B.tag,A=M.toLowerCase(),k=B.selfClosing;if(k||c9(M))return {node:{type:v$1.htmlSelfClosing,tag:M,attrs:I9(B.attrs,M,Y),a:$.slice(Q,B.end),b:false},end:B.end};var _=U$.has(A),O=p$($.slice(0,Z),B.end,M);if(O===-1)return {node:{type:v$1.htmlSelfClosing,tag:M,attrs:I9(B.attrs,M,Y),a:$.slice(Q,B.end),b:false},end:B.end};var E=dZ($,"</"+A,O),L=$.slice(B.end,E),y=[];if(_)L.trim()&&(y=[{type:v$1.text,text:L}]);else {var I=L.trim();if(I){var{inAnchor:f,inline:w}=V;A==="a"&&(V.inAnchor=true);var T=I.indexOf(`
16272
-
16273
- `)!==-1||/^#{1,6}\s/.test(I);T?(V.inline=false,y=b9(I,V,Y)):y=h0(I,0,I.length,V,Y),V.inAnchor=f,V.inline=w;}}return {node:{type:v$1.htmlBlock,tag:M,attrs:I9(B.attrs,M,Y),f:B.rawAttrs,children:y,a:void 0,text:L,c:false,b:false},end:O}}var Y5=200,e9=0;function h0($,Q,Z,V,Y){if(e9++,e9>Y5)return e9--,[{type:v$1.text,text:$.slice(Q,Z)}];var G=V.e;V.e=void 0;let K=V;if(Y.optimizeForStreaming){let n0=function(S,S0){for(var q0=1,s0=S0+1;s0<S.length;s0++){var z9=S.charCodeAt(s0);if(z9===O0)q0++;else if(z9===p0&&(q0--,q0===0))return s0}return -1},N=$.slice(Q,Z),e=N;for(var q=0,J=0,U=0,W=0,X=0,H=-1,z=-1,D=-1,j=-1,F=-1,B=0;B<N.length;B++){var M=N.charCodeAt(B);M===B0?B+1<N.length&&N.charCodeAt(B+1)===B0?(q++,H=B,B++):(J++,z=B):M===z0?B+1<N.length&&N.charCodeAt(B+1)===z0?(U++,D=B,B++):(W++,j=B):M===A0&&B+1<N.length&&N.charCodeAt(B+1)===A0&&(X++,F=B,B++);}var A=[];X%2===1&&F>=0&&A.push([F,2]),U%2===1&&D>=0&&A.push([D,2]),W%2===1&&j>=0&&A.push([j,1]),q%2===1&&H>=0&&A.push([H,2]),J%2===1&&z>=0&&A.push([z,1]),A.sort(function(S,S0){return S0[0]-S[0]});for(var k=0;k<A.length;k++){var _=A[k][0],O=A[k][1];N=N.slice(0,_)+N.slice(_+O);}let I0=0,a0=-1;for(let S=0;S<N.length;S++)N.charCodeAt(S)===$0&&(I0++,a0=S);if(I0%2===1&&a0!==-1){let S=false,S0=-1,q0=0;for(;q0<N.length;)N.charCodeAt(q0)===$0&&(S?(S=false,S0=-1):(S0=q0,S=true)),q0++;S&&S0!==-1&&(N=N.slice(0,S0));}for(var E=true;E;){E=false;for(var L=-1,y=-1,I=-1,f=false,w=0;w<N.length;w++){var T=N.charCodeAt(w);if(T===O0&&(w===0||N.charCodeAt(w-1)!==N0)){var m=w>0&&N.charCodeAt(w-1)===g0,C=m?w-1:w,g=n0(N,w);if(g===-1)L=C,f=m,y=w+1,I=N.length;else {var X0=g+1;if(X0>=N.length)L=C,f=m,y=w+1,I=g;else if(N.charCodeAt(X0)===$9){var J0=N.indexOf(")",X0+1);J0===-1?(L=C,f=m,y=w+1,I=g,w=N.length):w=J0;}else if(N.charCodeAt(X0)===O0){var P=N.indexOf("]",X0+1);P===-1?(L=C,f=m,y=w+1,I=g,w=N.length):w=P;}else w=g;}}}if(L>=0){var a=f?"":N.slice(y,I);N=N.slice(0,L)+a,E=true;}}let P0=N.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);if(P0&&P0.index!==void 0){var r=P0[0].length-P0[2].length,y0=r>=2&&P0[0].charCodeAt(r-2)===j0;if(!y0){for(var R0=false,U0=0,u=0;u<P0.index;u++)N.charCodeAt(u)===$0&&U0++;if(R0=U0%2===1,!R0){let S=P0[1];E9(N,"</"+S,0)===-1&&(N=N.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/,"$1"));}}}N!==e&&($=$.slice(0,Q)+N,Z=Q+N.length);}let n=[];var D0=[];let s=Q;var M0=Y.disableAutoLink||Y.disableBareUrls||K.inAnchor?-1:$.indexOf("@",Q);for(M0>=Z&&(M0=-1);Q<Z;){let N=$.charCodeAt(Q),e=null;if(N===$0){if(e=aZ($,Q,Z),!e){var _0=P9($,Q,Z,$0);Q+=_0-1;}}else if(N===B0||N===z0){var K0=tZ($,Q,Z);if(K0){if(K0.canOpen||K0.canClose){Q>s&&n.push(l9($.slice(s,Q)));var b0=$.slice(Q,Q+K0.len),V0=l9(b0);D0.push({idx:n.length,ch:N,len:K0.len,canOpen:K0.canOpen,canClose:K0.canClose,active:true}),n.push(V0),Q+=K0.len,s=Q;continue}Q+=K0.len-1;}}else if(N===A0)e=nZ($,Q,Z,K,Y);else if(N===C0)e=sZ($,Q,Z,K,Y);else if(N===O0)Q+1<Z&&$.charCodeAt(Q+1)===e0&&(e=$5($,Q,Z)),e||(e=T6($,Q,Z,K,Y));else if(N===g0&&Q+1<Z&&$.charCodeAt(Q+1)===O0)e=T6($,Q,Z,K,Y);else if(N===Z0)e=t6($,Q,Z),!e&&!Y.disableParsingRawHTML&&!Y.ignoreHTMLBlocks&&(e=V5($,Q,Z,K,Y));else if((N===m9||N===W9||N===j9)&&!K.inAnchor&&!Y.disableAutoLink&&(Q===0||$.charCodeAt(Q-1)!==Z0)){var W0=Q+1<Z?$.charCodeAt(Q+1):0;(N===m9&&W0===h9||N===j9&&W0===h9||N===W9&&W0===W9)&&(e=Z5($,Q,Z,Y));}if(!e&&M0>=0&&M0-Q<=64&&!K.inAnchor&&!Y.disableAutoLink&&!Y.disableBareUrls&&(N>=d&&N<=l$1||N>=F0&&N<=H0||N>=o&&N<=i)&&(e=Q5($,Q,Z,Y),!e&&Q>=M0&&(M0=$.indexOf("@",Q+1),M0>=Z&&(M0=-1))),N===D$){Q>s&&n.push(l9($.slice(s,Q))),n.push({type:v$1.breakLine}),Q++,s=Q;continue}if(e)Q>s&&n.push(l9($.slice(s,Q))),n.push(e.node),Q=e.end,s=Q;else {if(N===N0&&Q+1<Z){let I0=$.charCodeAt(Q+1);if(c$(I0)&p9){Q>s&&n.push(l9($.slice(s,Q))),n.push(l9($[Q+1])),Q+=2,s=Q;continue}}if(Q++,M0<0||M0-Q>64)for(;Q<Z&&!(M0>=0&&M0-Q<=64);){var h=$.charCodeAt(Q);if(h<n9&&!m6[h])Q++;else break}}}if(Z>s){let N=$.slice(s,Z);N&&n.push(l9(N));}return D0.length>0&&eZ(n,D0),V.e=G,e9--,n}var G5=500;function b9($,Q,Z){var V=Q.i||0;if(V>G5)return [{type:v$1.text,text:$}];Q.i=V+1;if(Z.optimizeForStreaming&&!Q.j){var G=$.length;G>0&&$.charCodeAt(G-1)===x&&G--;for(var K=G;K>0&&$.charCodeAt(K-1)!==x;)K--;if(K>0&&$.charCodeAt(K)===w0){for(var q=true,J=K;J<G;J++){var U=$.charCodeAt(J);if(U!==b&&U!==R&&U!==p$1&&U!==x0&&U!==w0){q=false;break}}if(q){for(var W=K-1;W>0&&$.charCodeAt(W-1)!==x;)W--;$.charCodeAt(W)===w0&&($=$.slice(0,W).trimEnd());}}var X=$.trim(),H=X.lastIndexOf(`
16274
- `),z=H===-1?X:X.slice(H+1);if(z.length>0&&z.charCodeAt(0)===w0){for(var D=false,j=false,F=1;F<z.length;F++){var B=z.charCodeAt(F);B===w0&&(D=true),B===p$1&&(j=true);}D&&j&&($=H===-1?"":$.slice(0,$.lastIndexOf(z)).trimEnd());}for(var M=-1,A=-1,k=-1,_=$.length-1;_>=0;_--)if($.charCodeAt(_)===Z0){var O=_+1<$.length?$.charCodeAt(_+1):0;if(O>=d&&O<=l$1||O>=F0&&O<=H0){for(var E=_+2;E<$.length;){var L=$.charCodeAt(E);if(L>=d&&L<=l$1||L>=F0&&L<=H0||L>=o&&L<=i)E++;else break}for(var y=E;y<$.length&&$.charCodeAt(y)!==c;)y++;if(y<$.length&&$.charCodeAt(y-1)!==j0){for(var I=false,f=y+1;f<$.length;f++)if($.charCodeAt(f)===Z0){I=true;break}I||(M=_,A=E,k=y+1);}}break}if(M>=0){for(var w=0,T=0;T<M;T++)$.charCodeAt(T)===$0&&w++;if(w%2===0){var m=$.slice(M+1,A);E9($,"</"+m,0)===-1&&($=$.slice(0,M)+$.slice(k));}}for(var C=$.length;C>0&&$.charCodeAt(C-1)===x;)C--;if(C>0){for(var g=C;g>0&&$.charCodeAt(g-1)!==x;)g--;for(var X0=g,J0=0;X0<C&&$.charCodeAt(X0)===b&&J0<3;)X0++,J0++;if(g>0&&X0<C&&CZ($,X0,C)){for(var P=g-1,a=P;a>0&&$.charCodeAt(a-1)!==x;)a--;l0($,a,P)||($=$.slice(0,g).trimEnd());}}var r=$.length;if(r>0){for(var y0=$.lastIndexOf(`
16275
- `),R0=y0===-1?0:y0+1,U0=r,u=R0,n=0;u<U0&&$.charCodeAt(u)===b&&n<3;)u++,n++;if(u<U0){var D0=$.charCodeAt(u),s=false;if(D0===B0||D0===p$1||D0===A9){var M0=u+1;if(M0>=U0||$.charCodeAt(M0)===b||$.charCodeAt(M0)===R){for(var _0=M0;_0<U0&&($.charCodeAt(_0)===b||$.charCodeAt(_0)===R);)_0++;_0>=U0&&(s=true);}}else if(D0>=o&&D0<=i){for(var K0=u;K0<U0&&$.charCodeAt(K0)>=o&&$.charCodeAt(K0)<=i;)K0++;if(K0<U0&&($.charCodeAt(K0)===d0||$.charCodeAt(K0)===Z9)){var b0=K0+1;if(b0>=U0||$.charCodeAt(b0)===b||$.charCodeAt(b0)===R){for(var V0=b0;V0<U0&&($.charCodeAt(V0)===b||$.charCodeAt(V0)===R);)V0++;V0>=U0&&(s=true);}}}s&&($=$.slice(0,R0).trimEnd());}}}if(Q.inline)return h0($,0,$.length,Q,Z);let W0=[],h=0,N=$.length;if(h===0&&!Z.disableFrontmatter&&$.startsWith("---")){let S=H6($);if(S&&S.hasValidYaml){if(Z.preserveFrontmatter!==false){let S0=$.slice(0,S.endPos).trimEnd();W0.push({type:v$1.frontmatter,text:S0});}h=S.endPos;}}for(;h<N;){for(var e=$.indexOf(`
16276
- `,h),I0=e<0?N:e;h<N&&l0($,h,I0);)h=I0<N?I0+1:I0,h<N&&(e=$.indexOf(`
16277
- `,h),I0=e<0?N:e);if(h>=N)break;$.charCodeAt(h),v0($,h,I0);let S=null;if(l6=$,r6=h,o6=I0,$.charCodeAt(h)!==a9&&Y0>=4&&!Q.inHTML)S=hZ($,h);else if($.charCodeAt(h)!==a9){let S0=h+Q0,q0=$.charCodeAt(S0);q0===J9?S=i6($,h,Q,Z):q0===c?S=uZ($,h,Q,Z):q0===$0||q0===A0?S=mZ($,h):q0===p$1||q0===B0||q0===z0?(S=T9($,h),!S&&(S=L6($,h,Q,Z))):q0===A9||q0>=o&&q0<=i?S=L6($,h,Q,Z):q0===Z0?S=n6($,h,Q,Z):q0===w0?S=g6($,h,Q,Z):q0===O0&&(S=lZ($,h,Q));}if(!S){for(var a0=false,n0=h;n0<I0;n0++)if($.charCodeAt(n0)===w0){a0=true;break}a0&&(S=g6($,h,Q,Z));}if(S||(S=oZ($,h,Q,Z)),S)S.node.type!==v$1.refCollection&&W0.push(S.node),h=S.end;else {var P0=$.indexOf(`
16278
- `,h);h=P0<0?N:P0+1;}}return Q.i=V,W0}function e6($,Q,Z,V){var Y=N9($,Q);return Y?{tagName:Y.tag,tagLower:Y.tag.toLowerCase(),attrs:Y.rawAttrs,whitespaceBeforeAttrs:Y.whitespaceBeforeAttrs,isSelfClosing:Y.selfClosing,hasSpaceBeforeSlash:Y.hasSpaceBeforeSlash,isClosing:Y.isClosing,hasNewline:Y.whitespaceBeforeAttrs.includes(`
16279
- `)||Y.rawAttrs.includes(`
16280
- `),endPos:Y.end}:null}function N$($,Q,Z){e9=0,$=f$($),!Q.refs&&(Q.refs={}),Q.j=d6($,Q.refs,Z);let V=b9($,Q,Z);return C$(Q.refs)?[{type:v$1.refCollection,refs:Q.refs},...V]:V}var J5=/^\n+/,l$;try{l$=reactExports.createElement("div").$$typeof;}catch{l$=Symbol.for("react.transitional.element");}function r$($,Q,Z){return {$$typeof:l$,type:$,key:Z!=null?""+Z:null,ref:null,props:Q,_owner:null,_store:{},_debugStack:null,_debugTask:null}}var o$=typeof reactExports.createContext<"u"?reactExports.createContext(void 0):void 0;function $Z($,Q,Z,V,Y,G,K,q,J){switch($.type){case v$1.blockQuote:{let F={key:Z.key};return $.alert&&(F.className="markdown-alert-"+G($.alert.toLowerCase(),E0),$.children.unshift(M6($.alert))),V("blockquote",F,Q($.children,Z))}case v$1.breakLine:return V("br",{key:Z.key});case v$1.breakThematic:return V("hr",{key:Z.key});case v$1.frontmatter:return q.preserveFrontmatter?V("pre",{key:Z.key},$.text):null;case v$1.codeBlock:let j=$.lang?s9($.lang):"";return V("pre",{key:Z.key},V("code",{...c0($.attrs||{}),className:j?`language-${j} lang-${j}`:""},$.text));case v$1.codeInline:return V("code",{key:Z.key},$.text);case v$1.footnoteReference:return V("a",{key:Z.key,href:Y($.target,"a","href")||void 0},V("sup",{key:Z.key},$.text));case v$1.gfmTask:return V("input",{checked:$.completed,key:Z.key,readOnly:true,type:"checkbox"});case v$1.heading:return V(`h${$.level}`,{id:$.id,key:Z.key},Q($.children,Z));case v$1.htmlBlock:{let F=$;if(q.tagfilter&&m$(F.tag)){var U="";if(F.attrs)for(var W in F.attrs){var X=F.attrs[W];X===true?U+=" "+W:X!=null&&X!==false&&(U+=" "+W+'="'+String(X)+'"');}return V("span",{key:Z.key},"<"+F.tag+U+">")}if(F.a&&F.c){let I=function(P){if((P.type===v$1.htmlSelfClosing||P.type===v$1.htmlBlock)&&P.b)return [];if(P.type===v$1.paragraph){let a=P.children;return a?a.flatMap(I):[]}return P.type===v$1.text?P.text?.trim()?[P]:[]:P.type===v$1.htmlBlock&&P.children?[{...P,children:P.children?.flatMap(I)}]:[P]},w=function(P){for(var a=0;a<P.length;a++)P[a].type===v$1.htmlBlock&&(P[a].c=false),"children"in P[a]&&P[a].children&&w(P[a].children);},J0=function(P,a){for(var r=0;r<P.length;r++){var y0=P[r];if(y0.type===v$1.paragraph&&y0.children)for(var R0=y0.children,U0=0;U0<R0.length;U0++){var u=R0[U0];if(u.type===v$1.htmlSelfClosing&&u.b&&u.tag.toLowerCase()===a){var n=P.slice(0,r);U0>0&&n.push({type:v$1.paragraph,children:R0.slice(0,U0)});var D0=[];if(U0+1<R0.length){var s=R0.slice(U0+1);s=s.filter(function(M0){return !(M0.type===v$1.htmlSelfClosing&&M0.b)}),s.length>0&&(D0=s);}return D0=D0.concat(P.slice(r+1)),{found:true,beforeClose:n,afterClose:D0}}}if((y0.type===v$1.htmlSelfClosing||y0.type===v$1.htmlBlock)&&y0.b&&y0.tag.toLowerCase()===a)return {found:true,beforeClose:P.slice(0,r),afterClose:P.slice(r+1)}}return {found:false,beforeClose:P,afterClose:[]}},B=F.tag.toLowerCase(),M=h6(B),A=F.children&&F.children.length>0,k=/<[a-z][^>]{0,100}>/i.test(F.a);if(M){let P=F.a.replace(new RegExp("\\s*</"+B+">\\s*$","i"),"");return q.tagfilter&&(P=h$(P)),k?J($.tag,{key:Z.key,...c0($.attrs||{}),dangerouslySetInnerHTML:{__html:P}}):J($.tag,{key:Z.key,...c0($.attrs||{})},P)}let _=new RegExp(`^<${F.tag}(\\s|>)`,"i").test(F.a);if(A&&!_&&q.tagfilter&&I6(F.a))return J($.tag,{key:Z.key,...c0($.attrs||{})},Q(F.children,Z));if(u6(F.a)){let P=q.tagfilter?h$(F.a):F.a;return J($.tag,{key:Z.key,...c0($.attrs||{}),dangerouslySetInnerHTML:{__html:P}})}let E={slugify:P=>G(P,E0),sanitizer:Y,tagfilter:true},L=F.a.replace(/>\s+</g,"><").replace(/\n+/g," ").trim();if(new RegExp(`^<${F.tag}(\\s[^>]*)?>(\\s*</${F.tag}>)?$`,"i").test(L))return F.children&&F.children.length>0?J($.tag,{key:Z.key,...c0($.attrs||{})},Q(F.children,Z)):J($.tag,{key:Z.key,...c0($.attrs||{})});let f=N$(L,{inline:false,refs:K,inHTML:false},E);w(f);let T=F.tag.toLowerCase(),m="</"+T+">",C=new RegExp(`^<${F.tag}(\\s|>)`,"i").test(L),g=L.toLowerCase().trimEnd().endsWith(m),X0=C&&g;if(X0&&A)return J($.tag,{key:Z.key,...c0($.attrs||{})},Q(F.children,Z));if(X0)return Q(f.flatMap(I),Z);var H=J0(f,T);if(H.found&&H.afterClose.length>0){var z=H.beforeClose.flatMap(I),D=H.afterClose.flatMap(I);return r$(reactExports.Fragment,{children:[J($.tag,{key:Z.key,...c0($.attrs||{})},Q(z,Z)),Q(D,Z)]},null)}return J($.tag,{key:Z.key,...c0($.attrs||{})},Q(f.flatMap(I),Z))}return c9($.tag)?J($.tag,{key:Z.key,...c0($.attrs||{})}):J($.tag,{key:Z.key,...c0($.attrs||{})},$.children?Q($.children,Z):"")}case v$1.htmlSelfClosing:{let F=$;if(q.tagfilter&&m$(F.tag)){var U="";if(F.attrs)for(var W in F.attrs){var X=F.attrs[W];X===true?U+=" "+W:X!=null&&X!==false&&(U+=" "+W+'="'+String(X)+'"');}return V("span",{key:Z.key},"<"+F.tag+U+" />")}return J($.tag,{key:Z.key,...c0($.attrs||{})})}case v$1.image:{let F=$.target!=null?Y($.target,"img","src"):null;return V("img",{key:Z.key,alt:$.alt&&$.alt.length>0?$.alt:void 0,title:$.title||void 0,src:F||void 0})}case v$1.link:{let F={key:Z.key};return $.target!=null&&(F.href=v6($.target)),$.title&&(F.title=$.title),V("a",F,Q($.children,Z))}case v$1.table:{let F=$;return V("table",{key:Z.key},V("thead",{key:"thead"},V("tr",null,F.header.map(function(M,A){return V("th",{key:A,style:F.align[A]==null?{}:{textAlign:F.align[A]}},Q(M,Z))}))),F.cells.length>0&&V("tbody",{key:"tbody"},F.cells.map(function(M,A){return V("tr",{key:A},M.map(function(_,O){return V("td",{key:O,style:F.align[O]==null?{}:{textAlign:F.align[O]}},Q(_,Z))}))})))}case v$1.text:return $.text;case v$1.textFormatted:return V($.tag,{key:Z.key},Q($.children,Z));case v$1.orderedList:case v$1.unorderedList:{let F=$.type===v$1.orderedList?"ol":"ul";return V(F,{key:Z.key,start:$.type===v$1.orderedList?$.start:void 0},$.items.map(function(M,A){return V("li",{key:A},Q(M,Z))}))}case v$1.paragraph:return V("p",{key:Z.key},Q($.children,Z));case v$1.ref:return null;default:return null}}var U5=($,Q,Z,V,Y,G,K)=>{var q=U=>U.map(function(W){return "text"in W?W.text:""}),J=(U,W={})=>{var X=(W.renderDepth||0)+1;if(X>2500)return q(U);W.renderDepth=X;for(var H=W.key,z=[],D=false,j=0;j<U.length;j++){W.key=j;var F;if($){var B=$Z.bind(null,U[j],J,W,Q,Z,V,Y,G,K);F=$(B,U[j],J,W);}else F=$Z(U[j],J,W,Q,Z,V,Y,G,K);var M=typeof F=="string";if(M&&D)z[z.length-1]+=F;else if(F!==null)if(Array.isArray(F))for(var A=0;A<F.length;A++)z.push(F[A]);else z.push(F);D=M;}return W.key=H,W.renderDepth=X-1,z};return J},F5=($,Q)=>{let Z=t9(Q,$,void 0);return Z?typeof Z=="function"||typeof Z=="object"&&"render"in Z?Z:t9(Q,`${$}.component`,$):$};function X5($,Q){let Z={...Q||{}};Z.overrides=Z.overrides||{};let V=Z.slugify||E0,Y=Z.sanitizer||d9,G=Z.createElement,K=Z.overrides&&Object.keys(Z.overrides).length>0,q=A=>i$(A,{...Z,wrapper:null});function J(A){for(var k in A){var _=A[k];if(typeof _=="string"&&_.length>0&&_.charCodeAt(0)===Z0&&(f6.test(_)||C6.test(_)||e6(_,0))){var O=q(_.trim());A[k]=k==="innerHTML"&&Array.isArray(O)?O[0]:O;}}}function U(A,k,..._){var O=k||{},E=A;if(K){var L=t9(Z.overrides,A+".props",{});E=F5(A,Z.overrides),O={...O,...L,className:_6(O.className,L.className)||void 0};}if(!G){var y=O.key;return y!=null&&delete O.key,_.length===1?O.children=_[0]:_.length>1&&(O.children=_),r$(E,O,y)}return G(E,O,..._)}function W(A,k,..._){return k&&J(k),U(A,k,..._)}let X={...Z,slugify:Z.slugify?A=>Z.slugify(A,E0):E0,sanitizer:Y,tagfilter:Z.tagfilter!==false},H=$[0]&&$[0].type===v$1.refCollection?$[0].refs:{},z=U5(Z.renderRule,U,Y,V,H,Z,W),D=z($,{inline:Z.forceInline,refs:H}),j=A6(H);if(j.length&&D.push(U("footer",{key:"footer"},j.map(function(k){let _=k.identifier.charCodeAt(0)===e0?k.identifier.slice(1):k.identifier,O=N$(k.footnote,{inline:true,refs:H},X);return U("div",{id:V(_,E0),key:k.identifier},_+": ",z(O,{inline:true,refs:H}))}))),Z.wrapper===null)return D;let F=Z.wrapper||(Z.forceInline?"span":"div"),B;if(D.length>1||Z.forceWrapper)B=D;else return D.length===1?D[0]:null;var M=Z.wrapperProps?{...Z.wrapperProps}:{};return M.children=B,r$(F,M,"outer")}function i$($="",Q={}){let Z={...Q||{}};Z.overrides=Z.overrides||{};Z.slugify||E0;let Y=Z.sanitizer||d9;function G(J){let U=Z.forceInline||!Z.forceBlock&&!O6.test(J),W={...Z,slugify:Z.slugify?D=>Z.slugify(D,E0):E0,sanitizer:Y,tagfilter:Z.tagfilter!==false},X=J;if(!U){let D=X.length;for(;D>0&&(X[D-1]===`
16281
- `||X[D-1]==="\r");)D--;X=X.slice(0,D),X=`${X.replace(J5,"")}
16282
-
16283
- `;}if(Z.optimizeForStreaming){var H=X.lastIndexOf("<");H!==-1&&X.indexOf(">",H)===-1&&(X=X.slice(0,H)),H=J.lastIndexOf("<"),H!==-1&&J.indexOf(">",H)===-1&&(J=J.slice(0,H));}let z=N$(U?J:X,{inline:U,refs:K},W);return X5(z,{...W,forceInline:U})}let K={};return G($)}var W5=({children:$,options:Q,...Z})=>{if(!(typeof reactExports.useContext<"u")){let J={...Q,overrides:{...Q?.overrides},wrapperProps:{...Q?.wrapperProps,...Z}};return i$($??"",J)}let Y=reactExports.useContext(o$),G=reactExports.useMemo(()=>({...Y,...Q,overrides:{...Y?.overrides,...Q?.overrides},wrapperProps:{...Y?.wrapperProps,...Q?.wrapperProps,...Z}}),[Y,Q,Z]),K=$??"";return reactExports.useMemo(()=>i$(K,G),[K,G])};
16566
+ // Format value to use the locale separator for rendering if it is a number
16567
+ let displayValue = value;
16568
+ if (typeof value === 'number' && separator !== '.') {
16569
+ const { schema, uiSchema } = props;
16570
+ const { schemaUtils } = registry;
16571
+ const enumOptions = schemaUtils.isSelect(schema) ? optionsList(schema, uiSchema) : undefined;
16572
+ const defaultWidget = enumOptions ? 'select' : 'text';
16573
+ const { widget = defaultWidget } = getUiOptions(uiSchema);
16574
+ // Do not convert the value to a locale-specific string for radio, select,
16575
+ // or hidden widgets because option matching relies on the original numeric value.
16576
+ if (widget !== 'radio' && widget !== 'select' && widget !== 'hidden') {
16577
+ displayValue = String(value).replace('.', separator);
16578
+ }
16579
+ }
16580
+ return jsxRuntimeExports.jsx(StringField, { ...props, formData: displayValue, onChange: handleChange });
16581
+ }
16582
+
16583
+ var j;function B$2(z){if(!j){if(typeof document>"u")return;j=document.createElement("textarea");}var q=`&${z};`;j.innerHTML=q;var v=j.value;return v===q?void 0:v}
16584
+
16585
+ var I=32,w=9,_5=13,C=10,$0=96,b0=126,D0=91,W5=94,d=62,G5=35,M9=37,u$1=45,V5=61,T0=92,v0=42,H0=95,Y0=60,S9=64,K5=93,c0=33,H9=38,m0=58,O9=70,b5=102,D9=104,C5=119,n5=116,k9=112,Z$=115,E$=160,C$=12,g$=44,A9=59,s5=63,X5=46,A0=47,g5=39,L5=34,T5=43,E0=124,y5=123,x9=125,F5=40,z5=41,f$=78,h$=110,m$=79,u$=111,X$=120,Q$=88,E9=30,c=48,l$1=57,h$1=65,m$1=90,G0=97,q0=122,K9=128,J5=32,W6={blockQuote:0,breakLine:1,breakThematic:2,codeBlock:3,codeInline:4,footnote:5,footnoteReference:6,frontmatter:7,gfmTask:8,heading:9,htmlBlock:10,htmlComment:11,htmlSelfClosing:12,image:13,link:14,orderedList:15,paragraph:16,ref:17,refCollection:18,table:19,text:20,textFormatted:21,unorderedList:22},_$1=W6;function i$($){if(!d$($,"---"))return null;let X=3;for(;X<$.length&&($[X]===" "||$[X]===" ");)X++;if(X<$.length&&$[X]==="\r"&&X++,X>=$.length||$[X]!==`
16586
+ `)return null;X++;let Z=false;for(;X<$.length;){let Q=X;for(;X<$.length&&$[X]!==`
16587
+ `&&$[X]!=="\r";)X++;if(X>=$.length)break;let Y=X;if($[X]==="\r"&&X++,X<$.length&&$[X]===`
16588
+ `&&X++,d$($,"---",Q))return {endPos:X,hasValidYaml:Z};if(!Z){let G=D6($,Q,Y);if(G<Y){let V=$.charCodeAt(G);if(V>=G0&&V<=q0||V>=h$1&&V<=m$1||V>=c&&V<=l$1||V===H0){for(G++;G<Y&&(V=$.charCodeAt(G),V>=G0&&V<=q0||V>=h$1&&V<=m$1||V>=c&&V<=l$1||V===H0||V===u$1||V===X5);)G++;G<Y&&$.charCodeAt(G)===m0&&(G++,G>=Y?Z=true:(V=$.charCodeAt(G),(V===I||V===w)&&(Z=true)));}}}}return null}var z6=/&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi,M6={class:"className",for:"htmlFor",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",viewbox:"viewBox"},H6={};function G$($){if(!$)return H6;var X={};for(var Z in $){var Q=Z.toLowerCase(),Y=M6[Q];if(Y)X[Y]=$[Z];else {var G=Z.indexOf(":");G===-1?X[Z]=$[Z]:X[Z.slice(0,G)+Z[G+1].toUpperCase()+Z.slice(G+2)]=$[Z];}}return X}var a$=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;function v5($){return $.indexOf("&")===-1?$:$.replace(z6,(X,Z)=>{var Q=B$2(Z);if(Q)return Q;if(Z[0]==="#"){var Y=Z[1]==="x"||Z[1]==="X"?Number.parseInt(Z.slice(2),16):Number.parseInt(Z.slice(1),10);return Y===0||Y>=55296&&Y<=57343||Y>1114111?"\uFFFD":Y<=65535?String.fromCharCode(Y):String.fromCharCode(55296+(Y-65536>>10),56320+(Y-65536&1023))}return X})}var p$=/(javascript|vbscript|data(?!:image)):/i;function M5($){if(p$.test($))return null;if($.indexOf("%")===-1)return $;try{let X=decodeURIComponent($).replace(/[^A-Za-z0-9/:]/g,"");if(p$.test(X))return null}catch{return null}return $}var r0={},t0,C0;for(t0=[192,193,194,195,196,197,224,225,226,227,228,229,230,198],C0=0;C0<t0.length;C0++)r0[t0[C0]]="a";for(r0[231]=r0[199]="c",r0[240]=r0[208]="d",t0=[200,201,202,203,233,232,234,235],C0=0;C0<t0.length;C0++)r0[t0[C0]]="e";for(t0=[207,239,206,238,205,237,204,236],C0=0;C0<t0.length;C0++)r0[t0[C0]]="i";for(r0[209]=r0[241]="n",t0=[248,216,339,338,213,245,212,244,211,243,210,242],C0=0;C0<t0.length;C0++)r0[t0[C0]]="o";for(t0=[220,252,219,251,218,250,217,249],C0=0;C0<t0.length;C0++)r0[t0[C0]]="u";r0[376]=r0[255]=r0[221]=r0[253]="y";function N5($){for(var X="",Z=-1,Q=$.length,Y=0;Y<Q;Y++){var G=$.charCodeAt(Y);if(G>=G0&&G<=q0||G>=c&&G<=l$1){Z<0&&(Z=Y);continue}if(G>=h$1&&G<=m$1){Z>=0&&(X+=$.slice(Z,Y),Z=-1),X+=String.fromCharCode(G+J5);continue}if(G===I||G===u$1){Z>=0&&(X+=$.slice(Z,Y),Z=-1),X+="-";continue}Z>=0&&(X+=$.slice(Z,Y),Z=-1);var V=r0[G];V&&(X+=V);}return Z>=0&&(X+=$.slice(Z)),X}function d$($,X,Z){return $.startsWith(X,Z)}var c$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","circle","ellipse","line","path","polygon","polyline","rect","use","stop","animate","set"]);function Z9($){let X=$.toLowerCase();if(c$.has(X))return true;let Z=X.indexOf(":");return Z!==-1?(X=X.slice(Z+1),c$.has(X)):false}var f5=1,l$=2,e5=4,o$=8,O6=16,H5=32,S5=64,n$=(()=>{var $=new Uint8Array(128),X;for($[w]=f5,$[C]=f5|l$,$[C$]=f5,$[_5]=f5|l$,$[I]=f5,X=c0;X<=A0;X++)$[X]=e5;for(X=m0;X<=S9;X++)$[X]=e5;for(X=D0;X<=$0;X++)$[X]=e5;for(X=y5;X<=b0;X++)$[X]=e5;for(X=c;X<=l$1;X++)$[X]=O6;for(X=h$1;X<=m$1;X++)$[X]=o$;for(X=G0;X<=q0;X++)$[X]=o$;return $})(),s$=/[\p{P}\p{S}]/u,t$=/\p{Zs}/u,t5=[];function e$($){var X=$.indexOf("\r"),Z=$.indexOf("\0");if(X===-1&&Z===-1)return $;var Q=$.length;t5.length=0;var Y=0,G=0;for(X===-1?G=Z:Z===-1?G=X:G=X<Z?X:Z;G<Q;G++){var V=$.charCodeAt(G);V===_5?(Y<G&&t5.push($.slice(Y,G)),G+1<Q&&$.charCodeAt(G+1)===C&&G++,t5.push(`
16589
+ `),Y=G+1):V===0&&(Y<G&&t5.push($.slice(Y,G)),t5.push("\uFFFD"),Y=G+1);}return Y<Q&&t5.push($.slice(Y)),t5.join("")}function $4($){return $.replace(/>\s+</g,"><").replace(/\n+/g," ").trim()}function D6($,X,Z){let Q=Z??$.length;for(;X<Q&&($[X]===" "||$[X]===" ");)X++;return X}function g9($){if(!$)return false;for(var X in $)return true;return false}function Z4($){return {attrs:{},children:[{type:_$1.text,text:$}],c:true,type:_$1.htmlBlock,tag:"header"}}var A6=/^\n+/;function X4($){for(var X=$.length;X>0&&($[X-1]===`
16590
+ `||$[X-1]==="\r");)X--;return `${$.slice(0,X).replace(A6,"")}
16591
+
16592
+ `}function $9($){if(($.type===_$1.htmlSelfClosing||$.type===_$1.htmlBlock)&&$.a)return [];if($.type===_$1.paragraph){var X=$.children;return X?X.flatMap($9):[]}return $.type===_$1.text?$.text?.trim()?[$]:[]:$.type===_$1.htmlBlock&&$.children?[{...$,children:$.children?.flatMap($9)}]:[$]}function V$($){for(var X=0;X<$.length;X++){if($[X].type===_$1.htmlBlock){var Z=$[X],Q=false;if(Z.c&&X===$.length-1){var Y=Z.j===void 0?Z.a?Z.e||"":(Z.e||"")+(Z.h||""):Z.j,G=`</${String(Z.tag).toLowerCase()}>`,V=Y.toLowerCase().indexOf(G);if(V!==-1){var K=Y.slice(V+G.length).replace(/<\/[a-z][a-z0-9-]*\s*>/gi,"");K.trim()&&(Q=true);}}Q||(Z.c=false);}"children"in $[X]&&$[X].children&&V$($[X].children);}}function Q4($,X){for(var Z=0;Z<$.length;Z++){var Q=$[Z];if(Q.type===_$1.paragraph&&Q.children)for(var Y=Q.children,G=0;G<Y.length;G++){var V=Y[G];if(V.type===_$1.htmlSelfClosing&&V.a&&V.tag.toLowerCase()===X){var K=$.slice(0,Z);G>0&&K.push({type:_$1.paragraph,children:Y.slice(0,G)});var J=[];if(G+1<Y.length){var U=Y.slice(G+1).filter(W=>!(W.type===_$1.htmlSelfClosing&&W.a));U.length>0&&(J=U);}return J=J.concat($.slice(Z+1)),{found:true,beforeClose:K,afterClose:J}}}if((Q.type===_$1.htmlSelfClosing||Q.type===_$1.htmlBlock)&&Q.a&&Q.tag.toLowerCase()===X)return {found:true,beforeClose:$.slice(0,Z),afterClose:$.slice(Z+1)}}return {found:false,beforeClose:$,afterClose:[]}}function j6($){var X="";for(var Z in $){var Q=$[Z];Q===true?X+=` ${Z}`:Q!==void 0&&Q!=null&&Q!==false&&(X+=` ${Z}="${String(Q)}"`);}return X}function r$($,X,Z,Q){var Y;return X===void 0?Y=j6(Z):Y=X.length>0&&X.charCodeAt(0)>I?` ${X}`:X,`<${$}${Y}${Q}`}function K$($){var X=$.tag,Z=$.type===_$1.htmlSelfClosing,Q=$,Y=Q.b,G=`</${X}>`;if(!Z&&Q.a)return {kind:"literal",literal:(Q.h||G)+(Q.e||"")};if(Z){var V=$;return V.a?{kind:"literal",literal:V.h||G}:V.n?{kind:"literal",literal:V.n}:{kind:"literal",literal:r$(X,Y,$.attrs," />")}}var K=r$(X,Y,$.attrs,">"),J=Q.children,U=J!=null&&J.length>0;if(Q.c&&Q.j!==void 0)return U?{kind:"sandwich",open:K,close:G}:{kind:"literal",literal:Q.j};if(Q.c&&!U)return {kind:"literal",literal:K+(Q.e||"")+(Q.h||G)};if(J!=null&&J.length>0){for(var W="",F=0;F<J.length;F++){var M=J[F];if(M.type!==_$1.text)return {kind:"sandwich",open:K,close:G};W+=M.text;}return {kind:"literal",literal:K+W+G}}var z=Q.e||"";return z&&z.indexOf(G)!==-1?{kind:"literal",literal:K+z}:{kind:"literal",literal:K+z+G}}function Y4($,X,Z){var Q=[],Y=$,G=Z;if(Y&&Q.push(Y),Array.isArray(X))for(var V=0;V<X.length;V++)Q.push(X[V]);else X!=null&&Q.push(X);G&&Q.push(G);for(var K=[],J=0;J<Q.length;J++){var U=Q[J];typeof U=="string"&&K.length>0&&typeof K.at(-1)=="string"?K[K.length-1]=K.at(-1)+U:K.push(U);}return K}function h5($){return $==null||$.tagfilter!==false}function G4($,X,Z,Q){var Y=X($,Z,Q);return Y===null?null:B6(Y)}function V4($){var X=[];if(!$)return X;for(var Z in $)Z.charCodeAt(0)===94&&X.push({identifier:Z,footnote:$[Z].target});return X}function f9($,X,Z){if(X.indexOf(".")===-1)return $?.[X]||Z;for(var Q=$,Y=X.split("."),G=0;G<Y.length&&(Q=Q?.[Y[G]],Q!==void 0);)G++;return Q||Z}function B6($){for(var X=false,Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q<=I||Q===L5||Q===M9||Q===Y0||Q===d||Q===D0||Q===T0||Q===K5||Q===W5||Q===$0||Q>=123){X=true;break}}if(!X)return $;for(var Y="",Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q===M9&&Z+2<$.length){var G=$.charCodeAt(Z+1),V=$.charCodeAt(Z+2);if((G>=c&&G<=l$1||G>=h$1&&G<=O9||G>=G0&&G<=b5)&&(V>=c&&V<=l$1||V>=h$1&&V<=O9||V>=G0&&V<=b5)){Y+=$[Z]+$[Z+1]+$[Z+2],Z+=2;continue}}if(Q>=55296&&Q<=57343){if(Q<=56319&&Z+1<$.length){var K=$.charCodeAt(Z+1);if(K>=56320&&K<=57343){Y+=encodeURI($[Z]+$[Z+1]),Z++;continue}}Y+=$[Z];continue}Y+=encodeURI($[Z]);}return Y}function K4(...$){return $.filter(Boolean).join(" ")}var _6=new Set(["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"]),C9=/<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;function J$($){return _6.has($.toLowerCase())}function J4($){return C9.lastIndex=0,C9.test($)}function U$($){return C9.lastIndex=0,$.replace(C9,(X,Z,Q,Y)=>`&lt;${Z}${Q}${Y}`)}function v9($,X){var Z=$||{},Q=Z.slugify,Y;if(Q){var G=Q;Y=V=>G(V,N5);}else Y=N5;return {disableAutoLink:Z.disableAutoLink,disableFrontmatter:Z.disableFrontmatter,disableParsingRawHTML:Z.disableParsingRawHTML,enforceAtxHeadings:Z.enforceAtxHeadings,evalUnserializableExpressions:Z.evalUnserializableExpressions,forceBlock:Z.forceBlock,forceInline:X===void 0?Z.forceInline:X,ignoreHTMLBlocks:Z.ignoreHTMLBlocks,optimizeForStreaming:Z.optimizeForStreaming,preserveFrontmatter:Z.preserveFrontmatter,sanitizer:Z.sanitizer||M5,slugify:Y,tagfilter:h5(Z)}}var R4=/^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/,b4=/^<[A-Z]/,W$=["script","pre","style","textarea"],N9=new Set(W$),v6=/<(?:pre|script|style|textarea)\b/i,q4=/<(?:pre|script|style|textarea)\b/iy,q$=/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m,W4=/^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im,L4=new Uint8Array(128);(()=>{for(var $=[$0,v0,H0,b0,V5,D0,c0,Y0,T0,H9,C,D9,C5,b5],X=0;X<$.length;X++)L4[$[X]]=1;})();var F4=/([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;function T4($){return N9.has($)}function y4($){return v6.test($)}function S4($,X,Z){for(var Q=X,Y=Z;Q<Y&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=Y)return false;$.charCodeAt(Q)===E0&&Q++;for(var G=0;Q<Y;){for(;Q<Y&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=Y)break;if($.charCodeAt(Q)===E0&&G>0){for(var V=Q+1;V<Y&&($.charCodeAt(V)===I||$.charCodeAt(V)===w);)V++;if(V>=Y)return true}if($.charCodeAt(Q)===m0&&Q++,Q>=Y||$.charCodeAt(Q)!==u$1)return false;for(;Q<Y&&$.charCodeAt(Q)===u$1;)Q++;for(Q<Y&&$.charCodeAt(Q)===m0&&Q++,G++;Q<Y&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q<Y)if($.charCodeAt(Q)===E0)Q++;else return false}return G>0}var N6=/[\u0000-\u001F\u007F]/g,I6={action:1,background:1,cite:1,data:1,formaction:1,href:1,longdesc:1,poster:1,src:1,"xlink:href":1},P6=/&#(x[0-9a-f]+|[0-9]+);?/gi;function w6($){return $.indexOf("&#")===-1?$:$.replace(P6,(X,Z)=>{var Q=Z.charCodeAt(0)===X$||Z.charCodeAt(0)===Q$?Number.parseInt(Z.slice(1),16):Number.parseInt(Z,10);return Q>0&&Q<=1114111?String.fromCodePoint(Q):X})}function R6($,X,Z){if(Z&&X.charCodeAt(0)===y5)return false;var Q=$.charCodeAt(0),Y=$.charCodeAt(1);if((Q===u$||Q===m$)&&(Y===h$||Y===f$))return !(Z&&X==="");var G=$.toLowerCase();if(G==="srcdoc")return true;if(G==="style")return /url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(X);if(I6[G]===1){var V=w6(v5(X));if(M5(V)===null)return true;var K=V.replace(N6,"");return K!==V&&M5(K)===null}return false}function F$($){return "<"+($.f?"/":"")+$.tag+$.g+$.b+($.o?$.s?" />":"/>":">")}function z4($,X,Z,Q){for(var Y=[],G=X,V=0;V<Q.length;V+=2){var K=Q[V];if(K>G){var J=$.slice(G,K).trim();J&&Y.push(J);}G=Q[V+1];}if(G<Z){var U=$.slice(G,Z).trim();U&&Y.push(U);}return Y.join(" ")}function P5($,X){if($.charCodeAt(X)!==Y0)return null;let Z=X+1,Q=$.length,Y=false;$.charCodeAt(Z)===A0&&(Z++,Y=true);let G=Z,V=$.charCodeAt(Z);if(!(V>=G0&&V<=q0||V>=h$1&&V<=m$1))return null;for(;Z<Q&&($.charCodeAt(Z)>=G0&&$.charCodeAt(Z)<=q0||$.charCodeAt(Z)>=h$1&&$.charCodeAt(Z)<=m$1||$.charCodeAt(Z)>=c&&$.charCodeAt(Z)<=l$1||$.charCodeAt(Z)===u$1);)Z++;let K=$.slice(G,Z);if(!K)return null;let J=K.charCodeAt(0),U=J>=h$1&&J<=m$1||K.indexOf("-")!==-1,W=Z;for(;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w||$.charCodeAt(Z)===C);)Z++;let F=$.slice(W,Z);if(Z===W&&Z<Q){var M=$.charCodeAt(Z);if(M!==d&&M!==A0)return null}let z=Z,H={},B=false;for(var j=null;Z<Q;){let f=$.charCodeAt(Z);if(f===d){let S=j?z4($,z,Z,j):$.slice(z,Z);return {s:B,v:U,f:Y,b:S,r:j!=null,o:false,g:F,attrs:H,end:Z+1,tag:K}}if(f===I||f===w||f===C){Z++;continue}if(f===A0&&Z+1<Q&&$.charCodeAt(Z+1)===d){B=Z>z&&$.charCodeAt(Z-1)===I;let S=j?z4($,z,Z,j):$.slice(z,Z);return {s:B,v:U,f:Y,b:S,r:j!=null,o:true,g:F,attrs:H,end:Z+2,tag:K}}var q=Z,O=$.charCodeAt(Z);if(!(O>=G0&&O<=q0||O>=h$1&&O<=m$1||O===H0||O===m0))return null;for(Z++;Z<Q;){var A=$.charCodeAt(Z);if(A>=G0&&A<=q0||A>=h$1&&A<=m$1||A>=c&&A<=l$1||A===H0||A===X5||A===m0||A===u$1)Z++;else break}for(var v=$.slice(q,Z),N=Z;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w);)Z++;var D,T;if($.charCodeAt(Z)===V5){for(Z++;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w);)Z++;var P=$.charCodeAt(Z);if(P===L5||P===g5){Z++;for(var R=Z;Z<Q&&$.charCodeAt(Z)!==P;)Z++;if(Z>=Q)return null;if(D=$.slice(R,Z),Z++,Z<Q){var k=$.charCodeAt(Z);if(k!==I&&k!==w&&k!==C&&k!==d&&k!==A0)return null}T=Z;}else if(P===y5){var E=1,R=Z;for(Z++;Z<Q&&E>0;){var A=$.charCodeAt(Z);A===y5?E++:A===x9&&E--,Z++;}D=$.slice(R,Z),T=Z;}else {for(var R=Z;Z<Q;){var y=$.charCodeAt(Z);if(y===I||y===w||y===d||y===C||y===L5||y===g5||y===V5||y===Y0||y===$0)break;Z++;}if(Z===R)return null;D=$.slice(R,Z),T=Z;}}else D="",T=N;R6(v,D,U)?(j===null&&(j=[]),j.push(q,T)):H[v]=D;}return null}function U5($){var X=$.indexOf("<");if(X===-1)return $;for(var Z="",Q=0,Y=false;X!==-1;){var G=P5($,X);G?(G.r&&(Z+=$.slice(Q,X)+F$(G),Q=G.end,Y=true),X=$.indexOf("<",G.end)):X=$.indexOf("<",X+1);}return Y?Z+$.slice(Q):$}function b6($,X,Z){if(!Z.optimizeForStreaming&&$.indexOf("[")===-1)return false;for(var Q=0,Y=$.length,G=false,V=false;Q<Y;){for(var K=$.indexOf(`
16593
+ `,Q),J=K<0?Y:K,U=Q,W=0;U<J&&W<4;)if($.charCodeAt(U)===I)W++,U++;else if($.charCodeAt(U)===w)W+=4,U++;else break;if(U>=J){G=false,Q=K<0?Y:K+1;continue}if(W<4){var F=$.charCodeAt(U);if(F===$0||F===b0){for(var M=F,z=0,H=U;H<J&&$.charCodeAt(H)===M;)z++,H++;if(z>=3){var B=true;if(M===$0){for(var j=H;j<J;j++)if($.charCodeAt(j)===$0){B=false;break}}if(B){G=false;for(var q=K<0?Y:K+1;q<Y;){for(var O=q,A=0;O<Y&&A<4;){var v=$.charCodeAt(O);if(v===I)A++,O++;else if(v===w)A+=4,O++;else break}if(A<4&&O<Y&&$.charCodeAt(O)===M){for(var N=0;O<Y&&$.charCodeAt(O)===M;)N++,O++;if(N>=z){for(;O<Y&&($.charCodeAt(O)===I||$.charCodeAt(O)===w);)O++;if(O>=Y||$.charCodeAt(O)===C){Q=O>=Y?Y:O+1;break}}}for(;q<Y&&$.charCodeAt(q)!==C;)q++;q<Y&&q++;}q>=Y&&(Q=Y,V=true);continue}}}}for(var D=U;D<J&&$.charCodeAt(D)===d;){D++,D<J&&$.charCodeAt(D)===I&&D++;for(var T=0;D<J&&T<4;)if($.charCodeAt(D)===I)T++,D++;else if($.charCodeAt(D)===w)T+=4,D++;else break;if(T>=4)break;G=false;}if(!G&&W<4&&D<J&&$.charCodeAt(D)===D0&&!(D+1<Y&&$.charCodeAt(D+1)===W5)){var P=k4($,D,X);if(P){Q=P,G=false;continue}}var R=$.charCodeAt(U);if(R===G5&&W<4)G=false;else if(W<4&&(R===u$1||R===v0||R===H0)){for(var k=U,E=0;k<J;){var y=$.charCodeAt(k);if(y===R)E++;else if(y!==I&&y!==w)break;k++;}G=!(E>=3&&k>=J);}else G=true;Q=K<0?Y:K+1;}return V}function k4($,X,Z){let Q=$.length;if($.charCodeAt(X)!==D0)return null;let Y=X+1<Q&&$.charCodeAt(X+1)===W5,G=X+1;for(;G<Q;){var V=$.charCodeAt(G);if(V===K5){G++;break}if(V===D0)return null;V===T0&&G+1<Q&&G++,G++;}if(G>Q||$.charCodeAt(G-1)!==K5)return null;let K=$.slice(X+1,G-1);if(K.length>999)return null;let J=m9(K);if(!J||G>=Q||$.charCodeAt(G)!==m0)return null;G++;let U=false;for(;G<Q;){let f=$.charCodeAt(G);if(f===I||f===w)G++;else if(f===C&&!U)U=true,G++;else break}if(Y){let f=$.indexOf(`
16594
+ `,G),S=f<0?Q:f,g=$.slice(G,S).trim();return Z[J]={target:g,title:void 0},f<0?Q:f+1}var W;if(G<Q&&$.charCodeAt(G)===Y0){G++;for(var F=G;G<Q&&$.charCodeAt(G)!==d&&$.charCodeAt(G)!==C;)$.charCodeAt(G)===T0&&G+1<Q&&G++,G++;if(G>=Q||$.charCodeAt(G)!==d)return null;W=$.slice(F,G),G++;for(var M=$.indexOf(`
16595
+ `,G),z=M<0?Q:M,H=G;H<z&&($.charCodeAt(H)===I||$.charCodeAt(H)===w);)H++;if(H<z){if(H===G)return null;var B=$.charCodeAt(H);if(B!==L5&&B!==g5&&B!==F5)return null}}else {for(var F=G,j=0;G<Q;){var V=$.charCodeAt(G);if(V===F5)j++;else if(V===z5){if(j===0)break;j--;}else {if(V===I||V===w||V===C)break;V===T0&&G+1<Q&&G++;}G++;}if(W=$.slice(F,G),!W)return null}for(;G<Q&&($.charCodeAt(G)===I||$.charCodeAt(G)===w);)G++;var q=$.indexOf(`
16596
+ `,G),O=q<0?Q:q,A,v=false,N=G,D=G;if(G===O&&G<Q)for(D=G+1;D<Q&&($.charCodeAt(D)===I||$.charCodeAt(D)===w);)D++;if(D<Q){var T=$.charCodeAt(D);if(T===L5||T===g5||T===F5){for(var P=T===F5?41:T,R=D+1,k=R;R<Q;){var E=$.charCodeAt(R);if(E===P){for(var y=R+1;y<Q&&($.charCodeAt(y)===I||$.charCodeAt(y)===w);)y++;(y>=Q||$.charCodeAt(y)===C)&&(A=$.slice(k,R),v=true,N=y<Q?y+1:Q);break}if(E===T0&&R+1<Q){R+=2;continue}if(E===C&&R+1<Q&&$.charCodeAt(R+1)===C)break;R++;}if(!v&&D===G)return null}}if(v)return Z[J]||(Z[J]={target:v5(U9(W)),title:A===void 0?A:v5(U9(A))}),N;for(;G<O&&($.charCodeAt(G)===I||$.charCodeAt(G)===w);)G++;return G<O?null:(Z[J]||(Z[J]={target:v5(U9(W)),title:A}),q<0?Q:q+1)}var Q5=new Uint8Array(n$);for(Q5[G5]|=H5,Q5[d]|=H5,Q5[u$1]|=H5|S5,Q5[T5]|=H5,Q5[v0]|=H5|S5,Q5[H0]|=H5|S5,Q5[$0]|=H5|S5,Q5[b0]|=H5|S5,Q5[Y0]|=H5|S5,Q5[D0]|=S5,Q5[c0]|=S5,Q5[E0]|=H5,j9=c;j9<=l$1;j9++)Q5[j9]|=H5;var j9;function M4($){if($.indexOf("[")<0&&$.indexOf("]")<0)return false;for(var X=0;X<$.length;X++){if($.charCodeAt(X)===T0){X++;continue}if($.charCodeAt(X)===D0||$.charCodeAt(X)===K5)return true}return false}function m9($){for(var X=$.length,Z=true,Q=X>0,Y=0;Y<X;Y++){var G=$.charCodeAt(Y);if(G===I){if(Z){Q=false;break}Z=true;}else if(G<33||G>126||G>=h$1&&G<=m$1){Q=false;break}else Z=false;}if(Q&&!Z)return $;var V=$.replace(/\s+/g," ").trim();return V.indexOf("\u1E9E")!==-1?V.replace(/\u1E9E/g,"ss").toLowerCase():V.toLowerCase()}function A$($){return $<K9?Q5[$]:$===E$?f5:0}function U9($){return $.indexOf("\\")===-1?$:$.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}var z$=null,M$=-1,u9=-1;function U0($,X){if(X>=M$&&X<=u9&&$===z$)return u9;var Z=$.indexOf(`
16597
+ `,X),Q=Z<0?$.length:Z;return z$=$,M$=X,u9=Q,Q}function t($,X){let Z=U0($,X);return Z<$.length?Z+1:Z}function _9($,X,Z){for(;X<Z;){let Q=$.charCodeAt(X);if(Q!==I&&Q!==w)break;X++;}return X}function H4($,X){let Z=t($,X);for(;Z<$.length;){let Q=U0($,Z);if(e0($,Z,Q))return Z;Z=t($,Z);}return $.length}function c5($,X,Z,Q){let Y=0;for(;X+Y<Z&&$.charCodeAt(X+Y)===Q;)Y++;return Y}var J0=0,Z0=0;function L0($,X,Z){for(J0=0,Z0=0;X+Z0<Z;){let Q=$.charCodeAt(X+Z0);if(Q===w)J0+=4-J0%4;else if(Q===I)J0++;else break;Z0++;}}function e0($,X,Z){return _9($,X,Z)>=Z}function L6($,X){if(!$)return $;var Z=X.w||(X.w=Object.create(null)),Q=Z[$];if(Q===void 0)return Z[$]=0,$;for(var Y=Q+1,G=`${$}-${Y}`;Z[G]!==void 0;)Y++,G=`${$}-${Y}`;return Z[$]=Y,Z[G]=0,G}function T6($,X,Z,Q){let Y=U0($,X);if(L0($,X,Y),J0>3)return null;let G=X+Z0;if($.charCodeAt(G)!==G5)return null;let V=c5($,G,Y,35);if(V<1||V>6||(G+=V,G<Y&&$.charCodeAt(G)!==I&&$.charCodeAt(G)!==w))return null;G=_9($,G,Y);for(var K=Y;K>G&&$.charCodeAt(K-1)===I;)K--;for(var J=K;K>G&&$.charCodeAt(K-1)===G5;)K--;if(K<J)if(K===G||$.charCodeAt(K-1)===I)for(;K>G&&$.charCodeAt(K-1)===I;)K--;else K=J;let U=$.slice(G,K),W=q9(U,false,Z,Q);return {node:{type:_$1.heading,level:V,children:W,id:""},end:t($,Y)}}function y6($,X,Z){var Q=$.charCodeAt(X);if(Q!==V5&&Q!==u$1)return false;for(var Y=X;Y<Z&&$.charCodeAt(Y)===Q;)Y++;for(;Y<Z&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===w);)Y++;return Y>=Z}function p5($,X){let Z=U0($,X);if(L0($,X,Z),J0>3)return null;let Q=X+Z0,Y=$.charCodeAt(Q);if(Y!==u$1&&Y!==v0&&Y!==H0)return null;let G=0;for(;Q<Z;){let V=$.charCodeAt(Q);if(V===Y)G++;else if(V!==I&&V!==w)return null;Q++;}return G<3?null:{node:{type:_$1.breakThematic},end:t($,Z)}}var O4=0,D4=0,A4="";function S6($,X,Z){let Q=U0($,X);if(L0($,X,Q),J0>3)return null;let Y=J0,V=X+Z0,K=$.charCodeAt(V);if(K!==$0&&K!==b0)return null;let J=c5($,V,Q,K);if(J<3)return null;V+=J;let U=_9($,V,Q),W=Q;if(K===$0){for(let g=U;g<Q;g++)if($.charCodeAt(g)===$0)return null}for(;W>U&&($.charCodeAt(W-1)===I||$.charCodeAt(W-1)===w);)W--;let F=$.slice(U,W),M="",z="",H=F.indexOf(" ");H===-1?M=F:(M=F.slice(0,H),z=F.slice(H+1).trim()),M=U9(M);var B;if(z){F4.lastIndex=0;for(var j;(j=F4.exec(z))!=null;)B||(B={}),B[j[1]]=j[2]===void 0?j[3]:j[2];}let q=t($,Q),O=$.length,A=$.length;var v;K===O4&&J===D4?v=A4:(v=String.fromCharCode(K).repeat(J),O4=K,D4=J,A4=v);for(var N=q;N<$.length;){var D=$.indexOf(v,N);if(D===-1)break;for(var T=D,P=0;T>0&&P<4&&$.charCodeAt(T-1)===I;)T--,P++;if(P<=3&&(T===0||$.charCodeAt(T-1)===C)){for(var R=D+J;R<$.length&&$.charCodeAt(R)===K;)R++;var k=U0($,R);if(e0($,R,k)){O=T,A=t($,k);break}}N=D+1;}var E;if(Y===0)E=O>q&&$.charCodeAt(O-1)===C?$.slice(q,O-1):$.slice(q,O);else {E="";for(var y=q;y<O;){var f=U0($,y);L0($,y,f);var S=Math.min(Z0,Y);E+=`${$.slice(y+S,f)}
16598
+ `,y=t($,f);}E.length>0&&E.charCodeAt(E.length-1)===C&&(E=E.slice(0,-1));}return {node:{type:_$1.codeBlock,lang:M||void 0,text:E,infoString:z||void 0,attrs:B},end:A}}function j4($,X,Z){for(var Q=0,Y=X;Y<Z&&Q<4;)$.charCodeAt(Y)===w?Q+=4-Q%4:Q++,Y++;if(Q<4)return "";for(var G="",V=4;V<Q;V++)G+=" ";return G+$.slice(Y,Z)}function k6($,X){let Z=U0($,X);if(L0($,X,Z),J0<4)return null;let Q="",Y=X;for(;Y<$.length;){let M=U0($,Y);if(L0($,Y,M),e0($,Y,M)){for(var G=`${j4($,Y,M)}
16599
+ `,V=t($,M);V<$.length;){var K=U0($,V);if(e0($,V,K)){G+=`${j4($,V,K)}
16600
+ `,V=t($,K);continue}L0($,V,K),J0>=4&&(Q+=G,Y=V);break}if(Y!==V)break;continue}if(J0<4)break;let z=0,H=0;var J=0;for(let B=Y;B<M&&H<4;B++){if($.charCodeAt(B)===w){var U=4-H%4;H+U>4&&(J=H+U-4),H+=U;}else H++;z++;}var W="";if(J>0)for(var F=0;F<J;F++)W+=" ";W+=$.slice(Y+z,M),Q+=`${W}
16601
+ `,Y=t($,M);}for(;Q.length>0&&Q.charCodeAt(Q.length-1)===C;)Q=Q.slice(0,-1);return Q?{node:{type:_$1.codeBlock,lang:void 0,text:Q,infoString:void 0,attrs:void 0},end:Y}:null}function x6($,X,Z,Q){let Y=U0($,X);if(L0($,X,Y),J0>3)return null;let G=X+Z0;if($.charCodeAt(G)!==d)return null;let V="",K=X,J,U=false,W=false,F=false;for(;K<$.length;){let b=U0($,K);L0($,K,b);let i=K+Z0;if($.charCodeAt(i)===d){let X0=i+1;var M=J0+1,z=false;if(X0<b){var H=$.charCodeAt(X0);H===I?(X0++,M++,z=true):H===w&&(z=true);}for(var B="",j=false,q=X0;q<b;q++)if($.charCodeAt(q)===w){j=true;break}if(j){var O=M;if(z&&X0<b&&$.charCodeAt(X0)===w){for(var A=4-O%4,v=0;v<A-1;v++)B+=" ";O+=A,X0++;}for(var N=X0;N<b;N++)if($.charCodeAt(N)===w){for(var D=4-O%4,T=0;T<D;T++)B+=" ";O+=D;}else B+=$[N],O++;}else B=$.slice(X0,b);if(!(V||J)){let P0=B.match(/^\[!([A-Za-z]+)\]\s*$/);if(P0){J=P0[1].toUpperCase(),K=t($,b);continue}}V+=`${B}
16602
+ `;var P=B.trimStart();P.startsWith("```")||P.startsWith("~~~")?F=!F:(B.startsWith(" ")||B.startsWith(" "))&&(F=true),W=P.length>0,K=t($,b);}else if(V&&!e0($,K,b)&&W){if(J0<4){var R=K+Z0,k=R<b?$.charCodeAt(R):0;if(k===G5||k===d||k===$0||k===b0||k===Y0||(k===u$1||k===v0||k===H0)&&p5($,K)||(k===u$1||k===v0||k===T5)&&R+1<b&&($.charCodeAt(R+1)===I||$.charCodeAt(R+1)===w))break;if(k>=c&&k<=l$1){for(var E=R;E<b&&$.charCodeAt(E)>=c&&$.charCodeAt(E)<=l$1;)E++;if(E<b&&($.charCodeAt(E)===X5||$.charCodeAt(E)===z5))break}}if(F)break;V+=`${$.slice(K,b)}
16603
+ `,U=true,K=t($,b);}else break}if(!(V||J))return null;var{inBlockQuote:y,l:f}=Z;Z.inBlockQuote=true,U&&(Z.l=true);var S=Z.i;Z.i=S||!e0($,K,$.length);let g=d5(V||"",Z,Q);return Z.i=S,Z.inBlockQuote=y,Z.l=f,{node:{type:_$1.blockQuote,children:g,alert:J||void 0},end:K}}function x4($,X,Z){for(var Q=0,Y=X;Y<Z;Y++)$.charCodeAt(Y)===w?Q+=4-Q%4:Q++;return Q}function m5($,X,Z){if(L0($,X,Z),J0>3)return null;var Q=X+Z0;if(Q>=Z)return null;var Y=$.charCodeAt(Q),G=J0,V=Q,K=Q;if(Y===u$1||Y===v0||Y===T5){if(V=Q+1,V<Z&&$.charCodeAt(V)!==I&&$.charCodeAt(V)!==w&&$.charCodeAt(V)!==C)return null}else if(Y>=c&&Y<=l$1){for(;K<Z&&K-Q<9;){var J=$.charCodeAt(K);if(J<c||J>l$1)break;K++;}if(K>Q&&K<Z){var U=$.charCodeAt(K);if(U===X5||U===z5){if(V=K+1,V<Z&&$.charCodeAt(V)!==I&&$.charCodeAt(V)!==w&&$.charCodeAt(V)!==C)return null}else return null}else return null}else return null;var W=V,F=x4($,X,V),M=0,z=W,H=F;if(W>=Z)return {ordered:Y>=c&&Y<=l$1,marker:Y>=c&&Y<=l$1?$[K]:$[Q],start:Y>=c&&Y<=l$1?Number.parseInt($.slice(Q,K),10):void 0,contentStart:W,contentCol:F+1,markerCol:G,isEmpty:true};for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===w);){if($.charCodeAt(z)===w){var B=4-H%4;H+=B;}else H++;z++,M++;}var j=z>=Z,q=H-F;return j||q>4?(H=F+1,z=W+1,M=1):M===0&&(H=F+1,z=W,M=1),{ordered:Y>=c&&Y<=l$1,marker:Y>=c&&Y<=l$1?$[K]:$[Q],start:Y>=c&&Y<=l$1?Number.parseInt($.slice(Q,K),10):void 0,contentStart:z,contentCol:H,markerCol:G,isEmpty:j}}var J9=0;function B4($,X,Z,Q){var Y=0,G=X;for(J9=0;G<Z&&Y<Q;){var V=$.charCodeAt(G);if(V===w){var K=4-Y%4;if(Y+K>Q){J9=Y+K-Q,G++,Y=Q;break}Y+=K;}else if(V===I)Y++;else break;G++;}return G}function _4($,X,Z,Q){var Y=U0($,X),G=m5($,X,Y);if(!G)return null;var V=[],K=X,J=G.contentCol,U="",W=G.isEmpty,F=false,M=false;if(!G.isEmpty){for(var z=false,H=G.contentStart;H<Y;H++)if($.charCodeAt(H)===w){z=true;break}if(z){var B="",j=x4($,X,G.contentStart),q=j-G.contentCol;if(q>0)for(var O=0;O<q;O++)B+=" ";for(var A=G.contentStart;A<Y;A++)if($.charCodeAt(A)===w){for(var v=4-j%4,N=0;N<v;N++)B+=" ";j+=v;}else B+=$[A],j++;U=`${B}
16604
+ `;}else U=`${$.slice(G.contentStart,Y)}
16605
+ `;}for(K=t($,Y);K<$.length;){var D=U0($,K);L0($,K,D);var T=$.charCodeAt(K+Z0);if(J0<J&&(T===u$1||T===v0||T===H0)&&J0<=3&&p5($,K))break;var P=m5($,K,D);if(P&&P.ordered===G.ordered&&P.marker===G.marker&&P.markerCol<J){V.push({contentCol:J,raw:U,hasBlankAfter:F,isEmpty:W}),F&&(M=true),J=P.contentCol,W=P.isEmpty,F=false,U=P.isEmpty?"":`${$.slice(P.contentStart,D)}
16606
+ `,K=t($,D);continue}if(e0($,K,D)){var R=B4($,K,D,J);if(J9>0||R<D){for(var k="",E=0;E<J9;E++)k+=" ";U+=`${k+$.slice(R,D)}
16607
+ `;}else U+=`
16608
+ `;K=t($,D);for(var y=false,f=0;f<U.length;f++){var S=U.charCodeAt(f);if(S!==C&&S!==_5&&S!==I&&S!==w){y=true;break}}if(W&&!y)if(K<$.length){var g=U0($,K),x=m5($,K,g);if(!x||x.ordered!==G.ordered||x.marker!==G.marker)break;F=true;}else break;if(K<$.length){var b=U0($,K);L0($,K,b);var i=$.charCodeAt(K+Z0);if((i===u$1||i===v0||i===H0)&&J0<=3&&p5($,K))break;var X0=m5($,K,b);if(X0&&X0.ordered===G.ordered&&X0.marker===G.marker&&X0.markerCol<J){F=true;continue}if(!e0($,K,b)&&J0<J)break}continue}if(J0>=J){var P0=B4($,K,D,J);if(J9>0){for(var Q0="",u0=J,z0=0;z0<J9;z0++)Q0+=" ",u0++;for(var O0=P0;O0<D;O0++)if($.charCodeAt(O0)===w){for(var w0=4-u0%4,N0=0;N0<w0;N0++)Q0+=" ";u0+=w0;}else Q0+=$[O0],u0++;U+=`${Q0}
16609
+ `;}else U+=`${$.slice(P0,D)}
16610
+ `;K=t($,D);continue}for(var o=false,p=0;p<U.length;p++){var V0=U.charCodeAt(p);if(V0!==C&&V0!==_5&&V0!==I&&V0!==w){o=true;break}}if(!F&&o&&!W){var y0=K+Z0,S0=$.charCodeAt(y0),j0=S0===G5||S0===d||S0===Y0||S0===$0||S0===b0||(S0===u$1||S0===v0||S0===H0||S0===T5)&&(p5($,K)!=null||m5($,K,D)!=null)||S0>=c&&S0<=l$1&&m5($,K,D)!=null;if(!j0){U+=`${$.slice(y0,D)}
16611
+ `,K=t($,D);continue}}break}if(V.push({contentCol:J,raw:U,hasBlankAfter:F,isEmpty:W}),V.length===0)return null;var a=M;if(!a)for(var I0=0;I0<V.length;I0++){if(V[I0].hasBlankAfter&&I0<V.length-1){a=true;break}if(!V[I0].isEmpty){for(var W0=V[I0].raw,F0=W0.length,M0=0,f0=false,B0=false,k0=false,h0=false,p0=0,n=0,_0=-1;M0<F0;){var r=W0.indexOf(`
16612
+ `,M0);if(r<0&&(r=F0),h0){L0(W0,M0,r);for(var x0=W0.slice(M0+Z0,r),L=0;L<x0.length&&x0.charCodeAt(L)===p0;)L++;L>=n&&x0.slice(L).trim()===""&&(h0=false),M0=r<F0?r+1:F0;continue}if(e0(W0,M0,r)){_0>=0?k0=true:f0&&(B0=true),M0=r<F0?r+1:F0;continue}if(L0(W0,M0,r),_0>=0){if(J0>=_0){M0=r<F0?r+1:F0;continue}var K0=m5(W0,M0,r);if(K0&&K0.markerCol<_0&&K0.contentCol<=_0){M0=r<F0?r+1:F0;continue}if(K0){M0=r<F0?r+1:F0;continue}_0=-1,k0&&(B0=true,k0=false);}var a0=W0.slice(M0+Z0,r),q5=a0.charCodeAt(0);if((q5===$0||q5===b0)&&J0<=3){for(var e=0;e<a0.length&&a0.charCodeAt(e)===q5;)e++;if(e>=3){if(B0&&f0){a=true;break}h0=true,p0=q5,n=e,f0=true,M0=r<F0?r+1:F0;continue}}var g0=J0<=3?m5(W0,M0,r):null;if(g0&&f0){if(B0){a=true;break}_0=g0.contentCol,k0=false,M0=r<F0?r+1:F0,f0=true;continue}if(B0){a=true;break}f0=true,M0=r<F0?r+1:F0;}if(a)break}}for(var s=[],d0=0;d0<V.length;d0++){for(var n0=V[d0],$5=n0.raw,l0=$5.length;l0>0&&$5.charCodeAt(l0-1)===C;)l0--;var s0=l0<$5.length?$5.slice(0,l0):$5,l5=null;if(s0.length>=3&&s0.charCodeAt(0)===D0){var k5=s0[1];(k5===" "||k5==="x"||k5==="X")&&s0.charCodeAt(2)===K5&&(l5={type:_$1.gfmTask,completed:k5==="x"||k5==="X"},s0=s0.slice(3));}var R0;if(n0.isEmpty&&s0.trim()==="")R0=[];else if(a){var o5=Z.inList;Z.inList=true;var P9=Z.i;Z.i=P9||d0!==V.length-1,R0=d5(s0,Z,Q),Z.i=P9,Z.inList=o5;}else {var R5=Z.inList;Z.inList=true;var r5=Z.i;if(Z.i=r5||d0!==V.length-1,R0=d5(s0,Z,Q),Z.i=r5,Z.inList=R5,R0.length===1&&R0[0].type===_$1.paragraph)R0=R0[0].children;else if(Z.q){var x5=[];Z.q.push({src:R0,dest:x5,unwrap:true}),R0=x5;}else {for(var A5=[],Z5=0;Z5<R0.length;Z5++)if(R0[Z5].type===_$1.paragraph)for(var j5=R0[Z5].children,Y9=0;Y9<j5.length;Y9++)A5.push(j5[Y9]);else A5.push(R0[Z5]);R0=A5;}}if(l5){var i5=[l5,{type:_$1.text,text:" "}];if(Z.q)Z.q.push({src:R0,dest:i5,unwrap:false});else for(var D5=0;D5<R0.length;D5++)i5.push(R0[D5]);s.push(i5);}else s.push(R0);}return {node:{type:G.ordered?_$1.orderedList:_$1.unorderedList,start:G.ordered?G.start:void 0,items:s},end:K}}var p9=new Set(["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]);function I5($,X,Z){let Q={};for(let[V,K]of Object.entries($)){let J=V.toLowerCase();if(J==="style"&&typeof K=="string"){let U={},W=[],F=0,M=0;for(let H=0;H<K.length;H++){let B=K.charCodeAt(H);B===F5?F++:B===z5?F--:B===A9&&F===0&&(W.push(K.slice(M,H)),M=H+1);}M<K.length&&W.push(K.slice(M));let z=false;W.forEach(H=>{let B=H.indexOf(":");if(B===-1)return;let j=H.slice(0,B).trim(),q=H.slice(B+1).trim();if(j&&q){if(/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(q)){z=true;return}let O=j.indexOf("-")===-1?j:j.replace(/-([a-z])/g,(A,v)=>v.toUpperCase());U[O]=q;}}),!z&&Object.keys(U).length>0&&(Q[V]=U);}else if((J==="href"||J==="src")&&Z?.sanitizer){let U=Z.sanitizer(K,X,J);U!=null&&(Q[V]=U);}else if(K==="")Q[V]=true;else if(K.length>=2&&K.charCodeAt(0)===y5&&K.charCodeAt(K.length-1)===x9){var Y=K.slice(1,-1);if(Y.length>0){var G=Y.charCodeAt(0);if(G===D0||G===y5)try{Q[V]=JSON.parse(Y);continue}catch{}}if(Y==="true"){Q[V]=true;continue}if(Y==="false"){Q[V]=false;continue}if(Z?.evalUnserializableExpressions)try{Q[V]=(0,eval)(`(${Y})`);continue}catch{}Q[V]=Y;}else Q[V]=K;}return Q}function u5($,X,Z){let Q=X.length;if(Q===0)return Z;var Y=X.charCodeAt(0),G=Y>=h$1&&Y<=m$1||Y>=G0&&Y<=q0;if(!G){for(var V=String.fromCharCode(Y),K=$.length-Q,J=Z;J<=K;){var U=$.indexOf(V,J);if(U===-1||U>K)return -1;for(var W=true,F=1;F<Q;F++){var M=$.charCodeAt(U+F),z=X.charCodeAt(F);if(M>=h$1&&M<=m$1&&(M+=J5),z>=h$1&&z<=m$1&&(z+=J5),M!==z){W=false;break}}if(W)return U;J=U+1;}return -1}Y>=h$1&&Y<=m$1&&(Y+=J5);for(let B=Z;B<=$.length-Q;B++){var H=$.charCodeAt(B);if(H>=h$1&&H<=m$1&&(H+=J5),H!==Y)continue;let j=true;for(let q=1;q<Q;q++){let O=$.charCodeAt(B+q),A=X.charCodeAt(q);if(O>=h$1&&O<=m$1&&(O+=J5),A>=h$1&&A<=m$1&&(A+=J5),O!==A){j=false;break}}if(j)return B}return -1}function E6($,X,Z){let Q=X.length;var Y=X.charCodeAt(0);Y>=h$1&&Y<=m$1&&(Y+=J5);for(let V=Math.min(Z,$.length-Q);V>=0;V--){var G=$.charCodeAt(V);if(G>=h$1&&G<=m$1&&(G+=J5),G!==Y)continue;let K=true;for(let J=1;J<Q;J++){let U=$.charCodeAt(V+J),W=X.charCodeAt(J);if(U>=h$1&&U<=m$1&&(U+=J5),W>=h$1&&W<=m$1&&(W+=J5),U!==W){K=false;break}}if(K)return V}return -1}var d9=-1;function H$($,X,Z){let Q=Z.toLowerCase(),Y=`<${Q}`,G=`</${Q}`,V=1,K=X,J=$.length;for(d9=-1;K<J&&V>0;){let F=u5($,Y,K),M=u5($,G,K);if(M===-1)return -1;if(F!==-1&&F<M){let z=P5($,F);z?(z.tag.toLowerCase()===Q&&!z.f&&!z.o&&!Z9(z.tag)&&V++,K=z.end):K=F+1;}else {var U=M+G.length,W=U<J?$.charCodeAt(U):62;if((W===d||W===I||W===w||W===C)&&(V--,V===0)){d9=M;let z=M+G.length;for(;z<J&&$.charCodeAt(z)!==d;)z++;return z+1}K=M+1;}}return -1}function E4($,X,Z,Q){if(Q.ignoreHTMLBlocks||Q.disableParsingRawHTML)return null;var Y=U0($,X);if(L0($,X,Y),J0>3&&!Z.inHTML)return null;var G=X+Z0;if($.charCodeAt(G)!==Y0)return null;var V=$.indexOf(">",G+1);if(V!==-1&&V<Y){var K=$.slice(G+1,V);if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(K)||/^[^\s@]+@[^\s@]+$/.test(K))return null}var J=C6($,G);if(J>=1&&J<=5){var U=$.length;if(J===1){for(var W=$.length,F=0;F<W$.length;F++){var M=u5($,`</${W$[F]}>`,G);M>=0&&M<W&&(W=M);}if(W<$.length){var z=$.indexOf(">",W);U=z>=0?t($,z+1):$.length;}}else {var H=J===2?"-->":J===3?"?>":J===4?">":"]]>",B=$.indexOf(H,G);B>=0&&(U=t($,B+H.length));}var j=$.slice(G,U);if(J>=2)return {node:{type:_$1.htmlComment,text:j,t:false,raw:true},end:U};var q="div",O=j.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);O&&(q=O[1]);var A=P5($,G),v={},N;A&&!A.f&&(v=I5(A.attrs,q,Q),N=A.g+A.b);var D=[],T=q.toLowerCase(),P=`</${T}`,R=u5(j,P,0),k="",E,y,f;if(A?.f){f=j.slice(0,A.end-G);for(var S=j.slice(A.end-G);S.length>0&&S.charCodeAt(S.length-1)===C;)S=S.slice(0,-1);S&&(y=U5(S));}else if(A&&!A.f){var g=A.end-G;if(R===-1){for(var x=j;x.length>0&&x.charCodeAt(x.length-1)===C;)x=x.slice(0,-1);E=U5(x);}else {var b=g;j.charCodeAt(b)===C&&b++;for(var i=R;i>b;){var X0=j.charCodeAt(i-1);if(X0!==I&&X0!==w&&X0!==C&&X0!==_5)break;i--;}var P0=j.slice(b,i);P0&&(y=U5(P0));for(var Q0=j.slice(R);Q0.length>0&&Q0.charCodeAt(Q0.length-1)===C;)Q0=Q0.slice(0,-1);f=U5(Q0),k=j.slice(g,R).trim();}}var u0=A?A.f:false;return {node:{type:_$1.htmlBlock,tag:q,attrs:v,b:N,children:D,e:y,h:f,j:E,text:k,c:true,a:u0},end:U}}if(J===6||J===7){var z0=H4($,X),O0=z0<$.length?z0:$.length,w0=$.slice(G,O0),N0=z0<$.length?t($,z0):$.length,o=P5($,G);if(o){var p=o.tag,V0=p.toLowerCase(),y0=o.f;if(y0){var S0=$.slice(o.end,O0);return {node:{type:_$1.htmlBlock,tag:p,attrs:{},children:[],h:$.slice(G,o.end),e:S0?U5(S0):void 0,text:S0,c:true,a:true},end:N0}}if(o.o||Z9(p))return {node:{type:_$1.htmlBlock,tag:p,attrs:I5(o.attrs,p,Q),b:o.g+o.b,children:[],text:"",c:false,a:false},end:o.end<$.length&&$.charCodeAt(o.end)===C?o.end+1:o.end};var j0=Z.d||0,a=$.slice(G,O0),I0=-1,W0=-1,F0=false;if(j0<10){for(var M0=`</${V0}`,f0=o.end-G,B0=1,k0=f0;k0<a.length&&B0>0;){var h0=u5(a,`<${V0}`,k0),p0=u5(a,M0,k0);if(p0===-1)break;if(h0!==-1&&h0<p0){var n=h0+V0.length+1;if(n<a.length){var _0=a.charCodeAt(n);(_0===I||_0===w||_0===C||_0===d||_0===A0)&&B0++;}k0=h0+1;}else {var r=p0+M0.length;if(r<a.length){var x0=a.charCodeAt(r);if((x0===d||x0===I||x0===w||x0===C)&&(B0--,B0===0)){I0=p0;for(var L=r;L<a.length&&a.charCodeAt(L)!==d;)L++;W0=L+1;break}}else if(B0--,B0===0){I0=p0,W0=a.length;break}k0=p0+1;}}if(I0===-1&&!o.f&&(J===6||o.v)){var K0=H$($,o.end,V0);if(K0!==-1){for(var a0=d9,q5=o.end,e=false,g0=false,s=false,d0=0,n0=false,$5=false,l0=q5;l0<a0;){var s0=$.charCodeAt(l0);if(s0===C)$5&&(e=true),n0||d0++,$5=true,l0++;else if(s0===I||s0===w)l0++;else {if(!n0&&(n0=true,d0>=2&&s0===Y0)){s=true;break}if($5=false,s0===Y0){var l5=$.charCodeAt(l0+1)|32;if((l5===k9||l5===Z$||l5===n5)&&(q4.lastIndex=l0,q4.test($))){g0=true;break}}l0++;}}if(e&&!s&&!g0){var k5=U0($,K0);O0=k5,N0=t($,k5),a=$.slice(G,O0),w0=$.slice(G,O0),I0=a0-G,W0=K0-G,F0=true;}}}}var R0=o.b.indexOf(`
16613
+ `)!==-1||o.g.indexOf(`
16614
+ `)!==-1,o5=false;if(I0!==-1){var P9=a.slice(W0).trim();o5=P9.length===0;}var R5=false,r5=O0,x5=N0;if(I0!==-1){var A5=G+W0,Z5=U0($,A5-1);if(A5<Z5){for(var j5=A5;j5<Z5&&($.charCodeAt(j5)===I||$.charCodeAt(j5)===w);)j5++;if(j5<Z5&&$.charCodeAt(j5)===Y0){var Y9=P5($,j5);Y9&&!Y9.f&&(R5=true,r5=A5,x5=A5,o5=true);}}if(!R5){var i5=t($,Z5);if(i5<O0){for(var D5=i5;D5<O0&&($.charCodeAt(D5)===I||$.charCodeAt(D5)===w);)D5++;if(D5<O0&&$.charCodeAt(D5)===Y0){var h4=P5($,D5);h4&&(R5=true,r5=Z5,x5=i5,o5=true);}}}if(!R5&&Z.inHTML){R5=true,r5=Z5,x5=t($,Z5);var m4=$.slice(A5,Z5).trim();o5=m4.length===0;}}var G9=[],Y5="";if(I0!==-1){Y5=a.slice(o.end-G,I0);var V9=Y5.trim();if(V9){var{inline:u4,inHTML:p4,d:d4}=Z;Z.inHTML=true,Z.d=j0+1;var c4=V0==="p";if(c4)Z.inline=true,G9=q9(V9,false,Z,Q);else {var N$=Y5.indexOf(`
16615
+
16616
+ `)!==-1,I$=q$.test(V9),o9=W4.test(V9),l4=N$||I$||Z.inHTML&&o9,o4=Y5.length>=2&&Y5.charCodeAt(0)===C&&Y5.charCodeAt(Y5.length-1)===C&&!N$;o4&&!I$&&!o9?G9=[{type:_$1.text,text:V9}]:l4||o9?(Z.inline=false,G9=d5(Y5,Z,Q)):(Z.inline=true,G9=q9(V9,false,Z,Q));}Z.inline=u4,Z.inHTML=p4,Z.d=d4;}}var P$=false;if(J===6&&I0!==-1&&!Z.inHTML&&!R0){var r4=/<[a-zA-Z][^>]*>/.test(Y5),i4=Y5.indexOf(`
16617
+
16618
+ `)!==-1||q$.test(Y5);r4&&!i4&&(P$=true);}var a4=!F0&&(Z.inHTML||J===7||R0||!o5||P$);if(a4){var W9,B5,w$=false;if(I0!==-1&&R5){var R$=false;if(Z.inHTML&&W0<a.length){for(var w9=W0;w9<a.length&&a.charCodeAt(w9)!==C;)w9++;var r9=a.slice(W0,w9).trim();R$=r9.length>1&&r9.charCodeAt(0)===Y0&&r9.charCodeAt(1)!==A0;}B5=R$?a.slice(o.end-G):Y5,w$=true;}else (J===7||Z.inHTML)&&I0!==-1?(B5=a.slice(o.end-G),B5.charCodeAt(0)===C&&(B5=B5.slice(1))):R5?W9=$.slice(G,r5):R0?W9=w0:(B5=a.slice(o.end-G),B5.charCodeAt(0)===C&&(B5=B5.slice(1)));var b$=W9!==void 0,i9=U5(W9===void 0?B5||"":W9),L$={type:_$1.htmlBlock,tag:p,attrs:I5(o.attrs,p,Q),b:o.g+o.b,children:G9,e:b$?void 0:i9,j:b$?i9:void 0,text:i9,c:true,a:false};return w$&&(L$.y=true),{node:L$,end:x5}}var T$=U5(Y5);return {node:{type:_$1.htmlBlock,tag:p,attrs:I5(o.attrs,p,Q),b:o.g+o.b,children:G9,e:F0?void 0:T$,text:T$,c:false,a:false},end:x5}}var R9=w0.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/),n4=R9?R9[2]:"div",a9=R9?R9[1]==="/":false,n9,y$,S$,b9="";if(a9){var s9=w0.indexOf(">");s9===-1?n9=w0:(n9=w0.slice(0,s9+1),b9=w0.slice(s9+1),b9&&(y$=U5(b9)));}else S$=U5(w0);return {node:{type:_$1.htmlBlock,tag:n4,attrs:{},children:[],e:y$,h:n9,j:S$,text:a9?b9:w0,c:true,a:a9},end:N0}}var o0=P5($,G);if(!o0)return null;var E5=o0.tag,t9=E5.toLowerCase(),k$=E5.charCodeAt(0),L9=k$>=h$1&&k$<=m$1;if(!(L9||p9.has(t9)||N9.has(t9)||t9.includes("-")))return null;if(o0.f)return {node:{type:_$1.htmlSelfClosing,tag:E5,attrs:{},h:$.slice(G,o0.end),a:true},end:o0.end};var a5=H$($,o0.end,E5),F9=[];if(a5!==-1){var s4=d9,T9=$.slice(o0.end,s4),y9=T9.trim();if(y9){var t4=T9.indexOf(`
16619
+
16620
+ `)!==-1,e4=q$.test(y9),$6=W4.test(y9),Z6=Z.inline,X6=Z.inHTML,Q6=Z.d;Z.inHTML=true,Z.d=(Z.d||0)+1,t4||e4||$6?(Z.inline=false,F9=d5(T9,Z,Q)):(Z.inline=true,F9=q9(y9,false,Z,Q)),Z.inline=Z6,Z.inHTML=X6,Z.d=Q6;}var Y6=U0($,a5),G6=$.slice(a5,Y6).trim(),e9=G6?a5:t($,a5),x$=L9?$.slice(G,a5):$.slice(G,e9);return {node:{type:_$1.htmlBlock,tag:E5,attrs:I5(o0.attrs,E5,Q),b:o0.g+o0.b,children:F9,j:U5(x$),text:L9?T9:x$,c:true,a:false},end:e9}}var z9=H4($,o0.end),V6=z9<$.length?t($,z9):z9,$$=$.slice(o0.end,z9);if($$.trim()){var{inline:K6,inHTML:J6,d:U6}=Z;Z.inline=false,Z.inHTML=true,Z.d=(Z.d||0)+1,F9=d5($$,Z,Q),Z.inline=K6,Z.inHTML=J6,Z.d=U6;}var q6=$.slice(o0.end,z9);return {node:{type:_$1.htmlBlock,tag:E5,attrs:I5(o0.attrs,E5,Q),b:o0.g+o0.b,children:F9,e:U5(q6),text:$$,c:true,a:false},end:V6}}function C6($,X){if($.charCodeAt(X)!==Y0)return 0;var Z=X+1,Q=$.length;if($.charCodeAt(Z)===c0&&$.charCodeAt(Z+1)===u$1&&$.charCodeAt(Z+2)===u$1)return 2;if($.charCodeAt(Z)===s5)return 3;if($.charCodeAt(Z)===c0){var Y=$.charCodeAt(Z+1);if(Y>=h$1&&Y<=m$1)return 4;if($.slice(Z+1,Z+8)==="[CDATA[")return 5}for(var G=$.charCodeAt(Z)===A0,V=G?Z+1:Z,K=V;K<Q;){var J=$.charCodeAt(K);if(J>=h$1&&J<=m$1||J>=G0&&J<=q0||J>=c&&J<=l$1||J===u$1)K++;else break}if(K===V)return 0;var U=$.slice(V,K);if(N9.has(U.toLowerCase())){if(G)return 0;var W=$.charCodeAt(K);return W===I||W===w||W===d||W===C||K>=Q?1:0}if(p9.has(U.toLowerCase())){if(G){for(var F=K;F<Q&&($.charCodeAt(F)===I||$.charCodeAt(F)===w);)F++;return F<Q&&$.charCodeAt(F)===d?6:0}var M=K<Q?$.charCodeAt(K):-1;return M===I||M===w||M===d||M===C||M===A0||M===-1?6:0}if(G){for(var z=K;z<Q&&($.charCodeAt(z)===I||$.charCodeAt(z)===w);)z++;if(z<Q&&$.charCodeAt(z)===d){var H=U0($,X),B=$.slice(z+1,H).trim();if(B==="")return 7}}else {var j=U0($,X),q=P5($,X);if(q&&q.end<=j){var O=$.slice(q.end,j).trim();if(O==="")return 7}}return 0}function v4($,X,Z){for(var Q=0,Y=$.length;Q<Y&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;for(;Y>Q&&($.charCodeAt(Y-1)===I||$.charCodeAt(Y-1)===w);)Y--;Q<Y&&$.charCodeAt(Q)===E0&&Q++,Y>Q&&$.charCodeAt(Y-1)===E0&&(Y-2<Q||$.charCodeAt(Y-2)!==T0)&&Y--;for(var G=[],V=Q,K=false,J=[],U=Q;U<Y;){var W=$.charCodeAt(U);if(W===T0&&U+1<Y){$.charCodeAt(U+1)===E0?(K||(K=true,J=[]),J.push($.slice(V,U)),J.push("|"),U+=2,V=U):U+=2;continue}if(W===$0){for(var F=0;U<Y&&$.charCodeAt(U)===$0;)F++,U++;for(var M=false;U<Y&&!M;){for(var z=0;U<Y&&$.charCodeAt(U)===$0;)z++,U++;z===F?M=true:z===0&&U++;}continue}if(W===E0){var H=K?(J.push($.slice(V,U)),J.join("")):$.slice(V,U);G.push(H.trim()),U++,V=U,K=false,J=[];continue}U++;}var B=K?(J.push($.slice(V,Y)),J.join("")):$.slice(V,Y);return G.push(B.trim()),G.map(j=>{var q=j.indexOf("\\|")===-1?j:j.replace(/\\\|/g,"|");return q?q9(q,false,X,Z):[]})}function N4($,X,Z,Q){let Y=U0($,X);var G=$.indexOf("|",X);if(G<0||G>=Y)return null;let V=t($,Y);if(V>=$.length)return null;let K=U0($,V);if(!S4($,V,K))return null;let J=$.slice(X,Y),U=$.slice(V,K);for(var W=[],F=0,M=U.length;F<M&&(U.charCodeAt(F)===I||U.charCodeAt(F)===w);)F++;for(F<M&&U.charCodeAt(F)===E0&&F++;F<M;){for(;F<M&&(U.charCodeAt(F)===I||U.charCodeAt(F)===w);)F++;if(F>=M||U.charCodeAt(F)===E0)break;var z=U.charCodeAt(F)===m0;for(z&&F++;F<M&&U.charCodeAt(F)===u$1;)F++;var H=F<M&&U.charCodeAt(F)===m0;for(H&&F++,W.push(z&&H?"center":H?"right":z?"left":null);F<M&&(U.charCodeAt(F)===I||U.charCodeAt(F)===w);)F++;F<M&&U.charCodeAt(F)===E0&&F++;}let B=v4(J,Z,Q);if(W.length!==B.length)return null;let j=[],q=t($,K);for(;q<$.length;){let T=U0($,q),P=$.slice(q,T);if(e0($,q,T))break;if(L0($,q,T),J0<4){var O=$.charCodeAt(q+Z0);if(O===d||O===G5||(O===u$1||O===v0||O===H0)&&p5($,q))break;if(O===$0||O===b0){for(var A=q+Z0,v=0;A<T&&$.charCodeAt(A)===O;)v++,A++;if(v>=3)break}}j.push(v4(P,Z,Q)),q=t($,T);}if(Q.optimizeForStreaming&&j.length===0)return null;for(var N=B.length,D=0;D<j.length;D++)if(j[D].length<N)for(;j[D].length<N;)j[D].push([]);else j[D].length>N&&(j[D].length=N);return {node:{type:_$1.table,header:B,cells:j,align:W},end:q}}function g6($,X,Z){var Q=U0($,X);if(L0($,X,Q),J0>3)return null;var Y=X+Z0;if($.charCodeAt(Y)!==D0)return null;if(Y+1<$.length&&$.charCodeAt(Y+1)===W5){var G=f6($,Y,Z);return G||null}Z.refs||(Z.refs={});var V=k4($,Y,Z.refs);return V===null?null:{node:{type:_$1.refCollection},end:V}}function f6($,X,Z){var Q=$.length;if($.charCodeAt(X)!==D0||X+1>=Q||$.charCodeAt(X+1)!==W5)return null;for(var Y=X+2,G=Y;Y<Q&&$.charCodeAt(Y)!==K5;){if($.charCodeAt(Y)===C)return null;Y++;}if(Y>=Q)return null;var V=`^${$.slice(G,Y)}`.toLowerCase();if(Y++,Y>=Q||$.charCodeAt(Y)!==m0)return null;for(Y++;Y<Q&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===w);)Y++;if(Y<Q&&$.charCodeAt(Y)===C)for(Y++;Y<Q&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===w);)Y++;var K=$.indexOf(`
16621
+ `,Y);K<0&&(K=Q);for(var J=$.slice(Y,K).trim(),U=K<Q?K+1:Q;U<Q;){var W=U0($,U);if(L0($,U,W),J0>=2&&!e0($,U,W))J+=`
16622
+ ${$.slice(U,W)}`,U=t($,W);else if(e0($,U,W)){var F=t($,W);if(F<Q){var M=U0($,F);if(L0($,F,M),J0>=2){J+=`
16623
+ `,U=t($,W);continue}}break}else break}var z=Z.refs;return z&&!z[V]&&(z[V]={target:J,title:void 0}),{node:{type:_$1.footnote},end:U}}function h6($,X,Z,Q){let Y=X,G=0,V=0,K=-1;for(;Y<$.length;){let f=K>=0?K:U0($,Y);if(K=-1,e0($,Y,f))break;if(L0($,Y,f),J0<4&&V>0&&!Z.l){let g=$.charCodeAt(Y+Z0);if(g===V5||g===u$1){let x=Y+Z0;for(;x<f&&$.charCodeAt(x)===g;)x++;for(;x<f&&($.charCodeAt(x)===I||$.charCodeAt(x)===w);)x++;if(x>=f){G=g===V5?1:2,Y=t($,f);break}}}V=f;let S=t($,f);if(S<$.length){if($.charCodeAt(S)===E9){var J=U0($,S);Y=t($,J),V=J;continue}let g=U0($,S);if(K=g,L0($,S,g),J0<4){let x=$.charCodeAt(S+Z0);if(x===d){Y=S;break}if(x===G5){for(var U=S+Z0,W=0;U<g&&$.charCodeAt(U)===G5&&W<=6;)W++,U++;if(W>=1&&W<=6&&(U>=g||$.charCodeAt(U)===I||$.charCodeAt(U)===w)){Y=S;break}}if(x===$0||x===b0){for(var F=S+Z0,M=0;F<g&&$.charCodeAt(F)===x;)M++,F++;if(M>=3){Y=S;break}}if(x===Y0){var z=S+Z0+1,H=z<g?$.charCodeAt(z):0,B=H===c0||H===s5;if(!B&&H===A0){for(var j=z+1,q=j;q<g&&($.charCodeAt(q)>=h$1&&$.charCodeAt(q)<=m$1||$.charCodeAt(q)>=G0&&$.charCodeAt(q)<=q0||$.charCodeAt(q)>=c&&$.charCodeAt(q)<=l$1||$.charCodeAt(q)===u$1);)q++;q>j&&(B=p9.has($.slice(j,q).toLowerCase()));}else if(!B){for(var O=z;O<g&&($.charCodeAt(O)>=h$1&&$.charCodeAt(O)<=m$1||$.charCodeAt(O)>=G0&&$.charCodeAt(O)<=q0||$.charCodeAt(O)>=c&&$.charCodeAt(O)<=l$1||$.charCodeAt(O)===u$1);)O++;if(O>z){var A=$.slice(z,O).toLowerCase();B=p9.has(A)||N9.has(A);}}if(B&&E4($,S,Z,Q)){Y=S;break}}if(x===u$1||x===v0||x===T5){let b=S+Z0+1;if(b<g&&($.charCodeAt(b)===I||$.charCodeAt(b)===w)){var v=_9($,b,g);if(v<g&&!p5($,S)){Y=S;break}}}if(x>=c&&x<=l$1){let b=S+Z0;for(;b<g&&$.charCodeAt(b)>=c&&$.charCodeAt(b)<=l$1;)b++;if(b<g&&($.charCodeAt(b)===X5||$.charCodeAt(b)===z5)&&b-(S+Z0)===1&&$.charCodeAt(S+Z0)===49){var N=b+1;if(N<g&&($.charCodeAt(N)===I||$.charCodeAt(N)===w)){var D=_9($,N,g);if(D<g){Y=S;break}}}}if(x===E0){let b=t($,g);if(b<$.length){let i=U0($,b);if(S4($,b,i)){Y=S;break}}}if((x===u$1||x===v0||x===H0)&&p5($,S)){if(x!==u$1){Y=S;break}let i=S+Z0;for(;i<g&&$.charCodeAt(i)===u$1;)i++;for(;i<g&&($.charCodeAt(i)===I||$.charCodeAt(i)===w);)i++;if(i<g){Y=S;break}}}}Y=t($,f);}for(var T=G?V:Y;T>X&&($.charCodeAt(T-1)===C||$.charCodeAt(T-1)===_5||$.charCodeAt(T-1)===I||$.charCodeAt(T-1)===w);)T--;for(var P=X;P<T&&($.charCodeAt(P)===I||$.charCodeAt(P)===w);)P++;if(P>=T)return null;for(var R=false,k=P;k<T;k++)if($.charCodeAt(k)===E9){R=true;break}var E=R?$.slice(P,T).replace(/\u001E/g,""):$.slice(P,T);if(!E)return null;let y=q9(E,true,Z,Q);return G?{node:{type:_$1.heading,level:G,children:y,id:""},end:Y}:{node:{type:_$1.paragraph,children:y},end:Y}}function q9($,X,Z,Q){var Y=Z.u;if(!Y){var G=Z.k;Z.k=X;var V=w5($,0,$.length,Z,Q);return Z.k=G,V}var K=[];return Y.push({dest:K,text:$,breaks:X,inline:Z.inline,inAnchor:Z.inAnchor,inHTML:Z.inHTML,htmlDepth:Z.d,inList:Z.inList,inBlockQuote:Z.inBlockQuote,noSetext:Z.l,depth:Z.p}),K}function m6($,X,Z){if($.charCodeAt(X)!==$0)return null;let Q=c5($,X,Z,96),Y=X+Q;for(;Y<Z;){let G=$.indexOf("`",Y);if(G<0||G>=Z)return null;let V=c5($,G,Z,96);if(V===Q){let K=$.slice(X+Q,G);return K.indexOf(`
16624
+ `)!==-1&&(K=K.replace(/\n/g," ")),K.length>0&&K[0]===" "&&K.at(-1)===" "&&K.trim().length>0&&(K=K.slice(1,-1)),{node:{type:_$1.codeInline,text:K},end:G+V}}Y=G+V;}return null}function j$($,X,Z){if($.charCodeAt(X)!==$0)return X;let Q=c5($,X,Z,96),Y=X+Q;for(;Y<Z;){let G=$.indexOf("`",Y);if(G<0||G>=Z)return X;let V=c5($,G,Z,96);if(V===Q)return G+V;Y=G+V;}return X}function u6($,X,Z){if($.charCodeAt(X)!==Y0)return X;if(X+1<Z&&$.charCodeAt(X+1)===A0){let U=X+2;for(;U<Z&&$.charCodeAt(U)!==d;)U++;return U<Z?U+1:X}if(X+3<Z&&$.charCodeAt(X+1)===c0&&$.charCodeAt(X+2)===u$1&&$.charCodeAt(X+3)===u$1){let U=$.indexOf("-->",X+4);return U>=0?U+3:X}let Q=X+1,Y=Q;for(;Q<Z;){let U=$.charCodeAt(Q);if(U>=h$1&&U<=m$1||U>=G0&&U<=q0||U>=c&&U<=l$1||U===u$1)Q++;else break}if(Q===Y)return X;let G=$.slice(Y,Q).toLowerCase(),V=false;for(;Q<Z;){let U=$.charCodeAt(Q);if(U===d){Q++;break}if(U===A0&&Q+1<Z&&$.charCodeAt(Q+1)===d){Q+=2,V=true;break}if(U===L5||U===g5){var K=U;for(Q++;Q<Z&&$.charCodeAt(Q)!==K;)Q++;Q<Z&&Q++;continue}if(U===C)return X;Q++;}if(V||Z9(G))return Q;let J=1;for(;Q<Z&&J>0;)if($.charCodeAt(Q)===Y0)if(Q+1<Z&&$.charCodeAt(Q+1)===A0){let U=Q+2,W=U;for(;W<Z&&($.charCodeAt(W)>=h$1&&$.charCodeAt(W)<=m$1||$.charCodeAt(W)>=G0&&$.charCodeAt(W)<=q0);)W++;if($.slice(U,W).toLowerCase()===G){for(;W<Z&&$.charCodeAt(W)!==d;)W++;if(W<Z&&W++,J--,J===0)return W}Q=W;}else {let U=Q+1,W=U;for(;W<Z&&($.charCodeAt(W)>=h$1&&$.charCodeAt(W)<=m$1||$.charCodeAt(W)>=G0&&$.charCodeAt(W)<=q0);)W++;$.slice(U,W).toLowerCase()===G&&J++,Q++;}else Q++;return Q}function p6($,X,Z,Q,Y){if($.charCodeAt(X)!==b0||X+1>=Z||$.charCodeAt(X+1)!==b0)return null;let G=X+2;for(;G+1<Z;){let V=$.charCodeAt(G);if(V===$0){let K=j$($,G,Z);if(K>G){G=K;continue}}if(V===b0&&$.charCodeAt(G+1)===b0){let K=$.slice(X+2,G),J=w5(K,0,K.length,Q,Y);return {node:{type:_$1.textFormatted,tag:"del",children:J},end:G+2}}V===T0&&G+1<Z&&G++,G++;}return null}function d6($,X,Z,Q,Y){if($.charCodeAt(X)!==V5||X+1>=Z||$.charCodeAt(X+1)!==V5)return null;let G=X+2;for(;G+1<Z;){let V=$.charCodeAt(G);if(V===$0){let K=j$($,G,Z);if(K>G){G=K;continue}}if(V===V5&&$.charCodeAt(G+1)===V5&&G>X+2){let K=$.slice(X+2,G),J=w5(K,0,K.length,Q,Y);return {node:{type:_$1.textFormatted,tag:"mark",children:J},end:G+2}}V===T0&&G+1<Z&&G++,G++;}return null}function I4($,X,Z){return $<K9?!!(A$($)&e5):s$.test(X[Z])}function P4($,X,Z){return $<K9?!!(A$($)&f5):t$.test(X[Z])}function c6($,X,Z){var Q=$.charCodeAt(X);if(Q!==v0&&Q!==H0)return null;var Y=c5($,X,Z,Q);if(Y===0)return null;var G=X>0?$.charCodeAt(X-1):32,V=X+Y<Z?$.charCodeAt(X+Y):32,K=P4(G,$,X-1),J=P4(V,$,X+Y),U=X>0?I4(G,$,X-1):false,W=X+Y<Z?I4(V,$,X+Y):false,F=!J&&(!W||K||U),M=!K&&(!U||J||W),z,H;return Q===v0?(z=F,H=M):(z=F&&(!M||U),H=M&&(!F||W)),{len:Y,canOpen:z,canClose:H}}function l6($,X,Z,Q){if(X.length!==0){for(var Y=$.length,G=Array(Y),V=null,K=null,J=0;J<Y;J++){var U={node:$[J],prev:K,next:null};K?K.next=U:V=U,G[J]=U,K=U;}for(var W=Array(X.length),F=0;F<X.length;F++)W[F]=G[X[F].idx];for(var M=[],z=0;z<12;z++)M[z]=-1;for(var H=0;H<X.length;){var B=X[H];if(!(B.active&&B.canClose)){H++;continue}for(var j=B.ch===v0?0:1,q=j*6+B.len%3*2+(B.canOpen?1:0),O=M[q]===void 0?-1:M[q],A=-1,v=H-1;v>O;v--){var N=X[v];if(!(!N.active||N.ch!==B.ch||!N.canOpen)&&!((B.canOpen||N.canClose)&&(N.len+B.len)%3===0&&N.len%3!==0)){A=v;break}}if(A<0){M[q]=H-1,!B.canOpen&&(B.active=false),H++;continue}var D=X[A],T=D.len>=2&&B.len>=2,P=T?2:1;D.len-=P,B.len-=P;var R=W[A],k=W[H],E=R.node,y=k.node;E.text=E.text.slice(0,E.text.length-P),y.text=y.text.slice(P);for(var f=[],S=R.next;S&&S!==k;)f.push(S.node),S=S.next;var g={type:_$1.textFormatted,tag:T?"strong":"em",children:f},x={node:g,prev:R,next:k};R.next=x,k.prev=x;for(var b=A+1;b<H;b++)X[b].active=false;if(D.len===0&&(D.active=false,E.text==="")){var i=R.prev;x.prev=i,i?i.next=x:V=x;}if(B.len===0){if(B.active=false,y.text===""){var X0=k.next;x.next=X0,X0&&(X0.prev=x);}}else continue;H++;}for(var P0=0,Q0=V;Q0;){var u0=Q0.node;if(u0.type===_$1.text){var z0=u0;if(z0.text===""){Q0=Q0.next;continue}if(P0>0&&$[P0-1].type===_$1.text){$[P0-1].text+=z0.text,Q0=Q0.next;continue}}$[P0++]=u0,Q0=Q0.next;}$.length=P0;}}function h9($,X,Z,Q){return X($,Z,Q)===null?null:$}function w4($,X,Z,Q,Y){let G=$.charCodeAt(X)===c0,V=G?X+1:X;if($.charCodeAt(V)!==D0)return null;var K=$.indexOf("]",V+1);if(K<0||K>=Z)return null;for(var J=V+1,U=-1,W=1;J<Z&&W>0;){var F=$.charCodeAt(J);if(F===T0&&J+1<Z){J+=2;continue}if(F===$0){var M=j$($,J,Z);if(M>J){J=M;continue}}if(F===Y0){var z=C4($,J,Z);if(z){J=z.end;continue}var H=u6($,J,Z);if(H>J){J=H;continue}}F===D0?W++:F===K5&&W--,J++;}if(W!==0)return null;var B=J-1,j=$.slice(V+1,B),q=J<Z?$.charCodeAt(J):0,O=false;if(q===F5){var A=true;for(J++;J<Z&&($.charCodeAt(J)===I||$.charCodeAt(J)===C);)J++;var v="",N=J;if(J<Z&&$.charCodeAt(J)===Y0){for(J++,N=J;N<Z&&$.charCodeAt(N)!==d;){if($.charCodeAt(N)===T0&&N+1<Z){N+=2;continue}if($.charCodeAt(N)===C){A=false;break}N++;}A&&(N>=Z||$.charCodeAt(N)!==d)&&(A=false),A&&(v=$.slice(J,N),N++);}else if(A)if(Q.m!==void 0&&J>=Q.m)A=false;else {for(var D=0,T=false;N<Z;){var P=$.charCodeAt(N);if(P===T0&&N+1<Z){N+=2;continue}if(P===F5)D++;else if(P===z5){if(T=true,D===0)break;D--;}else if(P===I||P===C)break;N++;}N>=Z&&!T&&(Q.m===void 0||J<Q.m)&&(Q.m=J),v=$.slice(J,N);}if(A){for(J=N;J<Z&&($.charCodeAt(J)===I||$.charCodeAt(J)===C);)J++;var R;if(J<Z){var k=$.charCodeAt(J);if(k===L5||k===g5||k===F5){var E=k===F5?41:k;J++;for(var y=J;J<Z&&$.charCodeAt(J)!==E;)$.charCodeAt(J)===T0&&J+1<Z&&J++,J++;J>=Z?A=false:(R=$.slice(y,J),J++);}}if(A){for(;J<Z&&($.charCodeAt(J)===I||$.charCodeAt(J)===C);)J++;(J>=Z||$.charCodeAt(J)!==z5)&&(A=false);}}if(A){if(J++,v=v5(U9(v)),R!==void 0&&(R=v5(U9(R))),G){var f=w5(j,0,j.length,Q,Y),S=c9(f);return {node:{type:_$1.image,target:h9(v,Y?.sanitizer||M5,"img","src"),alt:S,title:R},end:J}}var g=Q.inAnchor;Q.inAnchor=true;var z0=g?[{type:_$1.text,text:j}]:w5(j,0,j.length,Q,Y);return Q.inAnchor=g,!Q.inAnchor&&O$(z0)?null:{node:{type:_$1.link,target:h9(v,Y?.sanitizer||M5,"a","href"),title:R,children:z0},end:J}}J=B+1,O=true;}var x="",b=J;if(!O&&q===D0){var i=J+1;b=i;for(var X0=false;b<Z&&$.charCodeAt(b)!==K5;){if($.charCodeAt(b)===T0&&b+1<Z){b+=2;continue}if($.charCodeAt(b)===D0){X0=true;break}b++;}if(X0||b>=Z)return null;var P0=$.slice(i,b);if(P0.trim())x=m9(P0);else {if(M4(j))return null;x=m9(j);}b+=1;}else {if(M4(j))return null;x=m9(j);}var Q0=Q.refs?.[x];if(!Q0)return null;if(G)return {node:{type:_$1.image,target:h9(Q0.target,Y?.sanitizer||M5,"img","src"),alt:c9(w5(j,0,j.length,Q,Y)),title:Q0.title},end:b};var u0=Q.inAnchor;Q.inAnchor=true;var z0=u0?[{type:_$1.text,text:j}]:w5(j,0,j.length,Q,Y);return Q.inAnchor=u0,!Q.inAnchor&&O$(z0)?null:{node:{type:_$1.link,target:h9(Q0.target,Y?.sanitizer||M5,"a","href"),title:Q0.title,children:z0},end:b}}function C4($,X,Z){if($.charCodeAt(X)!==Y0)return null;for(var Q=X+1;Q<Z;){var Y=$.charCodeAt(Q);if(Y===d)break;if(Y===I||Y===C||Y===_5||Y===Y0)return null;Q++;}if(Q>=Z||$.charCodeAt(Q)!==d)return null;var G=$.slice(X+1,Q),V=G.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);return V?{node:{type:_$1.link,target:G,title:void 0,children:[{type:_$1.text,text:G}]},end:Q+1}:G.indexOf("@")!==-1&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(G)?{node:{type:_$1.link,target:`mailto:${G}`,title:void 0,children:[{type:_$1.text,text:G}]},end:Q+1}:null}function o6($,X,Z,Q){if($.charCodeAt(X)!==D0||X+1>=Z||$.charCodeAt(X+1)!==W5)return null;let Y=X+2;for(;Y<Z&&$.charCodeAt(Y)!==K5&&$.charCodeAt(Y)!==C;)Y++;if(Y>=Z||$.charCodeAt(Y)!==K5)return null;let G=$.slice(X+2,Y);return G?{node:{type:_$1.footnoteReference,target:`#${N5(G)}`,text:G},end:Y+1}:null}function r6($,X,Z,Q){if(Q.disableBareUrls)return null;var Y="",G=false,V=$.charCodeAt(X);if(V===D9||V===72?X+8<=Z&&$.charCodeAt(X+1)===n5&&$.charCodeAt(X+2)===n5&&$.charCodeAt(X+3)===k9&&($.charCodeAt(X+4)===Z$&&$.charCodeAt(X+5)===m0&&$.charCodeAt(X+6)===A0&&$.charCodeAt(X+7)===A0?Y="https://":$.charCodeAt(X+4)===m0&&$.charCodeAt(X+5)===A0&&$.charCodeAt(X+6)===A0&&(Y="http://")):V===b5||V===70?X+6<=Z&&$.charCodeAt(X+1)===n5&&$.charCodeAt(X+2)===k9&&$.charCodeAt(X+3)===m0&&$.charCodeAt(X+4)===A0&&$.charCodeAt(X+5)===A0&&(Y="ftp://"):(V===C5||V===87)&&X+4<=Z&&$.charCodeAt(X+1)===C5&&$.charCodeAt(X+2)===C5&&$.charCodeAt(X+3)===X5&&(Y="www.",G=true),!Y)return null;let K=X+Y.length;for(;K<Z;){let D=$.charCodeAt(K);if(D===I||D===C||D===w||D===_5||D===Y0||D===d)break;K++;}for(var J=0,U=0,W=X;W<K;W++){var F=$.charCodeAt(W);F===F5?J++:F===z5&&U++;}let M=K;for(;M>X+Y.length;){let D=$.charCodeAt(M-1);if(D===X5||D===g$||D===m0||D===c0||D===s5||D===z5||D===v0||D===H0||D===b0){if(D===z5){if(J>=U)break;U--;}M--;}else if(D===A9){for(var z=M-2;z>X&&($.charCodeAt(z)>=h$1&&$.charCodeAt(z)<=m$1||$.charCodeAt(z)>=G0&&$.charCodeAt(z)<=q0||$.charCodeAt(z)>=c&&$.charCodeAt(z)<=l$1);)z--;z>=X&&$.charCodeAt(z)===H9?M=z:M--;}else break}if(M<=X+Y.length)return null;var H=X+(G?4:Y.length),B=$.indexOf("/",H);if((B<0||B>M)&&(B=M),G&&$.indexOf(".",H)===-1)return null;for(var j=-1,q=-1,O=B-1;O>=H;O--)if($.charCodeAt(O)===X5)if(j<0)j=O;else {q=O;break}for(var A=q>=0?q+1:H,O=A;O<B;O++)if($.charCodeAt(O)===H0)return null;var v=$.slice(X,M),N=G?`http://${v}`:v;return {node:{type:_$1.link,target:N,title:void 0,children:[{type:_$1.text,text:v}]},end:M}}function i6($,X,Z,Q){if(Q.disableBareUrls)return null;for(var Y=X,G=Y;Y<Z;){var V=$.charCodeAt(Y);if(V>=h$1&&V<=m$1||V>=G0&&V<=q0||V>=c&&V<=l$1||V===X5||V===c0||V===G5||V===36||V===M9||V===H9||V===g5||V===v0||V===T5||V===A0||V===V5||V===s5||V===W5||V===H0||V===$0||V===y5||V===E0||V===x9||V===b0||V===u$1)Y++;else break}if(Y===G||Y>=Z||$.charCodeAt(Y)!==S9)return null;Y++;for(var K=Y,J=-1,U=Y;Y<Z;){var V=$.charCodeAt(Y);if(V>=h$1&&V<=m$1||V>=G0&&V<=q0||V>=c&&V<=l$1)Y++;else if((V===u$1||V===H0)&&Y>K)Y++;else if(V===X5){if(Y===K)break;var W=$.charCodeAt(Y-1);if(W===u$1||W===H0||Y-U>63)break;if(Y+1<Z){var F=$.charCodeAt(Y+1);if(F>=h$1&&F<=m$1||F>=G0&&F<=q0||F>=c&&F<=l$1)J=Y,U=Y+1,Y++;else break}else break}else break}if(Y-U>63||J<0)return null;var M=$.charCodeAt(Y-1);if(!(M>=h$1&&M<=m$1||M>=G0&&M<=q0||M>=c&&M<=l$1)||Y<=J+1)return null;for(var z=-1,H=J-1;H>=K;H--)if($.charCodeAt(H)===X5){z=H;break}for(var B=z>=0?z+1:K,H=B;H<Y;H++)if($.charCodeAt(H)===H0)return null;var j=$.slice(X,Y);return {node:{type:_$1.link,target:`mailto:${j}`,title:void 0,children:[{type:_$1.text,text:j}]},end:Y}}function O$($){for(var X=0;X<$.length;X++)if($[X].type===_$1.link||"children"in $[X]&&Array.isArray($[X].children)&&O$($[X].children))return true;return false}function c9($,X){for(var Z="",Q=0;Q<$.length;Q++){var Y=$[Q];Y.type===_$1.text?Z+=Y.text:Y.type===_$1.breakLine?Z+=" ":Y.type===_$1.codeInline||Y.type===_$1.footnoteReference?Z+=Y.text:"children"in Y&&Array.isArray(Y.children)?Z+=c9(Y.children,X):!X&&Y.type===_$1.image&&(Z+=Y.alt||"");}return Z}function D$($,X,Z){for(var Q=0;Q<$.length;Q++){var Y=$[Q];if(Y.type===_$1.heading){var G=Y;G.id=L6(Z(c9(G.children,true)),X);}if("children"in Y){var V=Y.children;Array.isArray(V)&&D$(V,X,Z);}if((Y.type===_$1.orderedList||Y.type===_$1.unorderedList)&&Array.isArray(Y.items))for(var K=Y.items,J=0;J<K.length;J++)D$(K[J],X,Z);}}function X9($){return {type:_$1.text,text:$}}function a6($,X,Z){var Q=X+1;if(Q>=Z)return -1;if($.charCodeAt(Q)===G5){Q++;var Y=Q<Z&&($.charCodeAt(Q)===X$||$.charCodeAt(Q)===Q$);Y&&Q++;for(var G=Q,V=Y?6:7;Q<Z&&Q-G<=V;){var K=$.charCodeAt(Q),J=K>=c&&K<=l$1||Y&&(K>=h$1&&K<=O9||K>=G0&&K<=b5);if(!J)break;Q++;}return Q===G||Q-G>V?-1:Q<Z&&$.charCodeAt(Q)===A9?Q+1:-1}for(var U=Q;Q<Z&&Q-U<48;){var W=$.charCodeAt(Q);if(W>=h$1&&W<=m$1||W>=G0&&W<=q0||W>=c&&W<=l$1){Q++;continue}break}return Q===U?-1:Q<Z&&$.charCodeAt(Q)===A9?Q+1:-1}function n6($,X,Z,Q,Y){if($.charCodeAt(X)!==Y0)return null;var G=X+1;if(G>=Z)return null;var V=$.charCodeAt(G);if(V===c0&&G+1<Z&&$.charCodeAt(G+1)===u$1&&G+2<Z&&$.charCodeAt(G+2)===u$1){var K=G+3;if(K<Z&&$.charCodeAt(K)===d)return {node:{type:_$1.htmlComment,text:"",t:true},end:K+1};if(K+1<Z&&$.charCodeAt(K)===u$1&&$.charCodeAt(K+1)===d)return {node:{type:_$1.htmlComment,text:"-",t:true},end:K+2};var J=$.indexOf("-->",K);return J!==-1&&J<=Z-3?{node:{type:_$1.htmlComment,text:$.slice(X+4,J),t:false},end:J+3}:null}if(V===s5){var U=$.indexOf("?>",G+1);return U!==-1&&U<Z?{node:{type:_$1.htmlSelfClosing,tag:"?",attrs:{},n:$.slice(X,U+2),a:false},end:U+2}:null}if(V===c0&&G+1<Z){var W=$.charCodeAt(G+1);if(W===D0&&$.slice(G+1,G+8)==="[CDATA["){var F=$.indexOf("]]>",G+8);return F!==-1&&F<Z?{node:{type:_$1.htmlSelfClosing,tag:"![CDATA[",attrs:{},n:$.slice(X,F+3),a:false},end:F+3}:null}if(W>=h$1&&W<=m$1){var M=$.indexOf(">",G+2);return M!==-1&&M<Z?{node:{type:_$1.htmlSelfClosing,tag:`!${$.slice(G+1,M)}`,attrs:{},n:$.slice(X,M+1),a:false},end:M+1}:null}}if(V===A0){var z=G+1;if(z>=Z)return null;var H=$.charCodeAt(z);if(!(H>=h$1&&H<=m$1||H>=G0&&H<=q0))return null;for(z++;z<Z;){var B=$.charCodeAt(z);if(B>=h$1&&B<=m$1||B>=G0&&B<=q0||B>=c&&B<=l$1||B===u$1)z++;else break}for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===w||$.charCodeAt(z)===C);)z++;if(z<Z&&$.charCodeAt(z)===d){var j=$.slice(G+1,z).trim();return {node:{type:_$1.htmlSelfClosing,tag:j,attrs:{},h:$.slice(X,z+1),a:true},end:z+1}}return null}if(!(V>=h$1&&V<=m$1||V>=G0&&V<=q0))return null;var q=P5($,X);if(!q)return null;var O=q.tag,A=O.toLowerCase(),v=q.o;if(v||Z9(O))return {node:{type:_$1.htmlSelfClosing,tag:O,attrs:I5(q.attrs,O,Y),n:q.r?F$(q):$.slice(X,q.end),a:false},end:q.end};var N=N9.has(A),D=H$($.slice(0,Z),q.end,O);if(D===-1)return {node:{type:_$1.htmlSelfClosing,tag:O,attrs:I5(q.attrs,O,Y),n:q.r?F$(q):$.slice(X,q.end),a:false},end:q.end};var T=E6($,`</${A}`,D),P=$.slice(q.end,T);if(N){var R=U5(P);return {node:{type:_$1.htmlBlock,tag:O,attrs:I5(q.attrs,O,Y),b:q.g+q.b,children:[],e:R||void 0,h:$.slice(T,D),text:R,c:true,a:false},end:D}}var k=[],E=P.trim();if(E){var{inAnchor:y,inline:f,k:S}=Q;A==="a"&&(Q.inAnchor=true),Q.k=false;var g=E.indexOf(`
16625
+
16626
+ `)!==-1||/^#{1,6}\s/.test(E);g?(Q.inline=false,k=d5(E,Q,Y)):k=w5(E,0,E.length,Q,Y),Q.inAnchor=y,Q.inline=f,Q.k=S;}return {node:{type:_$1.htmlBlock,tag:O,attrs:I5(q.attrs,O,Y),b:q.b,children:k,text:U5(P),c:false,a:false},end:D}}var s6=200,B9=0;function w5($,X,Z,Q,Y){if(B9++,B9>s6)return B9--,[{type:_$1.text,text:$.slice(X,Z)}];var G=Q.m;Q.m=void 0;let V=Q;if(Y.optimizeForStreaming){let e=function(s,d0){for(var n0=1,$5=d0+1;$5<s.length;$5++){var l0=s.charCodeAt($5);if(l0===D0)n0++;else if(l0===K5&&(n0--,n0===0))return $5}return -1},L=$.slice(X,Z),K0=L;for(var K=0,J=0,U=0,W=0,F=0,M=-1,z=-1,H=-1,B=-1,j=-1,q=0;q<L.length;q++){var O=L.charCodeAt(q);O===v0?q+1<L.length&&L.charCodeAt(q+1)===v0?(K++,M=q,q++):(J++,z=q):O===H0?q+1<L.length&&L.charCodeAt(q+1)===H0?(U++,H=q,q++):(W++,B=q):O===b0&&q+1<L.length&&L.charCodeAt(q+1)===b0&&(F++,j=q,q++);}var A=[];F%2===1&&j>=0&&A.push([j,2]),U%2===1&&H>=0&&A.push([H,2]),W%2===1&&B>=0&&A.push([B,1]),K%2===1&&M>=0&&A.push([M,2]),J%2===1&&z>=0&&A.push([z,1]),A.sort((s,d0)=>d0[0]-s[0]);for(var v=0;v<A.length;v++){var N=A[v][0],D=A[v][1];L=L.slice(0,N)+L.slice(N+D);}let a0=0,q5=-1;for(let s=0;s<L.length;s++)L.charCodeAt(s)===$0&&(a0++,q5=s);if(a0%2===1&&q5!==-1){let s=false,d0=-1,n0=0;for(;n0<L.length;)L.charCodeAt(n0)===$0&&(s?(s=false,d0=-1):(d0=n0,s=true)),n0++;s&&d0!==-1&&(L=L.slice(0,d0));}for(var T=true;T;){T=false;for(var P=-1,R=-1,k=-1,E=false,y=0;y<L.length;y++){var f=L.charCodeAt(y);if(f===D0&&(y===0||L.charCodeAt(y-1)!==T0)){var S=y>0&&L.charCodeAt(y-1)===c0,g=S?y-1:y,x=e(L,y);if(x===-1)P=g,E=S,R=y+1,k=L.length;else {var b=x+1;if(b>=L.length)P=g,E=S,R=y+1,k=x;else if(L.charCodeAt(b)===F5){var i=L.indexOf(")",b+1);i===-1?(P=g,E=S,R=y+1,k=x,y=L.length):y=i;}else if(L.charCodeAt(b)===D0){var X0=L.indexOf("]",b+1);X0===-1?(P=g,E=S,R=y+1,k=x,y=L.length):y=X0;}else y=x;}}}if(P>=0){var P0=E?"":L.slice(R,k);L=L.slice(0,P)+P0,T=true;}}let g0=L.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);if(g0&&g0.index!==void 0){var Q0=g0[0].length-g0[2].length,u0=Q0>=2&&g0[0].charCodeAt(Q0-2)===A0;if(!u0){for(var z0=false,O0=0,w0=0;w0<g0.index;w0++)L.charCodeAt(w0)===$0&&O0++;if(z0=O0%2===1,!z0){let s=g0[1];u5(L,`</${s}`,0)===-1&&(L=L.slice(0,g0.index)+g0[2]);}}}L!==K0&&($=$.slice(0,X)+L,Z=X+L.length);}let N0=[];var o=[];let p=X;var V0="",y0=Y.disableAutoLink||Y.disableBareUrls||V.inAnchor?-1:$.indexOf("@",X);for(y0>=Z&&(y0=-1);X<Z;){let L=$.charCodeAt(X),K0=null;if(L===$0){if(K0=m6($,X,Z),!K0){var S0=c5($,X,Z,$0);X+=S0-1;}}else if(L===v0||L===H0){var j0=c6($,X,Z);if(j0){if(j0.canOpen||j0.canClose){(V0||X>p)&&(N0.push(X9(V0+$.slice(p,X))),V0="");var a=$.slice(X,X+j0.len),I0=X9(a);o.push({idx:N0.length,ch:L,len:j0.len,canOpen:j0.canOpen,canClose:j0.canClose,active:true}),N0.push(I0),X+=j0.len,p=X;continue}X+=j0.len-1;}}else if(L===b0)K0=p6($,X,Z,V,Y);else if(L===V5)K0=d6($,X,Z,V,Y);else if(L===D0)X+1<Z&&$.charCodeAt(X+1)===W5&&(K0=o6($,X,Z)),K0||(K0=w4($,X,Z,V,Y));else if(L===c0&&X+1<Z&&$.charCodeAt(X+1)===D0)K0=w4($,X,Z,V,Y);else if(L===Y0)K0=C4($,X,Z),!(K0||Y.disableParsingRawHTML||Y.ignoreHTMLBlocks)&&(K0=n6($,X,Z,V,Y));else if(L===H9){var W0=a6($,X,Z);if(W0!==-1){var F0=$.slice(X,W0),M0=v5(F0);if(M0!==F0){V0=V0+$.slice(p,X)+M0,X=W0,p=W0;continue}}}else if((L===D9||L===C5||L===b5)&&!V.inAnchor&&!Y.disableAutoLink&&(X===0||$.charCodeAt(X-1)!==Y0)){var f0=X+1<Z?$.charCodeAt(X+1):0;(L===D9&&f0===n5||L===b5&&f0===n5||L===C5&&f0===C5)&&(K0=r6($,X,Z,Y));}if(!K0&&y0>=0&&y0-X<=64&&!V.inAnchor&&!Y.disableAutoLink&&!Y.disableBareUrls&&(L>=h$1&&L<=m$1||L>=G0&&L<=q0||L>=c&&L<=l$1)&&(K0=i6($,X,Z,Y),!K0&&X>=y0&&(y0=$.indexOf("@",X+1),y0>=Z&&(y0=-1))),L===C&&V.k){var B0=false,k0=0;if(X>p&&$.charCodeAt(X-1)===T0)B0=true,k0=1;else {for(var h0=0,p0=X-1;p0>=p&&$.charCodeAt(p0)===I;)h0++,p0--;h0>=2&&(B0=true,k0=h0);}if(B0){for((V0||X-k0>p)&&(N0.push(X9(V0+$.slice(p,X-k0))),V0=""),N0.push({type:_$1.breakLine}),X++;X<Z&&$.charCodeAt(X)===I;)X++;p=X;continue}var n=X>p&&$.charCodeAt(X-1)===I,_0=X+1<Z&&$.charCodeAt(X+1)===I;if(n||_0){for(var r=X;r>p&&$.charCodeAt(r-1)===I;)r--;for(V0+=`${$.slice(p,r)}
16627
+ `,X++;X<Z&&$.charCodeAt(X)===I;)X++;p=X;continue}}if(K0)(V0||X>p)&&(N0.push(X9(V0+$.slice(p,X))),V0=""),N0.push(K0.node),X=K0.end,p=X;else {if(L===T0&&X+1<Z){let a0=$.charCodeAt(X+1);if(A$(a0)&e5){(V0||X>p)&&(N0.push(X9(V0+$.slice(p,X))),V0=""),N0.push(X9($[X+1])),X+=2,p=X;continue}}if(X++,y0<0||y0-X>64)for(;X<Z&&!(y0>=0&&y0-X<=64);){var x0=$.charCodeAt(X);if(x0<K9&&!L4[x0])X++;else break}}}return (V0||Z>p)&&(N0.push(X9(V0+$.slice(p,Z))),V0=""),o.length>0&&l6(N0,o),Q.m=G,B9--,N0}var t6=500;function d5($,X,Z){var Q=X.p||0;if(Q>t6)return [{type:_$1.text,text:$}];X.p=Q+1;if(Z.optimizeForStreaming&&!(X.i||X.x)){for(var G=$.length;G>0&&$.charCodeAt(G-1)===C;)G--;for(var V=G;V>0&&$.charCodeAt(V-1)!==C;)V--;if(G>V&&$.charCodeAt(V)===E0){for(var K=false,J=V+1;J<G;J++){var U=$.charCodeAt(J);if(U!==I&&U!==w&&U!==E0&&U!==m0&&U!==u$1){K=true;break}}for(var W=false,F=false,M=0,z=V,H=V-1;H>0;){for(var B=H;B>0&&$.charCodeAt(B-1)!==C;)B--;if($.charCodeAt(B)!==E0)break;z=B;for(var j=true,q=false,O=B;O<H;O++){var A=$.charCodeAt(O);if(A===u$1)q=true;else if(A!==I&&A!==w&&A!==m0&&A!==E0){j=false;break}}j&&q?(W=true,F=true):F||M++,H=B-1;}K?W||($=$.slice(0,V).trimEnd()):$=W&&M>0?$.slice(0,V).trimEnd():$.slice(0,z).trimEnd();}for(var v=-1,N=-1,D=-1,T=false,P=$.length-1;P>=0;P--)if($.charCodeAt(P)===Y0){for(var R=P+1<$.length?$.charCodeAt(P+1):0,k=R>=h$1&&R<=m$1||R>=G0&&R<=q0,E=R===A0&&P+2<$.length&&($.charCodeAt(P+2)>=h$1&&$.charCodeAt(P+2)<=m$1||$.charCodeAt(P+2)>=G0&&$.charCodeAt(P+2)<=q0),y=R===c0||R===s5,f=$.length;f>P+1&&$.charCodeAt(f-1)===C;)f--;var S=P+1>=f;if(k||E||y||S){var g=P+1;if((E||k)&&(g=P+2),k||E)for(;g<$.length;){var x=$.charCodeAt(g);if(x>=h$1&&x<=m$1||x>=G0&&x<=q0||x>=c&&x<=l$1)g++;else break}for(var b=k||E?g:P+2;b<$.length&&$.charCodeAt(b)!==d;)b++;if(b>=$.length)v=P,T=true;else if((k||E)&&$.charCodeAt(b-1)!==A0){for(var i=false,X0=b+1;X0<$.length;X0++)if($.charCodeAt(X0)===Y0){i=true;break}i||(v=P,N=g,D=b+1);}}break}if(v>=0){for(var P0=0,Q0=0;Q0<v;Q0++)$.charCodeAt(Q0)===$0&&P0++;if(P0%2===0)if(T)$=$.slice(0,v);else {var u0=$.slice(v+1,N);u5($,`</${u0}`,0)===-1&&($=$.slice(0,v)+$.slice(D));}}for(var z0=$.length;z0>0&&$.charCodeAt(z0-1)===C;)z0--;if(z0>0){for(var O0=z0;O0>0&&$.charCodeAt(O0-1)!==C;)O0--;for(var w0=O0,N0=0;w0<z0&&$.charCodeAt(w0)===I&&N0<3;)w0++,N0++;if(O0>0&&w0<z0&&y6($,w0,z0)){for(var o=O0-1,p=o;p>0&&$.charCodeAt(p-1)!==C;)p--;e0($,p,o)||($=$.slice(0,O0).trimEnd());}}var V0=$.length;if(V0>0){for(var y0=$.lastIndexOf(`
16628
+ `),S0=y0===-1?0:y0+1,j0=V0,a=S0,I0=0;a<j0&&$.charCodeAt(a)===I&&I0<3;)a++,I0++;if(a<j0){var W0=$.charCodeAt(a),F0=false;if(W0===v0||W0===u$1||W0===T5){var M0=a+1;if(M0>=j0||$.charCodeAt(M0)===I||$.charCodeAt(M0)===w){for(var f0=M0;f0<j0&&($.charCodeAt(f0)===I||$.charCodeAt(f0)===w);)f0++;f0>=j0&&(F0=true);}}else if(W0>=c&&W0<=l$1){for(var B0=a;B0<j0&&$.charCodeAt(B0)>=c&&$.charCodeAt(B0)<=l$1;)B0++;if(B0<j0&&($.charCodeAt(B0)===X5||$.charCodeAt(B0)===z5)){var k0=B0+1;if(k0>=j0||$.charCodeAt(k0)===I||$.charCodeAt(k0)===w){for(var h0=k0;h0<j0&&($.charCodeAt(h0)===I||$.charCodeAt(h0)===w);)h0++;h0>=j0&&(F0=true);}}}F0&&($=$.slice(0,S0).trimEnd());}}}if(X.inline)return w5($,0,$.length,X,Z);let p0=[],n=0,_0=$.length;if(n===0&&!Z.disableFrontmatter&&$.startsWith("---")){let e=i$($);if(e?.hasValidYaml){if(Z.preserveFrontmatter!==false){let g0=$.slice(0,e.endPos).trimEnd();p0.push({type:_$1.frontmatter,text:g0});}n=e.endPos;}}for(;n<_0;){for(var r=$.indexOf(`
16629
+ `,n),x0=r<0?_0:r;n<_0&&e0($,n,x0);)n=x0<_0?x0+1:x0,n<_0&&(r=$.indexOf(`
16630
+ `,n),x0=r<0?_0:r);if(n>=_0)break;var L=$.charCodeAt(n)===E9;L0($,n,x0);let e=null;if(z$=$,M$=n,u9=x0,!L&&J0>=4&&!X.inHTML)e=k6($,n);else if(!L){let g0=n+Z0,s=$.charCodeAt(g0);s===G5?e=T6($,n,X,Z):s===d?e=x6($,n,X,Z):s===$0||s===b0?e=S6($,n):s===u$1||s===v0||s===H0?(e=p5($,n),!e&&(e=_4($,n,X,Z))):s===T5||s>=c&&s<=l$1?e=_4($,n,X,Z):s===Y0?e=E4($,n,X,Z):s===E0?e=N4($,n,X,Z):s===D0&&(e=g6($,n,X));}if(!e){for(var K0=false,a0=n;a0<x0;a0++)if($.charCodeAt(a0)===E0){K0=true;break}K0&&(e=N4($,n,X,Z));}if(e||(e=h6($,n,X,Z)),e)e.node.type!==_$1.refCollection&&p0.push(e.node),n=e.end;else {var q5=$.indexOf(`
16631
+ `,n);n=q5<0?_0:q5+1;}}return X.p=Q,p0}function g4($,X,Z,Q){var Y=P5($,X);return Y?{tagName:Y.tag,tagLower:Y.tag.toLowerCase(),attrs:Y.b,whitespaceBeforeAttrs:Y.g,isSelfClosing:Y.o,hasSpaceBeforeSlash:Y.s,isClosing:Y.f,hasNewline:Y.g.includes(`
16632
+ `)||Y.b.includes(`
16633
+ `),endPos:Y.end}:null}function I9($,X,Z){B9=0,$=e$($),!X.refs&&(X.refs={}),(Z.optimizeForStreaming||X.inline)&&(X.x=b6($,X.refs,Z));var Q,Y;X.u||(X.u=Q=[],X.q=Y=[]);let G=d5($,X,Z);if(Q&&Y){for(var V=Q,K={inline:X.inline,inAnchor:X.inAnchor,inHTML:X.inHTML,htmlDepth:X.d,inList:X.inList,inBlockQuote:X.inBlockQuote,noSetext:X.l,depth:X.p},J=0;J<V.length;J++){var U=V[J];X.inline=U.inline,X.inAnchor=U.inAnchor,X.inHTML=U.inHTML,X.d=U.htmlDepth,X.inList=U.inList,X.inBlockQuote=U.inBlockQuote,X.l=U.noSetext,X.p=U.depth,X.k=U.breaks;var W=w5(U.text,0,U.text.length,X,Z);X.k=false;for(var F=0;F<W.length;F++)U.dest.push(W[F]);}X.inline=K.inline,X.inAnchor=K.inAnchor,X.inHTML=K.inHTML,X.d=K.htmlDepth,X.inList=K.inList,X.inBlockQuote=K.inBlockQuote,X.l=K.noSetext,X.p=K.depth;for(var M=Y,z=0;z<M.length;z++)for(var H=M[z],B=0;B<H.src.length;B++){var j=H.src[B];if(H.unwrap&&j.type===_$1.paragraph)for(var q=j.children,O=0;O<q.length;O++)H.dest.push(q[O]);else H.dest.push(j);}X.u=void 0,X.q=void 0,D$(G,X,Z.slugify);}return g9(X.refs)?[{type:_$1.refCollection,refs:X.refs},...G]:G}var B$;try{Q9=reactExports.createElement("div"),B$=Q9!=null&&typeof Q9=="object"&&"$$typeof"in Q9&&typeof Q9.$$typeof=="symbol"?Q9.$$typeof:Symbol.for("react.transitional.element");}catch{B$=Symbol.for("react.transitional.element");}var Q9;function _$($,X,Z){return {$$typeof:B$,type:$,key:Z==null?null:String(Z),ref:null,props:X,_owner:null,_store:{},_debugStack:null,_debugTask:null}}function O5($,X){var Z={key:$};if(X){var Q=G$(X);for(var Y in Q)Z[Y]=Q[Y];}return Z}var l9=typeof reactExports.createContext>"u"?void 0:reactExports.createContext(void 0);function f4($,X,Z,Q,Y,G,V,K,J){switch($.type){case _$1.blockQuote:{let q={key:Z.key};return $.alert&&(q.className=`markdown-alert-${G($.alert.toLowerCase(),N5)}`,$.children.unshift(Z4($.alert))),Q("blockquote",q,X($.children,Z))}case _$1.breakLine:return Q("br",{key:Z.key});case _$1.breakThematic:return Q("hr",{key:Z.key});case _$1.frontmatter:return K.preserveFrontmatter?Q("pre",{key:Z.key},$.text):null;case _$1.codeBlock:{let q=$.lang?v5($.lang):"";var U=$.attrs?G$($.attrs):{};return U.className=q?`language-${q} lang-${q}`:"",Q("pre",{key:Z.key},Q("code",U,$.text))}case _$1.codeInline:return Q("code",{key:Z.key},$.text);case _$1.footnoteReference:return Q("a",{key:Z.key,href:Y($.target,"a","href")||void 0},Q("sup",null,$.text));case _$1.gfmTask:return Q("input",{checked:$.completed,key:Z.key,readOnly:true,type:"checkbox"});case _$1.heading:return Q(`h${$.level}`,{id:$.id,key:Z.key},X($.children,Z));case _$1.htmlBlock:{let q=$;if(h5(K)&&J$(q.tag)){var W=K$(q);return W.kind==="literal"?Q("span",{key:Z.key},W.literal):Q("span",{key:Z.key},...Y4(W.open,q.children?X(q.children,Z):null,W.close))}let O=q.j,A=O!==void 0,v=A?O:q.a?q.e||"":(q.e||"")+(q.h||"");if(v&&q.c){let N=q.tag.toLowerCase(),D=T4(N),T=q.children,P=T!=null&&T.length>0;if(D){let b=A?O:q.e||"",i=h5(K)?U$(b):b;if(/<[a-z][^>]{0,100}>/i.test(v)){var F=O5(Z.key,$.attrs);return F.dangerouslySetInnerHTML={__html:i},J($.tag,F)}return J($.tag,O5(Z.key,$.attrs),i)}let R=new RegExp(`^<${q.tag}(\\s|>)`,"i");if(P&&!R.test(v)&&h5(K)&&J4(v))return J($.tag,O5(Z.key,$.attrs),X(T,Z));if(y4(v)){let b=h5(K)?U$(v):v;var M=O5(Z.key,$.attrs);return M.dangerouslySetInnerHTML={__html:b},J($.tag,M)}let E=v9({slugify:K.slugify,sanitizer:Y,tagfilter:true}),y=$4(v);if(new RegExp(`^<${q.tag}(\\s[^>]*)?>(\\s*</${q.tag}>)?$`,"i").test(y))return q.children&&q.children.length>0?J($.tag,O5(Z.key,$.attrs),X(q.children,Z)):J($.tag,O5(Z.key,$.attrs));let S=I9(y,{inline:false,refs:V,inHTML:false},E);V$(S);let g=q.tag.toLowerCase(),x=A;if(x&&P)return J($.tag,O5(Z.key,$.attrs),X(T,Z));if(x)return X(S.flatMap($9),Z);var z=Q4(S,g);if(z.found&&z.afterClose.length>0){var H=z.beforeClose.flatMap($9),B=z.afterClose.flatMap($9);return _$(reactExports.Fragment,{children:[J($.tag,O5(Z.key,$.attrs),X(H,Z)),X(B,Z)]},Z.key)}return J($.tag,O5(Z.key,$.attrs),X(S.flatMap($9),Z))}return Z9($.tag)?J($.tag,O5(Z.key,$.attrs)):J($.tag,O5(Z.key,$.attrs),$.children?X($.children,Z):"")}case _$1.htmlSelfClosing:{let q=$;if(h5(K)&&J$(q.tag)){var j=K$(q);return Q("span",{key:Z.key},j.kind==="literal"?j.literal:j.open+(j.close||""))}return J($.tag,O5(Z.key,$.attrs))}case _$1.image:{let q=$.target===null?null:Y($.target,"img","src");return Q("img",{key:Z.key,alt:$.alt&&$.alt.length>0?$.alt:void 0,title:$.title||void 0,src:q||void 0})}case _$1.link:{let q={key:Z.key};if($.target!=null){let O=G4($.target,Y,"a","href");O!=null&&(q.href=O);}return $.title&&(q.title=$.title),Q("a",q,X($.children,Z))}case _$1.table:{let q=$;return Q("table",{key:Z.key},Q("thead",{key:"thead"},Q("tr",null,q.header.map(function(A,v){return Q("th",{key:v,style:q.align[v]===null?{}:{textAlign:q.align[v]}},X(A,Z))}))),q.cells.length>0&&Q("tbody",{key:"tbody"},q.cells.map(function(A,v){return Q("tr",{key:v},A.map(function(D,T){return Q("td",{key:T,style:q.align[T]===null?{}:{textAlign:q.align[T]}},X(D,Z))}))})))}case _$1.text:return $.text;case _$1.textFormatted:return Q($.tag,{key:Z.key},X($.children,Z));case _$1.orderedList:case _$1.unorderedList:{let q=$.type===_$1.orderedList?"ol":"ul";return Q(q,{key:Z.key,start:$.type===_$1.orderedList?$.start:void 0},$.items.map(function(A,v){return Q("li",{key:v},X(A,Z))}))}case _$1.paragraph:return Q("p",{key:Z.key},X($.children,Z));case _$1.ref:return null;default:return null}}var ZZ=($,X,Z,Q,Y,G,V)=>{var K=U=>U.map(W=>"text"in W?W.text:""),J=(U,W={})=>{var F=Array.isArray(U)?U:[U],M=(W.renderDepth||0)+1;if(M>2500)return K(F);W.renderDepth=M;for(var z=W.key,H=[],B=false,j=0;j<F.length;j++){W.key=j;var q;if($){var O=f4.bind(null,F[j],J,W,X,Z,Q,Y,G,V);q=$(O,F[j],J,W);}else q=f4(F[j],J,W,X,Z,Q,Y,G,V);var A=typeof q=="string";if(B&&typeof q=="string"){var v=H.at(-1);H[H.length-1]=(typeof v=="string"?v:"")+q;}else if(q!=null)if(Array.isArray(q))for(var N=0;N<q.length;N++)H.push(q[N]);else H.push(q);B=A;}return W.key=z,W.renderDepth=M-1,H};return J},XZ=($,X)=>{let Z=f9(X,$,void 0);return Z?typeof Z=="function"||typeof Z=="object"&&"render"in Z?Z:f9(X,`${$}.component`,$):$};function QZ($,X){let Z={...X||{}};Z.overrides=Z.overrides||{};let Q=Z.slugify||N5,Y=Z.sanitizer||M5,G=Z.createElement,V=g9(Z.overrides),K=A=>v$(A,{...Z,wrapper:null});function J(A){for(var v in A){var N=A[v];if(typeof N=="string"&&N.length>0&&N.charCodeAt(0)===Y0&&(R4.test(N)||b4.test(N)||g4(N,0))){var D=K(N.trim());A[v]=v==="innerHTML"&&Array.isArray(D)?D[0]:D;}}}function U(A,v,...N){var D=v||{},T=A;if(V){var P=f9(Z.overrides,`${A}.props`,{});T=XZ(A,Z.overrides),D={...D,...P,className:K4(D.className,P.className)||void 0};}if(!G){var R=D.key;return R!=null&&delete D.key,N.length===1?D.children=N[0]:N.length>1&&(D.children=N),_$(T,D,R)}return G(T,D,...N)}function W(A,v,...N){return v&&J(v),U(A,v,...N)}let F=v9(Z,Z.forceInline),M=$[0]&&$[0].type===_$1.refCollection?$[0].refs:{},z=ZZ(Z.renderRule,U,Y,Q,M,Z,W),H=z($,{inline:Z.forceInline,refs:M}),B=V4(M);if(B.length>0&&H.push(U("footer",{key:"footer"},B.map(function(v){let N=v.identifier.charCodeAt(0)===W5?v.identifier.slice(1):v.identifier,D=I9(v.footnote,{inline:true,refs:M},F);return U("div",{id:Q(N,N5),key:v.identifier},`${N}: `,z(D,{inline:true,refs:M}))}))),Z.wrapper===null)return H;let j=Z.wrapper||(Z.forceInline?"span":"div"),q;if(H.length>1||Z.forceWrapper)q=H;else return H.length===1?H[0]:null;var O=Z.wrapperProps?{...Z.wrapperProps}:{};return O.children=q,_$(j,O,"outer")}function v$($="",X={}){let Z={...X||{}};Z.overrides=Z.overrides||{};Z.slugify||N5;Z.sanitizer||M5;function G(K){let J=Z.forceInline||!(Z.forceBlock||a$.test(K)),U=v9(Z,J),W=J?K:X4(K),F=I9(W,{inline:J,refs:V},U);return QZ(F,{...Z,forceInline:J})}let V={};return G($)}function YZ($){let X=reactExports.useRef($),Z=X.current;if(Z!==$){var Q=true,Y=0;for(var G in $)if(Y++,!Object.is(Z[G],$[G])){Q=false;break}if(Q){var V=0;for(var K in Z)V++;Q=V===Y;}Q||(X.current=$);}return X.current}var GZ=({children:$,options:X,...Z})=>{if(!(typeof reactExports.useContext<"u")){let U={...X,overrides:{...X?.overrides},wrapperProps:{...X?.wrapperProps,...Z}};return v$($??"",U)}let Y=l9?reactExports.useContext(l9):void 0,G=YZ(Z),V=reactExports.useMemo(()=>({...Y,...X,overrides:{...Y?.overrides,...X?.overrides},wrapperProps:{...Y?.wrapperProps,...X?.wrapperProps,...G}}),[Y,X,G]),K=$??"";return reactExports.useMemo(()=>v$(K,V),[K,V])};
16284
16634
 
16285
16635
  /** Internal only symbol used by `Form` & `ObjectField` to mark an additional property element to be removed */
16286
16636
  const ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol('remove-this-key');
@@ -16319,6 +16669,12 @@
16319
16669
  return translateString(TranslatableString.NewStringDefault);
16320
16670
  }
16321
16671
  }
16672
+ function isAdditionalPropertySchema(schema) {
16673
+ return Boolean(schema?.[ADDITIONAL_PROPERTY_FLAG]);
16674
+ }
16675
+ function getAdditionalPropertyOrder(schemaProperties) {
16676
+ return Object.keys(schemaProperties).filter((property) => isAdditionalPropertySchema(schemaProperties[property]));
16677
+ }
16322
16678
  /** The `ObjectFieldProperty` component is used to render the `SchemaField` for a child property of an object
16323
16679
  */
16324
16680
  function ObjectFieldPropertyFn(props) {
@@ -16383,10 +16739,15 @@
16383
16739
  formDataRef.current = formData;
16384
16740
  const schema = reactExports.useMemo(() => schemaUtils.retrieveSchema(rawSchema, formData, true), [schemaUtils, rawSchema, formData]);
16385
16741
  const uiOptions = reactExports.useMemo(() => getUiOptions(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
16386
- const { properties: schemaProperties = {} } = schema;
16742
+ const schemaProperties = reactExports.useMemo(() => schema.properties ?? {}, [schema.properties]);
16387
16743
  // All the children will use childFieldPathId if present in the props, falling back to the fieldPathId
16388
16744
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
16389
16745
  const lastRenamedProperty = reactExports.useRef({ previousKey: '', currentKey: undefined });
16746
+ const [additionalPropertyOrder, setAdditionalPropertyOrder] = reactExports.useState(() => getAdditionalPropertyOrder(schemaProperties));
16747
+ const definedPropertyOrder = reactExports.useMemo(() => {
16748
+ const additionalPropertySet = new Set(getAdditionalPropertyOrder(schemaProperties));
16749
+ return Object.keys(schemaProperties).filter((property) => !additionalPropertySet.has(property));
16750
+ }, [schemaProperties]);
16390
16751
  const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
16391
16752
  const description = uiOptions.description ?? schema.description;
16392
16753
  const renderOptionalField = shouldRenderOptionalField(registry, schema, required, uiSchema);
@@ -16435,7 +16796,7 @@
16435
16796
  apSchema = schemaUtils.retrieveSchema({ [REF_KEY]: apSchema[REF_KEY] }, formData);
16436
16797
  type = apSchema.type;
16437
16798
  constValue = apSchema.const;
16438
- defaultValue = apSchema.default;
16799
+ defaultValue = schemaUtils.getDefaultFormState(apSchema, defaultValue);
16439
16800
  }
16440
16801
  if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
16441
16802
  type = 'object';
@@ -16449,6 +16810,7 @@
16449
16810
  lastRenamedProperty.current.currentKey = newKey;
16450
16811
  lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
16451
16812
  }
16813
+ setAdditionalPropertyOrder((order) => [...order, newKey]);
16452
16814
  onChange(newFormData, childFieldPathId.path);
16453
16815
  }, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
16454
16816
  /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
@@ -16477,6 +16839,7 @@
16477
16839
  lastRenamedProperty.current.previousKey = oldKey;
16478
16840
  }
16479
16841
  lastRenamedProperty.current.currentKey = actualNewKey;
16842
+ setAdditionalPropertyOrder((order) => order.map((property) => (property === oldKey ? actualNewKey : property)));
16480
16843
  onChange(renamedObj, childFieldPathId.path);
16481
16844
  }
16482
16845
  }, [onChange, childFieldPathId, getAvailableKey]);
@@ -16484,6 +16847,7 @@
16484
16847
  * value for the path plus the key to be removed
16485
16848
  */
16486
16849
  const handleRemoveProperty = reactExports.useCallback((key) => {
16850
+ setAdditionalPropertyOrder((order) => order.filter((property) => property !== key));
16487
16851
  onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
16488
16852
  }, [onChange, childFieldPathId]);
16489
16853
  /** Returns the stable React key for a property. For the most recently renamed
@@ -16499,11 +16863,12 @@
16499
16863
  }, []);
16500
16864
  if (!renderOptionalField || hasFormData) {
16501
16865
  try {
16502
- const properties = Object.keys(schemaProperties);
16503
- orderedProperties = orderProperties(properties, uiOptions.order);
16866
+ const definedPropertySet = new Set(definedPropertyOrder);
16867
+ const currentAdditionalProperties = additionalPropertyOrder.filter((property) => Object.hasOwn(schemaProperties, property) && !definedPropertySet.has(property));
16868
+ orderedProperties = orderProperties([...definedPropertyOrder, ...currentAdditionalProperties], uiOptions.order);
16504
16869
  }
16505
16870
  catch (err) {
16506
- return (jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: 'rjsf-config-error', style: { color: 'red' }, children: jsxRuntimeExports.jsx(W5, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), jsxRuntimeExports.jsx("pre", { children: JSON.stringify(schema) })] }));
16871
+ return (jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: 'rjsf-config-error', style: { color: 'red' }, children: jsxRuntimeExports.jsx(GZ, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), jsxRuntimeExports.jsx("pre", { children: JSON.stringify(schema) })] }));
16507
16872
  }
16508
16873
  }
16509
16874
  const Template = getTemplate('ObjectFieldTemplate', registry, uiOptions);
@@ -16513,7 +16878,7 @@
16513
16878
  title: uiOptions.label === false ? '' : templateTitle,
16514
16879
  description: uiOptions.label === false ? undefined : description,
16515
16880
  properties: orderedProperties.map((propertyName) => {
16516
- const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, propertyName, ADDITIONAL_PROPERTY_FLAG]);
16881
+ const addedByAdditionalProperties = isAdditionalPropertySchema(schema.properties?.[propertyName]);
16517
16882
  const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
16518
16883
  const hidden = getUiOptions(fieldUiSchema).widget === 'hidden';
16519
16884
  const content = (jsxRuntimeExports.jsx(ObjectFieldProperty, { propertyName: propertyName, required: isRequired(schema, propertyName), schema: get(schema, [PROPERTIES_KEY, propertyName], {}), uiSchema: fieldUiSchema, errorSchema: get(errorSchema, [propertyName]), fieldPathId: childFieldPathId, formData: get(formData, [propertyName]), handleKeyRename: handleKeyRename, handleRemoveProperty: handleRemoveProperty, addedByAdditionalProperties: addedByAdditionalProperties, onChange: onChange, onBlur: onBlur, onFocus: onFocus, registry: registry, disabled: disabled, readonly: readonly, hideError: hideError }, getStableKey(propertyName)));
@@ -16604,7 +16969,7 @@
16604
16969
  */
16605
16970
  function getFieldComponent(schema, uiOptions, registry) {
16606
16971
  const { field } = uiOptions;
16607
- const { fields } = registry;
16972
+ const { fields, schemaUtils } = registry;
16608
16973
  if (typeof field === 'function') {
16609
16974
  return field;
16610
16975
  }
@@ -16618,9 +16983,13 @@
16618
16983
  if (schemaId && schemaId in fields) {
16619
16984
  componentName = schemaId;
16620
16985
  }
16621
- // If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
16622
- // render a field and let the MultiSchemaField component handle the form display
16623
- if (!componentName && (schema.anyOf || schema.oneOf)) {
16986
+ // If the schema uses 'anyOf' or 'oneOf' and is not a pure select (all-constant options),
16987
+ // let the MultiSchemaField component handle the form display entirely.
16988
+ // ObjectField is excluded: it renders shared properties (defined at the parent schema
16989
+ // level) alongside the XxxOfField option selector.
16990
+ // All other field types — including primitives and arrays — have no shared renderable
16991
+ // properties, so the outer FieldComponent would only produce a spurious duplicate input.
16992
+ if ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) && componentName !== 'ObjectField') {
16624
16993
  return () => null;
16625
16994
  }
16626
16995
  return componentName in fields ? fields[componentName] : fields.FallbackField;
@@ -16634,14 +17003,7 @@
16634
17003
  function SchemaFieldRender(props) {
16635
17004
  const { schema: _schema, fieldPathId, uiSchema: _uiSchema, formData, errorSchema, name, onChange, onKeyRename, onKeyRenameBlur, onRemoveProperty, required = false, registry, wasPropertyKeyModified = false, } = props;
16636
17005
  const { schemaUtils, globalFormOptions, globalUiOptions, fields } = registry;
16637
- const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields;
16638
- const uiSchema = resolveUiSchema(_schema, _uiSchema, registry);
16639
- const uiOptions = getUiOptions(uiSchema, globalUiOptions);
16640
- const FieldTemplate = getTemplate('FieldTemplate', registry, uiOptions);
16641
- const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
16642
- const FieldHelpTemplate = getTemplate('FieldHelpTemplate', registry, uiOptions);
16643
- const FieldErrorTemplate = getTemplate('FieldErrorTemplate', registry, uiOptions);
16644
- const schema = schemaUtils.retrieveSchema(_schema, formData);
17006
+ const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField } = fields;
16645
17007
  const fieldId = fieldPathId[ID_KEY];
16646
17008
  /** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
16647
17009
  * `onChange` chain if it is not already being provided from a deeper level in the hierarchy
@@ -16650,6 +17012,18 @@
16650
17012
  const theId = id || fieldId;
16651
17013
  return onChange(newFormData, path, newErrorSchema, theId);
16652
17014
  }, [fieldId, onChange]);
17015
+ // Stop $ref cycles: when resolveAllReferences detects a repeated property $ref it tags the schema with this flag.
17016
+ // The check must come after all hook calls to satisfy React's rules of hooks.
17017
+ if (_schema[RJSF_REF_CYCLE_KEY]) {
17018
+ return jsxRuntimeExports.jsx(CyclicSchemaField, { ...props });
17019
+ }
17020
+ const uiSchema = resolveUiSchema(_schema, _uiSchema, registry);
17021
+ const uiOptions = getUiOptions(uiSchema, globalUiOptions);
17022
+ const FieldTemplate = getTemplate('FieldTemplate', registry, uiOptions);
17023
+ const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
17024
+ const FieldHelpTemplate = getTemplate('FieldHelpTemplate', registry, uiOptions);
17025
+ const FieldErrorTemplate = getTemplate('FieldErrorTemplate', registry, uiOptions);
17026
+ const schema = schemaUtils.retrieveSchema(_schema, formData);
16653
17027
  const FieldComponent = getFieldComponent(schema, uiOptions, registry);
16654
17028
  const isDeprecated = Boolean(schema.deprecated);
16655
17029
  const deprecatedHandling = isDeprecated ? (uiOptions.deprecatedHandling ?? 'label') : undefined;
@@ -16759,19 +17133,23 @@
16759
17133
  };
16760
17134
  return (jsxRuntimeExports.jsx(FieldTemplate, { ...fieldProps, children: jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [field, XxxOfField && (jsxRuntimeExports.jsx(XxxOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, fieldPathId: fieldPathId, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: XxxOfOptions, registry: registry, required: required, schema: schema, uiSchema: uiSchema }))] }) }));
16761
17135
  }
16762
- /** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
16763
- * and if so, calls the `SchemaFieldRender` component with the props.
17136
+ /** The `SchemaField` component wraps `SchemaFieldRender` with a custom memoization comparator that determines whether it is necessary to rerender the component based on any props changes
17137
+ * using `experimental_componentUpdateStrategy`.
17138
+ *
17139
+ * The cast to `typeof SchemaFieldRender` preserves the generic type signature (<T, S, F>) for consumers,
17140
+ * since React.memo's return type erases generic parameters.
16764
17141
  */
16765
- class SchemaField extends reactExports.Component {
16766
- shouldComponentUpdate(nextProps) {
16767
- const { registry: { globalFormOptions }, } = this.props;
16768
- const { experimental_componentUpdateStrategy = 'customDeep' } = globalFormOptions;
16769
- return shouldRender(this, nextProps, this.state, experimental_componentUpdateStrategy);
17142
+ const SchemaField = reactExports.memo(SchemaFieldRender, (prevProps, nextProps) => {
17143
+ const { experimental_componentUpdateStrategy = 'customDeep' } = nextProps.registry.globalFormOptions;
17144
+ if (experimental_componentUpdateStrategy === 'always') {
17145
+ return false; // always re-render — never consider props equal
16770
17146
  }
16771
- render() {
16772
- return jsxRuntimeExports.jsx(SchemaFieldRender, { ...this.props });
17147
+ if (experimental_componentUpdateStrategy === 'shallow') {
17148
+ return shallowEquals(prevProps, nextProps);
16773
17149
  }
16774
- }
17150
+ // default: 'customDeep'
17151
+ return deepEquals(prevProps, nextProps);
17152
+ });
16775
17153
 
16776
17154
  /** The `StringField` component is used to render a schema field that represents a string type
16777
17155
  *
@@ -16800,6 +17178,7 @@
16800
17178
  ArrayField: ArrayField,
16801
17179
  // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
16802
17180
  BooleanField,
17181
+ CyclicSchemaField,
16803
17182
  FallbackField,
16804
17183
  LayoutGridField,
16805
17184
  LayoutHeaderField,
@@ -16943,8 +17322,8 @@
16943
17322
  inputValue = value == null ? '' : value;
16944
17323
  }
16945
17324
  const handleChange = reactExports.useCallback(({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue), [onChange, options]);
16946
- const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, target && target.value), [onBlur, id]);
16947
- const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, target && target.value), [onFocus, id]);
17325
+ const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, target?.value), [onBlur, id]);
17326
+ const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, target?.value), [onFocus, id]);
16948
17327
  const handleClear = reactExports.useCallback((e) => {
16949
17328
  e.preventDefault();
16950
17329
  e.stopPropagation();
@@ -17013,6 +17392,17 @@
17013
17392
  };
17014
17393
  }
17015
17394
 
17395
+ /** The `CyclicSchemaExpandTemplate` is the template to use to render the cyclic schema expand message and controls
17396
+ *
17397
+ * @param props - The `DescriptionFieldProps` for this component
17398
+ */
17399
+ function CyclicSchemaExpandTemplate$1(props) {
17400
+ const { name, fieldPathId, registry, onExpand } = props;
17401
+ const { translateString } = registry;
17402
+ const buttonId = `${fieldPathId[ID_KEY]}-button`;
17403
+ return (jsxRuntimeExports.jsxs("div", { style: { marginTop: '1rem' }, children: [jsxRuntimeExports.jsx("div", { className: 'text-danger', children: translateString(TranslatableString.CycleDetected, [name]) }), jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("button", { id: buttonId, type: 'button', className: 'btn btn-sm btn-warning', onClick: () => onExpand(fieldPathId[ID_KEY]), children: translateString(TranslatableString.ExpandButton) }), ' '] })] }));
17404
+ }
17405
+
17016
17406
  const TEST_IDS$1 = getTestIds();
17017
17407
  /** Renders the given `description` in the props as
17018
17408
  *
@@ -17022,7 +17412,7 @@
17022
17412
  const { globalUiOptions } = registry;
17023
17413
  const uiOptions = getUiOptions(uiSchema, globalUiOptions);
17024
17414
  if (uiOptions.enableMarkdownInDescription && typeof description === 'string') {
17025
- return (jsxRuntimeExports.jsx(W5, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS$1.markdown, children: description }));
17415
+ return (jsxRuntimeExports.jsx(GZ, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS$1.markdown, children: description }));
17026
17416
  }
17027
17417
  return description;
17028
17418
  }
@@ -17084,7 +17474,7 @@
17084
17474
  const { globalUiOptions } = registry;
17085
17475
  const uiOptions = getUiOptions(uiSchema, globalUiOptions);
17086
17476
  if (uiOptions.enableMarkdownInHelp && typeof help === 'string') {
17087
- return (jsxRuntimeExports.jsx(W5, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: help }));
17477
+ return (jsxRuntimeExports.jsx(GZ, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: help }));
17088
17478
  }
17089
17479
  return help;
17090
17480
  }
@@ -17213,7 +17603,7 @@
17213
17603
  const { translateString } = registry;
17214
17604
  let translateEnum = TranslatableString.UnsupportedField;
17215
17605
  const translateParams = [];
17216
- if (fieldPathId && fieldPathId.$id) {
17606
+ if (fieldPathId?.$id) {
17217
17607
  translateEnum = TranslatableString.UnsupportedFieldWithId;
17218
17608
  translateParams.push(fieldPathId.$id);
17219
17609
  }
@@ -17224,7 +17614,7 @@
17224
17614
  : TranslatableString.UnsupportedFieldWithIdAndReason;
17225
17615
  translateParams.push(reason);
17226
17616
  }
17227
- return (jsxRuntimeExports.jsxs("div", { className: 'unsupported-field', children: [jsxRuntimeExports.jsx("p", { children: jsxRuntimeExports.jsx(W5, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }), schema && jsxRuntimeExports.jsx("pre", { children: JSON.stringify(schema, null, 2) })] }));
17617
+ return (jsxRuntimeExports.jsxs("div", { className: 'unsupported-field', children: [jsxRuntimeExports.jsx("p", { children: jsxRuntimeExports.jsx(GZ, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }), schema && jsxRuntimeExports.jsx("pre", { children: JSON.stringify(schema, null, 2) })] }));
17228
17618
  }
17229
17619
 
17230
17620
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
@@ -17261,6 +17651,7 @@
17261
17651
  ArrayFieldTitleTemplate,
17262
17652
  ButtonTemplates: buttonTemplates(),
17263
17653
  BaseInputTemplate: BaseInputTemplate$1,
17654
+ CyclicSchemaExpandTemplate: CyclicSchemaExpandTemplate$1,
17264
17655
  DescriptionFieldTemplate: DescriptionField$1,
17265
17656
  ErrorListTemplate: ErrorList$1,
17266
17657
  FallbackFieldTemplate,
@@ -17306,8 +17697,8 @@
17306
17697
  const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
17307
17698
  const optionValueFormat = getOptionValueFormat(options);
17308
17699
  const checkboxesValues = Array.isArray(value) ? value : [value];
17309
- const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
17310
- const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
17700
+ const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
17701
+ const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
17311
17702
  return (jsxRuntimeExports.jsx("div", { className: 'checkboxes', id: id, children: Array.isArray(enumOptions) &&
17312
17703
  enumOptions.map((option, index) => {
17313
17704
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
@@ -17415,7 +17806,7 @@
17415
17806
  return (jsxRuntimeExports.jsx("ul", { className: 'file-info', children: filesInfo.map((fileInfo, key) => {
17416
17807
  const { name, size, type } = fileInfo;
17417
17808
  const handleRemove = () => onRemove(key);
17418
- return (jsxRuntimeExports.jsxs("li", { children: [jsxRuntimeExports.jsx(W5, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }), preview && jsxRuntimeExports.jsx(FileInfoPreview, { fileInfo: fileInfo, registry: registry }), jsxRuntimeExports.jsx(RemoveButton, { onClick: handleRemove, registry: registry })] }, key));
17809
+ return (jsxRuntimeExports.jsxs("li", { children: [jsxRuntimeExports.jsx(GZ, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }), preview && jsxRuntimeExports.jsx(FileInfoPreview, { fileInfo: fileInfo, registry: registry }), jsxRuntimeExports.jsx(RemoveButton, { onClick: handleRemove, registry: registry })] }, key));
17419
17810
  }) }));
17420
17811
  }
17421
17812
  /**
@@ -17463,8 +17854,8 @@
17463
17854
  function RadioWidget$1({ options, value, required, disabled, readonly, autofocus = false, onBlur, onFocus, onChange, id, htmlName, }) {
17464
17855
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
17465
17856
  const optionValueFormat = getOptionValueFormat(options);
17466
- const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, enumOptions, emptyValue, id, optionValueFormat]);
17467
- const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, enumOptions, emptyValue, id, optionValueFormat]);
17857
+ const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, enumOptions, emptyValue, id, optionValueFormat]);
17858
+ const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, enumOptions, emptyValue, id, optionValueFormat]);
17468
17859
  return (jsxRuntimeExports.jsx("div", { className: 'field-radio-group', id: id, role: 'radiogroup', children: Array.isArray(enumOptions) &&
17469
17860
  enumOptions.map((option, i) => {
17470
17861
  const checked = enumOptionsIsSelected(option.value, value);
@@ -17562,7 +17953,7 @@
17562
17953
  *
17563
17954
  * @param props - The `WidgetProps` for this component
17564
17955
  */
17565
- function SelectWidget$1({ schema, id, options, value, required, disabled, readonly, multiple = false, autofocus = false, onChange, onBlur, onFocus, placeholder, htmlName, }) {
17956
+ function SelectWidget$1({ schema, id, options, value, required, disabled, readonly, multiple = false, autofocus = false, onChange, onBlur, onFocus, placeholder, htmlName, registry, uiSchema, }) {
17566
17957
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
17567
17958
  const emptyValue = multiple ? [] : '';
17568
17959
  const optionValueFormat = getOptionValueFormat(options);
@@ -17580,21 +17971,22 @@
17580
17971
  }, [onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]);
17581
17972
  const selectValue = enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
17582
17973
  const showPlaceholderOption = !multiple && schema.default === undefined;
17583
- return (jsxRuntimeExports.jsxs("select", { id: id, name: htmlName || id, multiple: multiple, className: 'form-control', value: selectValue, required: required, disabled: disabled || readonly, autoFocus: autofocus, onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && jsxRuntimeExports.jsx("option", { value: '', children: placeholder }), Array.isArray(enumOptions) &&
17584
- enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
17585
- const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
17586
- return (jsxRuntimeExports.jsx("option", { value: enumOptionValueEncoder(enumValue, i, optionValueFormat), disabled: isDisabled, children: enumLabel }, String(enumValue)));
17587
- })] }));
17974
+ logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
17975
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SelectedOptionDescription, { id: id, multiple: multiple, options: options, registry: registry, uiSchema: uiSchema, value: value }), jsxRuntimeExports.jsxs("select", { id: id, name: htmlName || id, multiple: multiple, className: 'form-control', value: selectValue, required: required, disabled: disabled || readonly, autoFocus: autofocus, onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && jsxRuntimeExports.jsx("option", { value: '', children: placeholder }), Array.isArray(enumOptions) &&
17976
+ enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
17977
+ const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
17978
+ return (jsxRuntimeExports.jsx("option", { value: enumOptionValueEncoder(enumValue, i, optionValueFormat), disabled: isDisabled, children: enumLabel }, String(enumValue)));
17979
+ })] })] }));
17588
17980
  }
17589
17981
 
17590
17982
  /** The `TextareaWidget` is a widget for rendering input fields as textarea.
17591
17983
  *
17592
17984
  * @param props - The `WidgetProps` for this component
17593
17985
  */
17594
- function TextareaWidget$1({ id, options = {}, placeholder, value, required, disabled, readonly, autofocus = false, onChange, onBlur, onFocus, htmlName, }) {
17986
+ function TextareaWidget$1({ id, options, placeholder, value, required, disabled, readonly, autofocus = false, onChange, onBlur, onFocus, htmlName, }) {
17595
17987
  const handleChange = reactExports.useCallback(({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue), [onChange, options.emptyValue]);
17596
- const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, target && target.value), [onBlur, id]);
17597
- const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, target && target.value), [id, onFocus]);
17988
+ const handleBlur = reactExports.useCallback(({ target }) => onBlur(id, target?.value), [onBlur, id]);
17989
+ const handleFocus = reactExports.useCallback(({ target }) => onFocus(id, target?.value), [id, onFocus]);
17598
17990
  return (jsxRuntimeExports.jsx("textarea", { id: id, name: htmlName || id, className: 'form-control', value: value || '', placeholder: placeholder, required: required, disabled: disabled, readOnly: readonly, autoFocus: autofocus, rows: options.rows, onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, "aria-describedby": ariaDescribedByIds(id) }));
17599
17991
  }
17600
17992
 
@@ -17999,16 +18391,19 @@
17999
18391
  // When a pre-resolved schema is provided (e.g., from live validation), use it directly.
18000
18392
  // Otherwise validate against the original schema so AJV sees the full constraint set.
18001
18393
  const validationSchema = retrievedSchema ?? schema;
18394
+ // JSON.stringify drops keys with `undefined` values; JSON.parse on the result gives AJV a clean
18395
+ // object that avoids spurious type errors for `type: "string"` fields that were cleared (#4518).
18396
+ const validationFormData = formData ? JSON.parse(JSON.stringify(formData)) : undefined;
18002
18397
  return schemaUtils
18003
18398
  .getValidator()
18004
- .validateFormData(formData, validationSchema, customValidate, transformErrors, uiSchema);
18399
+ .validateFormData(validationFormData, validationSchema, customValidate, transformErrors, uiSchema);
18005
18400
  }
18006
18401
  /** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
18007
18402
  renderErrors(registry) {
18008
18403
  const { errors, errorSchema, schema, uiSchema } = this.state;
18009
18404
  const options = getUiOptions(uiSchema);
18010
18405
  const ErrorListTemplate = getTemplate('ErrorListTemplate', registry, options);
18011
- if (errors && errors.length) {
18406
+ if (errors?.length) {
18012
18407
  return (jsxRuntimeExports.jsx(ErrorListTemplate, { errors: errors, errorSchema: errorSchema || {}, schema: schema, uiSchema: uiSchema, registry: registry }));
18013
18408
  }
18014
18409
  return null;
@@ -18155,13 +18550,18 @@
18155
18550
  const wasPreviouslyNull = oldFormData === null || oldFormData === undefined;
18156
18551
  const inputForDefaults = hasOnlyUndefinedValues && wasPreviouslyNull ? undefined : formData;
18157
18552
  if (isObject$3(formData) || Array.isArray(formData)) {
18553
+ // Tracks if the user cleared a plain (non-oneOf/anyOf) leaf field.
18554
+ // The key is removed twice: once before getStateFromProps so inputForDefaults
18555
+ // reflects an empty field for conditional schema resolution, and once after so
18556
+ // the user's clear overrides any schema default getStateFromProps re-applied (#5125)
18557
+ // and AJV never receives { key: undefined } for type:"string" fields (#4518).
18558
+ let plainLeafWasCleared = false;
18158
18559
  if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
18159
- // For additional properties, we were given the special remove this key value, so unset it
18560
+ // For additional properties, this key was explicitly removed, so unset it
18160
18561
  unset(formData, path);
18161
18562
  }
18162
18563
  else if (!isRootPath) {
18163
- // If the newValue is not on the root path, then set it into the form data
18164
- let unsetPath = false;
18564
+ // Set the new value at its path in the form data.
18165
18565
  let valueForPath = newValue;
18166
18566
  if (newValue === undefined) {
18167
18567
  const lastSegment = path[path.length - 1];
@@ -18173,27 +18573,34 @@
18173
18573
  const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
18174
18574
  const leaf = field;
18175
18575
  const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY in leaf || ANY_OF_KEY in leaf);
18176
- // Plain leaves: omit the key instead of `{ key: undefined }`, which breaks `type: "string"` validation in
18177
- // AJV after clearing a text input (https://github.com/rjsf-team/react-jsonschema-form/issues/4518).
18178
- // oneOf/anyOf leaves and unresolved leaves: keep `valueForPath === newValue` (already `undefined`) so
18179
- // mergeDefaults does not immediately re-apply a branch default when clearing those widgets.
18576
+ // oneOf/anyOf and unresolved leaves keep `undefined` so mergeDefaults doesn't
18577
+ // re-apply a branch default when the user clears the widget.
18578
+ // Plain resolved leaves use plainLeafWasCleared instead (see below).
18180
18579
  if (!isOneOfOrAnyOfLeaf && leaf !== undefined) {
18181
- unsetPath = true;
18580
+ plainLeafWasCleared = true;
18182
18581
  }
18183
18582
  }
18184
18583
  }
18185
- if (unsetPath) {
18186
- unset(formData, path);
18584
+ if (plainLeafWasCleared) {
18585
+ set(formData, path, undefined);
18187
18586
  }
18188
18587
  else {
18189
18588
  set(formData, path, valueForPath);
18190
18589
  }
18191
18590
  }
18192
18591
  const shouldSanitize = retrievedSchema && !isRootPath && !isObject$3(newValue) && !Array.isArray(newValue) && !disabled && !readonly;
18193
- // Pass true to skip live validation in `getStateFromProps()` since we will do it a bit later
18592
+ // Skip live validation here; it runs later in this function.
18194
18593
  const newState = this.getStateFromProps(this.props, inputForDefaults, undefined, undefined, undefined, true, shouldSanitize);
18195
18594
  formData = newState.formData;
18196
18595
  retrievedSchema = newState.retrievedSchema;
18596
+ // Re-set to undefined after merging defaults so the user's clear is preserved in
18597
+ // state (#5125 regression: without this, clearing a second field re-applies the
18598
+ // default to previously-cleared fields). The undefined key is stripped from the
18599
+ // formData copy passed to AJV via JSON.parse(JSON.stringify(...)) so the validator never
18600
+ // sees { [key]: undefined } for type:"string" or patternProperties fields (#4518).
18601
+ if (plainLeafWasCleared && formData) {
18602
+ set(formData, path, undefined);
18603
+ }
18197
18604
  }
18198
18605
  const mustValidate = !noValidate && (liveValidate === true || liveValidate === 'onChange');
18199
18606
  let state = { formData, retrievedSchema };
@@ -18291,7 +18698,7 @@
18291
18698
  initialDefaultsGenerated: false,
18292
18699
  customErrors: undefined,
18293
18700
  };
18294
- this.setState(state, () => onChange && onChange(toIChangeEvent({ ...this.state, ...state })));
18701
+ this.setState(state, () => onChange?.(toIChangeEvent({ ...this.state, ...state })));
18295
18702
  };
18296
18703
  /** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
18297
18704
  * was provided. Also runs any live validation and/or live omit operations if the flags indicate they should happen
@@ -18465,7 +18872,7 @@
18465
18872
  // some themes (e.g. shadcn) use button elements instead of native inputs for radio groups
18466
18873
  field = this.formElement.current.querySelector(`input[id^="${elementId}"], button[id^="${elementId}"]`);
18467
18874
  }
18468
- if (field && field.length) {
18875
+ if (field?.length) {
18469
18876
  // If we got a list with length > 0
18470
18877
  // oxlint-disable-next-line prefer-destructuring
18471
18878
  field = field[0];
@@ -18611,8 +19018,9 @@
18611
19018
  * @param errors - The list of AJV errors to convert to `RJSFValidationErrors`
18612
19019
  * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
18613
19020
  * @param [suppressDuplicateFiltering] - Controls which duplicate filtering is suppressed; see `filterDuplicateErrors`
19021
+ * @param [schema] - The schema for the validation
18614
19022
  */
18615
- function transformRJSFValidationErrors(errors = [], uiSchema, suppressDuplicateFiltering) {
19023
+ function transformRJSFValidationErrors(errors = [], uiSchema, suppressDuplicateFiltering, schema) {
18616
19024
  const errorList = errors.map((e) => {
18617
19025
  var _a;
18618
19026
  const { instancePath, keyword, params, schemaPath, parentSchema, ...rest } = e;
@@ -18639,6 +19047,13 @@
18639
19047
  .concat([currentProperty]);
18640
19048
  uiSchemaTitle = getUiOptions(get(uiSchema, uiSchemaPath)).title;
18641
19049
  }
19050
+ if (uiSchemaTitle === undefined) {
19051
+ // schemaPath may include non-property segments (e.g. allOf/if/then) that do
19052
+ // not exist in the uiSchema; fall back to the instance path, the same way the
19053
+ // root-schema title fallback does below.
19054
+ const propParts = property.replace(/^\./, '').split('.').filter(Boolean);
19055
+ uiSchemaTitle = get(uiSchema, [...propParts, currentProperty, 'title']);
19056
+ }
18642
19057
  if (uiSchemaTitle) {
18643
19058
  message = message.replace(`'${currentProperty}'`, `'${uiSchemaTitle}'`);
18644
19059
  uiTitle = uiSchemaTitle;
@@ -18649,6 +19064,21 @@
18649
19064
  message = message.replace(`'${currentProperty}'`, `'${parentSchemaTitle}'`);
18650
19065
  uiTitle = parentSchemaTitle;
18651
19066
  }
19067
+ else if (schema) {
19068
+ // parentSchema may be an allOf/anyOf/oneOf entry that lacks `properties`;
19069
+ // fall back to looking up the title from the root schema.
19070
+ const propParts = property.replace(/^\./, '').split('.').filter(Boolean);
19071
+ const aSchemaPath = [];
19072
+ for (const part of propParts) {
19073
+ aSchemaPath.push(PROPERTIES_KEY, part);
19074
+ }
19075
+ aSchemaPath.push(PROPERTIES_KEY, currentProperty, 'title');
19076
+ const rootSchemaTitle = get(schema, aSchemaPath);
19077
+ if (rootSchemaTitle) {
19078
+ message = message.replace(`'${currentProperty}'`, `'${rootSchemaTitle}'`);
19079
+ uiTitle = rootSchemaTitle;
19080
+ }
19081
+ }
18652
19082
  }
18653
19083
  });
18654
19084
  stack = message;
@@ -18700,7 +19130,7 @@
18700
19130
  */
18701
19131
  function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema, suppressDuplicateFiltering) {
18702
19132
  const { validationError: invalidSchemaError } = rawErrors;
18703
- let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema, suppressDuplicateFiltering);
19133
+ let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema, suppressDuplicateFiltering, schema);
18704
19134
  if (invalidSchemaError) {
18705
19135
  errors = [...errors, { stack: invalidSchemaError.message }];
18706
19136
  }
@@ -21701,333 +22131,1490 @@
21701
22131
  return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
21702
22132
  }
21703
22133
  }
21704
- validate.getData = getData;
21705
-
21706
- return validate;
21707
- }
22134
+ validate.getData = getData;
22135
+
22136
+ return validate;
22137
+ }
22138
+
22139
+ var validation_error = {};
22140
+
22141
+ var hasRequiredValidation_error;
22142
+
22143
+ function requireValidation_error () {
22144
+ if (hasRequiredValidation_error) return validation_error;
22145
+ hasRequiredValidation_error = 1;
22146
+ Object.defineProperty(validation_error, "__esModule", { value: true });
22147
+ class ValidationError extends Error {
22148
+ constructor(errors) {
22149
+ super("validation failed");
22150
+ this.errors = errors;
22151
+ this.ajv = this.validation = true;
22152
+ }
22153
+ }
22154
+ validation_error.default = ValidationError;
22155
+
22156
+ return validation_error;
22157
+ }
22158
+
22159
+ var ref_error = {};
22160
+
22161
+ var hasRequiredRef_error;
22162
+
22163
+ function requireRef_error () {
22164
+ if (hasRequiredRef_error) return ref_error;
22165
+ hasRequiredRef_error = 1;
22166
+ Object.defineProperty(ref_error, "__esModule", { value: true });
22167
+ const resolve_1 = /*@__PURE__*/ requireResolve();
22168
+ class MissingRefError extends Error {
22169
+ constructor(resolver, baseId, ref, msg) {
22170
+ super(msg || `can't resolve reference ${ref} from id ${baseId}`);
22171
+ this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
22172
+ this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
22173
+ }
22174
+ }
22175
+ ref_error.default = MissingRefError;
22176
+
22177
+ return ref_error;
22178
+ }
22179
+
22180
+ var compile = {};
22181
+
22182
+ var hasRequiredCompile;
22183
+
22184
+ function requireCompile () {
22185
+ if (hasRequiredCompile) return compile;
22186
+ hasRequiredCompile = 1;
22187
+ Object.defineProperty(compile, "__esModule", { value: true });
22188
+ compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
22189
+ const codegen_1 = /*@__PURE__*/ requireCodegen();
22190
+ const validation_error_1 = /*@__PURE__*/ requireValidation_error();
22191
+ const names_1 = /*@__PURE__*/ requireNames();
22192
+ const resolve_1 = /*@__PURE__*/ requireResolve();
22193
+ const util_1 = /*@__PURE__*/ requireUtil();
22194
+ const validate_1 = /*@__PURE__*/ requireValidate();
22195
+ class SchemaEnv {
22196
+ constructor(env) {
22197
+ var _a;
22198
+ this.refs = {};
22199
+ this.dynamicAnchors = {};
22200
+ let schema;
22201
+ if (typeof env.schema == "object")
22202
+ schema = env.schema;
22203
+ this.schema = env.schema;
22204
+ this.schemaId = env.schemaId;
22205
+ this.root = env.root || this;
22206
+ this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
22207
+ this.schemaPath = env.schemaPath;
22208
+ this.localRefs = env.localRefs;
22209
+ this.meta = env.meta;
22210
+ this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
22211
+ this.refs = {};
22212
+ }
22213
+ }
22214
+ compile.SchemaEnv = SchemaEnv;
22215
+ // let codeSize = 0
22216
+ // let nodeCount = 0
22217
+ // Compiles schema in SchemaEnv
22218
+ function compileSchema(sch) {
22219
+ // TODO refactor - remove compilations
22220
+ const _sch = getCompilingSchema.call(this, sch);
22221
+ if (_sch)
22222
+ return _sch;
22223
+ const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails
22224
+ const { es5, lines } = this.opts.code;
22225
+ const { ownProperties } = this.opts;
22226
+ const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
22227
+ let _ValidationError;
22228
+ if (sch.$async) {
22229
+ _ValidationError = gen.scopeValue("Error", {
22230
+ ref: validation_error_1.default,
22231
+ code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`,
22232
+ });
22233
+ }
22234
+ const validateName = gen.scopeName("validate");
22235
+ sch.validateName = validateName;
22236
+ const schemaCxt = {
22237
+ gen,
22238
+ allErrors: this.opts.allErrors,
22239
+ data: names_1.default.data,
22240
+ parentData: names_1.default.parentData,
22241
+ parentDataProperty: names_1.default.parentDataProperty,
22242
+ dataNames: [names_1.default.data],
22243
+ dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed?
22244
+ dataLevel: 0,
22245
+ dataTypes: [],
22246
+ definedProperties: new Set(),
22247
+ topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true
22248
+ ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) }
22249
+ : { ref: sch.schema }),
22250
+ validateName,
22251
+ ValidationError: _ValidationError,
22252
+ schema: sch.schema,
22253
+ schemaEnv: sch,
22254
+ rootId,
22255
+ baseId: sch.baseId || rootId,
22256
+ schemaPath: codegen_1.nil,
22257
+ errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
22258
+ errorPath: (0, codegen_1._) `""`,
22259
+ opts: this.opts,
22260
+ self: this,
22261
+ };
22262
+ let sourceCode;
22263
+ try {
22264
+ this._compilations.add(sch);
22265
+ (0, validate_1.validateFunctionCode)(schemaCxt);
22266
+ gen.optimize(this.opts.code.optimize);
22267
+ // gen.optimize(1)
22268
+ const validateCode = gen.toString();
22269
+ sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
22270
+ // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))
22271
+ if (this.opts.code.process)
22272
+ sourceCode = this.opts.code.process(sourceCode, sch);
22273
+ // console.log("\n\n\n *** \n", sourceCode)
22274
+ const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
22275
+ const validate = makeValidate(this, this.scope.get());
22276
+ this.scope.value(validateName, { ref: validate });
22277
+ validate.errors = null;
22278
+ validate.schema = sch.schema;
22279
+ validate.schemaEnv = sch;
22280
+ if (sch.$async)
22281
+ validate.$async = true;
22282
+ if (this.opts.code.source === true) {
22283
+ validate.source = { validateName, validateCode, scopeValues: gen._values };
22284
+ }
22285
+ if (this.opts.unevaluated) {
22286
+ const { props, items } = schemaCxt;
22287
+ validate.evaluated = {
22288
+ props: props instanceof codegen_1.Name ? undefined : props,
22289
+ items: items instanceof codegen_1.Name ? undefined : items,
22290
+ dynamicProps: props instanceof codegen_1.Name,
22291
+ dynamicItems: items instanceof codegen_1.Name,
22292
+ };
22293
+ if (validate.source)
22294
+ validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
22295
+ }
22296
+ sch.validate = validate;
22297
+ return sch;
22298
+ }
22299
+ catch (e) {
22300
+ delete sch.validate;
22301
+ delete sch.validateName;
22302
+ if (sourceCode)
22303
+ this.logger.error("Error compiling schema, function code:", sourceCode);
22304
+ // console.log("\n\n\n *** \n", sourceCode, this.opts)
22305
+ throw e;
22306
+ }
22307
+ finally {
22308
+ this._compilations.delete(sch);
22309
+ }
22310
+ }
22311
+ compile.compileSchema = compileSchema;
22312
+ function resolveRef(root, baseId, ref) {
22313
+ var _a;
22314
+ ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
22315
+ const schOrFunc = root.refs[ref];
22316
+ if (schOrFunc)
22317
+ return schOrFunc;
22318
+ let _sch = resolve.call(this, root, ref);
22319
+ if (_sch === undefined) {
22320
+ const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
22321
+ const { schemaId } = this.opts;
22322
+ if (schema)
22323
+ _sch = new SchemaEnv({ schema, schemaId, root, baseId });
22324
+ }
22325
+ if (_sch === undefined)
22326
+ return;
22327
+ return (root.refs[ref] = inlineOrCompile.call(this, _sch));
22328
+ }
22329
+ compile.resolveRef = resolveRef;
22330
+ function inlineOrCompile(sch) {
22331
+ if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
22332
+ return sch.schema;
22333
+ return sch.validate ? sch : compileSchema.call(this, sch);
22334
+ }
22335
+ // Index of schema compilation in the currently compiled list
22336
+ function getCompilingSchema(schEnv) {
22337
+ for (const sch of this._compilations) {
22338
+ if (sameSchemaEnv(sch, schEnv))
22339
+ return sch;
22340
+ }
22341
+ }
22342
+ compile.getCompilingSchema = getCompilingSchema;
22343
+ function sameSchemaEnv(s1, s2) {
22344
+ return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
22345
+ }
22346
+ // resolve and compile the references ($ref)
22347
+ // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
22348
+ function resolve(root, // information about the root schema for the current schema
22349
+ ref // reference to resolve
22350
+ ) {
22351
+ let sch;
22352
+ while (typeof (sch = this.refs[ref]) == "string")
22353
+ ref = sch;
22354
+ return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
22355
+ }
22356
+ // Resolve schema, its root and baseId
22357
+ function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
22358
+ ref // reference to resolve
22359
+ ) {
22360
+ const p = this.opts.uriResolver.parse(ref);
22361
+ const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
22362
+ let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined);
22363
+ // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
22364
+ if (Object.keys(root.schema).length > 0 && refPath === baseId) {
22365
+ return getJsonPointer.call(this, p, root);
22366
+ }
22367
+ const id = (0, resolve_1.normalizeId)(refPath);
22368
+ const schOrRef = this.refs[id] || this.schemas[id];
22369
+ if (typeof schOrRef == "string") {
22370
+ const sch = resolveSchema.call(this, root, schOrRef);
22371
+ if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
22372
+ return;
22373
+ return getJsonPointer.call(this, p, sch);
22374
+ }
22375
+ if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
22376
+ return;
22377
+ if (!schOrRef.validate)
22378
+ compileSchema.call(this, schOrRef);
22379
+ if (id === (0, resolve_1.normalizeId)(ref)) {
22380
+ const { schema } = schOrRef;
22381
+ const { schemaId } = this.opts;
22382
+ const schId = schema[schemaId];
22383
+ if (schId)
22384
+ baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
22385
+ return new SchemaEnv({ schema, schemaId, root, baseId });
22386
+ }
22387
+ return getJsonPointer.call(this, p, schOrRef);
22388
+ }
22389
+ compile.resolveSchema = resolveSchema;
22390
+ const PREVENT_SCOPE_CHANGE = new Set([
22391
+ "properties",
22392
+ "patternProperties",
22393
+ "enum",
22394
+ "dependencies",
22395
+ "definitions",
22396
+ ]);
22397
+ function getJsonPointer(parsedRef, { baseId, schema, root }) {
22398
+ var _a;
22399
+ if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
22400
+ return;
22401
+ for (const part of parsedRef.fragment.slice(1).split("/")) {
22402
+ if (typeof schema === "boolean")
22403
+ return;
22404
+ const partSchema = schema[(0, util_1.unescapeFragment)(part)];
22405
+ if (partSchema === undefined)
22406
+ return;
22407
+ schema = partSchema;
22408
+ // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
22409
+ const schId = typeof schema === "object" && schema[this.opts.schemaId];
22410
+ if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
22411
+ baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
22412
+ }
22413
+ }
22414
+ let env;
22415
+ if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
22416
+ const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
22417
+ env = resolveSchema.call(this, root, $ref);
22418
+ }
22419
+ // even though resolution failed we need to return SchemaEnv to throw exception
22420
+ // so that compileAsync loads missing schema.
22421
+ const { schemaId } = this.opts;
22422
+ env = env || new SchemaEnv({ schema, schemaId, root, baseId });
22423
+ if (env.schema !== env.root.schema)
22424
+ return env;
22425
+ return undefined;
22426
+ }
22427
+
22428
+ return compile;
22429
+ }
22430
+
22431
+ var $id$1 = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
22432
+ var description = "Meta-schema for $data reference (JSON AnySchema extension proposal)";
22433
+ var type$1 = "object";
22434
+ var required$1 = [
22435
+ "$data"
22436
+ ];
22437
+ var properties$2 = {
22438
+ $data: {
22439
+ type: "string",
22440
+ anyOf: [
22441
+ {
22442
+ format: "relative-json-pointer"
22443
+ },
22444
+ {
22445
+ format: "json-pointer"
22446
+ }
22447
+ ]
22448
+ }
22449
+ };
22450
+ var additionalProperties$1 = false;
22451
+ var require$$9 = {
22452
+ $id: $id$1,
22453
+ description: description,
22454
+ type: type$1,
22455
+ required: required$1,
22456
+ properties: properties$2,
22457
+ additionalProperties: additionalProperties$1
22458
+ };
22459
+
22460
+ var uri = {};
22461
+
22462
+ var fastUri = {exports: {}};
22463
+
22464
+ var utils;
22465
+ var hasRequiredUtils;
22466
+
22467
+ function requireUtils () {
22468
+ if (hasRequiredUtils) return utils;
22469
+ hasRequiredUtils = 1;
22470
+
22471
+ /** @type {(value: string) => boolean} */
22472
+ const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
22473
+
22474
+ /** @type {(value: string) => boolean} */
22475
+ const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
22476
+
22477
+ /** @type {(value: string) => boolean} */
22478
+ const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
22479
+
22480
+ /** @type {(value: string) => boolean} */
22481
+ const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
22482
+
22483
+ /** @type {(value: string) => boolean} */
22484
+ const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
22485
+
22486
+ /**
22487
+ * @param {Array<string>} input
22488
+ * @returns {string}
22489
+ */
22490
+ function stringArrayToHexStripped (input) {
22491
+ let acc = '';
22492
+ let code = 0;
22493
+ let i = 0;
22494
+
22495
+ for (i = 0; i < input.length; i++) {
22496
+ code = input[i].charCodeAt(0);
22497
+ if (code === 48) {
22498
+ continue
22499
+ }
22500
+ if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
22501
+ return ''
22502
+ }
22503
+ acc += input[i];
22504
+ break
22505
+ }
22506
+
22507
+ for (i += 1; i < input.length; i++) {
22508
+ code = input[i].charCodeAt(0);
22509
+ if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
22510
+ return ''
22511
+ }
22512
+ acc += input[i];
22513
+ }
22514
+ return acc
22515
+ }
22516
+
22517
+ /**
22518
+ * @typedef {Object} GetIPV6Result
22519
+ * @property {boolean} error - Indicates if there was an error parsing the IPv6 address.
22520
+ * @property {string} address - The parsed IPv6 address.
22521
+ * @property {string} [zone] - The zone identifier, if present.
22522
+ */
22523
+
22524
+ /**
22525
+ * @param {string} value
22526
+ * @returns {boolean}
22527
+ */
22528
+ const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
22529
+
22530
+ /**
22531
+ * @param {Array<string>} buffer
22532
+ * @returns {boolean}
22533
+ */
22534
+ function consumeIsZone (buffer) {
22535
+ buffer.length = 0;
22536
+ return true
22537
+ }
22538
+
22539
+ /**
22540
+ * @param {Array<string>} buffer
22541
+ * @param {Array<string>} address
22542
+ * @param {GetIPV6Result} output
22543
+ * @returns {boolean}
22544
+ */
22545
+ function consumeHextets (buffer, address, output) {
22546
+ if (buffer.length) {
22547
+ const hex = stringArrayToHexStripped(buffer);
22548
+ if (hex !== '') {
22549
+ address.push(hex);
22550
+ } else {
22551
+ output.error = true;
22552
+ return false
22553
+ }
22554
+ buffer.length = 0;
22555
+ }
22556
+ return true
22557
+ }
22558
+
22559
+ /**
22560
+ * @param {string} input
22561
+ * @returns {GetIPV6Result}
22562
+ */
22563
+ function getIPV6 (input) {
22564
+ let tokenCount = 0;
22565
+ const output = { error: false, address: '', zone: '' };
22566
+ /** @type {Array<string>} */
22567
+ const address = [];
22568
+ /** @type {Array<string>} */
22569
+ const buffer = [];
22570
+ let endipv6Encountered = false;
22571
+ let endIpv6 = false;
22572
+
22573
+ let consume = consumeHextets;
22574
+
22575
+ for (let i = 0; i < input.length; i++) {
22576
+ const cursor = input[i];
22577
+ if (cursor === '[' || cursor === ']') { continue }
22578
+ if (cursor === ':') {
22579
+ if (endipv6Encountered === true) {
22580
+ endIpv6 = true;
22581
+ }
22582
+ if (!consume(buffer, address, output)) { break }
22583
+ if (++tokenCount > 7) {
22584
+ // not valid
22585
+ output.error = true;
22586
+ break
22587
+ }
22588
+ if (i > 0 && input[i - 1] === ':') {
22589
+ endipv6Encountered = true;
22590
+ }
22591
+ address.push(':');
22592
+ continue
22593
+ } else if (cursor === '%') {
22594
+ if (!consume(buffer, address, output)) { break }
22595
+ // switch to zone detection
22596
+ consume = consumeIsZone;
22597
+ } else {
22598
+ buffer.push(cursor);
22599
+ continue
22600
+ }
22601
+ }
22602
+ if (buffer.length) {
22603
+ if (consume === consumeIsZone) {
22604
+ output.zone = buffer.join('');
22605
+ } else if (endIpv6) {
22606
+ address.push(buffer.join(''));
22607
+ } else {
22608
+ address.push(stringArrayToHexStripped(buffer));
22609
+ }
22610
+ }
22611
+ output.address = address.join('');
22612
+ return output
22613
+ }
22614
+
22615
+ /**
22616
+ * @typedef {Object} NormalizeIPv6Result
22617
+ * @property {string} host - The normalized host.
22618
+ * @property {string} [escapedHost] - The escaped host.
22619
+ * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
22620
+ */
22621
+
22622
+ /**
22623
+ * @param {string} host
22624
+ * @returns {NormalizeIPv6Result}
22625
+ */
22626
+ function normalizeIPv6 (host) {
22627
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
22628
+ const ipv6 = getIPV6(host);
22629
+
22630
+ if (!ipv6.error) {
22631
+ let newHost = ipv6.address;
22632
+ let escapedHost = ipv6.address;
22633
+ if (ipv6.zone) {
22634
+ newHost += '%' + ipv6.zone;
22635
+ escapedHost += '%25' + ipv6.zone;
22636
+ }
22637
+ return { host: newHost, isIPV6: true, escapedHost }
22638
+ } else {
22639
+ return { host, isIPV6: false }
22640
+ }
22641
+ }
22642
+
22643
+ /**
22644
+ * @param {string} str
22645
+ * @param {string} token
22646
+ * @returns {number}
22647
+ */
22648
+ function findToken (str, token) {
22649
+ let ind = 0;
22650
+ for (let i = 0; i < str.length; i++) {
22651
+ if (str[i] === token) ind++;
22652
+ }
22653
+ return ind
22654
+ }
22655
+
22656
+ /**
22657
+ * @param {string} path
22658
+ * @returns {string}
22659
+ *
22660
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
22661
+ */
22662
+ function removeDotSegments (path) {
22663
+ let input = path;
22664
+ const output = [];
22665
+ let nextSlash = -1;
22666
+ let len = 0;
22667
+
22668
+ // eslint-disable-next-line no-cond-assign
22669
+ while (len = input.length) {
22670
+ if (len === 1) {
22671
+ if (input === '.') {
22672
+ break
22673
+ } else if (input === '/') {
22674
+ output.push('/');
22675
+ break
22676
+ } else {
22677
+ output.push(input);
22678
+ break
22679
+ }
22680
+ } else if (len === 2) {
22681
+ if (input[0] === '.') {
22682
+ if (input[1] === '.') {
22683
+ break
22684
+ } else if (input[1] === '/') {
22685
+ input = input.slice(2);
22686
+ continue
22687
+ }
22688
+ } else if (input[0] === '/') {
22689
+ if (input[1] === '.' || input[1] === '/') {
22690
+ output.push('/');
22691
+ break
22692
+ }
22693
+ }
22694
+ } else if (len === 3) {
22695
+ if (input === '/..') {
22696
+ if (output.length !== 0) {
22697
+ output.pop();
22698
+ }
22699
+ output.push('/');
22700
+ break
22701
+ }
22702
+ }
22703
+ if (input[0] === '.') {
22704
+ if (input[1] === '.') {
22705
+ if (input[2] === '/') {
22706
+ input = input.slice(3);
22707
+ continue
22708
+ }
22709
+ } else if (input[1] === '/') {
22710
+ input = input.slice(2);
22711
+ continue
22712
+ }
22713
+ } else if (input[0] === '/') {
22714
+ if (input[1] === '.') {
22715
+ if (input[2] === '/') {
22716
+ input = input.slice(2);
22717
+ continue
22718
+ } else if (input[2] === '.') {
22719
+ if (input[3] === '/') {
22720
+ input = input.slice(3);
22721
+ if (output.length !== 0) {
22722
+ output.pop();
22723
+ }
22724
+ continue
22725
+ }
22726
+ }
22727
+ }
22728
+ }
22729
+
22730
+ // Rule 2E: Move normal path segment to output
22731
+ if ((nextSlash = input.indexOf('/', 1)) === -1) {
22732
+ output.push(input);
22733
+ break
22734
+ } else {
22735
+ output.push(input.slice(0, nextSlash));
22736
+ input = input.slice(nextSlash);
22737
+ }
22738
+ }
22739
+
22740
+ return output.join('')
22741
+ }
22742
+
22743
+ /**
22744
+ * Re-escape RFC 3986 gen-delims that must not appear literally in the host.
22745
+ * After the URI regex parses, these characters cannot be literal in the host
22746
+ * field, so any that appear after decoding came from percent-encoding and
22747
+ * must be restored to prevent authority structure changes.
22748
+ *
22749
+ * @param {string} host
22750
+ * @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
22751
+ * @returns {string}
22752
+ */
22753
+ const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' };
22754
+ const HOST_DELIM_RE = /[@/?#:]/g;
22755
+ const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
22756
+
22757
+ function reescapeHostDelimiters (host, isIP) {
22758
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
22759
+ re.lastIndex = 0;
22760
+ return host.replace(re, (ch) => HOST_DELIMS[ch])
22761
+ }
22762
+
22763
+ /**
22764
+ * Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
22765
+ * Reserved delimiters such as `%2F` and `%2E` stay escaped.
22766
+ *
22767
+ * @param {string} input
22768
+ * @param {boolean} [decodeUnreserved=false]
22769
+ * @returns {string}
22770
+ */
22771
+ function normalizePercentEncoding (input, decodeUnreserved = false) {
22772
+ if (input.indexOf('%') === -1) {
22773
+ return input
22774
+ }
22775
+
22776
+ let output = '';
22777
+
22778
+ for (let i = 0; i < input.length; i++) {
22779
+ if (input[i] === '%' && i + 2 < input.length) {
22780
+ const hex = input.slice(i + 1, i + 3);
22781
+ if (isHexPair(hex)) {
22782
+ const normalizedHex = hex.toUpperCase();
22783
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
22784
+
22785
+ if (decodeUnreserved && isUnreserved(decoded)) {
22786
+ output += decoded;
22787
+ } else {
22788
+ output += '%' + normalizedHex;
22789
+ }
22790
+
22791
+ i += 2;
22792
+ continue
22793
+ }
22794
+ }
22795
+
22796
+ output += input[i];
22797
+ }
22798
+
22799
+ return output
22800
+ }
22801
+
22802
+ /**
22803
+ * Normalizes path data without turning reserved escapes into live path syntax.
22804
+ * Valid escapes are uppercased, raw unsafe characters are escaped, and only
22805
+ * unreserved bytes that are not `.` are decoded.
22806
+ *
22807
+ * @param {string} input
22808
+ * @returns {string}
22809
+ */
22810
+ function normalizePathEncoding (input) {
22811
+ let output = '';
22812
+
22813
+ for (let i = 0; i < input.length; i++) {
22814
+ if (input[i] === '%' && i + 2 < input.length) {
22815
+ const hex = input.slice(i + 1, i + 3);
22816
+ if (isHexPair(hex)) {
22817
+ const normalizedHex = hex.toUpperCase();
22818
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
22819
+
22820
+ if (decoded !== '.' && isUnreserved(decoded)) {
22821
+ output += decoded;
22822
+ } else {
22823
+ output += '%' + normalizedHex;
22824
+ }
22825
+
22826
+ i += 2;
22827
+ continue
22828
+ }
22829
+ }
22830
+
22831
+ if (isPathCharacter(input[i])) {
22832
+ output += input[i];
22833
+ } else {
22834
+ output += escape(input[i]);
22835
+ }
22836
+ }
22837
+
22838
+ return output
22839
+ }
22840
+
22841
+ /**
22842
+ * Escapes a component while preserving existing valid percent escapes.
22843
+ *
22844
+ * @param {string} input
22845
+ * @returns {string}
22846
+ */
22847
+ function escapePreservingEscapes (input) {
22848
+ let output = '';
22849
+
22850
+ for (let i = 0; i < input.length; i++) {
22851
+ if (input[i] === '%' && i + 2 < input.length) {
22852
+ const hex = input.slice(i + 1, i + 3);
22853
+ if (isHexPair(hex)) {
22854
+ output += '%' + hex.toUpperCase();
22855
+ i += 2;
22856
+ continue
22857
+ }
22858
+ }
22859
+
22860
+ output += escape(input[i]);
22861
+ }
22862
+
22863
+ return output
22864
+ }
22865
+
22866
+ /**
22867
+ * @param {import('../types/index').URIComponent} component
22868
+ * @returns {string|undefined}
22869
+ */
22870
+ function recomposeAuthority (component) {
22871
+ const uriTokens = [];
22872
+
22873
+ if (component.userinfo !== undefined) {
22874
+ uriTokens.push(component.userinfo);
22875
+ uriTokens.push('@');
22876
+ }
22877
+
22878
+ if (component.host !== undefined) {
22879
+ let host = unescape(component.host);
22880
+ if (!isIPv4(host)) {
22881
+ const ipV6res = normalizeIPv6(host);
22882
+ if (ipV6res.isIPV6 === true) {
22883
+ host = `[${ipV6res.escapedHost}]`;
22884
+ } else {
22885
+ host = reescapeHostDelimiters(host, false);
22886
+ }
22887
+ }
22888
+ uriTokens.push(host);
22889
+ }
22890
+
22891
+ if (typeof component.port === 'number' || typeof component.port === 'string') {
22892
+ uriTokens.push(':');
22893
+ uriTokens.push(String(component.port));
22894
+ }
22895
+
22896
+ return uriTokens.length ? uriTokens.join('') : undefined
22897
+ }
22898
+ utils = {
22899
+ nonSimpleDomain,
22900
+ recomposeAuthority,
22901
+ reescapeHostDelimiters,
22902
+ normalizePercentEncoding,
22903
+ normalizePathEncoding,
22904
+ escapePreservingEscapes,
22905
+ removeDotSegments,
22906
+ isIPv4,
22907
+ isUUID,
22908
+ normalizeIPv6,
22909
+ stringArrayToHexStripped
22910
+ };
22911
+ return utils;
22912
+ }
22913
+
22914
+ var schemes;
22915
+ var hasRequiredSchemes;
22916
+
22917
+ function requireSchemes () {
22918
+ if (hasRequiredSchemes) return schemes;
22919
+ hasRequiredSchemes = 1;
22920
+
22921
+ const { isUUID } = requireUtils();
22922
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
22923
+
22924
+ const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws',
22925
+ 'wss', 'urn', 'urn:uuid']);
22926
+
22927
+ /** @typedef {supportedSchemeNames[number]} SchemeName */
22928
+
22929
+ /**
22930
+ * @param {string} name
22931
+ * @returns {name is SchemeName}
22932
+ */
22933
+ function isValidSchemeName (name) {
22934
+ return supportedSchemeNames.indexOf(/** @type {*} */ (name)) !== -1
22935
+ }
22936
+
22937
+ /**
22938
+ * @callback SchemeFn
22939
+ * @param {import('../types/index').URIComponent} component
22940
+ * @param {import('../types/index').Options} options
22941
+ * @returns {import('../types/index').URIComponent}
22942
+ */
22943
+
22944
+ /**
22945
+ * @typedef {Object} SchemeHandler
22946
+ * @property {SchemeName} scheme - The scheme name.
22947
+ * @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts.
22948
+ * @property {SchemeFn} parse - Function to parse the URI component for this scheme.
22949
+ * @property {SchemeFn} serialize - Function to serialize the URI component for this scheme.
22950
+ * @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme.
22951
+ * @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths.
22952
+ * @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode.
22953
+ */
22954
+
22955
+ /**
22956
+ * @param {import('../types/index').URIComponent} wsComponent
22957
+ * @returns {boolean}
22958
+ */
22959
+ function wsIsSecure (wsComponent) {
22960
+ if (wsComponent.secure === true) {
22961
+ return true
22962
+ } else if (wsComponent.secure === false) {
22963
+ return false
22964
+ } else if (wsComponent.scheme) {
22965
+ return (
22966
+ wsComponent.scheme.length === 3 &&
22967
+ (wsComponent.scheme[0] === 'w' || wsComponent.scheme[0] === 'W') &&
22968
+ (wsComponent.scheme[1] === 's' || wsComponent.scheme[1] === 'S') &&
22969
+ (wsComponent.scheme[2] === 's' || wsComponent.scheme[2] === 'S')
22970
+ )
22971
+ } else {
22972
+ return false
22973
+ }
22974
+ }
22975
+
22976
+ /** @type {SchemeFn} */
22977
+ function httpParse (component) {
22978
+ if (!component.host) {
22979
+ component.error = component.error || 'HTTP URIs must have a host.';
22980
+ }
22981
+
22982
+ return component
22983
+ }
22984
+
22985
+ /** @type {SchemeFn} */
22986
+ function httpSerialize (component) {
22987
+ const secure = String(component.scheme).toLowerCase() === 'https';
22988
+
22989
+ // normalize the default port
22990
+ if (component.port === (secure ? 443 : 80) || component.port === '') {
22991
+ component.port = undefined;
22992
+ }
22993
+
22994
+ // normalize the empty path
22995
+ if (!component.path) {
22996
+ component.path = '/';
22997
+ }
22998
+
22999
+ // NOTE: We do not parse query strings for HTTP URIs
23000
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
23001
+ // and not the HTTP spec.
23002
+
23003
+ return component
23004
+ }
23005
+
23006
+ /** @type {SchemeFn} */
23007
+ function wsParse (wsComponent) {
23008
+ // indicate if the secure flag is set
23009
+ wsComponent.secure = wsIsSecure(wsComponent);
23010
+
23011
+ // construct resouce name
23012
+ wsComponent.resourceName = (wsComponent.path || '/') + (wsComponent.query ? '?' + wsComponent.query : '');
23013
+ wsComponent.path = undefined;
23014
+ wsComponent.query = undefined;
23015
+
23016
+ return wsComponent
23017
+ }
23018
+
23019
+ /** @type {SchemeFn} */
23020
+ function wsSerialize (wsComponent) {
23021
+ // normalize the default port
23022
+ if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === '') {
23023
+ wsComponent.port = undefined;
23024
+ }
23025
+
23026
+ // ensure scheme matches secure flag
23027
+ if (typeof wsComponent.secure === 'boolean') {
23028
+ wsComponent.scheme = (wsComponent.secure ? 'wss' : 'ws');
23029
+ wsComponent.secure = undefined;
23030
+ }
23031
+
23032
+ // reconstruct path from resource name
23033
+ if (wsComponent.resourceName) {
23034
+ const [path, query] = wsComponent.resourceName.split('?');
23035
+ wsComponent.path = (path && path !== '/' ? path : undefined);
23036
+ wsComponent.query = query;
23037
+ wsComponent.resourceName = undefined;
23038
+ }
23039
+
23040
+ // forbid fragment component
23041
+ wsComponent.fragment = undefined;
23042
+
23043
+ return wsComponent
23044
+ }
23045
+
23046
+ /** @type {SchemeFn} */
23047
+ function urnParse (urnComponent, options) {
23048
+ if (!urnComponent.path) {
23049
+ urnComponent.error = 'URN can not be parsed';
23050
+ return urnComponent
23051
+ }
23052
+ const matches = urnComponent.path.match(URN_REG);
23053
+ if (matches) {
23054
+ const scheme = options.scheme || urnComponent.scheme || 'urn';
23055
+ urnComponent.nid = matches[1].toLowerCase();
23056
+ urnComponent.nss = matches[2];
23057
+ const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
23058
+ const schemeHandler = getSchemeHandler(urnScheme);
23059
+ urnComponent.path = undefined;
23060
+
23061
+ if (schemeHandler) {
23062
+ urnComponent = schemeHandler.parse(urnComponent, options);
23063
+ }
23064
+ } else {
23065
+ urnComponent.error = urnComponent.error || 'URN can not be parsed.';
23066
+ }
23067
+
23068
+ return urnComponent
23069
+ }
23070
+
23071
+ /** @type {SchemeFn} */
23072
+ function urnSerialize (urnComponent, options) {
23073
+ if (urnComponent.nid === undefined) {
23074
+ throw new Error('URN without nid cannot be serialized')
23075
+ }
23076
+ const scheme = options.scheme || urnComponent.scheme || 'urn';
23077
+ const nid = urnComponent.nid.toLowerCase();
23078
+ const urnScheme = `${scheme}:${options.nid || nid}`;
23079
+ const schemeHandler = getSchemeHandler(urnScheme);
23080
+
23081
+ if (schemeHandler) {
23082
+ urnComponent = schemeHandler.serialize(urnComponent, options);
23083
+ }
23084
+
23085
+ const uriComponent = urnComponent;
23086
+ const nss = urnComponent.nss;
23087
+ uriComponent.path = `${nid || options.nid}:${nss}`;
23088
+
23089
+ options.skipEscape = true;
23090
+ return uriComponent
23091
+ }
23092
+
23093
+ /** @type {SchemeFn} */
23094
+ function urnuuidParse (urnComponent, options) {
23095
+ const uuidComponent = urnComponent;
23096
+ uuidComponent.uuid = uuidComponent.nss;
23097
+ uuidComponent.nss = undefined;
23098
+
23099
+ if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
23100
+ uuidComponent.error = uuidComponent.error || 'UUID is not valid.';
23101
+ }
23102
+
23103
+ return uuidComponent
23104
+ }
23105
+
23106
+ /** @type {SchemeFn} */
23107
+ function urnuuidSerialize (uuidComponent) {
23108
+ const urnComponent = uuidComponent;
23109
+ // normalize UUID
23110
+ urnComponent.nss = (uuidComponent.uuid || '').toLowerCase();
23111
+ return urnComponent
23112
+ }
23113
+
23114
+ const http = /** @type {SchemeHandler} */ ({
23115
+ scheme: 'http',
23116
+ domainHost: true,
23117
+ parse: httpParse,
23118
+ serialize: httpSerialize
23119
+ });
23120
+
23121
+ const https = /** @type {SchemeHandler} */ ({
23122
+ scheme: 'https',
23123
+ domainHost: http.domainHost,
23124
+ parse: httpParse,
23125
+ serialize: httpSerialize
23126
+ });
23127
+
23128
+ const ws = /** @type {SchemeHandler} */ ({
23129
+ scheme: 'ws',
23130
+ domainHost: true,
23131
+ parse: wsParse,
23132
+ serialize: wsSerialize
23133
+ });
23134
+
23135
+ const wss = /** @type {SchemeHandler} */ ({
23136
+ scheme: 'wss',
23137
+ domainHost: ws.domainHost,
23138
+ parse: ws.parse,
23139
+ serialize: ws.serialize
23140
+ });
23141
+
23142
+ const urn = /** @type {SchemeHandler} */ ({
23143
+ scheme: 'urn',
23144
+ parse: urnParse,
23145
+ serialize: urnSerialize,
23146
+ skipNormalize: true
23147
+ });
23148
+
23149
+ const urnuuid = /** @type {SchemeHandler} */ ({
23150
+ scheme: 'urn:uuid',
23151
+ parse: urnuuidParse,
23152
+ serialize: urnuuidSerialize,
23153
+ skipNormalize: true
23154
+ });
23155
+
23156
+ const SCHEMES = /** @type {Record<SchemeName, SchemeHandler>} */ ({
23157
+ http,
23158
+ https,
23159
+ ws,
23160
+ wss,
23161
+ urn,
23162
+ 'urn:uuid': urnuuid
23163
+ });
23164
+
23165
+ Object.setPrototypeOf(SCHEMES, null);
23166
+
23167
+ /**
23168
+ * @param {string|undefined} scheme
23169
+ * @returns {SchemeHandler|undefined}
23170
+ */
23171
+ function getSchemeHandler (scheme) {
23172
+ return (
23173
+ scheme && (
23174
+ SCHEMES[/** @type {SchemeName} */ (scheme)] ||
23175
+ SCHEMES[/** @type {SchemeName} */(scheme.toLowerCase())])
23176
+ ) ||
23177
+ undefined
23178
+ }
23179
+
23180
+ schemes = {
23181
+ wsIsSecure,
23182
+ SCHEMES,
23183
+ isValidSchemeName,
23184
+ getSchemeHandler,
23185
+ };
23186
+ return schemes;
23187
+ }
23188
+
23189
+ var hasRequiredFastUri;
23190
+
23191
+ function requireFastUri () {
23192
+ if (hasRequiredFastUri) return fastUri.exports;
23193
+ hasRequiredFastUri = 1;
23194
+
23195
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
23196
+ const { SCHEMES, getSchemeHandler } = requireSchemes();
23197
+
23198
+ /**
23199
+ * @template {import('./types/index').URIComponent|string} T
23200
+ * @param {T} uri
23201
+ * @param {import('./types/index').Options} [options]
23202
+ * @returns {T}
23203
+ */
23204
+ function normalize (uri, options) {
23205
+ if (typeof uri === 'string') {
23206
+ uri = /** @type {T} */ (normalizeString(uri, options));
23207
+ } else if (typeof uri === 'object') {
23208
+ uri = /** @type {T} */ (parse(serialize(uri, options), options));
23209
+ }
23210
+ return uri
23211
+ }
23212
+
23213
+ /**
23214
+ * @param {string} baseURI
23215
+ * @param {string} relativeURI
23216
+ * @param {import('./types/index').Options} [options]
23217
+ * @returns {string}
23218
+ */
23219
+ function resolve (baseURI, relativeURI, options) {
23220
+ const schemelessOptions = options ? Object.assign({ scheme: 'null' }, options) : { scheme: 'null' };
23221
+ const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
23222
+ schemelessOptions.skipEscape = true;
23223
+ return serialize(resolved, schemelessOptions)
23224
+ }
23225
+
23226
+ /**
23227
+ * @param {import ('./types/index').URIComponent} base
23228
+ * @param {import ('./types/index').URIComponent} relative
23229
+ * @param {import('./types/index').Options} [options]
23230
+ * @param {boolean} [skipNormalization=false]
23231
+ * @returns {import ('./types/index').URIComponent}
23232
+ */
23233
+ function resolveComponent (base, relative, options, skipNormalization) {
23234
+ /** @type {import('./types/index').URIComponent} */
23235
+ const target = {};
23236
+ if (!skipNormalization) {
23237
+ base = parse(serialize(base, options), options); // normalize base component
23238
+ relative = parse(serialize(relative, options), options); // normalize relative component
23239
+ }
23240
+ options = options || {};
23241
+
23242
+ if (!options.tolerant && relative.scheme) {
23243
+ target.scheme = relative.scheme;
23244
+ // target.authority = relative.authority;
23245
+ target.userinfo = relative.userinfo;
23246
+ target.host = relative.host;
23247
+ target.port = relative.port;
23248
+ target.path = removeDotSegments(relative.path || '');
23249
+ target.query = relative.query;
23250
+ } else {
23251
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
23252
+ // target.authority = relative.authority;
23253
+ target.userinfo = relative.userinfo;
23254
+ target.host = relative.host;
23255
+ target.port = relative.port;
23256
+ target.path = removeDotSegments(relative.path || '');
23257
+ target.query = relative.query;
23258
+ } else {
23259
+ if (!relative.path) {
23260
+ target.path = base.path;
23261
+ if (relative.query !== undefined) {
23262
+ target.query = relative.query;
23263
+ } else {
23264
+ target.query = base.query;
23265
+ }
23266
+ } else {
23267
+ if (relative.path[0] === '/') {
23268
+ target.path = removeDotSegments(relative.path);
23269
+ } else {
23270
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
23271
+ target.path = '/' + relative.path;
23272
+ } else if (!base.path) {
23273
+ target.path = relative.path;
23274
+ } else {
23275
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
23276
+ }
23277
+ target.path = removeDotSegments(target.path);
23278
+ }
23279
+ target.query = relative.query;
23280
+ }
23281
+ // target.authority = base.authority;
23282
+ target.userinfo = base.userinfo;
23283
+ target.host = base.host;
23284
+ target.port = base.port;
23285
+ }
23286
+ target.scheme = base.scheme;
23287
+ }
23288
+
23289
+ target.fragment = relative.fragment;
23290
+
23291
+ return target
23292
+ }
23293
+
23294
+ /**
23295
+ * @param {import ('./types/index').URIComponent|string} uriA
23296
+ * @param {import ('./types/index').URIComponent|string} uriB
23297
+ * @param {import ('./types/index').Options} options
23298
+ * @returns {boolean}
23299
+ */
23300
+ function equal (uriA, uriB, options) {
23301
+ const normalizedA = normalizeComparableURI(uriA, options);
23302
+ const normalizedB = normalizeComparableURI(uriB, options);
23303
+
23304
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
23305
+ }
23306
+
23307
+ /**
23308
+ * @param {Readonly<import('./types/index').URIComponent>} cmpts
23309
+ * @param {import('./types/index').Options} [opts]
23310
+ * @returns {string}
23311
+ */
23312
+ function serialize (cmpts, opts) {
23313
+ const component = {
23314
+ host: cmpts.host,
23315
+ scheme: cmpts.scheme,
23316
+ userinfo: cmpts.userinfo,
23317
+ port: cmpts.port,
23318
+ path: cmpts.path,
23319
+ query: cmpts.query,
23320
+ nid: cmpts.nid,
23321
+ nss: cmpts.nss,
23322
+ uuid: cmpts.uuid,
23323
+ fragment: cmpts.fragment,
23324
+ reference: cmpts.reference,
23325
+ resourceName: cmpts.resourceName,
23326
+ secure: cmpts.secure,
23327
+ error: ''
23328
+ };
23329
+ const options = Object.assign({}, opts);
23330
+ const uriTokens = [];
23331
+
23332
+ // find scheme handler
23333
+ const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
23334
+
23335
+ // perform scheme specific serialization
23336
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
23337
+
23338
+ if (component.path !== undefined) {
23339
+ if (!options.skipEscape) {
23340
+ component.path = escapePreservingEscapes(component.path);
23341
+
23342
+ if (component.scheme !== undefined) {
23343
+ component.path = component.path.split('%3A').join(':');
23344
+ }
23345
+ } else {
23346
+ component.path = normalizePercentEncoding(component.path);
23347
+ }
23348
+ }
23349
+
23350
+ if (options.reference !== 'suffix' && component.scheme) {
23351
+ uriTokens.push(component.scheme, ':');
23352
+ }
23353
+
23354
+ const authority = recomposeAuthority(component);
23355
+ if (authority !== undefined) {
23356
+ if (options.reference !== 'suffix') {
23357
+ uriTokens.push('//');
23358
+ }
23359
+
23360
+ uriTokens.push(authority);
23361
+
23362
+ if (component.path && component.path[0] !== '/') {
23363
+ uriTokens.push('/');
23364
+ }
23365
+ }
23366
+ if (component.path !== undefined) {
23367
+ let s = component.path;
23368
+
23369
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
23370
+ s = removeDotSegments(s);
23371
+ }
23372
+
23373
+ if (
23374
+ authority === undefined &&
23375
+ s[0] === '/' &&
23376
+ s[1] === '/'
23377
+ ) {
23378
+ // don't allow the path to start with "//"
23379
+ s = '/%2F' + s.slice(2);
23380
+ }
23381
+
23382
+ uriTokens.push(s);
23383
+ }
23384
+
23385
+ if (component.query !== undefined) {
23386
+ uriTokens.push('?', component.query);
23387
+ }
23388
+
23389
+ if (component.fragment !== undefined) {
23390
+ uriTokens.push('#', component.fragment);
23391
+ }
23392
+ return uriTokens.join('')
23393
+ }
23394
+
23395
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
23396
+
23397
+ // Captures the authority component (between "//" and the next "/", "?" or "#"),
23398
+ // with or without a scheme prefix, for the literal-backslash rejection below.
23399
+ const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
23400
+
23401
+ /**
23402
+ * @param {import('./types/index').URIComponent} parsed
23403
+ * @param {RegExpMatchArray} matches
23404
+ * @returns {string|undefined}
23405
+ */
23406
+ function getParseError (parsed, matches) {
23407
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== '/') {
23408
+ return 'URI path must start with "/" when authority is present.'
23409
+ }
23410
+
23411
+ if (typeof parsed.port === 'number' && (parsed.port < 0 || parsed.port > 65535)) {
23412
+ return 'URI port is malformed.'
23413
+ }
23414
+
23415
+ return undefined
23416
+ }
21708
23417
 
21709
- var validation_error = {};
23418
+ /**
23419
+ * @param {string} uri
23420
+ * @param {import('./types/index').Options} [opts]
23421
+ * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
23422
+ */
23423
+ function parseWithStatus (uri, opts) {
23424
+ const options = Object.assign({}, opts);
23425
+ /** @type {import('./types/index').URIComponent} */
23426
+ const parsed = {
23427
+ scheme: undefined,
23428
+ userinfo: undefined,
23429
+ host: '',
23430
+ port: undefined,
23431
+ path: '',
23432
+ query: undefined,
23433
+ fragment: undefined
23434
+ };
21710
23435
 
21711
- var hasRequiredValidation_error;
23436
+ let malformedAuthorityOrPort = false;
21712
23437
 
21713
- function requireValidation_error () {
21714
- if (hasRequiredValidation_error) return validation_error;
21715
- hasRequiredValidation_error = 1;
21716
- Object.defineProperty(validation_error, "__esModule", { value: true });
21717
- class ValidationError extends Error {
21718
- constructor(errors) {
21719
- super("validation failed");
21720
- this.errors = errors;
21721
- this.ajv = this.validation = true;
23438
+ let isIP = false;
23439
+ if (options.reference === 'suffix') {
23440
+ if (options.scheme) {
23441
+ uri = options.scheme + ':' + uri;
23442
+ } else {
23443
+ uri = '//' + uri;
21722
23444
  }
21723
- }
21724
- validation_error.default = ValidationError;
21725
-
21726
- return validation_error;
21727
- }
23445
+ }
21728
23446
 
21729
- var ref_error = {};
23447
+ // A literal backslash (U+005C) is not a valid RFC 3986 URI character and is
23448
+ // not an authority delimiter. Reject it in the authority rather than
23449
+ // rewriting it: normalizing "\" -> "/" (WHATWG error recovery) could silently
23450
+ // change the resource identified by an otherwise-invalid input, and lets "\"
23451
+ // act as a host delimiter here while Node's native URL parses a different
23452
+ // host (SSRF / redirect / origin-allowlist bypass). Percent-encoded %5C is
23453
+ // untouched and remains valid encoded data.
23454
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
23455
+ if (authorityMatch !== null && authorityMatch[1].indexOf('\\') !== -1) {
23456
+ parsed.error = 'URI authority must not contain a literal backslash.';
23457
+ malformedAuthorityOrPort = true;
23458
+ }
21730
23459
 
21731
- var hasRequiredRef_error;
23460
+ const matches = uri.match(URI_PARSE);
21732
23461
 
21733
- function requireRef_error () {
21734
- if (hasRequiredRef_error) return ref_error;
21735
- hasRequiredRef_error = 1;
21736
- Object.defineProperty(ref_error, "__esModule", { value: true });
21737
- const resolve_1 = /*@__PURE__*/ requireResolve();
21738
- class MissingRefError extends Error {
21739
- constructor(resolver, baseId, ref, msg) {
21740
- super(msg || `can't resolve reference ${ref} from id ${baseId}`);
21741
- this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
21742
- this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
23462
+ if (matches) {
23463
+ // store each component
23464
+ parsed.scheme = matches[1];
23465
+ parsed.userinfo = matches[3];
23466
+ parsed.host = matches[4];
23467
+ parsed.port = parseInt(matches[5], 10);
23468
+ parsed.path = matches[6] || '';
23469
+ parsed.query = matches[7];
23470
+ parsed.fragment = matches[8];
23471
+
23472
+ // fix port number
23473
+ if (isNaN(parsed.port)) {
23474
+ parsed.port = matches[5];
21743
23475
  }
21744
- }
21745
- ref_error.default = MissingRefError;
21746
-
21747
- return ref_error;
21748
- }
21749
23476
 
21750
- var compile = {};
23477
+ const parseError = getParseError(parsed, matches);
23478
+ if (parseError !== undefined) {
23479
+ parsed.error = parsed.error || parseError;
23480
+ malformedAuthorityOrPort = true;
23481
+ }
21751
23482
 
21752
- var hasRequiredCompile;
23483
+ if (parsed.host) {
23484
+ const ipv4result = isIPv4(parsed.host);
23485
+ if (ipv4result === false) {
23486
+ const ipv6result = normalizeIPv6(parsed.host);
23487
+ parsed.host = ipv6result.host.toLowerCase();
23488
+ isIP = ipv6result.isIPV6;
23489
+ } else {
23490
+ isIP = true;
23491
+ }
23492
+ }
23493
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
23494
+ parsed.reference = 'same-document';
23495
+ } else if (parsed.scheme === undefined) {
23496
+ parsed.reference = 'relative';
23497
+ } else if (parsed.fragment === undefined) {
23498
+ parsed.reference = 'absolute';
23499
+ } else {
23500
+ parsed.reference = 'uri';
23501
+ }
21753
23502
 
21754
- function requireCompile () {
21755
- if (hasRequiredCompile) return compile;
21756
- hasRequiredCompile = 1;
21757
- Object.defineProperty(compile, "__esModule", { value: true });
21758
- compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
21759
- const codegen_1 = /*@__PURE__*/ requireCodegen();
21760
- const validation_error_1 = /*@__PURE__*/ requireValidation_error();
21761
- const names_1 = /*@__PURE__*/ requireNames();
21762
- const resolve_1 = /*@__PURE__*/ requireResolve();
21763
- const util_1 = /*@__PURE__*/ requireUtil();
21764
- const validate_1 = /*@__PURE__*/ requireValidate();
21765
- class SchemaEnv {
21766
- constructor(env) {
21767
- var _a;
21768
- this.refs = {};
21769
- this.dynamicAnchors = {};
21770
- let schema;
21771
- if (typeof env.schema == "object")
21772
- schema = env.schema;
21773
- this.schema = env.schema;
21774
- this.schemaId = env.schemaId;
21775
- this.root = env.root || this;
21776
- this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
21777
- this.schemaPath = env.schemaPath;
21778
- this.localRefs = env.localRefs;
21779
- this.meta = env.meta;
21780
- this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
21781
- this.refs = {};
23503
+ // check for reference errors
23504
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
23505
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
21782
23506
  }
21783
- }
21784
- compile.SchemaEnv = SchemaEnv;
21785
- // let codeSize = 0
21786
- // let nodeCount = 0
21787
- // Compiles schema in SchemaEnv
21788
- function compileSchema(sch) {
21789
- // TODO refactor - remove compilations
21790
- const _sch = getCompilingSchema.call(this, sch);
21791
- if (_sch)
21792
- return _sch;
21793
- const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails
21794
- const { es5, lines } = this.opts.code;
21795
- const { ownProperties } = this.opts;
21796
- const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
21797
- let _ValidationError;
21798
- if (sch.$async) {
21799
- _ValidationError = gen.scopeValue("Error", {
21800
- ref: validation_error_1.default,
21801
- code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`,
21802
- });
23507
+
23508
+ // find scheme handler
23509
+ const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
23510
+
23511
+ // check if scheme can't handle IRIs
23512
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
23513
+ // if host component is a domain name
23514
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
23515
+ // convert Unicode IDN -> ASCII IDN
23516
+ try {
23517
+ parsed.host = new URL('http://' + parsed.host).hostname;
23518
+ } catch (e) {
23519
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
23520
+ }
23521
+ }
23522
+ // convert IRI -> URI
21803
23523
  }
21804
- const validateName = gen.scopeName("validate");
21805
- sch.validateName = validateName;
21806
- const schemaCxt = {
21807
- gen,
21808
- allErrors: this.opts.allErrors,
21809
- data: names_1.default.data,
21810
- parentData: names_1.default.parentData,
21811
- parentDataProperty: names_1.default.parentDataProperty,
21812
- dataNames: [names_1.default.data],
21813
- dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed?
21814
- dataLevel: 0,
21815
- dataTypes: [],
21816
- definedProperties: new Set(),
21817
- topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true
21818
- ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) }
21819
- : { ref: sch.schema }),
21820
- validateName,
21821
- ValidationError: _ValidationError,
21822
- schema: sch.schema,
21823
- schemaEnv: sch,
21824
- rootId,
21825
- baseId: sch.baseId || rootId,
21826
- schemaPath: codegen_1.nil,
21827
- errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
21828
- errorPath: (0, codegen_1._) `""`,
21829
- opts: this.opts,
21830
- self: this,
21831
- };
21832
- let sourceCode;
21833
- try {
21834
- this._compilations.add(sch);
21835
- (0, validate_1.validateFunctionCode)(schemaCxt);
21836
- gen.optimize(this.opts.code.optimize);
21837
- // gen.optimize(1)
21838
- const validateCode = gen.toString();
21839
- sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
21840
- // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))
21841
- if (this.opts.code.process)
21842
- sourceCode = this.opts.code.process(sourceCode, sch);
21843
- // console.log("\n\n\n *** \n", sourceCode)
21844
- const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
21845
- const validate = makeValidate(this, this.scope.get());
21846
- this.scope.value(validateName, { ref: validate });
21847
- validate.errors = null;
21848
- validate.schema = sch.schema;
21849
- validate.schemaEnv = sch;
21850
- if (sch.$async)
21851
- validate.$async = true;
21852
- if (this.opts.code.source === true) {
21853
- validate.source = { validateName, validateCode, scopeValues: gen._values };
23524
+
23525
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
23526
+ if (uri.indexOf('%') !== -1) {
23527
+ if (parsed.scheme !== undefined) {
23528
+ parsed.scheme = unescape(parsed.scheme);
21854
23529
  }
21855
- if (this.opts.unevaluated) {
21856
- const { props, items } = schemaCxt;
21857
- validate.evaluated = {
21858
- props: props instanceof codegen_1.Name ? undefined : props,
21859
- items: items instanceof codegen_1.Name ? undefined : items,
21860
- dynamicProps: props instanceof codegen_1.Name,
21861
- dynamicItems: items instanceof codegen_1.Name,
21862
- };
21863
- if (validate.source)
21864
- validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
23530
+ if (parsed.host !== undefined) {
23531
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
21865
23532
  }
21866
- sch.validate = validate;
21867
- return sch;
21868
- }
21869
- catch (e) {
21870
- delete sch.validate;
21871
- delete sch.validateName;
21872
- if (sourceCode)
21873
- this.logger.error("Error compiling schema, function code:", sourceCode);
21874
- // console.log("\n\n\n *** \n", sourceCode, this.opts)
21875
- throw e;
21876
- }
21877
- finally {
21878
- this._compilations.delete(sch);
21879
- }
21880
- }
21881
- compile.compileSchema = compileSchema;
21882
- function resolveRef(root, baseId, ref) {
21883
- var _a;
21884
- ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
21885
- const schOrFunc = root.refs[ref];
21886
- if (schOrFunc)
21887
- return schOrFunc;
21888
- let _sch = resolve.call(this, root, ref);
21889
- if (_sch === undefined) {
21890
- const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
21891
- const { schemaId } = this.opts;
21892
- if (schema)
21893
- _sch = new SchemaEnv({ schema, schemaId, root, baseId });
23533
+ }
23534
+ if (parsed.path) {
23535
+ parsed.path = normalizePathEncoding(parsed.path);
23536
+ }
23537
+ if (parsed.fragment) {
23538
+ try {
23539
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
23540
+ } catch {
23541
+ parsed.error = parsed.error || 'URI malformed';
23542
+ }
23543
+ }
21894
23544
  }
21895
- if (_sch === undefined)
21896
- return;
21897
- return (root.refs[ref] = inlineOrCompile.call(this, _sch));
21898
- }
21899
- compile.resolveRef = resolveRef;
21900
- function inlineOrCompile(sch) {
21901
- if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
21902
- return sch.schema;
21903
- return sch.validate ? sch : compileSchema.call(this, sch);
21904
- }
21905
- // Index of schema compilation in the currently compiled list
21906
- function getCompilingSchema(schEnv) {
21907
- for (const sch of this._compilations) {
21908
- if (sameSchemaEnv(sch, schEnv))
21909
- return sch;
23545
+
23546
+ // perform scheme specific parsing
23547
+ if (schemeHandler && schemeHandler.parse) {
23548
+ schemeHandler.parse(parsed, options);
21910
23549
  }
23550
+ } else {
23551
+ parsed.error = parsed.error || 'URI can not be parsed.';
23552
+ }
23553
+ return { parsed, malformedAuthorityOrPort }
21911
23554
  }
21912
- compile.getCompilingSchema = getCompilingSchema;
21913
- function sameSchemaEnv(s1, s2) {
21914
- return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
21915
- }
21916
- // resolve and compile the references ($ref)
21917
- // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
21918
- function resolve(root, // information about the root schema for the current schema
21919
- ref // reference to resolve
21920
- ) {
21921
- let sch;
21922
- while (typeof (sch = this.refs[ref]) == "string")
21923
- ref = sch;
21924
- return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
23555
+
23556
+ /**
23557
+ * @param {string} uri
23558
+ * @param {import('./types/index').Options} [opts]
23559
+ * @returns
23560
+ */
23561
+ function parse (uri, opts) {
23562
+ return parseWithStatus(uri, opts).parsed
21925
23563
  }
21926
- // Resolve schema, its root and baseId
21927
- function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
21928
- ref // reference to resolve
21929
- ) {
21930
- const p = this.opts.uriResolver.parse(ref);
21931
- const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
21932
- let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined);
21933
- // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
21934
- if (Object.keys(root.schema).length > 0 && refPath === baseId) {
21935
- return getJsonPointer.call(this, p, root);
21936
- }
21937
- const id = (0, resolve_1.normalizeId)(refPath);
21938
- const schOrRef = this.refs[id] || this.schemas[id];
21939
- if (typeof schOrRef == "string") {
21940
- const sch = resolveSchema.call(this, root, schOrRef);
21941
- if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
21942
- return;
21943
- return getJsonPointer.call(this, p, sch);
21944
- }
21945
- if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
21946
- return;
21947
- if (!schOrRef.validate)
21948
- compileSchema.call(this, schOrRef);
21949
- if (id === (0, resolve_1.normalizeId)(ref)) {
21950
- const { schema } = schOrRef;
21951
- const { schemaId } = this.opts;
21952
- const schId = schema[schemaId];
21953
- if (schId)
21954
- baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
21955
- return new SchemaEnv({ schema, schemaId, root, baseId });
21956
- }
21957
- return getJsonPointer.call(this, p, schOrRef);
23564
+
23565
+ /**
23566
+ * @param {string} uri
23567
+ * @param {import('./types/index').Options} [opts]
23568
+ * @returns {string}
23569
+ */
23570
+ function normalizeString (uri, opts) {
23571
+ return normalizeStringWithStatus(uri, opts).normalized
21958
23572
  }
21959
- compile.resolveSchema = resolveSchema;
21960
- const PREVENT_SCOPE_CHANGE = new Set([
21961
- "properties",
21962
- "patternProperties",
21963
- "enum",
21964
- "dependencies",
21965
- "definitions",
21966
- ]);
21967
- function getJsonPointer(parsedRef, { baseId, schema, root }) {
21968
- var _a;
21969
- if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
21970
- return;
21971
- for (const part of parsedRef.fragment.slice(1).split("/")) {
21972
- if (typeof schema === "boolean")
21973
- return;
21974
- const partSchema = schema[(0, util_1.unescapeFragment)(part)];
21975
- if (partSchema === undefined)
21976
- return;
21977
- schema = partSchema;
21978
- // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
21979
- const schId = typeof schema === "object" && schema[this.opts.schemaId];
21980
- if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
21981
- baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
21982
- }
21983
- }
21984
- let env;
21985
- if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
21986
- const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
21987
- env = resolveSchema.call(this, root, $ref);
21988
- }
21989
- // even though resolution failed we need to return SchemaEnv to throw exception
21990
- // so that compileAsync loads missing schema.
21991
- const { schemaId } = this.opts;
21992
- env = env || new SchemaEnv({ schema, schemaId, root, baseId });
21993
- if (env.schema !== env.root.schema)
21994
- return env;
21995
- return undefined;
23573
+
23574
+ /**
23575
+ * @param {string} uri
23576
+ * @param {import('./types/index').Options} [opts]
23577
+ * @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
23578
+ */
23579
+ function normalizeStringWithStatus (uri, opts) {
23580
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
23581
+ return {
23582
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
23583
+ malformedAuthorityOrPort
23584
+ }
21996
23585
  }
21997
-
21998
- return compile;
21999
- }
22000
23586
 
22001
- var $id$1 = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
22002
- var description = "Meta-schema for $data reference (JSON AnySchema extension proposal)";
22003
- var type$1 = "object";
22004
- var required$1 = [
22005
- "$data"
22006
- ];
22007
- var properties$2 = {
22008
- $data: {
22009
- type: "string",
22010
- anyOf: [
22011
- {
22012
- format: "relative-json-pointer"
22013
- },
22014
- {
22015
- format: "json-pointer"
22016
- }
22017
- ]
23587
+ /**
23588
+ * @param {import ('./types/index').URIComponent|string} uri
23589
+ * @param {import('./types/index').Options} [opts]
23590
+ * @returns {string|undefined}
23591
+ */
23592
+ function normalizeComparableURI (uri, opts) {
23593
+ if (typeof uri === 'string') {
23594
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
23595
+ return malformedAuthorityOrPort ? undefined : normalized
23596
+ }
23597
+
23598
+ if (typeof uri === 'object') {
23599
+ return serialize(uri, opts)
23600
+ }
22018
23601
  }
22019
- };
22020
- var additionalProperties$1 = false;
22021
- var require$$9 = {
22022
- $id: $id$1,
22023
- description: description,
22024
- type: type$1,
22025
- required: required$1,
22026
- properties: properties$2,
22027
- additionalProperties: additionalProperties$1
22028
- };
22029
23602
 
22030
- var uri = {};
23603
+ const fastUri$1 = {
23604
+ SCHEMES,
23605
+ normalize,
23606
+ resolve,
23607
+ resolveComponent,
23608
+ equal,
23609
+ serialize,
23610
+ parse
23611
+ };
23612
+
23613
+ fastUri.exports = fastUri$1;
23614
+ fastUri.exports.default = fastUri$1;
23615
+ fastUri.exports.fastUri = fastUri$1;
23616
+ return fastUri.exports;
23617
+ }
22031
23618
 
22032
23619
  var hasRequiredUri;
22033
23620
 
@@ -25362,8 +26949,9 @@
25362
26949
  // add custom formats
25363
26950
  ajv.addFormat('data-url', DATA_URL_FORMAT_REGEX);
25364
26951
  ajv.addFormat('color', COLOR_FORMAT_REGEX);
25365
- // Add RJSF-specific additional properties keywords so Ajv doesn't report errors if strict is enabled.
25366
- ajv.addKeyword(ADDITIONAL_PROPERTY_FLAG);
26952
+ // Register the remaining string-keyed RJSF property so AJV strict mode doesn't reject it.
26953
+ // ADDITIONAL_PROPERTY_FLAG, RJSF_REF_KEY, and RJSF_REF_CYCLE_KEY are now Symbols and
26954
+ // invisible to AJV, so they no longer need to be registered as keywords.
25367
26955
  ajv.addKeyword(RJSF_ADDITIONAL_PROPERTIES_FLAG);
25368
26956
  // add more schemas to validate against
25369
26957
  if (Array.isArray(additionalMetaSchemas)) {
@@ -29475,8 +31063,8 @@
29475
31063
  ...getInputProps(schema, type, options),
29476
31064
  };
29477
31065
  const handleChange = ({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue);
29478
- const handleBlur = ({ target }) => onBlur(id, target && target.value);
29479
- const handleFocus = ({ target }) => onFocus(id, target && target.value);
31066
+ const handleBlur = ({ target }) => onBlur(id, target === null || target === void 0 ? void 0 : target.value);
31067
+ const handleFocus = ({ target }) => onFocus(id, target === null || target === void 0 ? void 0 : target.value);
29480
31068
  const handleClear = reactExports.useCallback((e) => {
29481
31069
  var _a;
29482
31070
  e.preventDefault();
@@ -29486,17 +31074,6 @@
29486
31074
  return (jsxRuntimeExports.jsxs("div", { className: 'p-0.5', children: [jsxRuntimeExports.jsx(Input, { id: id, name: htmlName || id, type: type, placeholder: placeholder, autoFocus: autofocus, required: required, disabled: disabled, readOnly: readonly, className: cn({ 'border-destructive focus-visible:ring-0': rawErrors.length > 0 }, className), list: schema.examples ? examplesId(id) : undefined, ...inputProps, value: value || value === 0 ? value : '', onChange: onChangeOverride || handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), options.allowClearTextInputs && !readonly && !disabled && value && (jsxRuntimeExports.jsx(ClearButton, { onClick: handleClear, registry: registry })), children, jsxRuntimeExports.jsx(SchemaExamples, { id: id, schema: schema })] }));
29487
31075
  }
29488
31076
 
29489
- /** The `DescriptionField` is the template to use to render the description of a field
29490
- *
29491
- * @param props - The `DescriptionFieldProps` for this component
29492
- */
29493
- function DescriptionField({ id, description, registry, uiSchema }) {
29494
- if (!description) {
29495
- return null;
29496
- }
29497
- return (jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { id: id, className: 'text-sm text-muted-foreground', children: jsxRuntimeExports.jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }) }));
29498
- }
29499
-
29500
31077
  const alertVariants = cva('relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current', {
29501
31078
  variants: {
29502
31079
  variant: {
@@ -29537,6 +31114,28 @@
29537
31114
  return (jsxRuntimeExports.jsx("div", { "data-slot": 'alert-description', className: cn('text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed', className), ...props }));
29538
31115
  }
29539
31116
 
31117
+ /** The `CyclicSchemaExpandTemplate` is the template to use to render the cyclic schema expand message and controls
31118
+ *
31119
+ * @param props - The `CyclicSchemaExpandProps` for this component
31120
+ */
31121
+ function CyclicSchemaExpandTemplate(props) {
31122
+ const { name, fieldPathId, registry, onExpand } = props;
31123
+ const { translateString } = registry;
31124
+ const buttonId = `${fieldPathId[ID_KEY]}-button`;
31125
+ return (jsxRuntimeExports.jsxs("div", { className: 'mt-4', children: [jsxRuntimeExports.jsxs(Alert, { variant: 'default', className: 'mb-2', children: [jsxRuntimeExports.jsx(CircleAlert, { className: 'h-4 w-4' }), jsxRuntimeExports.jsx(AlertDescription, { children: translateString(TranslatableString.CycleDetected, [name]) })] }), jsxRuntimeExports.jsx(Button, { id: buttonId, type: 'button', variant: 'outline', size: 'sm', className: cn('my-1'), onClick: () => onExpand(fieldPathId[ID_KEY]), children: translateString(TranslatableString.ExpandButton) })] }));
31126
+ }
31127
+
31128
+ /** The `DescriptionField` is the template to use to render the description of a field
31129
+ *
31130
+ * @param props - The `DescriptionFieldProps` for this component
31131
+ */
31132
+ function DescriptionField({ id, description, registry, uiSchema }) {
31133
+ if (!description) {
31134
+ return null;
31135
+ }
31136
+ return (jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { id: id, className: 'text-sm text-muted-foreground', children: jsxRuntimeExports.jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }) }));
31137
+ }
31138
+
29540
31139
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
29541
31140
  *
29542
31141
  * @param props - The `ErrorListProps` for this component
@@ -30082,6 +31681,7 @@
30082
31681
  ArrayFieldItemTemplate,
30083
31682
  ArrayFieldTemplate,
30084
31683
  BaseInputTemplate,
31684
+ CyclicSchemaExpandTemplate,
30085
31685
  ButtonTemplates: {
30086
31686
  AddButton,
30087
31687
  CopyButton,
@@ -30972,8 +32572,8 @@
30972
32572
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
30973
32573
  const optionValueFormat = getOptionValueFormat(options);
30974
32574
  const checkboxesValues = Array.isArray(value) ? value : [value];
30975
- const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
30976
- const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
32575
+ const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target === null || target === void 0 ? void 0 : target.value, enumOptions, optionValueFormat, emptyValue));
32576
+ const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target === null || target === void 0 ? void 0 : target.value, enumOptions, optionValueFormat, emptyValue));
30977
32577
  return (jsxRuntimeExports.jsx("div", { className: cn({ 'flex flex-col gap-2': !inline, 'flex flex-row gap-4 flex-wrap': inline }), children: Array.isArray(enumOptions) &&
30978
32578
  enumOptions.map((option, index) => {
30979
32579
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
@@ -32270,9 +33870,9 @@
32270
33870
  const { enumOptions, enumDisabled, emptyValue } = options;
32271
33871
  const optionValueFormat = getOptionValueFormat(options);
32272
33872
  const handleChange = (enumValue) => onChange(enumOptionValueDecoder(enumValue, enumOptions, optionValueFormat, emptyValue));
32273
- const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
32274
- const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
32275
- const inline = Boolean(options && options.inline);
33873
+ const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target === null || target === void 0 ? void 0 : target.value, enumOptions, optionValueFormat, emptyValue));
33874
+ const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target === null || target === void 0 ? void 0 : target.value, enumOptions, optionValueFormat, emptyValue));
33875
+ const inline = Boolean(options === null || options === void 0 ? void 0 : options.inline);
32276
33876
  return (jsxRuntimeExports.jsx("div", { className: 'mb-0', children: jsxRuntimeExports.jsx(RadioGroup, { defaultValue: value === null || value === void 0 ? void 0 : value.toString(), required: required, disabled: disabled || readonly, onValueChange: (e) => {
32277
33877
  handleChange(e);
32278
33878
  }, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id), orientation: inline ? 'horizontal' : 'vertical', className: cn('flex flex-wrap', { 'flex-col': !inline }, className), children: Array.isArray(enumOptions) &&
@@ -34835,7 +36435,8 @@
34835
36435
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newSelected.map((item) => item.index));
34836
36436
  }, [selectedItems, onValueChange, disabled]);
34837
36437
  const handleKeyDown = reactExports.useCallback((e) => {
34838
- if (disabled || !inputRef.current || inputRef.current.value !== '') {
36438
+ var _a;
36439
+ if (disabled || ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) !== '') {
34839
36440
  return;
34840
36441
  }
34841
36442
  if (e.key === 'Delete' || e.key === 'Backspace') {
@@ -34863,7 +36464,7 @@
34863
36464
  return (jsxRuntimeExports.jsxs(Command, { onKeyDown: handleKeyDown, className: cn('overflow-visible bg-transparent', className), autoFocus: autoFocus, "aria-disabled": disabled, onBlur: onBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedby, "aria-placeholder": ariaPlaceholder, children: [jsxRuntimeExports.jsx("div", { className: cn('group border border-input px-3 py-2 text-sm ring-offset-background rounded-md focus-within:ring-1 focus-within:ring-ring focus-within:ring-offset-1', disabled && 'opacity-50 cursor-not-allowed'), children: jsxRuntimeExports.jsxs("div", { className: 'flex gap-1 flex-wrap', children: [selectedItems.map((item) => (jsxRuntimeExports.jsxs(Badge, { variant: 'secondary', children: [item.label, jsxRuntimeExports.jsx("button", { type: 'button', className: 'rtl:mr-1 ltr:ml-1 ring-offset-background rounded-full outline-none focus:ring-1 focus:ring-ring focus:ring-offset-1', onKeyDown: (e) => e.key === 'Enter' && !disabled && handleUnselect(item), onMouseDown: (e) => {
34864
36465
  e.preventDefault();
34865
36466
  e.stopPropagation();
34866
- }, onClick: () => handleUnselect(item), disabled: disabled, children: jsxRuntimeExports.jsx(X$1, { className: cn('h-3 w-3 text-muted-foreground hover:text-foreground', disabled && 'pointer-events-none') }) })] }, item.value))), jsxRuntimeExports.jsx(_e.Input, { ref: inputRef, value: inputValue, onValueChange: setInputValue, onBlur: () => setOpen(false), onFocus: () => !disabled && setOpen(true), placeholder: 'Select ...', className: 'rtl:mr-2 ltr:ml-2 bg-transparent outline-none placeholder:text-muted-foreground flex-1', disabled: disabled, "aria-controls": `command-item-input-${id}`, "aria-labelledby": `command-item-input-${id}`, id: `command-item-input-${id}` })] }) }), open && !disabled && selectables.length > 0 && (jsxRuntimeExports.jsx("div", { className: 'relative mt-2', children: jsxRuntimeExports.jsx("div", { className: 'absolute w-full z-10 top-0 rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in', children: jsxRuntimeExports.jsx(CommandGroup, { className: 'h-full overflow-auto', children: jsxRuntimeExports.jsx(CommandList, { children: selectables.map((item) => (jsxRuntimeExports.jsx(CommandItem, { disabled: item.disabled, onMouseDown: (e) => {
36467
+ }, onClick: () => handleUnselect(item), disabled: disabled, children: jsxRuntimeExports.jsx(X$1, { className: cn('h-3 w-3 text-muted-foreground hover:text-foreground', disabled && 'pointer-events-none') }) })] }, item.value))), jsxRuntimeExports.jsx(_e.Input, { ref: inputRef, value: inputValue, onValueChange: setInputValue, onBlur: () => setOpen(false), onFocus: () => !disabled && setOpen(true), placeholder: 'Select ...', className: 'rtl:mr-2 ltr:ml-2 bg-transparent outline-none placeholder:text-muted-foreground flex-1', disabled: disabled, "aria-controls": `command-item-input-${id}`, "aria-labelledby": `command-item-input-${id}`, id: `command-item-input-${id}` })] }) }), open && !disabled && selectables.length > 0 && (jsxRuntimeExports.jsx("div", { className: 'relative mt-2', children: jsxRuntimeExports.jsx("div", { className: 'absolute w-full z-10 top-0 rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in', children: jsxRuntimeExports.jsx(CommandGroup, { className: 'h-full overflow-auto', children: jsxRuntimeExports.jsx(CommandList, { children: selectables.map((item) => (jsxRuntimeExports.jsx(CommandItem, { disabled: item.disabled, value: String(item.value), onMouseDown: (e) => {
34867
36468
  e.preventDefault();
34868
36469
  e.stopPropagation();
34869
36470
  }, "aria-controls": `${item.value}-command-item`, "aria-labelledby": `${item.value}-command-item`, id: `${item.value}-command-item`, onSelect: () => handleSelect(item), className: 'cursor-pointer', children: item.label }, `${item.value}-command-item`))) }) }) }) }))] }));
@@ -34893,7 +36494,13 @@
34893
36494
  }
34894
36495
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
34895
36496
  };
34896
- return (jsxRuntimeExports.jsxs(Command, { ref: containerRef, className: cn('overflow-visible bg-transparent', className), autoFocus: autoFocus, "aria-disabled": disabled, onBlur: handleBlur, onFocus: onFocus, "aria-describedby": ariaDescribedby, "aria-placeholder": ariaPlaceholder, children: [jsxRuntimeExports.jsxs("div", { role: 'button', tabIndex: disabled ? -1 : 0, onClick: () => !disabled && setOpen(!open), onKeyDown: (e) => (e.key === 'Enter' || e.key === ' ') && !disabled && setOpen(!open), className: cn('flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50', !selectedItem && required && 'border-red-500', disabled && 'opacity-50 cursor-not-allowed', className), children: [jsxRuntimeExports.jsx("span", { className: cn('flex-1 line-clamp-1', !selectedItem && 'text-muted-foreground'), children: (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label) || placeholder }), jsxRuntimeExports.jsx(ChevronDown, { className: 'h-4 w-4 opacity-50' })] }), jsxRuntimeExports.jsx("div", { className: 'relative', children: open && items && items.length > 0 ? (jsxRuntimeExports.jsx("div", { style: { top: '0.5rem' }, className: 'absolute w-full z-10 rounded-md border bg-popover text-popover-foreground shadow-md outline-none', children: jsxRuntimeExports.jsx(CommandGroup, { className: 'h-full overflow-auto', children: jsxRuntimeExports.jsx(CommandList, { children: items.map((item) => (jsxRuntimeExports.jsxs(CommandItem, { ref: item.value === selected ? selectedRef : undefined, onMouseDown: (e) => {
36497
+ return (jsxRuntimeExports.jsxs(Command, { ref: containerRef, className: cn('overflow-visible bg-transparent', className), autoFocus: autoFocus, "aria-disabled": disabled, onBlur: handleBlur, onFocus: onFocus, "aria-describedby": ariaDescribedby, "aria-placeholder": ariaPlaceholder, children: [jsxRuntimeExports.jsxs("button", { type: 'button', disabled: disabled, "aria-expanded": open, "aria-haspopup": 'listbox', onClick: () => !disabled && setOpen(!open), onKeyDown: (e) => {
36498
+ if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
36499
+ e.preventDefault();
36500
+ e.stopPropagation();
36501
+ setOpen(!open);
36502
+ }
36503
+ }, className: cn('flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50', !selectedItem && required && 'border-red-500', disabled && 'opacity-50 cursor-not-allowed', className), children: [jsxRuntimeExports.jsx("span", { className: cn('flex-1 line-clamp-1', !selectedItem && 'text-muted-foreground'), children: (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label) || placeholder }), jsxRuntimeExports.jsx(ChevronDown, { className: 'h-4 w-4 opacity-50' })] }), jsxRuntimeExports.jsx("div", { className: 'relative', children: open && items && items.length > 0 ? (jsxRuntimeExports.jsx("div", { style: { top: '0.5rem' }, className: 'absolute w-full z-10 rounded-md border bg-popover text-popover-foreground shadow-md outline-none', children: jsxRuntimeExports.jsx(CommandGroup, { className: 'h-full overflow-auto', children: jsxRuntimeExports.jsx(CommandList, { children: items.map((item) => (jsxRuntimeExports.jsxs(CommandItem, { ref: item.value === selected ? selectedRef : undefined, value: String(item.value), onMouseDown: (e) => {
34897
36504
  e.preventDefault();
34898
36505
  e.stopPropagation();
34899
36506
  }, onSelect: () => {
@@ -34909,9 +36516,10 @@
34909
36516
  *
34910
36517
  * @param props - The `WidgetProps` for this component
34911
36518
  */
34912
- function SelectWidget({ id, options, required, disabled, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, placeholder, rawErrors = [], className, }) {
36519
+ function SelectWidget({ id, options, required, disabled, readonly, value, schema, multiple, autofocus, onChange, onBlur, onFocus, placeholder, rawErrors = [], className, registry, uiSchema, }) {
34913
36520
  const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
34914
36521
  const optionValueFormat = getOptionValueFormat(options);
36522
+ logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
34915
36523
  const handleFancyFocus = () => {
34916
36524
  onFocus(id, enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyValue));
34917
36525
  };
@@ -34925,11 +36533,11 @@
34925
36533
  disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue),
34926
36534
  }));
34927
36535
  const cnClassName = cn({ 'border-destructive': rawErrors.length > 0 }, className);
34928
- return (jsxRuntimeExports.jsx("div", { className: 'p-0.5', children: !multiple ? (jsxRuntimeExports.jsx(FancySelect, { items: items, selected: enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, ''), onValueChange: (selectedValue) => {
34929
- onChange(enumOptionValueDecoder(selectedValue, enumOptions, optionValueFormat, optEmptyValue));
34930
- }, autoFocus: autofocus, disabled: disabled || readonly, required: required, placeholder: placeholder, className: cnClassName, onFocus: handleFancyFocus, onBlur: handleFancyBlur, ariaDescribedby: ariaDescribedByIds(id) })) : (jsxRuntimeExports.jsx(FancyMultiSelect, { id: id, autoFocus: autofocus, disabled: disabled || readonly, multiple: true, className: cnClassName, items: items, selected: value, onValueChange: (values) => {
34931
- onChange(enumOptionValueDecoder(values.map(String), enumOptions, optionValueFormat, optEmptyValue));
34932
- }, onFocus: handleFancyFocus, onBlur: handleFancyBlur })) }));
36536
+ return (jsxRuntimeExports.jsxs("div", { className: 'p-0.5', children: [!multiple ? (jsxRuntimeExports.jsx(FancySelect, { items: items, selected: enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, ''), onValueChange: (selectedValue) => {
36537
+ onChange(enumOptionValueDecoder(selectedValue, enumOptions, optionValueFormat, optEmptyValue));
36538
+ }, autoFocus: autofocus, disabled: disabled || readonly, required: required, placeholder: placeholder, className: cnClassName, onFocus: handleFancyFocus, onBlur: handleFancyBlur, ariaDescribedby: ariaDescribedByIds(id) })) : (jsxRuntimeExports.jsx(FancyMultiSelect, { id: id, autoFocus: autofocus, disabled: disabled || readonly, multiple: true, className: cnClassName, items: items, selected: value, onValueChange: (values) => {
36539
+ onChange(enumOptionValueDecoder(values.map(String), enumOptions, optionValueFormat, optEmptyValue));
36540
+ }, onFocus: handleFancyFocus, onBlur: handleFancyBlur })), jsxRuntimeExports.jsx(SelectedOptionDescription, { id: id, multiple: multiple, options: options, registry: registry, uiSchema: uiSchema, value: value })] }));
34933
36541
  }
34934
36542
 
34935
36543
  /**
@@ -34950,8 +36558,8 @@
34950
36558
  */
34951
36559
  function TextareaWidget({ id, htmlName, placeholder, value, required, disabled, autofocus, readonly, onBlur, onFocus, onChange, options, className, }) {
34952
36560
  const handleChange = ({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue);
34953
- const handleBlur = ({ target }) => onBlur(id, target && target.value);
34954
- const handleFocus = ({ target }) => onFocus(id, target && target.value);
36561
+ const handleBlur = ({ target }) => onBlur(id, target === null || target === void 0 ? void 0 : target.value);
36562
+ const handleFocus = ({ target }) => onFocus(id, target === null || target === void 0 ? void 0 : target.value);
34955
36563
  return (jsxRuntimeExports.jsx("div", { className: 'flex p-0.5', children: jsxRuntimeExports.jsx(Textarea, { id: id, name: htmlName || id, placeholder: placeholder, disabled: disabled, readOnly: readonly, value: value !== null && value !== void 0 ? value : '', required: required, autoFocus: autofocus, rows: options.rows || 5, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id), className: className }) }));
34956
36564
  }
34957
36565