swagger-client 3.27.3 → 3.27.4

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.
@@ -41,19 +41,19 @@ __webpack_require__.r(__webpack_exports__);
41
41
  /* harmony export */ self: () => (/* binding */ self)
42
42
  /* harmony export */ });
43
43
  /* harmony import */ var cookie__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57427);
44
- /* harmony import */ var is_plain_object__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(58270);
45
- /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(19500);
44
+ /* harmony import */ var is_plain_object__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(58270);
45
+ /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(19500);
46
46
  /* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(83748);
47
47
  /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3832);
48
48
  /* harmony import */ var _http_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51670);
49
49
  /* harmony import */ var _http_serializers_request_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29382);
50
50
  /* harmony import */ var _swagger2_parameter_builders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(90520);
51
- /* harmony import */ var _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42276);
52
- /* harmony import */ var _oas3_build_request_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53044);
53
- /* harmony import */ var _swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77768);
54
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(47555);
51
+ /* harmony import */ var _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42276);
52
+ /* harmony import */ var _oas3_build_request_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(53044);
53
+ /* harmony import */ var _swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(77768);
54
+ /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47555);
55
55
  /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(50324);
56
- /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(50918);
56
+ /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(50918);
57
57
 
58
58
 
59
59
 
@@ -95,7 +95,7 @@ const parseURIReference = uriReference => {
95
95
  };
96
96
  }
97
97
  };
98
- class OperationNotFoundError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_7__["default"] {}
98
+ class OperationNotFoundError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"] {}
99
99
  const findParametersWithName = (name, parameters) => parameters.filter(p => p.name === name);
100
100
 
101
101
  // removes parameters that have duplicate 'in' and 'name' properties
@@ -139,7 +139,7 @@ function execute({
139
139
  const http = userHttp || fetch || _http_index_js__WEBPACK_IMPORTED_MODULE_2__["default"]; // Default to _our_ http
140
140
 
141
141
  if (pathName && method && !operationId) {
142
- operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_8__["default"])(pathName, method);
142
+ operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_9__["default"])(pathName, method);
143
143
  }
144
144
  const request = self.buildRequest({
145
145
  spec,
@@ -149,7 +149,7 @@ function execute({
149
149
  http,
150
150
  ...extras
151
151
  });
152
- if (request.body && ((0,is_plain_object__WEBPACK_IMPORTED_MODULE_9__.isPlainObject)(request.body) || Array.isArray(request.body))) {
152
+ if (request.body && ((0,is_plain_object__WEBPACK_IMPORTED_MODULE_10__.isPlainObject)(request.body) || Array.isArray(request.body))) {
153
153
  request.body = JSON.stringify(request.body);
154
154
  }
155
155
 
@@ -177,11 +177,11 @@ function buildRequest(options) {
177
177
  parameters,
178
178
  parameterBuilders
179
179
  } = options;
180
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__.isOpenAPI3)(spec);
180
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__.isOpenAPI3)(spec);
181
181
  if (!parameterBuilders) {
182
182
  // user did not provide custom parameter builders
183
183
  if (specIsOAS3) {
184
- parameterBuilders = _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_11__;
184
+ parameterBuilders = _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_5__;
185
185
  } else {
186
186
  parameterBuilders = _swagger2_parameter_builders_js__WEBPACK_IMPORTED_MODULE_4__["default"];
187
187
  }
@@ -289,7 +289,8 @@ function buildRequest(options) {
289
289
  parameter,
290
290
  value,
291
291
  operation,
292
- spec
292
+ spec,
293
+ pathName
293
294
  });
294
295
  }
295
296
  });
@@ -300,10 +301,10 @@ function buildRequest(options) {
300
301
  operation
301
302
  };
302
303
  if (specIsOAS3) {
303
- req = (0,_oas3_build_request_js__WEBPACK_IMPORTED_MODULE_5__["default"])(versionSpecificOptions, req);
304
+ req = (0,_oas3_build_request_js__WEBPACK_IMPORTED_MODULE_6__["default"])(versionSpecificOptions, req);
304
305
  } else {
305
306
  // If not OAS3, then treat as Swagger2.
306
- req = (0,_swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_6__["default"])(versionSpecificOptions, req);
307
+ req = (0,_swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_7__["default"])(versionSpecificOptions, req);
307
308
  }
308
309
 
309
310
  // If the cookie convenience object exists in our request,
@@ -332,7 +333,7 @@ const stripNonAlpha = str => str ? str.replace(/\W/g, '') : null;
332
333
 
333
334
  // be careful when modifying this! it is a publicly-exposed method.
334
335
  function baseUrl(obj) {
335
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__.isOpenAPI3)(obj.spec);
336
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__.isOpenAPI3)(obj.spec);
336
337
  return specIsOAS3 ? oas3BaseUrl(obj) : swagger2BaseUrl(obj);
337
338
  }
338
339
  const isNonEmptyServerList = value => Array.isArray(value) && value.length > 0;
@@ -667,14 +668,17 @@ __webpack_require__.r(__webpack_exports__);
667
668
  /* harmony export */ path: () => (/* binding */ path),
668
669
  /* harmony export */ query: () => (/* binding */ query)
669
670
  /* harmony export */ });
670
- /* harmony import */ var _style_serializer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33838);
671
- /* harmony import */ var _content_serializer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27986);
671
+ /* harmony import */ var openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61546);
672
+ /* harmony import */ var _style_serializer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33838);
673
+ /* harmony import */ var _content_serializer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27986);
674
+
672
675
 
673
676
 
674
677
  function path({
675
678
  req,
676
679
  value,
677
- parameter
680
+ parameter,
681
+ pathName
678
682
  }) {
679
683
  const {
680
684
  name,
@@ -683,19 +687,28 @@ function path({
683
687
  content
684
688
  } = parameter;
685
689
  if (value === undefined) return;
690
+ let resolvedPathname;
686
691
  if (content) {
687
692
  const effectiveMediaType = Object.keys(content)[0];
688
- req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)));
693
+ resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
694
+ [name]: value
695
+ }, {
696
+ encoder: val => (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(val, effectiveMediaType))
697
+ });
689
698
  } else {
690
- const styledValue = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
691
- key: parameter.name,
692
- value,
693
- style: style || 'simple',
694
- explode: explode || false,
695
- escape: 'reserved'
699
+ resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
700
+ [name]: value
701
+ }, {
702
+ encoder: val => (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
703
+ key: parameter.name,
704
+ value: val,
705
+ style: style || 'simple',
706
+ explode: explode || false,
707
+ escape: 'reserved'
708
+ })
696
709
  });
697
- req.url = req.url.replace(new RegExp(`{${name}}`, 'g'), styledValue);
698
710
  }
711
+ req.url = req.url.replace(pathName, resolvedPathname);
699
712
  }
700
713
  function query({
701
714
  req,
@@ -705,7 +718,7 @@ function query({
705
718
  req.query = req.query || {};
706
719
  if (value !== undefined && parameter.content) {
707
720
  const effectiveMediaType = Object.keys(parameter.content)[0];
708
- const serializedValue = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType);
721
+ const serializedValue = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType);
709
722
  if (serializedValue) {
710
723
  req.query[parameter.name] = serializedValue;
711
724
  } else if (parameter.allowEmptyValue) {
@@ -753,11 +766,11 @@ function header({
753
766
  }
754
767
  if (value !== undefined && parameter.content) {
755
768
  const effectiveMediaType = Object.keys(parameter.content)[0];
756
- req.headers[parameter.name] = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType);
769
+ req.headers[parameter.name] = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType);
757
770
  return;
758
771
  }
759
772
  if (value !== undefined && !(Array.isArray(value) && value.length === 0)) {
760
- req.headers[parameter.name] = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
773
+ req.headers[parameter.name] = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
761
774
  key: parameter.name,
762
775
  value,
763
776
  style: parameter.style || 'simple',
@@ -775,12 +788,12 @@ function cookie({
775
788
  const type = typeof value;
776
789
  if (value !== undefined && parameter.content) {
777
790
  const effectiveMediaType = Object.keys(parameter.content)[0];
778
- req.headers.Cookie = `${parameter.name}=${(0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)}`;
791
+ req.headers.Cookie = `${parameter.name}=${(0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType)}`;
779
792
  return;
780
793
  }
781
794
  if (value !== undefined && !(Array.isArray(value) && value.length === 0)) {
782
795
  const prefix = type === 'object' && !Array.isArray(value) && parameter.explode ? '' : `${parameter.name}=`;
783
- req.headers.Cookie = prefix + (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
796
+ req.headers.Cookie = prefix + (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
784
797
  key: parameter.name,
785
798
  value,
786
799
  escape: false,
@@ -1085,6 +1098,9 @@ __webpack_require__.r(__webpack_exports__);
1085
1098
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1086
1099
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1087
1100
  /* harmony export */ });
1101
+ /* harmony import */ var openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61546);
1102
+
1103
+
1088
1104
  // These functions will update the request.
1089
1105
  // They'll be given {req, value, paramter, spec, operation}.
1090
1106
 
@@ -1148,10 +1164,14 @@ function headerBuilder({
1148
1164
  function pathBuilder({
1149
1165
  req,
1150
1166
  value,
1151
- parameter
1167
+ parameter,
1168
+ pathName
1152
1169
  }) {
1153
1170
  if (value !== undefined) {
1154
- req.url = req.url.replace(new RegExp(`{${parameter.name}}`, 'g'), encodeURIComponent(value));
1171
+ const resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
1172
+ [parameter.name]: value
1173
+ });
1174
+ req.url = req.url.replace(pathName, resolvedPathname);
1155
1175
  }
1156
1176
  }
1157
1177
 
@@ -39013,6 +39033,1250 @@ const unsanitize = uri => {
39013
39033
  return decodeURI(uri);
39014
39034
  };
39015
39035
 
39036
+ /***/ }),
39037
+
39038
+ /***/ 16646:
39039
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
39040
+
39041
+ "use strict";
39042
+ __webpack_require__.r(__webpack_exports__);
39043
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39044
+ /* harmony export */ Ast: () => (/* binding */ Ast),
39045
+ /* harmony export */ Parser: () => (/* binding */ Parser),
39046
+ /* harmony export */ Stats: () => (/* binding */ Stats),
39047
+ /* harmony export */ Trace: () => (/* binding */ Trace),
39048
+ /* harmony export */ identifiers: () => (/* binding */ identifiers),
39049
+ /* harmony export */ utilities: () => (/* binding */ utilities)
39050
+ /* harmony export */ });
39051
+ /* *************************************************************************************
39052
+ * copyright: Copyright (c) 2023 Lowell D. Thomas, all rights reserved
39053
+ * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
39054
+ *
39055
+ * Redistribution and use in source and binary forms, with or without
39056
+ * modification, are permitted provided that the following conditions are met:
39057
+ *
39058
+ * 1. Redistributions of source code must retain the above copyright notice, this
39059
+ * list of conditions and the following disclaimer.
39060
+ *
39061
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
39062
+ * this list of conditions and the following disclaimer in the documentation
39063
+ * and/or other materials provided with the distribution.
39064
+ *
39065
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39066
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39067
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39068
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
39069
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39070
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39071
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39072
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39073
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39074
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39075
+ *
39076
+ * ********************************************************************************* */
39077
+
39078
+
39079
+ const Parser = function fnparser() {
39080
+ const id = identifiers;
39081
+ const utils = utilities;
39082
+ const p = this;
39083
+ const thisFileName = 'parser.js: Parser(): ';
39084
+ const systemData = function systemData() {
39085
+ this.state = id.ACTIVE;
39086
+ this.phraseLength = 0;
39087
+ this.refresh = () => {
39088
+ this.state = id.ACTIVE;
39089
+ this.phraseLength = 0;
39090
+ };
39091
+ };
39092
+ p.ast = undefined;
39093
+ p.stats = undefined;
39094
+ p.trace = undefined;
39095
+ p.callbacks = [];
39096
+ let lookAhead = 0;
39097
+ let treeDepth = 0;
39098
+ let maxTreeDepth = 0;
39099
+ let nodeHits = 0;
39100
+ let maxMatched = 0;
39101
+ let rules = undefined;
39102
+ let udts = undefined;
39103
+ let opcodes = undefined;
39104
+ let chars = undefined;
39105
+ let sysData = new systemData();
39106
+ let ruleCallbacks = undefined;
39107
+ let udtCallbacks = undefined;
39108
+ let userData = undefined;
39109
+ const clear = () => {
39110
+ lookAhead = 0;
39111
+ treeDepth = 0;
39112
+ maxTreeDepth = 0;
39113
+ nodeHits = 0;
39114
+ maxMatched = 0;
39115
+ rules = undefined;
39116
+ udts = undefined;
39117
+ opcodes = undefined;
39118
+ chars = undefined;
39119
+ sysData.refresh();
39120
+ ruleCallbacks = undefined;
39121
+ udtCallbacks = undefined;
39122
+ userData = undefined;
39123
+ };
39124
+
39125
+ const initializeCallbacks = () => {
39126
+ const functionName = `${thisFileName}initializeCallbacks(): `;
39127
+ let i;
39128
+ ruleCallbacks = [];
39129
+ udtCallbacks = [];
39130
+ for (i = 0; i < rules.length; i += 1) {
39131
+ ruleCallbacks[i] = undefined;
39132
+ }
39133
+ for (i = 0; i < udts.length; i += 1) {
39134
+ udtCallbacks[i] = undefined;
39135
+ }
39136
+ let func;
39137
+ const list = [];
39138
+ for (i = 0; i < rules.length; i += 1) {
39139
+ list.push(rules[i].lower);
39140
+ }
39141
+ for (i = 0; i < udts.length; i += 1) {
39142
+ list.push(udts[i].lower);
39143
+ }
39144
+ for (const index in p.callbacks) {
39145
+ i = list.indexOf(index.toLowerCase());
39146
+ if (i < 0) {
39147
+ throw new Error(`${functionName}syntax callback '${index}' not a rule or udt name`);
39148
+ }
39149
+ func = p.callbacks[index] ? p.callbacks[index] : undefined;
39150
+ if (typeof func === 'function' || func === undefined) {
39151
+ if (i < rules.length) {
39152
+ ruleCallbacks[i] = func;
39153
+ } else {
39154
+ udtCallbacks[i - rules.length] = func;
39155
+ }
39156
+ } else {
39157
+ throw new Error(`${functionName}syntax callback[${index}] must be function reference or falsy)`);
39158
+ }
39159
+ }
39160
+ };
39161
+
39162
+ p.parse = (grammar, startName, inputString, callbackData) => {
39163
+ const functionName = `${thisFileName}parse(): `;
39164
+ clear();
39165
+ chars = utils.stringToChars(inputString);
39166
+ rules = grammar.rules;
39167
+ udts = grammar.udts;
39168
+ const lower = startName.toLowerCase();
39169
+ let startIndex = undefined;
39170
+ for (const i in rules) {
39171
+ if (lower === rules[i].lower) {
39172
+ startIndex = rules[i].index;
39173
+ break;
39174
+ }
39175
+ }
39176
+ if (startIndex === undefined) {
39177
+ throw new Error(`${functionName}start rule name '${startRule}' not recognized`);
39178
+ }
39179
+ initializeCallbacks();
39180
+ if (p.trace) {
39181
+ p.trace.init(rules, udts, chars);
39182
+ }
39183
+ if (p.stats) {
39184
+ p.stats.init(rules, udts);
39185
+ }
39186
+ if (p.ast) {
39187
+ p.ast.init(rules, udts, chars);
39188
+ }
39189
+ userData = callbackData;
39190
+ /* create a dummy opcode for the start rule */
39191
+ opcodes = [
39192
+ {
39193
+ type: id.RNM,
39194
+ index: startIndex,
39195
+ },
39196
+ ];
39197
+ /* execute the start rule */
39198
+ opExecute(0, 0);
39199
+ opcodes = undefined;
39200
+ /* test and return the sysData */
39201
+ let success = false;
39202
+ switch (sysData.state) {
39203
+ case id.ACTIVE:
39204
+ throw new Error(`${functionName}final state should never be 'ACTIVE'`);
39205
+ case id.NOMATCH:
39206
+ success = false;
39207
+ break;
39208
+ case id.EMPTY:
39209
+ case id.MATCH:
39210
+ if (sysData.phraseLength === chars.length) {
39211
+ success = true;
39212
+ } else {
39213
+ success = false;
39214
+ }
39215
+ break;
39216
+ default:
39217
+ throw new Error('unrecognized state');
39218
+ }
39219
+ return {
39220
+ success,
39221
+ state: sysData.state,
39222
+ stateName: id.idName(sysData.state),
39223
+ length: chars.length,
39224
+ matched: sysData.phraseLength,
39225
+ maxMatched,
39226
+ maxTreeDepth,
39227
+ nodeHits,
39228
+ };
39229
+ };
39230
+ // The `ALT` operator.<br>
39231
+ // Executes its child nodes, from left to right, until it finds a match.
39232
+ // Fails if *all* of its child nodes fail.
39233
+ const opALT = (opIndex, phraseIndex) => {
39234
+ const op = opcodes[opIndex];
39235
+ for (let i = 0; i < op.children.length; i += 1) {
39236
+ opExecute(op.children[i], phraseIndex);
39237
+ if (sysData.state !== id.NOMATCH) {
39238
+ break;
39239
+ }
39240
+ }
39241
+ };
39242
+ // The `CAT` operator.<br>
39243
+ // Executes all of its child nodes, from left to right,
39244
+ // concatenating the matched phrases.
39245
+ // Fails if *any* child nodes fail.
39246
+ const opCAT = (opIndex, phraseIndex) => {
39247
+ let success;
39248
+ let astLength;
39249
+ let catCharIndex;
39250
+ let catPhrase;
39251
+ const op = opcodes[opIndex];
39252
+ if (p.ast) {
39253
+ astLength = p.ast.getLength();
39254
+ }
39255
+ success = true;
39256
+ catCharIndex = phraseIndex;
39257
+ catPhrase = 0;
39258
+ for (let i = 0; i < op.children.length; i += 1) {
39259
+ opExecute(op.children[i], catCharIndex);
39260
+ if (sysData.state === id.NOMATCH) {
39261
+ success = false;
39262
+ break;
39263
+ } else {
39264
+ catCharIndex += sysData.phraseLength;
39265
+ catPhrase += sysData.phraseLength;
39266
+ }
39267
+ }
39268
+ if (success) {
39269
+ sysData.state = catPhrase === 0 ? id.EMPTY : id.MATCH;
39270
+ sysData.phraseLength = catPhrase;
39271
+ } else {
39272
+ sysData.state = id.NOMATCH;
39273
+ sysData.phraseLength = 0;
39274
+ if (p.ast) {
39275
+ p.ast.setLength(astLength);
39276
+ }
39277
+ }
39278
+ };
39279
+ // The `REP` operator.<br>
39280
+ // Repeatedly executes its single child node,
39281
+ // concatenating each of the matched phrases found.
39282
+ // The number of repetitions executed and its final sysData depends
39283
+ // on its `min` & `max` repetition values.
39284
+ const opREP = (opIndex, phraseIndex) => {
39285
+ let astLength;
39286
+ let repCharIndex;
39287
+ let repPhrase;
39288
+ let repCount;
39289
+ const op = opcodes[opIndex];
39290
+ if (op.max === 0) {
39291
+ // this is an empty-string acceptor
39292
+ // deprecated: use the TLS empty string operator, "", instead
39293
+ sysData.state = id.EMPTY;
39294
+ sysData.phraseLength = 0;
39295
+ return;
39296
+ }
39297
+ repCharIndex = phraseIndex;
39298
+ repPhrase = 0;
39299
+ repCount = 0;
39300
+ if (p.ast) {
39301
+ astLength = p.ast.getLength();
39302
+ }
39303
+ while (1) {
39304
+ if (repCharIndex >= chars.length) {
39305
+ /* exit on end of input string */
39306
+ break;
39307
+ }
39308
+ opExecute(opIndex + 1, repCharIndex);
39309
+ if (sysData.state === id.NOMATCH) {
39310
+ /* always end if the child node fails */
39311
+ break;
39312
+ }
39313
+ if (sysData.state === id.EMPTY) {
39314
+ /* REP always succeeds when the child node returns an empty phrase */
39315
+ /* this may not seem obvious, but that's the way it works out */
39316
+ break;
39317
+ }
39318
+ repCount += 1;
39319
+ repPhrase += sysData.phraseLength;
39320
+ repCharIndex += sysData.phraseLength;
39321
+ if (repCount === op.max) {
39322
+ /* end on maxed out reps */
39323
+ break;
39324
+ }
39325
+ }
39326
+ /* evaluate the match count according to the min, max values */
39327
+ if (sysData.state === id.EMPTY) {
39328
+ sysData.state = repPhrase === 0 ? id.EMPTY : id.MATCH;
39329
+ sysData.phraseLength = repPhrase;
39330
+ } else if (repCount >= op.min) {
39331
+ sysData.state = repPhrase === 0 ? id.EMPTY : id.MATCH;
39332
+ sysData.phraseLength = repPhrase;
39333
+ } else {
39334
+ sysData.state = id.NOMATCH;
39335
+ sysData.phraseLength = 0;
39336
+ if (p.ast) {
39337
+ p.ast.setLength(astLength);
39338
+ }
39339
+ }
39340
+ };
39341
+ // Validate the callback function's returned sysData values.
39342
+ // It's the user's responsibility to get them right
39343
+ // but `RNM` fails if not.
39344
+ const validateRnmCallbackResult = (rule, sysData, charsLeft, down) => {
39345
+ if (sysData.phraseLength > charsLeft) {
39346
+ let str = `${thisFileName}opRNM(${rule.name}): callback function error: `;
39347
+ str += `sysData.phraseLength: ${sysData.phraseLength}`;
39348
+ str += ` must be <= remaining chars: ${charsLeft}`;
39349
+ throw new Error(str);
39350
+ }
39351
+ switch (sysData.state) {
39352
+ case id.ACTIVE:
39353
+ if (!down) {
39354
+ throw new Error(
39355
+ `${thisFileName}opRNM(${rule.name}): callback function return error. ACTIVE state not allowed.`
39356
+ );
39357
+ }
39358
+ break;
39359
+ case id.EMPTY:
39360
+ sysData.phraseLength = 0;
39361
+ break;
39362
+ case id.MATCH:
39363
+ if (sysData.phraseLength === 0) {
39364
+ sysData.state = id.EMPTY;
39365
+ }
39366
+ break;
39367
+ case id.NOMATCH:
39368
+ sysData.phraseLength = 0;
39369
+ break;
39370
+ default:
39371
+ throw new Error(
39372
+ `${thisFileName}opRNM(${rule.name}): callback function return error. Unrecognized return state: ${sysData.state}`
39373
+ );
39374
+ }
39375
+ };
39376
+ // The `RNM` operator.<br>
39377
+ // This operator will acts as a root node for a parse tree branch below and
39378
+ // returns the matched phrase to its parent.
39379
+ // However, its larger responsibility is handling user-defined callback functions and `AST` nodes.
39380
+ // Note that the `AST` is a separate object, but `RNM` calls its functions to create its nodes.
39381
+ const opRNM = (opIndex, phraseIndex) => {
39382
+ let astLength;
39383
+ let astDefined;
39384
+ let savedOpcodes;
39385
+ const op = opcodes[opIndex];
39386
+ const rule = rules[op.index];
39387
+ const callback = ruleCallbacks[rule.index];
39388
+ /* ignore AST in look ahead (AND or NOT operator above) */
39389
+ if (!lookAhead) {
39390
+ astDefined = p.ast && p.ast.ruleDefined(op.index);
39391
+ if (astDefined) {
39392
+ astLength = p.ast.getLength();
39393
+ p.ast.down(op.index, rules[op.index].name);
39394
+ }
39395
+ }
39396
+ if (callback) {
39397
+ /* call user's callback going down the parse tree*/
39398
+ const charsLeft = chars.length - phraseIndex;
39399
+ callback(sysData, chars, phraseIndex, userData);
39400
+ validateRnmCallbackResult(rule, sysData, charsLeft, true);
39401
+ if (sysData.state === id.ACTIVE) {
39402
+ savedOpcodes = opcodes;
39403
+ opcodes = rule.opcodes;
39404
+ opExecute(0, phraseIndex);
39405
+ opcodes = savedOpcodes;
39406
+ /* call user's callback going up the parse tree*/
39407
+ callback(sysData, chars, phraseIndex, userData);
39408
+ validateRnmCallbackResult(rule, sysData, charsLeft, false);
39409
+ } /* implied else clause: just accept the callback sysData - RNM acting as UDT */
39410
+ } else {
39411
+ /* no callback - just execute the rule */
39412
+ savedOpcodes = opcodes;
39413
+ opcodes = rule.opcodes;
39414
+ opExecute(0, phraseIndex, sysData);
39415
+ opcodes = savedOpcodes;
39416
+ }
39417
+ if (!lookAhead) {
39418
+ /* end AST */
39419
+ if (astDefined) {
39420
+ if (sysData.state === id.NOMATCH) {
39421
+ p.ast.setLength(astLength);
39422
+ } else {
39423
+ p.ast.up(op.index, rule.name, phraseIndex, sysData.phraseLength);
39424
+ }
39425
+ }
39426
+ }
39427
+ };
39428
+ // The `TRG` operator.<br>
39429
+ // Succeeds if the single first character of the phrase is
39430
+ // within the `min - max` range.
39431
+ const opTRG = (opIndex, phraseIndex) => {
39432
+ const op = opcodes[opIndex];
39433
+ sysData.state = id.NOMATCH;
39434
+ if (phraseIndex < chars.length) {
39435
+ if (op.min <= chars[phraseIndex] && chars[phraseIndex] <= op.max) {
39436
+ sysData.state = id.MATCH;
39437
+ sysData.phraseLength = 1;
39438
+ }
39439
+ }
39440
+ };
39441
+ // The `TBS` operator.<br>
39442
+ // Matches its pre-defined phrase against the input string.
39443
+ // All characters must match exactly.
39444
+ // Case-sensitive literal strings (`'string'` & `%s"string"`) are translated to `TBS`
39445
+ // operators by `apg`.
39446
+ // Phrase length of zero is not allowed.
39447
+ // Empty phrases can only be defined with `TLS` operators.
39448
+ const opTBS = (opIndex, phraseIndex) => {
39449
+ const op = opcodes[opIndex];
39450
+ const len = op.string.length;
39451
+ sysData.state = id.NOMATCH;
39452
+ if (phraseIndex + len <= chars.length) {
39453
+ for (let i = 0; i < len; i += 1) {
39454
+ if (chars[phraseIndex + i] !== op.string[i]) {
39455
+ return;
39456
+ }
39457
+ }
39458
+ sysData.state = id.MATCH;
39459
+ sysData.phraseLength = len;
39460
+ } /* implied else NOMATCH */
39461
+ };
39462
+ // The `TLS` operator.<br>
39463
+ // Matches its pre-defined phrase against the input string.
39464
+ // A case-insensitive match is attempted for ASCII alphbetical characters.
39465
+ // `TLS` is the only operator that explicitly allows empty phrases.
39466
+ // `apg` will fail for empty `TBS`, case-sensitive strings (`''`) or
39467
+ // zero repetitions (`0*0RuleName` or `0RuleName`).
39468
+ const opTLS = (opIndex, phraseIndex) => {
39469
+ let code;
39470
+ const op = opcodes[opIndex];
39471
+ sysData.state = id.NOMATCH;
39472
+ const len = op.string.length;
39473
+ if (len === 0) {
39474
+ /* EMPTY match allowed for TLS */
39475
+ sysData.state = id.EMPTY;
39476
+ return;
39477
+ }
39478
+ if (phraseIndex + len <= chars.length) {
39479
+ for (let i = 0; i < len; i += 1) {
39480
+ code = chars[phraseIndex + i];
39481
+ if (code >= 65 && code <= 90) {
39482
+ code += 32;
39483
+ }
39484
+ if (code !== op.string[i]) {
39485
+ return;
39486
+ }
39487
+ }
39488
+ sysData.state = id.MATCH;
39489
+ sysData.phraseLength = len;
39490
+ } /* implied else NOMATCH */
39491
+ };
39492
+ // Validate the callback function's returned sysData values.
39493
+ // It's the user's responsibility to get it right but `UDT` fails if not.
39494
+ const validateUdtCallbackResult = (udt, sysData, charsLeft) => {
39495
+ if (sysData.phraseLength > charsLeft) {
39496
+ let str = `${thisFileName}opUDT(${udt.name}): callback function error: `;
39497
+ str += `sysData.phraseLength: ${sysData.phraseLength}`;
39498
+ str += ` must be <= remaining chars: ${charsLeft}`;
39499
+ throw new Error(str);
39500
+ }
39501
+ switch (sysData.state) {
39502
+ case id.ACTIVE:
39503
+ throw new Error(`${thisFileName}opUDT(${udt.name}) ACTIVE state return not allowed.`);
39504
+ case id.EMPTY:
39505
+ if (udt.empty) {
39506
+ sysData.phraseLength = 0;
39507
+ } else {
39508
+ throw new Error(`${thisFileName}opUDT(${udt.name}) may not return EMPTY.`);
39509
+ }
39510
+ break;
39511
+ case id.MATCH:
39512
+ if (sysData.phraseLength === 0) {
39513
+ if (udt.empty) {
39514
+ sysData.state = id.EMPTY;
39515
+ } else {
39516
+ throw new Error(`${thisFileName}opUDT(${udt.name}) may not return EMPTY.`);
39517
+ }
39518
+ }
39519
+ break;
39520
+ case id.NOMATCH:
39521
+ sysData.phraseLength = 0;
39522
+ break;
39523
+ default:
39524
+ throw new Error(
39525
+ `${thisFileName}opUDT(${udt.name}): callback function return error. Unrecognized return state: ${sysData.state}`
39526
+ );
39527
+ }
39528
+ };
39529
+ // The `UDT` operator.<br>
39530
+ // Simply calls the user's callback function, but operates like `RNM` with regard to the `AST`
39531
+ // and back referencing.
39532
+ // There is some ambiguity here. `UDT`s act as terminals for phrase recognition but as named rules
39533
+ // for `AST` nodes and back referencing.
39534
+ // See [`ast.js`](./ast.html) for usage.
39535
+ const opUDT = (opIndex, phraseIndex) => {
39536
+ let astLength;
39537
+ let astIndex;
39538
+ let astDefined;
39539
+ const op = opcodes[opIndex];
39540
+ const udt = udts[op.index];
39541
+ sysData.UdtIndex = udt.index;
39542
+ /* ignore AST in look ahead */
39543
+ if (!lookAhead) {
39544
+ astDefined = p.ast && p.ast.udtDefined(op.index);
39545
+ if (astDefined) {
39546
+ astIndex = rules.length + op.index;
39547
+ astLength = p.ast.getLength();
39548
+ p.ast.down(astIndex, udt.name);
39549
+ }
39550
+ }
39551
+ /* call the UDT */
39552
+ const charsLeft = chars.length - phraseIndex;
39553
+ udtCallbacks[op.index](sysData, chars, phraseIndex, userData);
39554
+ validateUdtCallbackResult(udt, sysData, charsLeft);
39555
+ if (!lookAhead) {
39556
+ /* end AST */
39557
+ if (astDefined) {
39558
+ if (sysData.state === id.NOMATCH) {
39559
+ p.ast.setLength(astLength);
39560
+ } else {
39561
+ p.ast.up(astIndex, udt.name, phraseIndex, sysData.phraseLength);
39562
+ }
39563
+ }
39564
+ }
39565
+ };
39566
+ // The `AND` operator.<br>
39567
+ // This is the positive `look ahead` operator.
39568
+ // Executes its single child node, returning the EMPTY state
39569
+ // if it succeedsand NOMATCH if it fails.
39570
+ // *Always* backtracks on any matched phrase and returns EMPTY on success.
39571
+ const opAND = (opIndex, phraseIndex) => {
39572
+ lookAhead += 1;
39573
+ opExecute(opIndex + 1, phraseIndex);
39574
+ lookAhead -= 1;
39575
+ sysData.phraseLength = 0;
39576
+ switch (sysData.state) {
39577
+ case id.EMPTY:
39578
+ sysData.state = id.EMPTY;
39579
+ break;
39580
+ case id.MATCH:
39581
+ sysData.state = id.EMPTY;
39582
+ break;
39583
+ case id.NOMATCH:
39584
+ sysData.state = id.NOMATCH;
39585
+ break;
39586
+ default:
39587
+ throw new Error(`opAND: invalid state ${sysData.state}`);
39588
+ }
39589
+ };
39590
+ // The `NOT` operator.<br>
39591
+ // This is the negative `look ahead` operator.
39592
+ // Executes its single child node, returning the EMPTY state
39593
+ // if it *fails* and NOMATCH if it succeeds.
39594
+ // *Always* backtracks on any matched phrase and returns EMPTY
39595
+ // on success (failure of its child node).
39596
+ const opNOT = (opIndex, phraseIndex) => {
39597
+ lookAhead += 1;
39598
+ opExecute(opIndex + 1, phraseIndex);
39599
+ lookAhead -= 1;
39600
+ sysData.phraseLength = 0;
39601
+ switch (sysData.state) {
39602
+ case id.EMPTY:
39603
+ case id.MATCH:
39604
+ sysData.state = id.NOMATCH;
39605
+ break;
39606
+ case id.NOMATCH:
39607
+ sysData.state = id.EMPTY;
39608
+ break;
39609
+ default:
39610
+ throw new Error(`opNOT: invalid state ${sysData.state}`);
39611
+ }
39612
+ };
39613
+
39614
+ const opExecute = (opIndex, phraseIndex) => {
39615
+ const functionName = `${thisFileName}opExecute(): `;
39616
+ const op = opcodes[opIndex];
39617
+ nodeHits += 1;
39618
+ if (treeDepth > maxTreeDepth) {
39619
+ maxTreeDepth = treeDepth;
39620
+ }
39621
+ treeDepth += 1;
39622
+ sysData.refresh();
39623
+ if (p.trace) {
39624
+ p.trace.down(op, phraseIndex);
39625
+ }
39626
+ switch (op.type) {
39627
+ case id.ALT:
39628
+ opALT(opIndex, phraseIndex);
39629
+ break;
39630
+ case id.CAT:
39631
+ opCAT(opIndex, phraseIndex);
39632
+ break;
39633
+ case id.REP:
39634
+ opREP(opIndex, phraseIndex);
39635
+ break;
39636
+ case id.RNM:
39637
+ opRNM(opIndex, phraseIndex);
39638
+ break;
39639
+ case id.TRG:
39640
+ opTRG(opIndex, phraseIndex);
39641
+ break;
39642
+ case id.TBS:
39643
+ opTBS(opIndex, phraseIndex);
39644
+ break;
39645
+ case id.TLS:
39646
+ opTLS(opIndex, phraseIndex);
39647
+ break;
39648
+ case id.UDT:
39649
+ opUDT(opIndex, phraseIndex);
39650
+ break;
39651
+ case id.AND:
39652
+ opAND(opIndex, phraseIndex);
39653
+ break;
39654
+ case id.NOT:
39655
+ opNOT(opIndex, phraseIndex);
39656
+ break;
39657
+ default:
39658
+ throw new Error(`${functionName}unrecognized operator`);
39659
+ }
39660
+ if (!lookAhead) {
39661
+ if (phraseIndex + sysData.phraseLength > maxMatched) {
39662
+ maxMatched = phraseIndex + sysData.phraseLength;
39663
+ }
39664
+ }
39665
+ if (p.stats) {
39666
+ p.stats.collect(op, sysData);
39667
+ }
39668
+ if (p.trace) {
39669
+ p.trace.up(op, sysData.state, phraseIndex, sysData.phraseLength);
39670
+ }
39671
+ treeDepth -= 1;
39672
+ };
39673
+ };
39674
+
39675
+ const Ast = function fnast() {
39676
+ const thisFileName = 'parser.js: Ast()): ';
39677
+ const id = identifiers;
39678
+ const utils = utilities;
39679
+ const a = this;
39680
+ let rules = undefined;
39681
+ let udts = undefined;
39682
+ let chars = undefined;
39683
+ let nodeCount = 0;
39684
+ const nodeCallbacks = [];
39685
+ const stack = [];
39686
+ const records = [];
39687
+ a.callbacks = [];
39688
+ /* called by the parser to initialize the AST with the rules, UDTs and the input characters */
39689
+ a.init = (rulesIn, udtsIn, charsIn) => {
39690
+ stack.length = 0;
39691
+ records.length = 0;
39692
+ nodeCount = 0;
39693
+ rules = rulesIn;
39694
+ udts = udtsIn;
39695
+ chars = charsIn;
39696
+ let i;
39697
+ const list = [];
39698
+ for (i = 0; i < rules.length; i += 1) {
39699
+ list.push(rules[i].lower);
39700
+ }
39701
+ for (i = 0; i < udts.length; i += 1) {
39702
+ list.push(udts[i].lower);
39703
+ }
39704
+ nodeCount = rules.length + udts.length;
39705
+ for (i = 0; i < nodeCount; i += 1) {
39706
+ nodeCallbacks[i] = undefined;
39707
+ }
39708
+ for (const index in a.callbacks) {
39709
+ const lower = index.toLowerCase();
39710
+ i = list.indexOf(lower);
39711
+ if (i < 0) {
39712
+ throw new Error(`${thisFileName}init: node '${index}' not a rule or udt name`);
39713
+ }
39714
+ nodeCallbacks[i] = a.callbacks[index];
39715
+ }
39716
+ };
39717
+ /* AST node rule callbacks - called by the parser's `RNM` operator */
39718
+ a.ruleDefined = (index) => !!nodeCallbacks[index];
39719
+ /* AST node UDT callbacks - called by the parser's `UDT` operator */
39720
+ a.udtDefined = (index) => !!nodeCallbacks[rules.length + index];
39721
+ /* called by the parser's `RNM` & `UDT` operators
39722
+ builds a record for the downward traversal of the node */
39723
+ a.down = (callbackIndex, name) => {
39724
+ const thisIndex = records.length;
39725
+ stack.push(thisIndex);
39726
+ records.push({
39727
+ name,
39728
+ thisIndex,
39729
+ thatIndex: undefined,
39730
+ state: id.SEM_PRE,
39731
+ callbackIndex,
39732
+ phraseIndex: undefined,
39733
+ phraseLength: undefined,
39734
+ stack: stack.length,
39735
+ });
39736
+ return thisIndex;
39737
+ };
39738
+ /* called by the parser's `RNM` & `UDT` operators */
39739
+ /* builds a record for the upward traversal of the node */
39740
+ a.up = (callbackIndex, name, phraseIndex, phraseLength) => {
39741
+ const thisIndex = records.length;
39742
+ const thatIndex = stack.pop();
39743
+ records.push({
39744
+ name,
39745
+ thisIndex,
39746
+ thatIndex,
39747
+ state: id.SEM_POST,
39748
+ callbackIndex,
39749
+ phraseIndex,
39750
+ phraseLength,
39751
+ stack: stack.length,
39752
+ });
39753
+ records[thatIndex].thatIndex = thisIndex;
39754
+ records[thatIndex].phraseIndex = phraseIndex;
39755
+ records[thatIndex].phraseLength = phraseLength;
39756
+ return thisIndex;
39757
+ };
39758
+ // Called by the user to translate the AST.
39759
+ // Translate means to associate or apply some semantic action to the
39760
+ // phrases that were syntactically matched to the AST nodes according
39761
+ // to the defining grammar.
39762
+ // ```
39763
+ // data - optional user-defined data
39764
+ // passed to the callback functions by the translator
39765
+ // ```
39766
+ a.translate = (data) => {
39767
+ let ret;
39768
+ let callback;
39769
+ let record;
39770
+ for (let i = 0; i < records.length; i += 1) {
39771
+ record = records[i];
39772
+ callback = nodeCallbacks[record.callbackIndex];
39773
+ if (callback) {
39774
+ if (record.state === id.SEM_PRE) {
39775
+ callback(id.SEM_PRE, chars, record.phraseIndex, record.phraseLength, data);
39776
+ } else if (callback) {
39777
+ callback(id.SEM_POST, chars, record.phraseIndex, record.phraseLength, data);
39778
+ }
39779
+ }
39780
+ }
39781
+ };
39782
+ /* called by the parser to reset the length of the records array */
39783
+ /* necessary on backtracking */
39784
+ a.setLength = (length) => {
39785
+ records.length = length;
39786
+ if (length > 0) {
39787
+ stack.length = records[length - 1].stack;
39788
+ } else {
39789
+ stack.length = 0;
39790
+ }
39791
+ };
39792
+ /* called by the parser to get the length of the records array */
39793
+ a.getLength = () => records.length;
39794
+ /* helper for XML display */
39795
+ function indent(n) {
39796
+ let ret = '';
39797
+ while (n-- > 0) {
39798
+ ret += ' ';
39799
+ }
39800
+ return ret;
39801
+ }
39802
+ // Generate an `XML` version of the AST.
39803
+ // Useful if you want to use a special or favorite XML parser to translate the
39804
+ // AST. Node data are JavaScript strings.
39805
+ a.toXml = () => {
39806
+ let xml = '';
39807
+ let depth = 0;
39808
+ xml += '<?xml version="1.0" encoding="utf-8"?>\n';
39809
+ xml += `<root nodes="${records.length / 2}" characters="${chars.length}">\n`;
39810
+ xml += `<!-- input string -->\n`;
39811
+ xml += indent(depth + 2);
39812
+ xml += utils.charsToString(chars);
39813
+ xml += '\n';
39814
+ records.forEach((rec) => {
39815
+ if (rec.state === id.SEM_PRE) {
39816
+ depth += 1;
39817
+ xml += indent(depth);
39818
+ xml += `<node name="${rec.name}" index="${rec.phraseIndex}" length="${rec.phraseLength}">\n`;
39819
+ xml += indent(depth + 2);
39820
+ xml += utils.charsToString(chars, rec.phraseIndex, rec.phraseLength);
39821
+ xml += '\n';
39822
+ } else {
39823
+ xml += indent(depth);
39824
+ xml += `</node><!-- name="${rec.name}" -->\n`;
39825
+ depth -= 1;
39826
+ }
39827
+ });
39828
+
39829
+ xml += '</root>\n';
39830
+ return xml;
39831
+ };
39832
+ };
39833
+
39834
+ const Trace = function fntrace() {
39835
+ const id = identifiers;
39836
+ const utils = utilities;
39837
+ const thisFile = 'parser.js: Trace(): ';
39838
+ let chars = undefined;
39839
+ let rules = undefined;
39840
+ let udts = undefined;
39841
+ let out = '';
39842
+ let treeDepth = 0;
39843
+ const MAX_PHRASE = 100;
39844
+ const t = this;
39845
+ const indent = (n) => {
39846
+ let ret = '';
39847
+ let count = 0;
39848
+ if (n >= 0) {
39849
+ while (n--) {
39850
+ count += 1;
39851
+ if (count === 5) {
39852
+ ret += '|';
39853
+ count = 0;
39854
+ } else {
39855
+ ret += '.';
39856
+ }
39857
+ }
39858
+ }
39859
+ return ret;
39860
+ };
39861
+ t.init = (r, u, c) => {
39862
+ rules = r;
39863
+ udts = u;
39864
+ chars = c;
39865
+ };
39866
+ const opName = (op) => {
39867
+ let name;
39868
+ switch (op.type) {
39869
+ case id.ALT:
39870
+ name = 'ALT';
39871
+ break;
39872
+ case id.CAT:
39873
+ name = 'CAT';
39874
+ break;
39875
+ case id.REP:
39876
+ if (op.max === Infinity) {
39877
+ name = `REP(${op.min},inf)`;
39878
+ } else {
39879
+ name = `REP(${op.min},${op.max})`;
39880
+ }
39881
+ break;
39882
+ case id.RNM:
39883
+ name = `RNM(${rules[op.index].name})`;
39884
+ break;
39885
+ case id.TRG:
39886
+ name = `TRG(${op.min},${op.max})`;
39887
+ break;
39888
+ case id.TBS:
39889
+ if (op.string.length > 6) {
39890
+ name = `TBS(${utils.charsToString(op.string, 0, 3)}...)`;
39891
+ } else {
39892
+ name = `TBS(${utils.charsToString(op.string, 0, 6)})`;
39893
+ }
39894
+ break;
39895
+ case id.TLS:
39896
+ if (op.string.length > 6) {
39897
+ name = `TLS(${utils.charsToString(op.string, 0, 3)}...)`;
39898
+ } else {
39899
+ name = `TLS(${utils.charsToString(op.string, 0, 6)})`;
39900
+ }
39901
+ break;
39902
+ case id.UDT:
39903
+ name = `UDT(${udts[op.index].name})`;
39904
+ break;
39905
+ case id.AND:
39906
+ name = 'AND';
39907
+ break;
39908
+ case id.NOT:
39909
+ name = 'NOT';
39910
+ break;
39911
+ default:
39912
+ throw new Error(`${thisFile}Trace: opName: unrecognized opcode`);
39913
+ }
39914
+ return name;
39915
+ };
39916
+ t.down = (op, offset) => {
39917
+ const lead = indent(treeDepth);
39918
+ const len = Math.min(MAX_PHRASE, chars.length - offset);
39919
+ let phrase = utils.charsToString(chars, offset, len);
39920
+ if (len < chars.length - offset) {
39921
+ phrase += '...';
39922
+ }
39923
+ phrase = `${lead}|-|[${opName(op)}]${phrase}\n`;
39924
+ out += phrase;
39925
+ treeDepth += 1;
39926
+ };
39927
+ t.up = (op, state, offset, phraseLength) => {
39928
+ const thisFunc = `${thisFile}trace.up: `;
39929
+ treeDepth -= 1;
39930
+ const lead = indent(treeDepth);
39931
+ let len;
39932
+ let phrase;
39933
+ let st;
39934
+ switch (state) {
39935
+ case id.EMPTY:
39936
+ st = '|E|';
39937
+ phrase = `''`;
39938
+ break;
39939
+ case id.MATCH:
39940
+ st = '|M|';
39941
+ len = Math.min(MAX_PHRASE, phraseLength);
39942
+ if (len < phraseLength) {
39943
+ phrase = `'${utils.charsToString(chars, offset, len)}...'`;
39944
+ } else {
39945
+ phrase = `'${utils.charsToString(chars, offset, len)}'`;
39946
+ }
39947
+ break;
39948
+ case id.NOMATCH:
39949
+ st = '|N|';
39950
+ phrase = '';
39951
+ break;
39952
+ default:
39953
+ throw new Error(`${thisFunc} unrecognized state`);
39954
+ }
39955
+ phrase = `${lead}${st}[${opName(op)}]${phrase}\n`;
39956
+ out += phrase;
39957
+ };
39958
+ t.displayTrace = () => out;
39959
+ };
39960
+
39961
+ const Stats = function fnstats() {
39962
+ const id = identifiers;
39963
+ const thisFileName = 'parser.js: Stats(): ';
39964
+ let rules;
39965
+ let udts;
39966
+ let totals;
39967
+ const stats = [];
39968
+ const ruleStats = [];
39969
+ const udtStats = [];
39970
+ /* called by parser to initialize the stats */
39971
+ this.init = (r, u) => {
39972
+ rules = r;
39973
+ udts = u;
39974
+ clear();
39975
+ };
39976
+ /* This function is the main interaction with the parser. */
39977
+ /* The parser calls it after each node has been traversed. */
39978
+ this.collect = (op, sys) => {
39979
+ incStat(totals, sys.state, sys.phraseLength);
39980
+ incStat(stats[op.type], sys.state, sys.phraseLength);
39981
+ if (op.type === id.RNM) {
39982
+ incStat(ruleStats[op.index], sys.state, sys.phraseLength);
39983
+ }
39984
+ if (op.type === id.UDT) {
39985
+ incStat(udtStats[op.index], sys.state, sys.phraseLength);
39986
+ }
39987
+ };
39988
+ this.displayStats = () => {
39989
+ let out = '';
39990
+ const totals = {
39991
+ match: 0,
39992
+ empty: 0,
39993
+ nomatch: 0,
39994
+ total: 0,
39995
+ };
39996
+ const displayRow = (op, m, e, n, t) => {
39997
+ totals.match += m;
39998
+ totals.empty += e;
39999
+ totals.nomatch += n;
40000
+ totals.total += t;
40001
+ const mm = normalize(m);
40002
+ const ee = normalize(e);
40003
+ const nn = normalize(n);
40004
+ const tt = normalize(t);
40005
+ return `${op} | ${mm} | ${ee} | ${nn} | ${tt} |\n`;
40006
+ };
40007
+ out += ' OPERATOR STATS\n';
40008
+ out += ' | MATCH | EMPTY | NOMATCH | TOTAL |\n';
40009
+ out += displayRow(' ALT', stats[id.ALT].match, stats[id.ALT].empty, stats[id.ALT].nomatch, stats[id.ALT].total);
40010
+ out += displayRow(' CAT', stats[id.CAT].match, stats[id.CAT].empty, stats[id.CAT].nomatch, stats[id.CAT].total);
40011
+ out += displayRow(' REP', stats[id.REP].match, stats[id.REP].empty, stats[id.REP].nomatch, stats[id.REP].total);
40012
+ out += displayRow(' RNM', stats[id.RNM].match, stats[id.RNM].empty, stats[id.RNM].nomatch, stats[id.RNM].total);
40013
+ out += displayRow(' TRG', stats[id.TRG].match, stats[id.TRG].empty, stats[id.TRG].nomatch, stats[id.TRG].total);
40014
+ out += displayRow(' TBS', stats[id.TBS].match, stats[id.TBS].empty, stats[id.TBS].nomatch, stats[id.TBS].total);
40015
+ out += displayRow(' TLS', stats[id.TLS].match, stats[id.TLS].empty, stats[id.TLS].nomatch, stats[id.TLS].total);
40016
+ out += displayRow(' UDT', stats[id.UDT].match, stats[id.UDT].empty, stats[id.UDT].nomatch, stats[id.UDT].total);
40017
+ out += displayRow(' AND', stats[id.AND].match, stats[id.AND].empty, stats[id.AND].nomatch, stats[id.AND].total);
40018
+ out += displayRow(' NOT', stats[id.NOT].match, stats[id.NOT].empty, stats[id.NOT].nomatch, stats[id.NOT].total);
40019
+ out += displayRow('TOTAL', totals.match, totals.empty, totals.nomatch, totals.total);
40020
+ return out;
40021
+ };
40022
+ /*
40023
+ Display rule/udt
40024
+ */
40025
+ this.displayHits = (type) => {
40026
+ let out = '';
40027
+ const displayRow = (m, e, n, t, name) => {
40028
+ totals.match += m;
40029
+ totals.empty += e;
40030
+ totals.nomatch += n;
40031
+ totals.total += t;
40032
+ const mm = normalize(m);
40033
+ const ee = normalize(e);
40034
+ const nn = normalize(n);
40035
+ const tt = normalize(t);
40036
+ return `| ${mm} | ${ee} | ${nn} | ${tt} | ${name}\n`;
40037
+ };
40038
+ if (typeof type === 'string' && type.toLowerCase()[0] === 'a') {
40039
+ ruleStats.sort(sortAlpha);
40040
+ udtStats.sort(sortAlpha);
40041
+ out += ' RULES/UDTS ALPHABETICALLY\n';
40042
+ } else if (typeof type === 'string' && type.toLowerCase()[0] === 'i') {
40043
+ ruleStats.sort(sortIndex);
40044
+ udtStats.sort(sortIndex);
40045
+ out += ' RULES/UDTS BY INDEX\n';
40046
+ } else {
40047
+ ruleStats.sort(sortHits);
40048
+ udtStats.sort(sortHits);
40049
+ out += ' RULES/UDTS BY HIT COUNT\n';
40050
+ }
40051
+ out += '| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n';
40052
+ for (let i = 0; i < ruleStats.length; i += 1) {
40053
+ let r = ruleStats[i];
40054
+ if (r.total) {
40055
+ out += displayRow(r.match, r.empty, r.nomatch, r.total, r.name);
40056
+ }
40057
+ }
40058
+ for (let i = 0; i < udtStats.length; i += 1) {
40059
+ let r = udtStats[i];
40060
+ if (r.total) {
40061
+ out += displayRow(r.match, r.empty, r.nomatch, r.total, r.name);
40062
+ }
40063
+ }
40064
+ return out;
40065
+ };
40066
+ const normalize = (n) => {
40067
+ if (n < 10) {
40068
+ return ` ${n}`;
40069
+ }
40070
+ if (n < 100) {
40071
+ return ` ${n}`;
40072
+ }
40073
+ if (n < 1000) {
40074
+ return ` ${n}`;
40075
+ }
40076
+ if (n < 10000) {
40077
+ return ` ${n}`;
40078
+ }
40079
+ if (n < 100000) {
40080
+ return ` ${n}`;
40081
+ }
40082
+ if (n < 1000000) {
40083
+ return ` ${n}`;
40084
+ }
40085
+ return `${n}`;
40086
+ };
40087
+ const sortAlpha = (lhs, rhs) => {
40088
+ if (lhs.lower < rhs.lower) {
40089
+ return -1;
40090
+ }
40091
+ if (lhs.lower > rhs.lower) {
40092
+ return 1;
40093
+ }
40094
+ return 0;
40095
+ };
40096
+ const sortHits = (lhs, rhs) => {
40097
+ if (lhs.total < rhs.total) {
40098
+ return 1;
40099
+ }
40100
+ if (lhs.total > rhs.total) {
40101
+ return -1;
40102
+ }
40103
+ return sortAlpha(lhs, rhs);
40104
+ };
40105
+ const sortIndex = (lhs, rhs) => {
40106
+ if (lhs.index < rhs.index) {
40107
+ return -1;
40108
+ }
40109
+ if (lhs.index > rhs.index) {
40110
+ return 1;
40111
+ }
40112
+ return 0;
40113
+ };
40114
+ const EmptyStat = function fnempty() {
40115
+ this.empty = 0;
40116
+ this.match = 0;
40117
+ this.nomatch = 0;
40118
+ this.total = 0;
40119
+ };
40120
+ /* Zero out all stats */
40121
+ const clear = () => {
40122
+ stats.length = 0;
40123
+ totals = new EmptyStat();
40124
+ stats[id.ALT] = new EmptyStat();
40125
+ stats[id.CAT] = new EmptyStat();
40126
+ stats[id.REP] = new EmptyStat();
40127
+ stats[id.RNM] = new EmptyStat();
40128
+ stats[id.TRG] = new EmptyStat();
40129
+ stats[id.TBS] = new EmptyStat();
40130
+ stats[id.TLS] = new EmptyStat();
40131
+ stats[id.UDT] = new EmptyStat();
40132
+ stats[id.AND] = new EmptyStat();
40133
+ stats[id.NOT] = new EmptyStat();
40134
+ ruleStats.length = 0;
40135
+ for (let i = 0; i < rules.length; i += 1) {
40136
+ ruleStats.push({
40137
+ empty: 0,
40138
+ match: 0,
40139
+ nomatch: 0,
40140
+ total: 0,
40141
+ name: rules[i].name,
40142
+ lower: rules[i].lower,
40143
+ index: rules[i].index,
40144
+ });
40145
+ }
40146
+ if (udts.length > 0) {
40147
+ udtStats.length = 0;
40148
+ for (let i = 0; i < udts.length; i += 1) {
40149
+ udtStats.push({
40150
+ empty: 0,
40151
+ match: 0,
40152
+ nomatch: 0,
40153
+ total: 0,
40154
+ name: udts[i].name,
40155
+ lower: udts[i].lower,
40156
+ index: udts[i].index,
40157
+ });
40158
+ }
40159
+ }
40160
+ };
40161
+ /* increment the designated operator hit count by one */
40162
+ const incStat = (stat, state) => {
40163
+ stat.total += 1;
40164
+ switch (state) {
40165
+ case id.EMPTY:
40166
+ stat.empty += 1;
40167
+ break;
40168
+ case id.MATCH:
40169
+ stat.match += 1;
40170
+ break;
40171
+ case id.NOMATCH:
40172
+ stat.nomatch += 1;
40173
+ break;
40174
+ default:
40175
+ throw new Error(`${thisFileName}collect(): incStat(): unrecognized state: ${state}`);
40176
+ }
40177
+ };
40178
+ };
40179
+
40180
+ const utilities = {
40181
+ // utility functions
40182
+ stringToChars: (string) => [...string].map((cp) => cp.codePointAt(0)),
40183
+ charsToString: (chars, beg, len) => {
40184
+ let subChars = chars;
40185
+ while (1) {
40186
+ if (beg === undefined || beg < 0) {
40187
+ break;
40188
+ }
40189
+ if (len === undefined) {
40190
+ subChars = chars.slice(beg);
40191
+ break;
40192
+ }
40193
+ if (len <= 0) {
40194
+ // always an empty string
40195
+ return '';
40196
+ }
40197
+ subChars = chars.slice(beg, beg + len);
40198
+ break;
40199
+ }
40200
+ return String.fromCodePoint(...subChars);
40201
+ },
40202
+ };
40203
+
40204
+ const identifiers = {
40205
+ // Identifies the operator type.
40206
+ // NB: These must match the values in apg-js 4.3.0, apg-lib/identifiers.
40207
+ /* the original ABNF operators */
40208
+ ALT: 1 /* alternation */,
40209
+ CAT: 2 /* concatenation */,
40210
+ REP: 3 /* repetition */,
40211
+ RNM: 4 /* rule name */,
40212
+ TRG: 5 /* terminal range */,
40213
+ TBS: 6 /* terminal binary string, case sensitive */,
40214
+ TLS: 7 /* terminal literal string, case insensitive */,
40215
+ /* the super set, SABNF operators */
40216
+ UDT: 11 /* user-defined terminal */,
40217
+ AND: 12 /* positive look ahead */,
40218
+ NOT: 13 /* negative look ahead */,
40219
+ // Used by the parser and the user's `RNM` and `UDT` callback functions.
40220
+ // Identifies the parser state as it traverses the parse tree nodes.
40221
+ // - *ACTIVE* - indicates the downward direction through the parse tree node.
40222
+ // - *MATCH* - indicates the upward direction and a phrase, of length \> 0, has been successfully matched
40223
+ // - *EMPTY* - indicates the upward direction and a phrase, of length = 0, has been successfully matched
40224
+ // - *NOMATCH* - indicates the upward direction and the parser failed to match any phrase at all
40225
+ ACTIVE: 100,
40226
+ MATCH: 101,
40227
+ EMPTY: 102,
40228
+ NOMATCH: 103,
40229
+ // Used by [`AST` translator](./ast.html) (semantic analysis) and the user's callback functions
40230
+ // to indicate the direction of flow through the `AST` nodes.
40231
+ // - *SEM_PRE* - indicates the downward (pre-branch) direction through the `AST` node.
40232
+ // - *SEM_POST* - indicates the upward (post-branch) direction through the `AST` node.
40233
+ SEM_PRE: 200,
40234
+ SEM_POST: 201,
40235
+ // Ignored. Retained for backwords compatibility.
40236
+ SEM_OK: 300,
40237
+ idName: (s) => {
40238
+ switch (s) {
40239
+ case identifiers.ALT:
40240
+ return 'ALT';
40241
+ case identifiers.CAT:
40242
+ return 'CAT';
40243
+ case identifiers.REP:
40244
+ return 'REP';
40245
+ case identifiers.RNM:
40246
+ return 'RNM';
40247
+ case identifiers.TRG:
40248
+ return 'TRG';
40249
+ case identifiers.TBS:
40250
+ return 'TBS';
40251
+ case identifiers.TLS:
40252
+ return 'TLS';
40253
+ case identifiers.UDT:
40254
+ return 'UDT';
40255
+ case identifiers.AND:
40256
+ return 'AND';
40257
+ case identifiers.NOT:
40258
+ return 'NOT';
40259
+ case identifiers.ACTIVE:
40260
+ return 'ACTIVE';
40261
+ case identifiers.EMPTY:
40262
+ return 'EMPTY';
40263
+ case identifiers.MATCH:
40264
+ return 'MATCH';
40265
+ case identifiers.NOMATCH:
40266
+ return 'NOMATCH';
40267
+ case identifiers.SEM_PRE:
40268
+ return 'SEM_PRE';
40269
+ case identifiers.SEM_POST:
40270
+ return 'SEM_POST';
40271
+ case identifiers.SEM_OK:
40272
+ return 'SEM_OK';
40273
+ default:
40274
+ return 'UNRECOGNIZED STATE';
40275
+ }
40276
+ },
40277
+ };
40278
+
40279
+
39016
40280
  /***/ }),
39017
40281
 
39018
40282
  /***/ 16111:
@@ -43823,6 +45087,1113 @@ var jsYaml = {
43823
45087
 
43824
45088
 
43825
45089
 
45090
+ /***/ }),
45091
+
45092
+ /***/ 61546:
45093
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45094
+
45095
+ "use strict";
45096
+ __webpack_require__.r(__webpack_exports__);
45097
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45098
+ /* harmony export */ Grammar: () => (/* reexport safe */ _path_templating_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
45099
+ /* harmony export */ encodePathComponent: () => (/* reexport safe */ _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__.encodePathComponent),
45100
+ /* harmony export */ parse: () => (/* reexport safe */ _parse_index_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
45101
+ /* harmony export */ resolve: () => (/* reexport safe */ _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
45102
+ /* harmony export */ test: () => (/* reexport safe */ _test_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])
45103
+ /* harmony export */ });
45104
+ /* harmony import */ var _path_templating_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56167);
45105
+ /* harmony import */ var _test_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62674);
45106
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10426);
45107
+ /* harmony import */ var _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97642);
45108
+
45109
+
45110
+
45111
+
45112
+
45113
+ /***/ }),
45114
+
45115
+ /***/ 41856:
45116
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45117
+
45118
+ "use strict";
45119
+ __webpack_require__.r(__webpack_exports__);
45120
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45121
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45122
+ /* harmony export */ });
45123
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45124
+
45125
+ const fragmentMarker = (state, chars, phraseIndex, phraseLength, data) => {
45126
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45127
+ data.push(['fragment-marker', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45128
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45129
+ /* not used in this example */
45130
+ }
45131
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45132
+ };
45133
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fragmentMarker);
45134
+
45135
+ /***/ }),
45136
+
45137
+ /***/ 97774:
45138
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45139
+
45140
+ "use strict";
45141
+ __webpack_require__.r(__webpack_exports__);
45142
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45143
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45144
+ /* harmony export */ });
45145
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45146
+
45147
+ const fragment = (state, chars, phraseIndex, phraseLength, data) => {
45148
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45149
+ data.push(['fragment', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45150
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45151
+ /* not used in this example */
45152
+ }
45153
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45154
+ };
45155
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fragment);
45156
+
45157
+ /***/ }),
45158
+
45159
+ /***/ 88430:
45160
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45161
+
45162
+ "use strict";
45163
+ __webpack_require__.r(__webpack_exports__);
45164
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45165
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45166
+ /* harmony export */ });
45167
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45168
+
45169
+ const pathLiteral = (state, chars, phraseIndex, phraseLength, data) => {
45170
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45171
+ data.push(['path-literal', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45172
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45173
+ /* not used in this example */
45174
+ }
45175
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45176
+ };
45177
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (pathLiteral);
45178
+
45179
+ /***/ }),
45180
+
45181
+ /***/ 33659:
45182
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45183
+
45184
+ "use strict";
45185
+ __webpack_require__.r(__webpack_exports__);
45186
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45187
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45188
+ /* harmony export */ });
45189
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45190
+
45191
+ const pathTemplate = (state, chars, phraseIndex, phraseLength, data) => {
45192
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45193
+ if (Array.isArray(data) === false) {
45194
+ throw new Error("parser's user data must be an array");
45195
+ }
45196
+ data.push(['path-template', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45197
+ }
45198
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45199
+ };
45200
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (pathTemplate);
45201
+
45202
+ /***/ }),
45203
+
45204
+ /***/ 28580:
45205
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45206
+
45207
+ "use strict";
45208
+ __webpack_require__.r(__webpack_exports__);
45209
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45210
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45211
+ /* harmony export */ });
45212
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45213
+
45214
+ const path = (state, chars, phraseIndex, phraseLength, data) => {
45215
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45216
+ data.push(['path', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45217
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45218
+ /* not used in this example */
45219
+ }
45220
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45221
+ };
45222
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (path);
45223
+
45224
+ /***/ }),
45225
+
45226
+ /***/ 34518:
45227
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45228
+
45229
+ "use strict";
45230
+ __webpack_require__.r(__webpack_exports__);
45231
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45232
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45233
+ /* harmony export */ });
45234
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45235
+
45236
+ const queryMarker = (state, chars, phraseIndex, phraseLength, data) => {
45237
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45238
+ data.push(['query-marker', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45239
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45240
+ /* not used in this example */
45241
+ }
45242
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45243
+ };
45244
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (queryMarker);
45245
+
45246
+ /***/ }),
45247
+
45248
+ /***/ 76559:
45249
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45250
+
45251
+ "use strict";
45252
+ __webpack_require__.r(__webpack_exports__);
45253
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45254
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45255
+ /* harmony export */ });
45256
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45257
+
45258
+ const query = (state, chars, phraseIndex, phraseLength, data) => {
45259
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45260
+ data.push(['query', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45261
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45262
+ /* not used in this example */
45263
+ }
45264
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45265
+ };
45266
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (query);
45267
+
45268
+ /***/ }),
45269
+
45270
+ /***/ 31696:
45271
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45272
+
45273
+ "use strict";
45274
+ __webpack_require__.r(__webpack_exports__);
45275
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45276
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45277
+ /* harmony export */ });
45278
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45279
+
45280
+ const slash = (state, chars, phraseIndex, phraseLength, data) => {
45281
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45282
+ data.push(['slash', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45283
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45284
+ /* not used in this example */
45285
+ }
45286
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45287
+ };
45288
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (slash);
45289
+
45290
+ /***/ }),
45291
+
45292
+ /***/ 21926:
45293
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45294
+
45295
+ "use strict";
45296
+ __webpack_require__.r(__webpack_exports__);
45297
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45298
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45299
+ /* harmony export */ });
45300
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45301
+
45302
+ const templateExpressionParamName = (state, chars, phraseIndex, phraseLength, data) => {
45303
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45304
+ data.push(['template-expression-param-name', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45305
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45306
+ /* not used in this example */
45307
+ }
45308
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45309
+ };
45310
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (templateExpressionParamName);
45311
+
45312
+ /***/ }),
45313
+
45314
+ /***/ 82966:
45315
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45316
+
45317
+ "use strict";
45318
+ __webpack_require__.r(__webpack_exports__);
45319
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45320
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45321
+ /* harmony export */ });
45322
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45323
+
45324
+ const templateExpression = (state, chars, phraseIndex, phraseLength, data) => {
45325
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45326
+ data.push(['template-expression', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45327
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45328
+ /* not used in this example */
45329
+ }
45330
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45331
+ };
45332
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (templateExpression);
45333
+
45334
+ /***/ }),
45335
+
45336
+ /***/ 10426:
45337
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45338
+
45339
+ "use strict";
45340
+ __webpack_require__.r(__webpack_exports__);
45341
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45342
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45343
+ /* harmony export */ });
45344
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45345
+ /* harmony import */ var _path_templating_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(56167);
45346
+ /* harmony import */ var _callbacks_slash_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31696);
45347
+ /* harmony import */ var _callbacks_path_template_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33659);
45348
+ /* harmony import */ var _callbacks_path_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28580);
45349
+ /* harmony import */ var _callbacks_path_literal_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88430);
45350
+ /* harmony import */ var _callbacks_query_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(76559);
45351
+ /* harmony import */ var _callbacks_query_marker_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(34518);
45352
+ /* harmony import */ var _callbacks_fragment_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(97774);
45353
+ /* harmony import */ var _callbacks_fragment_marker_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(41856);
45354
+ /* harmony import */ var _callbacks_template_expression_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(82966);
45355
+ /* harmony import */ var _callbacks_template_expression_param_name_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(21926);
45356
+
45357
+
45358
+
45359
+
45360
+
45361
+
45362
+
45363
+
45364
+
45365
+
45366
+
45367
+
45368
+ const grammar = new _path_templating_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]();
45369
+ const parse = str => {
45370
+ const parser = new _apg_lite__WEBPACK_IMPORTED_MODULE_0__.Parser();
45371
+ parser.ast = new _apg_lite__WEBPACK_IMPORTED_MODULE_0__.Ast();
45372
+ parser.ast.callbacks['path-template'] = _callbacks_path_template_mjs__WEBPACK_IMPORTED_MODULE_2__["default"];
45373
+ parser.ast.callbacks['path'] = _callbacks_path_mjs__WEBPACK_IMPORTED_MODULE_3__["default"];
45374
+ parser.ast.callbacks['query'] = _callbacks_query_mjs__WEBPACK_IMPORTED_MODULE_5__["default"];
45375
+ parser.ast.callbacks['query-marker'] = _callbacks_query_marker_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
45376
+ parser.ast.callbacks['fragment'] = _callbacks_fragment_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
45377
+ parser.ast.callbacks['fragment-marker'] = _callbacks_fragment_marker_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
45378
+ parser.ast.callbacks['slash'] = _callbacks_slash_mjs__WEBPACK_IMPORTED_MODULE_1__["default"];
45379
+ parser.ast.callbacks['path-literal'] = _callbacks_path_literal_mjs__WEBPACK_IMPORTED_MODULE_4__["default"];
45380
+ parser.ast.callbacks['template-expression'] = _callbacks_template_expression_mjs__WEBPACK_IMPORTED_MODULE_9__["default"];
45381
+ parser.ast.callbacks['template-expression-param-name'] = _callbacks_template_expression_param_name_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
45382
+ const result = parser.parse(grammar, 'path-template', str);
45383
+ return {
45384
+ result,
45385
+ ast: parser.ast
45386
+ };
45387
+ };
45388
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
45389
+
45390
+ /***/ }),
45391
+
45392
+ /***/ 56167:
45393
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45394
+
45395
+ "use strict";
45396
+ __webpack_require__.r(__webpack_exports__);
45397
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45398
+ /* harmony export */ "default": () => (/* binding */ grammar)
45399
+ /* harmony export */ });
45400
+ // copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
45401
+ // license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
45402
+ //
45403
+ // Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
45404
+ function grammar() {
45405
+ // ```
45406
+ // SUMMARY
45407
+ // rules = 20
45408
+ // udts = 0
45409
+ // opcodes = 113
45410
+ // --- ABNF original opcodes
45411
+ // ALT = 10
45412
+ // CAT = 7
45413
+ // REP = 11
45414
+ // RNM = 31
45415
+ // TLS = 51
45416
+ // TBS = 0
45417
+ // TRG = 3
45418
+ // --- SABNF superset opcodes
45419
+ // UDT = 0
45420
+ // AND = 0
45421
+ // NOT = 0
45422
+ // characters = [33 - 126]
45423
+ // ```
45424
+ /* OBJECT IDENTIFIER (for internal parser use) */
45425
+ this.grammarObject = 'grammarObject';
45426
+
45427
+ /* RULES */
45428
+ this.rules = [];
45429
+ this.rules[0] = {
45430
+ name: 'path-template',
45431
+ lower: 'path-template',
45432
+ index: 0,
45433
+ isBkr: false
45434
+ };
45435
+ this.rules[1] = {
45436
+ name: 'path',
45437
+ lower: 'path',
45438
+ index: 1,
45439
+ isBkr: false
45440
+ };
45441
+ this.rules[2] = {
45442
+ name: 'path-segment',
45443
+ lower: 'path-segment',
45444
+ index: 2,
45445
+ isBkr: false
45446
+ };
45447
+ this.rules[3] = {
45448
+ name: 'query',
45449
+ lower: 'query',
45450
+ index: 3,
45451
+ isBkr: false
45452
+ };
45453
+ this.rules[4] = {
45454
+ name: 'query-literal',
45455
+ lower: 'query-literal',
45456
+ index: 4,
45457
+ isBkr: false
45458
+ };
45459
+ this.rules[5] = {
45460
+ name: 'query-marker',
45461
+ lower: 'query-marker',
45462
+ index: 5,
45463
+ isBkr: false
45464
+ };
45465
+ this.rules[6] = {
45466
+ name: 'fragment',
45467
+ lower: 'fragment',
45468
+ index: 6,
45469
+ isBkr: false
45470
+ };
45471
+ this.rules[7] = {
45472
+ name: 'fragment-literal',
45473
+ lower: 'fragment-literal',
45474
+ index: 7,
45475
+ isBkr: false
45476
+ };
45477
+ this.rules[8] = {
45478
+ name: 'fragment-marker',
45479
+ lower: 'fragment-marker',
45480
+ index: 8,
45481
+ isBkr: false
45482
+ };
45483
+ this.rules[9] = {
45484
+ name: 'slash',
45485
+ lower: 'slash',
45486
+ index: 9,
45487
+ isBkr: false
45488
+ };
45489
+ this.rules[10] = {
45490
+ name: 'path-literal',
45491
+ lower: 'path-literal',
45492
+ index: 10,
45493
+ isBkr: false
45494
+ };
45495
+ this.rules[11] = {
45496
+ name: 'template-expression',
45497
+ lower: 'template-expression',
45498
+ index: 11,
45499
+ isBkr: false
45500
+ };
45501
+ this.rules[12] = {
45502
+ name: 'template-expression-param-name',
45503
+ lower: 'template-expression-param-name',
45504
+ index: 12,
45505
+ isBkr: false
45506
+ };
45507
+ this.rules[13] = {
45508
+ name: 'unreserved',
45509
+ lower: 'unreserved',
45510
+ index: 13,
45511
+ isBkr: false
45512
+ };
45513
+ this.rules[14] = {
45514
+ name: 'pct-encoded',
45515
+ lower: 'pct-encoded',
45516
+ index: 14,
45517
+ isBkr: false
45518
+ };
45519
+ this.rules[15] = {
45520
+ name: 'sub-delims',
45521
+ lower: 'sub-delims',
45522
+ index: 15,
45523
+ isBkr: false
45524
+ };
45525
+ this.rules[16] = {
45526
+ name: 'sub-delims-no-slash',
45527
+ lower: 'sub-delims-no-slash',
45528
+ index: 16,
45529
+ isBkr: false
45530
+ };
45531
+ this.rules[17] = {
45532
+ name: 'ALPHA',
45533
+ lower: 'alpha',
45534
+ index: 17,
45535
+ isBkr: false
45536
+ };
45537
+ this.rules[18] = {
45538
+ name: 'DIGIT',
45539
+ lower: 'digit',
45540
+ index: 18,
45541
+ isBkr: false
45542
+ };
45543
+ this.rules[19] = {
45544
+ name: 'HEXDIG',
45545
+ lower: 'hexdig',
45546
+ index: 19,
45547
+ isBkr: false
45548
+ };
45549
+
45550
+ /* UDTS */
45551
+ this.udts = [];
45552
+
45553
+ /* OPCODES */
45554
+ /* path-template */
45555
+ this.rules[0].opcodes = [];
45556
+ this.rules[0].opcodes[0] = {
45557
+ type: 2,
45558
+ children: [1, 2, 6]
45559
+ }; // CAT
45560
+ this.rules[0].opcodes[1] = {
45561
+ type: 4,
45562
+ index: 1
45563
+ }; // RNM(path)
45564
+ this.rules[0].opcodes[2] = {
45565
+ type: 3,
45566
+ min: 0,
45567
+ max: 1
45568
+ }; // REP
45569
+ this.rules[0].opcodes[3] = {
45570
+ type: 2,
45571
+ children: [4, 5]
45572
+ }; // CAT
45573
+ this.rules[0].opcodes[4] = {
45574
+ type: 4,
45575
+ index: 5
45576
+ }; // RNM(query-marker)
45577
+ this.rules[0].opcodes[5] = {
45578
+ type: 4,
45579
+ index: 3
45580
+ }; // RNM(query)
45581
+ this.rules[0].opcodes[6] = {
45582
+ type: 3,
45583
+ min: 0,
45584
+ max: 1
45585
+ }; // REP
45586
+ this.rules[0].opcodes[7] = {
45587
+ type: 2,
45588
+ children: [8, 9]
45589
+ }; // CAT
45590
+ this.rules[0].opcodes[8] = {
45591
+ type: 4,
45592
+ index: 8
45593
+ }; // RNM(fragment-marker)
45594
+ this.rules[0].opcodes[9] = {
45595
+ type: 4,
45596
+ index: 6
45597
+ }; // RNM(fragment)
45598
+
45599
+ /* path */
45600
+ this.rules[1].opcodes = [];
45601
+ this.rules[1].opcodes[0] = {
45602
+ type: 2,
45603
+ children: [1, 2, 6]
45604
+ }; // CAT
45605
+ this.rules[1].opcodes[1] = {
45606
+ type: 4,
45607
+ index: 9
45608
+ }; // RNM(slash)
45609
+ this.rules[1].opcodes[2] = {
45610
+ type: 3,
45611
+ min: 0,
45612
+ max: Infinity
45613
+ }; // REP
45614
+ this.rules[1].opcodes[3] = {
45615
+ type: 2,
45616
+ children: [4, 5]
45617
+ }; // CAT
45618
+ this.rules[1].opcodes[4] = {
45619
+ type: 4,
45620
+ index: 2
45621
+ }; // RNM(path-segment)
45622
+ this.rules[1].opcodes[5] = {
45623
+ type: 4,
45624
+ index: 9
45625
+ }; // RNM(slash)
45626
+ this.rules[1].opcodes[6] = {
45627
+ type: 3,
45628
+ min: 0,
45629
+ max: 1
45630
+ }; // REP
45631
+ this.rules[1].opcodes[7] = {
45632
+ type: 4,
45633
+ index: 2
45634
+ }; // RNM(path-segment)
45635
+
45636
+ /* path-segment */
45637
+ this.rules[2].opcodes = [];
45638
+ this.rules[2].opcodes[0] = {
45639
+ type: 3,
45640
+ min: 1,
45641
+ max: Infinity
45642
+ }; // REP
45643
+ this.rules[2].opcodes[1] = {
45644
+ type: 1,
45645
+ children: [2, 3]
45646
+ }; // ALT
45647
+ this.rules[2].opcodes[2] = {
45648
+ type: 4,
45649
+ index: 10
45650
+ }; // RNM(path-literal)
45651
+ this.rules[2].opcodes[3] = {
45652
+ type: 4,
45653
+ index: 11
45654
+ }; // RNM(template-expression)
45655
+
45656
+ /* query */
45657
+ this.rules[3].opcodes = [];
45658
+ this.rules[3].opcodes[0] = {
45659
+ type: 3,
45660
+ min: 0,
45661
+ max: Infinity
45662
+ }; // REP
45663
+ this.rules[3].opcodes[1] = {
45664
+ type: 4,
45665
+ index: 4
45666
+ }; // RNM(query-literal)
45667
+
45668
+ /* query-literal */
45669
+ this.rules[4].opcodes = [];
45670
+ this.rules[4].opcodes[0] = {
45671
+ type: 3,
45672
+ min: 1,
45673
+ max: Infinity
45674
+ }; // REP
45675
+ this.rules[4].opcodes[1] = {
45676
+ type: 1,
45677
+ children: [2, 3, 4, 5, 6, 7, 8, 9, 10]
45678
+ }; // ALT
45679
+ this.rules[4].opcodes[2] = {
45680
+ type: 4,
45681
+ index: 13
45682
+ }; // RNM(unreserved)
45683
+ this.rules[4].opcodes[3] = {
45684
+ type: 4,
45685
+ index: 14
45686
+ }; // RNM(pct-encoded)
45687
+ this.rules[4].opcodes[4] = {
45688
+ type: 4,
45689
+ index: 15
45690
+ }; // RNM(sub-delims)
45691
+ this.rules[4].opcodes[5] = {
45692
+ type: 7,
45693
+ string: [58]
45694
+ }; // TLS
45695
+ this.rules[4].opcodes[6] = {
45696
+ type: 7,
45697
+ string: [64]
45698
+ }; // TLS
45699
+ this.rules[4].opcodes[7] = {
45700
+ type: 7,
45701
+ string: [47]
45702
+ }; // TLS
45703
+ this.rules[4].opcodes[8] = {
45704
+ type: 7,
45705
+ string: [63]
45706
+ }; // TLS
45707
+ this.rules[4].opcodes[9] = {
45708
+ type: 7,
45709
+ string: [38]
45710
+ }; // TLS
45711
+ this.rules[4].opcodes[10] = {
45712
+ type: 7,
45713
+ string: [61]
45714
+ }; // TLS
45715
+
45716
+ /* query-marker */
45717
+ this.rules[5].opcodes = [];
45718
+ this.rules[5].opcodes[0] = {
45719
+ type: 7,
45720
+ string: [63]
45721
+ }; // TLS
45722
+
45723
+ /* fragment */
45724
+ this.rules[6].opcodes = [];
45725
+ this.rules[6].opcodes[0] = {
45726
+ type: 3,
45727
+ min: 0,
45728
+ max: Infinity
45729
+ }; // REP
45730
+ this.rules[6].opcodes[1] = {
45731
+ type: 4,
45732
+ index: 7
45733
+ }; // RNM(fragment-literal)
45734
+
45735
+ /* fragment-literal */
45736
+ this.rules[7].opcodes = [];
45737
+ this.rules[7].opcodes[0] = {
45738
+ type: 3,
45739
+ min: 1,
45740
+ max: Infinity
45741
+ }; // REP
45742
+ this.rules[7].opcodes[1] = {
45743
+ type: 1,
45744
+ children: [2, 3, 4, 5, 6, 7, 8]
45745
+ }; // ALT
45746
+ this.rules[7].opcodes[2] = {
45747
+ type: 4,
45748
+ index: 13
45749
+ }; // RNM(unreserved)
45750
+ this.rules[7].opcodes[3] = {
45751
+ type: 4,
45752
+ index: 14
45753
+ }; // RNM(pct-encoded)
45754
+ this.rules[7].opcodes[4] = {
45755
+ type: 4,
45756
+ index: 15
45757
+ }; // RNM(sub-delims)
45758
+ this.rules[7].opcodes[5] = {
45759
+ type: 7,
45760
+ string: [58]
45761
+ }; // TLS
45762
+ this.rules[7].opcodes[6] = {
45763
+ type: 7,
45764
+ string: [64]
45765
+ }; // TLS
45766
+ this.rules[7].opcodes[7] = {
45767
+ type: 7,
45768
+ string: [47]
45769
+ }; // TLS
45770
+ this.rules[7].opcodes[8] = {
45771
+ type: 7,
45772
+ string: [63]
45773
+ }; // TLS
45774
+
45775
+ /* fragment-marker */
45776
+ this.rules[8].opcodes = [];
45777
+ this.rules[8].opcodes[0] = {
45778
+ type: 7,
45779
+ string: [35]
45780
+ }; // TLS
45781
+
45782
+ /* slash */
45783
+ this.rules[9].opcodes = [];
45784
+ this.rules[9].opcodes[0] = {
45785
+ type: 7,
45786
+ string: [47]
45787
+ }; // TLS
45788
+
45789
+ /* path-literal */
45790
+ this.rules[10].opcodes = [];
45791
+ this.rules[10].opcodes[0] = {
45792
+ type: 3,
45793
+ min: 1,
45794
+ max: Infinity
45795
+ }; // REP
45796
+ this.rules[10].opcodes[1] = {
45797
+ type: 1,
45798
+ children: [2, 3, 4, 5, 6]
45799
+ }; // ALT
45800
+ this.rules[10].opcodes[2] = {
45801
+ type: 4,
45802
+ index: 13
45803
+ }; // RNM(unreserved)
45804
+ this.rules[10].opcodes[3] = {
45805
+ type: 4,
45806
+ index: 14
45807
+ }; // RNM(pct-encoded)
45808
+ this.rules[10].opcodes[4] = {
45809
+ type: 4,
45810
+ index: 16
45811
+ }; // RNM(sub-delims-no-slash)
45812
+ this.rules[10].opcodes[5] = {
45813
+ type: 7,
45814
+ string: [58]
45815
+ }; // TLS
45816
+ this.rules[10].opcodes[6] = {
45817
+ type: 7,
45818
+ string: [64]
45819
+ }; // TLS
45820
+
45821
+ /* template-expression */
45822
+ this.rules[11].opcodes = [];
45823
+ this.rules[11].opcodes[0] = {
45824
+ type: 2,
45825
+ children: [1, 2, 3]
45826
+ }; // CAT
45827
+ this.rules[11].opcodes[1] = {
45828
+ type: 7,
45829
+ string: [123]
45830
+ }; // TLS
45831
+ this.rules[11].opcodes[2] = {
45832
+ type: 4,
45833
+ index: 12
45834
+ }; // RNM(template-expression-param-name)
45835
+ this.rules[11].opcodes[3] = {
45836
+ type: 7,
45837
+ string: [125]
45838
+ }; // TLS
45839
+
45840
+ /* template-expression-param-name */
45841
+ this.rules[12].opcodes = [];
45842
+ this.rules[12].opcodes[0] = {
45843
+ type: 3,
45844
+ min: 1,
45845
+ max: Infinity
45846
+ }; // REP
45847
+ this.rules[12].opcodes[1] = {
45848
+ type: 1,
45849
+ children: [2, 3, 4, 5, 6]
45850
+ }; // ALT
45851
+ this.rules[12].opcodes[2] = {
45852
+ type: 4,
45853
+ index: 13
45854
+ }; // RNM(unreserved)
45855
+ this.rules[12].opcodes[3] = {
45856
+ type: 4,
45857
+ index: 14
45858
+ }; // RNM(pct-encoded)
45859
+ this.rules[12].opcodes[4] = {
45860
+ type: 4,
45861
+ index: 16
45862
+ }; // RNM(sub-delims-no-slash)
45863
+ this.rules[12].opcodes[5] = {
45864
+ type: 7,
45865
+ string: [58]
45866
+ }; // TLS
45867
+ this.rules[12].opcodes[6] = {
45868
+ type: 7,
45869
+ string: [64]
45870
+ }; // TLS
45871
+
45872
+ /* unreserved */
45873
+ this.rules[13].opcodes = [];
45874
+ this.rules[13].opcodes[0] = {
45875
+ type: 1,
45876
+ children: [1, 2, 3, 4, 5, 6]
45877
+ }; // ALT
45878
+ this.rules[13].opcodes[1] = {
45879
+ type: 4,
45880
+ index: 17
45881
+ }; // RNM(ALPHA)
45882
+ this.rules[13].opcodes[2] = {
45883
+ type: 4,
45884
+ index: 18
45885
+ }; // RNM(DIGIT)
45886
+ this.rules[13].opcodes[3] = {
45887
+ type: 7,
45888
+ string: [45]
45889
+ }; // TLS
45890
+ this.rules[13].opcodes[4] = {
45891
+ type: 7,
45892
+ string: [46]
45893
+ }; // TLS
45894
+ this.rules[13].opcodes[5] = {
45895
+ type: 7,
45896
+ string: [95]
45897
+ }; // TLS
45898
+ this.rules[13].opcodes[6] = {
45899
+ type: 7,
45900
+ string: [126]
45901
+ }; // TLS
45902
+
45903
+ /* pct-encoded */
45904
+ this.rules[14].opcodes = [];
45905
+ this.rules[14].opcodes[0] = {
45906
+ type: 2,
45907
+ children: [1, 2, 3]
45908
+ }; // CAT
45909
+ this.rules[14].opcodes[1] = {
45910
+ type: 7,
45911
+ string: [37]
45912
+ }; // TLS
45913
+ this.rules[14].opcodes[2] = {
45914
+ type: 4,
45915
+ index: 19
45916
+ }; // RNM(HEXDIG)
45917
+ this.rules[14].opcodes[3] = {
45918
+ type: 4,
45919
+ index: 19
45920
+ }; // RNM(HEXDIG)
45921
+
45922
+ /* sub-delims */
45923
+ this.rules[15].opcodes = [];
45924
+ this.rules[15].opcodes[0] = {
45925
+ type: 1,
45926
+ children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
45927
+ }; // ALT
45928
+ this.rules[15].opcodes[1] = {
45929
+ type: 7,
45930
+ string: [33]
45931
+ }; // TLS
45932
+ this.rules[15].opcodes[2] = {
45933
+ type: 7,
45934
+ string: [36]
45935
+ }; // TLS
45936
+ this.rules[15].opcodes[3] = {
45937
+ type: 7,
45938
+ string: [38]
45939
+ }; // TLS
45940
+ this.rules[15].opcodes[4] = {
45941
+ type: 7,
45942
+ string: [39]
45943
+ }; // TLS
45944
+ this.rules[15].opcodes[5] = {
45945
+ type: 7,
45946
+ string: [40]
45947
+ }; // TLS
45948
+ this.rules[15].opcodes[6] = {
45949
+ type: 7,
45950
+ string: [41]
45951
+ }; // TLS
45952
+ this.rules[15].opcodes[7] = {
45953
+ type: 7,
45954
+ string: [42]
45955
+ }; // TLS
45956
+ this.rules[15].opcodes[8] = {
45957
+ type: 7,
45958
+ string: [43]
45959
+ }; // TLS
45960
+ this.rules[15].opcodes[9] = {
45961
+ type: 7,
45962
+ string: [44]
45963
+ }; // TLS
45964
+ this.rules[15].opcodes[10] = {
45965
+ type: 7,
45966
+ string: [59]
45967
+ }; // TLS
45968
+ this.rules[15].opcodes[11] = {
45969
+ type: 7,
45970
+ string: [61]
45971
+ }; // TLS
45972
+
45973
+ /* sub-delims-no-slash */
45974
+ this.rules[16].opcodes = [];
45975
+ this.rules[16].opcodes[0] = {
45976
+ type: 1,
45977
+ children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
45978
+ }; // ALT
45979
+ this.rules[16].opcodes[1] = {
45980
+ type: 7,
45981
+ string: [33]
45982
+ }; // TLS
45983
+ this.rules[16].opcodes[2] = {
45984
+ type: 7,
45985
+ string: [36]
45986
+ }; // TLS
45987
+ this.rules[16].opcodes[3] = {
45988
+ type: 7,
45989
+ string: [38]
45990
+ }; // TLS
45991
+ this.rules[16].opcodes[4] = {
45992
+ type: 7,
45993
+ string: [39]
45994
+ }; // TLS
45995
+ this.rules[16].opcodes[5] = {
45996
+ type: 7,
45997
+ string: [40]
45998
+ }; // TLS
45999
+ this.rules[16].opcodes[6] = {
46000
+ type: 7,
46001
+ string: [41]
46002
+ }; // TLS
46003
+ this.rules[16].opcodes[7] = {
46004
+ type: 7,
46005
+ string: [42]
46006
+ }; // TLS
46007
+ this.rules[16].opcodes[8] = {
46008
+ type: 7,
46009
+ string: [43]
46010
+ }; // TLS
46011
+ this.rules[16].opcodes[9] = {
46012
+ type: 7,
46013
+ string: [44]
46014
+ }; // TLS
46015
+ this.rules[16].opcodes[10] = {
46016
+ type: 7,
46017
+ string: [59]
46018
+ }; // TLS
46019
+
46020
+ /* ALPHA */
46021
+ this.rules[17].opcodes = [];
46022
+ this.rules[17].opcodes[0] = {
46023
+ type: 1,
46024
+ children: [1, 2]
46025
+ }; // ALT
46026
+ this.rules[17].opcodes[1] = {
46027
+ type: 5,
46028
+ min: 65,
46029
+ max: 90
46030
+ }; // TRG
46031
+ this.rules[17].opcodes[2] = {
46032
+ type: 5,
46033
+ min: 97,
46034
+ max: 122
46035
+ }; // TRG
46036
+
46037
+ /* DIGIT */
46038
+ this.rules[18].opcodes = [];
46039
+ this.rules[18].opcodes[0] = {
46040
+ type: 5,
46041
+ min: 48,
46042
+ max: 57
46043
+ }; // TRG
46044
+
46045
+ /* HEXDIG */
46046
+ this.rules[19].opcodes = [];
46047
+ this.rules[19].opcodes[0] = {
46048
+ type: 1,
46049
+ children: [1, 2, 3, 4, 5, 6, 7]
46050
+ }; // ALT
46051
+ this.rules[19].opcodes[1] = {
46052
+ type: 4,
46053
+ index: 18
46054
+ }; // RNM(DIGIT)
46055
+ this.rules[19].opcodes[2] = {
46056
+ type: 7,
46057
+ string: [97]
46058
+ }; // TLS
46059
+ this.rules[19].opcodes[3] = {
46060
+ type: 7,
46061
+ string: [98]
46062
+ }; // TLS
46063
+ this.rules[19].opcodes[4] = {
46064
+ type: 7,
46065
+ string: [99]
46066
+ }; // TLS
46067
+ this.rules[19].opcodes[5] = {
46068
+ type: 7,
46069
+ string: [100]
46070
+ }; // TLS
46071
+ this.rules[19].opcodes[6] = {
46072
+ type: 7,
46073
+ string: [101]
46074
+ }; // TLS
46075
+ this.rules[19].opcodes[7] = {
46076
+ type: 7,
46077
+ string: [102]
46078
+ }; // TLS
46079
+
46080
+ // The `toString()` function will display the original grammar file(s) that produced these opcodes.
46081
+ this.toString = function toString() {
46082
+ let str = "";
46083
+ str += "; OpenAPI Path Templating ABNF syntax\n";
46084
+ str += "path-template = path [ query-marker query ] [ fragment-marker fragment ]\n";
46085
+ str += "path = slash *( path-segment slash ) [ path-segment ]\n";
46086
+ str += "path-segment = 1*( path-literal / template-expression )\n";
46087
+ str += "query = *( query-literal )\n";
46088
+ str += "query-literal = 1*( unreserved / pct-encoded / sub-delims / \":\" / \"@\" / \"/\" / \"?\" / \"&\" / \"=\" )\n";
46089
+ str += "query-marker = \"?\"\n";
46090
+ str += "fragment = *( fragment-literal )\n";
46091
+ str += "fragment-literal = 1*( unreserved / pct-encoded / sub-delims / \":\" / \"@\" / \"/\" / \"?\" )\n";
46092
+ str += "fragment-marker = \"#\"\n";
46093
+ str += "slash = \"/\"\n";
46094
+ str += "path-literal = 1*( unreserved / pct-encoded / sub-delims-no-slash / \":\" / \"@\" )\n";
46095
+ str += "template-expression = \"{\" template-expression-param-name \"}\"\n";
46096
+ str += "template-expression-param-name = 1*( unreserved / pct-encoded / sub-delims-no-slash / \":\" / \"@\" )\n";
46097
+ str += "\n";
46098
+ str += "; Characters definitions (from RFC 3986)\n";
46099
+ str += "unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n";
46100
+ str += "pct-encoded = \"%\" HEXDIG HEXDIG\n";
46101
+ str += "sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n";
46102
+ str += " / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n";
46103
+ str += "sub-delims-no-slash = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n";
46104
+ str += " / \"*\" / \"+\" / \",\" / \";\"\n";
46105
+ str += "ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n";
46106
+ str += "DIGIT = %x30-39 ; 0-9\n";
46107
+ str += "HEXDIG = DIGIT / \"A\" / \"B\" / \"C\" / \"D\" / \"E\" / \"F\"\n";
46108
+ return str;
46109
+ };
46110
+ }
46111
+
46112
+ /***/ }),
46113
+
46114
+ /***/ 97642:
46115
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
46116
+
46117
+ "use strict";
46118
+ __webpack_require__.r(__webpack_exports__);
46119
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
46120
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
46121
+ /* harmony export */ encodePathComponent: () => (/* binding */ encodePathComponent)
46122
+ /* harmony export */ });
46123
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10426);
46124
+
46125
+ const isEncoded = component => {
46126
+ try {
46127
+ return typeof component === 'string' && decodeURIComponent(component) !== component;
46128
+ } catch (e) {
46129
+ return false;
46130
+ }
46131
+ };
46132
+ const encodePathComponent = component => {
46133
+ if (isEncoded(component)) {
46134
+ return component;
46135
+ }
46136
+ return encodeURIComponent(component);
46137
+ };
46138
+ const significantTypes = ['slash', 'path-literal', 'query-marker', 'query-literal', 'template-expression-param-name'];
46139
+ const resolve = (pathTemplate, parameters = {}, options = {}) => {
46140
+ const defaultOptions = {
46141
+ encoder: encodePathComponent
46142
+ };
46143
+ const mergedOptions = {
46144
+ ...defaultOptions,
46145
+ ...options
46146
+ };
46147
+ const parseResult = (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(pathTemplate);
46148
+ if (!parseResult.result.success) return pathTemplate;
46149
+ const parts = [];
46150
+ parseResult.ast.translate(parts);
46151
+ const resolvedParts = parts.filter(([type]) => significantTypes.includes(type)).map(([type, value]) => {
46152
+ if (type === 'template-expression-param-name') {
46153
+ return Object.hasOwn(parameters, value) ? mergedOptions.encoder(parameters[value]) : `{${value}}`;
46154
+ }
46155
+ return value;
46156
+ });
46157
+ return resolvedParts.join('');
46158
+ };
46159
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolve);
46160
+
46161
+ /***/ }),
46162
+
46163
+ /***/ 62674:
46164
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
46165
+
46166
+ "use strict";
46167
+ __webpack_require__.r(__webpack_exports__);
46168
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
46169
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
46170
+ /* harmony export */ });
46171
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10426);
46172
+
46173
+ /**
46174
+ * Test if a string is a path template.
46175
+ *
46176
+ * @param {string} str
46177
+ * @param {Object} [options={}] - An object.
46178
+ * @param {boolean} [options.strict=true] - A boolean indicating presence of at least one `template-expression` AST node.
46179
+ * @returns {boolean}
46180
+ */
46181
+ const test = (str, {
46182
+ strict = false
46183
+ } = {}) => {
46184
+ try {
46185
+ const parseResult = (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(str);
46186
+ if (!parseResult.result.success) return false;
46187
+ if (!strict) return true;
46188
+ const parts = [];
46189
+ parseResult.ast.translate(parts);
46190
+ return parts.some(([type]) => type === 'template-expression');
46191
+ } catch {
46192
+ return false;
46193
+ }
46194
+ };
46195
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (test);
46196
+
43826
46197
  /***/ }),
43827
46198
 
43828
46199
  /***/ 89360: