@nmshd/runtime 2.5.2 → 2.5.3

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.
@@ -548,10 +548,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
548
548
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
549
549
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
550
550
  exports.buildInformation = {
551
- version: "2.5.2",
552
- build: "156",
553
- date: "2023-07-13T14:45:52+00:00",
554
- commit: "cfd1e4319bd78295a7ea7e73d9af4365b0fbaf0c",
551
+ version: "2.5.3",
552
+ build: "157",
553
+ date: "2023-07-14T09:42:05+00:00",
554
+ commit: "43b0467c1a9c013a2b022018255a71083377abd5",
555
555
  dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.8","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.2.2","@nmshd/content":"2.3.6","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.0.5","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.3.0","qrcode":"1.5.3","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
556
556
  libraries: {
557
557
  serval: ts_serval_1.buildInformation,
@@ -3677,7 +3677,7 @@ exports.AttributesFacade = void 0;
3677
3677
  const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
3678
3678
  const useCases_1 = __webpack_require__(/*! ../../../useCases */ "./dist/useCases/index.js");
3679
3679
  let AttributesFacade = exports.AttributesFacade = class AttributesFacade {
3680
- constructor(createAttributeUseCase, createSharedAttributeCopyUseCase, deleteAttributeUseCase, getPeerAttributesUseCase, getSharedToPeerAttributesUseCase, getAttributeUseCase, getAttributesUseCase, succeedAttributeUseCase, updateAttributeUseCase, executeIdentityAttributeQueryUseCase, executeRelationshipAttributeQueryUseCase, executeThirdPartyRelationshipAttributeQueryUseCase, executeIQLQueryUseCase, shareAttributeUseCase) {
3680
+ constructor(createAttributeUseCase, createSharedAttributeCopyUseCase, deleteAttributeUseCase, getPeerAttributesUseCase, getSharedToPeerAttributesUseCase, getAttributeUseCase, getAttributesUseCase, succeedAttributeUseCase, updateAttributeUseCase, executeIdentityAttributeQueryUseCase, executeRelationshipAttributeQueryUseCase, executeThirdPartyRelationshipAttributeQueryUseCase, executeIQLQueryUseCase, validateIQLQueryUseCase, shareAttributeUseCase) {
3681
3681
  this.createAttributeUseCase = createAttributeUseCase;
3682
3682
  this.createSharedAttributeCopyUseCase = createSharedAttributeCopyUseCase;
3683
3683
  this.deleteAttributeUseCase = deleteAttributeUseCase;
@@ -3691,6 +3691,7 @@ let AttributesFacade = exports.AttributesFacade = class AttributesFacade {
3691
3691
  this.executeRelationshipAttributeQueryUseCase = executeRelationshipAttributeQueryUseCase;
3692
3692
  this.executeThirdPartyRelationshipAttributeQueryUseCase = executeThirdPartyRelationshipAttributeQueryUseCase;
3693
3693
  this.executeIQLQueryUseCase = executeIQLQueryUseCase;
3694
+ this.validateIQLQueryUseCase = validateIQLQueryUseCase;
3694
3695
  this.shareAttributeUseCase = shareAttributeUseCase;
3695
3696
  }
3696
3697
  async createAttribute(request) {
@@ -3726,6 +3727,9 @@ let AttributesFacade = exports.AttributesFacade = class AttributesFacade {
3726
3727
  async executeIQLQuery(request) {
3727
3728
  return await this.executeIQLQueryUseCase.execute(request);
3728
3729
  }
3730
+ async validateIQLQuery(request) {
3731
+ return await this.validateIQLQueryUseCase.execute(request);
3732
+ }
3729
3733
  async succeedAttribute(request) {
3730
3734
  return await this.succeedAttributeUseCase.execute(request);
3731
3735
  }
@@ -3751,6 +3755,7 @@ exports.AttributesFacade = AttributesFacade = __decorate([
3751
3755
  __param(11, typescript_ioc_1.Inject),
3752
3756
  __param(12, typescript_ioc_1.Inject),
3753
3757
  __param(13, typescript_ioc_1.Inject),
3758
+ __param(14, typescript_ioc_1.Inject),
3754
3759
  __metadata("design:paramtypes", [useCases_1.CreateAttributeUseCase,
3755
3760
  useCases_1.CreateSharedAttributeCopyUseCase,
3756
3761
  useCases_1.DeleteAttributeUseCase,
@@ -3764,6 +3769,7 @@ exports.AttributesFacade = AttributesFacade = __decorate([
3764
3769
  useCases_1.ExecuteRelationshipAttributeQueryUseCase,
3765
3770
  useCases_1.ExecuteThirdPartyRelationshipAttributeQueryUseCase,
3766
3771
  useCases_1.ExecuteIQLQueryUseCase,
3772
+ useCases_1.ValidateIQLQueryUseCase,
3767
3773
  useCases_1.ShareAttributeUseCase])
3768
3774
  ], AttributesFacade);
3769
3775
  //# sourceMappingURL=AttributesFacade.js.map
@@ -6307,8 +6313,8 @@ exports.JsonSchema = JsonSchema;
6307
6313
  "use strict";
6308
6314
 
6309
6315
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6310
- exports.CreateRelationshipChallengeRequest = exports.SyncEverythingRequest = exports.DownloadAttachmentRequest = exports.SyncDatawalletRequest = exports.RegisterPushNotificationTokenRequest = exports.LoadItemFromTruncatedReferenceRequest = exports.DownloadFileRequest = exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.ShareAttributeRequest = exports.SentOutgoingRequestRequest = exports.RequireManualDecisionOfIncomingRequestRequest = exports.ReceivedIncomingRequestRequest = exports.GetOutgoingRequestsRequest = exports.GetOutgoingRequestRequest = exports.GetIncomingRequestsRequest = exports.GetIncomingRequestRequest = exports.DiscardOutgoingRequestRequest = exports.CreateOutgoingRequestRequest = exports.CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseRequest = exports.CompleteOutgoingRequestRequest = exports.CompleteIncomingRequestRequest = exports.CheckPrerequisitesOfIncomingRequestRequest = exports.RejectIncomingRequestRequest = exports.CanCreateOutgoingRequestRequest = exports.AcceptIncomingRequestRequest = exports.GetSharedToPeerAttributesRequest = exports.GetPeerAttributesRequest = exports.GetAttributesRequest = exports.GetAttributeRequest = exports.ExecuteThirdPartyRelationshipAttributeQueryRequest = exports.ExecuteRelationshipAttributeQueryRequest = exports.ExecuteIQLQueryRequest = exports.ExecuteIdentityAttributeQueryRequest = exports.DeleteAttributeRequest = exports.CreateSharedAttributeCopyRequest = exports.CreateAttributeRequest = exports.GetAttributeListenerRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
6311
- exports.LoadPeerTokenRequest = exports.LoadPeerTokenViaSecretRequest = exports.LoadPeerTokenViaReferenceRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.LoadPeerRelationshipTemplateViaReferenceRequest = exports.LoadPeerRelationshipTemplateViaSecretRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateQrCodeForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.GetAttributesForRelationshipRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileValidatableRequest = exports.UploadOwnFileRequest = exports.GetOrLoadFileRequest = exports.GetOrLoadFileViaReferenceRequest = exports.GetOrLoadFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.CreateQrCodeForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.ValidateChallengeRequest = exports.CreateChallengeRequest = exports.CreateDeviceChallengeRequest = exports.CreateIdentityChallengeRequest = void 0;
6316
+ exports.SyncEverythingRequest = exports.DownloadAttachmentRequest = exports.SyncDatawalletRequest = exports.RegisterPushNotificationTokenRequest = exports.LoadItemFromTruncatedReferenceRequest = exports.DownloadFileRequest = exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.ValidateIQLQueryRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.ShareAttributeRequest = exports.SentOutgoingRequestRequest = exports.RequireManualDecisionOfIncomingRequestRequest = exports.ReceivedIncomingRequestRequest = exports.GetOutgoingRequestsRequest = exports.GetOutgoingRequestRequest = exports.GetIncomingRequestsRequest = exports.GetIncomingRequestRequest = exports.DiscardOutgoingRequestRequest = exports.CreateOutgoingRequestRequest = exports.CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseRequest = exports.CompleteOutgoingRequestRequest = exports.CompleteIncomingRequestRequest = exports.CheckPrerequisitesOfIncomingRequestRequest = exports.RejectIncomingRequestRequest = exports.CanCreateOutgoingRequestRequest = exports.AcceptIncomingRequestRequest = exports.GetSharedToPeerAttributesRequest = exports.GetPeerAttributesRequest = exports.GetAttributesRequest = exports.GetAttributeRequest = exports.ExecuteThirdPartyRelationshipAttributeQueryRequest = exports.ExecuteRelationshipAttributeQueryRequest = exports.ExecuteIQLQueryRequest = exports.ExecuteIdentityAttributeQueryRequest = exports.DeleteAttributeRequest = exports.CreateSharedAttributeCopyRequest = exports.CreateAttributeRequest = exports.GetAttributeListenerRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
6317
+ exports.LoadPeerTokenRequest = exports.LoadPeerTokenViaSecretRequest = exports.LoadPeerTokenViaReferenceRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.LoadPeerRelationshipTemplateViaReferenceRequest = exports.LoadPeerRelationshipTemplateViaSecretRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateQrCodeForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.GetAttributesForRelationshipRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileValidatableRequest = exports.UploadOwnFileRequest = exports.GetOrLoadFileRequest = exports.GetOrLoadFileViaReferenceRequest = exports.GetOrLoadFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.CreateQrCodeForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.ValidateChallengeRequest = exports.CreateChallengeRequest = exports.CreateDeviceChallengeRequest = exports.CreateIdentityChallengeRequest = exports.CreateRelationshipChallengeRequest = void 0;
6312
6318
  exports.LoadPeerTokenAnonymousByIdAndKeyRequest = {
6313
6319
  "$schema": "http://json-schema.org/draft-07/schema#",
6314
6320
  "$ref": "#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",
@@ -26792,6 +26798,66 @@ exports.UpdateAttributeRequest = {
26792
26798
  }
26793
26799
  }
26794
26800
  };
26801
+ exports.ValidateIQLQueryRequest = {
26802
+ "$schema": "http://json-schema.org/draft-07/schema#",
26803
+ "$ref": "#/definitions/ValidateIQLQueryRequest",
26804
+ "definitions": {
26805
+ "ValidateIQLQueryRequest": {
26806
+ "type": "object",
26807
+ "properties": {
26808
+ "query": {
26809
+ "anyOf": [
26810
+ {
26811
+ "$ref": "#/definitions/IIQLQuery"
26812
+ },
26813
+ {
26814
+ "$ref": "#/definitions/IQLQueryJSON"
26815
+ }
26816
+ ]
26817
+ }
26818
+ },
26819
+ "required": [
26820
+ "query"
26821
+ ],
26822
+ "additionalProperties": false
26823
+ },
26824
+ "IIQLQuery": {
26825
+ "type": "object",
26826
+ "properties": {
26827
+ "queryString": {
26828
+ "type": "string"
26829
+ }
26830
+ },
26831
+ "required": [
26832
+ "queryString"
26833
+ ],
26834
+ "additionalProperties": false
26835
+ },
26836
+ "IQLQueryJSON": {
26837
+ "type": "object",
26838
+ "properties": {
26839
+ "@type": {
26840
+ "type": "string",
26841
+ "const": "IQLQuery"
26842
+ },
26843
+ "@context": {
26844
+ "type": "string"
26845
+ },
26846
+ "@version": {
26847
+ "type": "string"
26848
+ },
26849
+ "queryString": {
26850
+ "type": "string"
26851
+ }
26852
+ },
26853
+ "required": [
26854
+ "@type",
26855
+ "queryString"
26856
+ ],
26857
+ "additionalProperties": false
26858
+ }
26859
+ }
26860
+ };
26795
26861
  exports.CreateDraftRequest = {
26796
26862
  "$schema": "http://json-schema.org/draft-07/schema#",
26797
26863
  "$ref": "#/definitions/CreateDraftRequest",
@@ -29703,9 +29769,18 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
29703
29769
  const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
29704
29770
  const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
29705
29771
  const AttributeMapper_1 = __webpack_require__(/*! ./AttributeMapper */ "./dist/useCases/consumption/attributes/AttributeMapper.js");
29772
+ let Validator = class Validator extends common_1.SchemaValidator {
29773
+ constructor(schemaRepository) {
29774
+ super(schemaRepository.getSchema("ExecuteIQLQueryRequest"));
29775
+ }
29776
+ };
29777
+ Validator = __decorate([
29778
+ __param(0, typescript_ioc_1.Inject),
29779
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
29780
+ ], Validator);
29706
29781
  let ExecuteIQLQueryUseCase = exports.ExecuteIQLQueryUseCase = class ExecuteIQLQueryUseCase extends common_1.UseCase {
29707
- constructor(attributeController) {
29708
- super();
29782
+ constructor(attributeController, validator) {
29783
+ super(validator);
29709
29784
  this.attributeController = attributeController;
29710
29785
  }
29711
29786
  async executeInternal(request) {
@@ -29716,7 +29791,8 @@ let ExecuteIQLQueryUseCase = exports.ExecuteIQLQueryUseCase = class ExecuteIQLQu
29716
29791
  };
29717
29792
  exports.ExecuteIQLQueryUseCase = ExecuteIQLQueryUseCase = __decorate([
29718
29793
  __param(0, typescript_ioc_1.Inject),
29719
- __metadata("design:paramtypes", [consumption_1.AttributesController])
29794
+ __param(1, typescript_ioc_1.Inject),
29795
+ __metadata("design:paramtypes", [consumption_1.AttributesController, Validator])
29720
29796
  ], ExecuteIQLQueryUseCase);
29721
29797
  //# sourceMappingURL=ExecuteIQLQuery.js.map
29722
29798
 
@@ -30405,6 +30481,60 @@ exports.UpdateAttributeUseCase = UpdateAttributeUseCase = __decorate([
30405
30481
 
30406
30482
  /***/ }),
30407
30483
 
30484
+ /***/ "./dist/useCases/consumption/attributes/ValidateIQLQuery.js":
30485
+ /*!******************************************************************!*\
30486
+ !*** ./dist/useCases/consumption/attributes/ValidateIQLQuery.js ***!
30487
+ \******************************************************************/
30488
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
30489
+
30490
+ "use strict";
30491
+
30492
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
30493
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30494
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30495
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30496
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30497
+ };
30498
+ var __metadata = (this && this.__metadata) || function (k, v) {
30499
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
30500
+ };
30501
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
30502
+ return function (target, key) { decorator(target, key, paramIndex); }
30503
+ };
30504
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
30505
+ exports.ValidateIQLQueryUseCase = void 0;
30506
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
30507
+ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
30508
+ const iql_1 = __webpack_require__(/*! @nmshd/iql */ "./node_modules/@nmshd/iql/dist/src/index.js");
30509
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
30510
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
30511
+ let Validator = class Validator extends common_1.SchemaValidator {
30512
+ constructor(schemaRepository) {
30513
+ super(schemaRepository.getSchema("ValidateIQLQueryRequest"));
30514
+ }
30515
+ };
30516
+ Validator = __decorate([
30517
+ __param(0, typescript_ioc_1.Inject),
30518
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
30519
+ ], Validator);
30520
+ let ValidateIQLQueryUseCase = exports.ValidateIQLQueryUseCase = class ValidateIQLQueryUseCase extends common_1.UseCase {
30521
+ constructor(validator) {
30522
+ super(validator);
30523
+ }
30524
+ executeInternal(request) {
30525
+ const query = content_1.IQLQuery.from(request.query);
30526
+ const validationResult = (0, iql_1.validate)(query.queryString);
30527
+ return ts_utils_1.Result.ok(validationResult);
30528
+ }
30529
+ };
30530
+ exports.ValidateIQLQueryUseCase = ValidateIQLQueryUseCase = __decorate([
30531
+ __param(0, typescript_ioc_1.Inject),
30532
+ __metadata("design:paramtypes", [Validator])
30533
+ ], ValidateIQLQueryUseCase);
30534
+ //# sourceMappingURL=ValidateIQLQuery.js.map
30535
+
30536
+ /***/ }),
30537
+
30408
30538
  /***/ "./dist/useCases/consumption/attributes/index.js":
30409
30539
  /*!*******************************************************!*\
30410
30540
  !*** ./dist/useCases/consumption/attributes/index.js ***!
@@ -30443,6 +30573,7 @@ __exportStar(__webpack_require__(/*! ./GetSharedToPeerAttributes */ "./dist/useC
30443
30573
  __exportStar(__webpack_require__(/*! ./ShareAttribute */ "./dist/useCases/consumption/attributes/ShareAttribute.js"), exports);
30444
30574
  __exportStar(__webpack_require__(/*! ./SucceedAttribute */ "./dist/useCases/consumption/attributes/SucceedAttribute.js"), exports);
30445
30575
  __exportStar(__webpack_require__(/*! ./UpdateAttribute */ "./dist/useCases/consumption/attributes/UpdateAttribute.js"), exports);
30576
+ __exportStar(__webpack_require__(/*! ./ValidateIQLQuery */ "./dist/useCases/consumption/attributes/ValidateIQLQuery.js"), exports);
30446
30577
  //# sourceMappingURL=index.js.map
30447
30578
 
30448
30579
  /***/ }),
@@ -37815,6 +37946,1574 @@ exports.sleep = sleep;
37815
37946
 
37816
37947
  /***/ }),
37817
37948
 
37949
+ /***/ "./node_modules/@nmshd/iql/dist/generated/iql.js":
37950
+ /*!*******************************************************!*\
37951
+ !*** ./node_modules/@nmshd/iql/dist/generated/iql.js ***!
37952
+ \*******************************************************/
37953
+ /***/ ((module) => {
37954
+
37955
+ "use strict";
37956
+ // Generated by Peggy 3.0.2.
37957
+ //
37958
+ // https://peggyjs.org/
37959
+
37960
+ /**
37961
+ * Takes the path through a nested dict as an array of strings and returns
37962
+ * the value, or a fallback value, if the path does not exist.
37963
+ */
37964
+ function resolvePath(dict, path, fallback = null) {
37965
+ let val = dict;
37966
+ for (const e of path) {
37967
+ if (!Object.keys(val).includes(e)) {
37968
+ return fallback;
37969
+ }
37970
+ val = val[e];
37971
+ }
37972
+ return val;
37973
+ }
37974
+ /**
37975
+ * Generic matching function for attributes.
37976
+ *
37977
+ * attributes: Array of attributes
37978
+ * path: Path to data field to apply matchFn to, represented as an
37979
+ * array of strings. E.g. Foo.bar.baz is represented as ["Foo",
37980
+ * "bar", "baz"].
37981
+ * matchFn: Predicate function applied to the value of the extracted
37982
+ * attribute data field represented by 'path'.
37983
+ * attributeType: See comment below.
37984
+ */
37985
+ function match(attributes, path, matchFn, attributeType = undefined) {
37986
+ const indices = [];
37987
+ for (let ii = 0; ii < attributes.length; ii++) {
37988
+ const val = resolvePath(attributes[ii], path, null);
37989
+ // If attributeType is defined, assert that it matches the attribute's
37990
+ // type. When matching primary fields the mechanism presented by matchFn
37991
+ // below is insufficient as it's not given the full attribute but only
37992
+ // the selected data field.
37993
+ if (attributeType !== undefined && attributes[ii].value["@type"] !== attributeType) {
37994
+ continue;
37995
+ }
37996
+ if (val !== null && matchFn(val)) {
37997
+ indices.push(ii);
37998
+ }
37999
+ }
38000
+ return indices;
38001
+ }
38002
+ /**
38003
+ * Returns the union of two sets (represented as arrays of primitive
38004
+ * elements).
38005
+ */
38006
+ function union(arr1, arr2) {
38007
+ const result = Array.from(new Set([...arr1, ...arr2]));
38008
+ result.sort((a, b) => { return a - b; });
38009
+ return result;
38010
+ }
38011
+ /**
38012
+ * Returns the intersection of two sets (represented as arrays of primitive
38013
+ * elements).
38014
+ */
38015
+ function intersect(b, ...a) {
38016
+ const result = [b, ...a].reduce((p, c) => p.filter(e => c.includes(e)));
38017
+ result.sort((a, b) => { return a - b; });
38018
+ return result;
38019
+ }
38020
+ /**
38021
+ * Returns the asymmetric difference of two sets (represented as arrays of
38022
+ * primitive elements).
38023
+ */
38024
+ function diffAsym(arr1, arr2) {
38025
+ const result = arr1.filter((x) => { return !arr2.includes(x); });
38026
+ result.sort((a, b) => { return a - b; });
38027
+ return result;
38028
+ }
38029
+ function peg$subclass(child, parent) {
38030
+ function C() { this.constructor = child; }
38031
+ C.prototype = parent.prototype;
38032
+ child.prototype = new C();
38033
+ }
38034
+ function peg$SyntaxError(message, expected, found, location) {
38035
+ var self = Error.call(this, message);
38036
+ // istanbul ignore next Check is a necessary evil to support older environments
38037
+ if (Object.setPrototypeOf) {
38038
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
38039
+ }
38040
+ self.expected = expected;
38041
+ self.found = found;
38042
+ self.location = location;
38043
+ self.name = "SyntaxError";
38044
+ return self;
38045
+ }
38046
+ peg$subclass(peg$SyntaxError, Error);
38047
+ function peg$padEnd(str, targetLength, padString) {
38048
+ padString = padString || " ";
38049
+ if (str.length > targetLength) {
38050
+ return str;
38051
+ }
38052
+ targetLength -= str.length;
38053
+ padString += padString.repeat(targetLength);
38054
+ return str + padString.slice(0, targetLength);
38055
+ }
38056
+ peg$SyntaxError.prototype.format = function (sources) {
38057
+ var str = "Error: " + this.message;
38058
+ if (this.location) {
38059
+ var src = null;
38060
+ var k;
38061
+ for (k = 0; k < sources.length; k++) {
38062
+ if (sources[k].source === this.location.source) {
38063
+ src = sources[k].text.split(/\r\n|\n|\r/g);
38064
+ break;
38065
+ }
38066
+ }
38067
+ var s = this.location.start;
38068
+ var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
38069
+ ? this.location.source.offset(s)
38070
+ : s;
38071
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
38072
+ if (src) {
38073
+ var e = this.location.end;
38074
+ var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
38075
+ var line = src[s.line - 1];
38076
+ var last = s.line === e.line ? e.column : line.length + 1;
38077
+ var hatLen = (last - s.column) || 1;
38078
+ str += "\n --> " + loc + "\n"
38079
+ + filler + " |\n"
38080
+ + offset_s.line + " | " + line + "\n"
38081
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
38082
+ + peg$padEnd("", hatLen, "^");
38083
+ }
38084
+ else {
38085
+ str += "\n at " + loc;
38086
+ }
38087
+ }
38088
+ return str;
38089
+ };
38090
+ peg$SyntaxError.buildMessage = function (expected, found) {
38091
+ var DESCRIBE_EXPECTATION_FNS = {
38092
+ literal: function (expectation) {
38093
+ return "\"" + literalEscape(expectation.text) + "\"";
38094
+ },
38095
+ class: function (expectation) {
38096
+ var escapedParts = expectation.parts.map(function (part) {
38097
+ return Array.isArray(part)
38098
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
38099
+ : classEscape(part);
38100
+ });
38101
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
38102
+ },
38103
+ any: function () {
38104
+ return "any character";
38105
+ },
38106
+ end: function () {
38107
+ return "end of input";
38108
+ },
38109
+ other: function (expectation) {
38110
+ return expectation.description;
38111
+ }
38112
+ };
38113
+ function hex(ch) {
38114
+ return ch.charCodeAt(0).toString(16).toUpperCase();
38115
+ }
38116
+ function literalEscape(s) {
38117
+ return s
38118
+ .replace(/\\/g, "\\\\")
38119
+ .replace(/"/g, "\\\"")
38120
+ .replace(/\0/g, "\\0")
38121
+ .replace(/\t/g, "\\t")
38122
+ .replace(/\n/g, "\\n")
38123
+ .replace(/\r/g, "\\r")
38124
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
38125
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
38126
+ }
38127
+ function classEscape(s) {
38128
+ return s
38129
+ .replace(/\\/g, "\\\\")
38130
+ .replace(/\]/g, "\\]")
38131
+ .replace(/\^/g, "\\^")
38132
+ .replace(/-/g, "\\-")
38133
+ .replace(/\0/g, "\\0")
38134
+ .replace(/\t/g, "\\t")
38135
+ .replace(/\n/g, "\\n")
38136
+ .replace(/\r/g, "\\r")
38137
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
38138
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
38139
+ }
38140
+ function describeExpectation(expectation) {
38141
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
38142
+ }
38143
+ function describeExpected(expected) {
38144
+ var descriptions = expected.map(describeExpectation);
38145
+ var i, j;
38146
+ descriptions.sort();
38147
+ if (descriptions.length > 0) {
38148
+ for (i = 1, j = 1; i < descriptions.length; i++) {
38149
+ if (descriptions[i - 1] !== descriptions[i]) {
38150
+ descriptions[j] = descriptions[i];
38151
+ j++;
38152
+ }
38153
+ }
38154
+ descriptions.length = j;
38155
+ }
38156
+ switch (descriptions.length) {
38157
+ case 1:
38158
+ return descriptions[0];
38159
+ case 2:
38160
+ return descriptions[0] + " or " + descriptions[1];
38161
+ default:
38162
+ return descriptions.slice(0, -1).join(", ")
38163
+ + ", or "
38164
+ + descriptions[descriptions.length - 1];
38165
+ }
38166
+ }
38167
+ function describeFound(found) {
38168
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
38169
+ }
38170
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
38171
+ };
38172
+ function peg$parse(input, options) {
38173
+ options = options !== undefined ? options : {};
38174
+ var peg$FAILED = {};
38175
+ var peg$source = options.grammarSource;
38176
+ var peg$startRuleFunctions = { Expr: peg$parseExpr };
38177
+ var peg$startRuleFunction = peg$parseExpr;
38178
+ var peg$c0 = "||";
38179
+ var peg$c1 = "&&";
38180
+ var peg$c2 = "!";
38181
+ var peg$c3 = "(";
38182
+ var peg$c4 = ")";
38183
+ var peg$c5 = ".";
38184
+ var peg$c6 = "#";
38185
+ var peg$c7 = "'";
38186
+ var peg$c8 = "\\\\";
38187
+ var peg$c9 = "\\'";
38188
+ var peg$r0 = /^[=><~]/;
38189
+ var peg$r1 = /^[?]/;
38190
+ var peg$r2 = /^[^'\\]/;
38191
+ var peg$r3 = /^[^'\\ ]/;
38192
+ var peg$r4 = /^[a-z]/;
38193
+ var peg$r5 = /^[A-za-z0-9]/;
38194
+ var peg$r6 = /^[A-Z]/;
38195
+ var peg$r7 = /^[A-Za-z0-9]/;
38196
+ var peg$r8 = /^[ \t\n\r]/;
38197
+ var peg$e0 = peg$literalExpectation("||", false);
38198
+ var peg$e1 = peg$literalExpectation("&&", false);
38199
+ var peg$e2 = peg$literalExpectation("!", false);
38200
+ var peg$e3 = peg$literalExpectation("(", false);
38201
+ var peg$e4 = peg$literalExpectation(")", false);
38202
+ var peg$e5 = peg$otherExpectation("metadata field term");
38203
+ var peg$e6 = peg$literalExpectation(".", false);
38204
+ var peg$e7 = peg$otherExpectation("tag term");
38205
+ var peg$e8 = peg$literalExpectation("#", false);
38206
+ var peg$e9 = peg$otherExpectation("primary field term");
38207
+ var peg$e10 = peg$classExpectation(["=", ">", "<", "~"], false, false);
38208
+ var peg$e11 = peg$classExpectation(["?"], false, false);
38209
+ var peg$e12 = peg$literalExpectation("'", false);
38210
+ var peg$e13 = peg$literalExpectation("\\\\", false);
38211
+ var peg$e14 = peg$literalExpectation("\\'", false);
38212
+ var peg$e15 = peg$classExpectation(["'", "\\"], true, false);
38213
+ var peg$e16 = peg$classExpectation(["'", "\\", " "], true, false);
38214
+ var peg$e17 = peg$classExpectation([["a", "z"]], false, false);
38215
+ var peg$e18 = peg$classExpectation([["A", "z"], ["a", "z"], ["0", "9"]], false, false);
38216
+ var peg$e19 = peg$otherExpectation("attribute type");
38217
+ var peg$e20 = peg$classExpectation([["A", "Z"]], false, false);
38218
+ var peg$e21 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"]], false, false);
38219
+ var peg$e22 = peg$otherExpectation("whitespace");
38220
+ var peg$e23 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false);
38221
+ var peg$f0 = function (h, t) {
38222
+ return t.reduce((acc, element) => {
38223
+ return union(acc, element);
38224
+ }, h);
38225
+ };
38226
+ var peg$f1 = function (h, t) {
38227
+ return t.reduce((acc, element) => {
38228
+ return intersect(acc, element);
38229
+ }, h);
38230
+ };
38231
+ var peg$f2 = function (expr) {
38232
+ const allIndices = [...Array(options.attributes.length).keys()];
38233
+ return diffAsym(allIndices, expr);
38234
+ };
38235
+ var peg$f3 = function (pathPrefix, pathSuffix, matchFn) {
38236
+ return match(options.attributes, [pathPrefix, ...pathSuffix], matchFn);
38237
+ };
38238
+ var peg$f4 = function (tag) {
38239
+ return match(options.attributes, ["tags"], (fieldVal) => { return Array.isArray(fieldVal) && fieldVal.includes(tag); });
38240
+ };
38241
+ var peg$f5 = function (attributeType, path, matchFn) {
38242
+ const result = match(options.attributes, ["value", ...path], matchFn, attributeType);
38243
+ return result;
38244
+ };
38245
+ var peg$f6 = function (attributeType, matchFn) {
38246
+ return match(options.attributes, ["value", "value"], matchFn, attributeType);
38247
+ };
38248
+ var peg$f7 = function (attributeType) {
38249
+ // Providing only the attribute type returns attributes whose type
38250
+ // matches. E.g. 'PhoneNumber' will return all attributes whose type is
38251
+ // 'PhoneNumber', regardless of the values of any of their fields.
38252
+ return match(options.attributes, ["value", "@type"], (fieldVal) => { return fieldVal === attributeType; });
38253
+ };
38254
+ var peg$f8 = function (op, rhs) {
38255
+ switch (op) {
38256
+ case "=":
38257
+ return (fieldVal) => { return String(fieldVal) === rhs; };
38258
+ case ">":
38259
+ return (fieldVal) => { return new Date(fieldVal) >= new Date(rhs); };
38260
+ case "<":
38261
+ return (fieldVal) => { return new Date(fieldVal) <= new Date(rhs); };
38262
+ case "~":
38263
+ return (fieldVal) => { return Array.isArray(fieldVal) && fieldVal.includes(rhs); };
38264
+ }
38265
+ };
38266
+ var peg$f9 = function (op) {
38267
+ switch (op) {
38268
+ case "?":
38269
+ return (fieldVal) => { return fieldVal != undefined; };
38270
+ }
38271
+ };
38272
+ var peg$f10 = function (val) {
38273
+ return val.join("").replaceAll("\\\\", "\\").replaceAll("\\'", "'");
38274
+ };
38275
+ var peg$f11 = function (val) {
38276
+ return val.join("").replaceAll("\\\\", "\\").replaceAll("\\'", "'");
38277
+ };
38278
+ var peg$currPos = 0;
38279
+ var peg$savedPos = 0;
38280
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
38281
+ var peg$maxFailPos = 0;
38282
+ var peg$maxFailExpected = [];
38283
+ var peg$silentFails = 0;
38284
+ var peg$result;
38285
+ if ("startRule" in options) {
38286
+ if (!(options.startRule in peg$startRuleFunctions)) {
38287
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
38288
+ }
38289
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
38290
+ }
38291
+ function text() {
38292
+ return input.substring(peg$savedPos, peg$currPos);
38293
+ }
38294
+ function offset() {
38295
+ return peg$savedPos;
38296
+ }
38297
+ function range() {
38298
+ return {
38299
+ source: peg$source,
38300
+ start: peg$savedPos,
38301
+ end: peg$currPos
38302
+ };
38303
+ }
38304
+ function location() {
38305
+ return peg$computeLocation(peg$savedPos, peg$currPos);
38306
+ }
38307
+ function expected(description, location) {
38308
+ location = location !== undefined
38309
+ ? location
38310
+ : peg$computeLocation(peg$savedPos, peg$currPos);
38311
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
38312
+ }
38313
+ function error(message, location) {
38314
+ location = location !== undefined
38315
+ ? location
38316
+ : peg$computeLocation(peg$savedPos, peg$currPos);
38317
+ throw peg$buildSimpleError(message, location);
38318
+ }
38319
+ function peg$literalExpectation(text, ignoreCase) {
38320
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
38321
+ }
38322
+ function peg$classExpectation(parts, inverted, ignoreCase) {
38323
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
38324
+ }
38325
+ function peg$anyExpectation() {
38326
+ return { type: "any" };
38327
+ }
38328
+ function peg$endExpectation() {
38329
+ return { type: "end" };
38330
+ }
38331
+ function peg$otherExpectation(description) {
38332
+ return { type: "other", description: description };
38333
+ }
38334
+ function peg$computePosDetails(pos) {
38335
+ var details = peg$posDetailsCache[pos];
38336
+ var p;
38337
+ if (details) {
38338
+ return details;
38339
+ }
38340
+ else {
38341
+ p = pos - 1;
38342
+ while (!peg$posDetailsCache[p]) {
38343
+ p--;
38344
+ }
38345
+ details = peg$posDetailsCache[p];
38346
+ details = {
38347
+ line: details.line,
38348
+ column: details.column
38349
+ };
38350
+ while (p < pos) {
38351
+ if (input.charCodeAt(p) === 10) {
38352
+ details.line++;
38353
+ details.column = 1;
38354
+ }
38355
+ else {
38356
+ details.column++;
38357
+ }
38358
+ p++;
38359
+ }
38360
+ peg$posDetailsCache[pos] = details;
38361
+ return details;
38362
+ }
38363
+ }
38364
+ function peg$computeLocation(startPos, endPos, offset) {
38365
+ var startPosDetails = peg$computePosDetails(startPos);
38366
+ var endPosDetails = peg$computePosDetails(endPos);
38367
+ var res = {
38368
+ source: peg$source,
38369
+ start: {
38370
+ offset: startPos,
38371
+ line: startPosDetails.line,
38372
+ column: startPosDetails.column
38373
+ },
38374
+ end: {
38375
+ offset: endPos,
38376
+ line: endPosDetails.line,
38377
+ column: endPosDetails.column
38378
+ }
38379
+ };
38380
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
38381
+ res.start = peg$source.offset(res.start);
38382
+ res.end = peg$source.offset(res.end);
38383
+ }
38384
+ return res;
38385
+ }
38386
+ function peg$fail(expected) {
38387
+ if (peg$currPos < peg$maxFailPos) {
38388
+ return;
38389
+ }
38390
+ if (peg$currPos > peg$maxFailPos) {
38391
+ peg$maxFailPos = peg$currPos;
38392
+ peg$maxFailExpected = [];
38393
+ }
38394
+ peg$maxFailExpected.push(expected);
38395
+ }
38396
+ function peg$buildSimpleError(message, location) {
38397
+ return new peg$SyntaxError(message, null, null, location);
38398
+ }
38399
+ function peg$buildStructuredError(expected, found, location) {
38400
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
38401
+ }
38402
+ function peg$parseExpr() {
38403
+ var s0, s1, s2, s3, s4, s5, s6, s7;
38404
+ s0 = peg$currPos;
38405
+ s1 = peg$parseExpr0();
38406
+ if (s1 !== peg$FAILED) {
38407
+ s2 = [];
38408
+ s3 = peg$currPos;
38409
+ s4 = [];
38410
+ s5 = peg$parse_();
38411
+ if (s5 !== peg$FAILED) {
38412
+ while (s5 !== peg$FAILED) {
38413
+ s4.push(s5);
38414
+ s5 = peg$parse_();
38415
+ }
38416
+ }
38417
+ else {
38418
+ s4 = peg$FAILED;
38419
+ }
38420
+ if (s4 !== peg$FAILED) {
38421
+ if (input.substr(peg$currPos, 2) === peg$c0) {
38422
+ s5 = peg$c0;
38423
+ peg$currPos += 2;
38424
+ }
38425
+ else {
38426
+ s5 = peg$FAILED;
38427
+ if (peg$silentFails === 0) {
38428
+ peg$fail(peg$e0);
38429
+ }
38430
+ }
38431
+ if (s5 !== peg$FAILED) {
38432
+ s6 = [];
38433
+ s7 = peg$parse_();
38434
+ if (s7 !== peg$FAILED) {
38435
+ while (s7 !== peg$FAILED) {
38436
+ s6.push(s7);
38437
+ s7 = peg$parse_();
38438
+ }
38439
+ }
38440
+ else {
38441
+ s6 = peg$FAILED;
38442
+ }
38443
+ if (s6 !== peg$FAILED) {
38444
+ s7 = peg$parseExpr0();
38445
+ if (s7 !== peg$FAILED) {
38446
+ s3 = s7;
38447
+ }
38448
+ else {
38449
+ peg$currPos = s3;
38450
+ s3 = peg$FAILED;
38451
+ }
38452
+ }
38453
+ else {
38454
+ peg$currPos = s3;
38455
+ s3 = peg$FAILED;
38456
+ }
38457
+ }
38458
+ else {
38459
+ peg$currPos = s3;
38460
+ s3 = peg$FAILED;
38461
+ }
38462
+ }
38463
+ else {
38464
+ peg$currPos = s3;
38465
+ s3 = peg$FAILED;
38466
+ }
38467
+ while (s3 !== peg$FAILED) {
38468
+ s2.push(s3);
38469
+ s3 = peg$currPos;
38470
+ s4 = [];
38471
+ s5 = peg$parse_();
38472
+ if (s5 !== peg$FAILED) {
38473
+ while (s5 !== peg$FAILED) {
38474
+ s4.push(s5);
38475
+ s5 = peg$parse_();
38476
+ }
38477
+ }
38478
+ else {
38479
+ s4 = peg$FAILED;
38480
+ }
38481
+ if (s4 !== peg$FAILED) {
38482
+ if (input.substr(peg$currPos, 2) === peg$c0) {
38483
+ s5 = peg$c0;
38484
+ peg$currPos += 2;
38485
+ }
38486
+ else {
38487
+ s5 = peg$FAILED;
38488
+ if (peg$silentFails === 0) {
38489
+ peg$fail(peg$e0);
38490
+ }
38491
+ }
38492
+ if (s5 !== peg$FAILED) {
38493
+ s6 = [];
38494
+ s7 = peg$parse_();
38495
+ if (s7 !== peg$FAILED) {
38496
+ while (s7 !== peg$FAILED) {
38497
+ s6.push(s7);
38498
+ s7 = peg$parse_();
38499
+ }
38500
+ }
38501
+ else {
38502
+ s6 = peg$FAILED;
38503
+ }
38504
+ if (s6 !== peg$FAILED) {
38505
+ s7 = peg$parseExpr0();
38506
+ if (s7 !== peg$FAILED) {
38507
+ s3 = s7;
38508
+ }
38509
+ else {
38510
+ peg$currPos = s3;
38511
+ s3 = peg$FAILED;
38512
+ }
38513
+ }
38514
+ else {
38515
+ peg$currPos = s3;
38516
+ s3 = peg$FAILED;
38517
+ }
38518
+ }
38519
+ else {
38520
+ peg$currPos = s3;
38521
+ s3 = peg$FAILED;
38522
+ }
38523
+ }
38524
+ else {
38525
+ peg$currPos = s3;
38526
+ s3 = peg$FAILED;
38527
+ }
38528
+ }
38529
+ peg$savedPos = s0;
38530
+ s0 = peg$f0(s1, s2);
38531
+ }
38532
+ else {
38533
+ peg$currPos = s0;
38534
+ s0 = peg$FAILED;
38535
+ }
38536
+ return s0;
38537
+ }
38538
+ function peg$parseExpr0() {
38539
+ var s0, s1, s2, s3, s4, s5, s6, s7;
38540
+ s0 = peg$currPos;
38541
+ s1 = peg$parseExpr1();
38542
+ if (s1 !== peg$FAILED) {
38543
+ s2 = [];
38544
+ s3 = peg$currPos;
38545
+ s4 = [];
38546
+ s5 = peg$parse_();
38547
+ if (s5 !== peg$FAILED) {
38548
+ while (s5 !== peg$FAILED) {
38549
+ s4.push(s5);
38550
+ s5 = peg$parse_();
38551
+ }
38552
+ }
38553
+ else {
38554
+ s4 = peg$FAILED;
38555
+ }
38556
+ if (s4 !== peg$FAILED) {
38557
+ if (input.substr(peg$currPos, 2) === peg$c1) {
38558
+ s5 = peg$c1;
38559
+ peg$currPos += 2;
38560
+ }
38561
+ else {
38562
+ s5 = peg$FAILED;
38563
+ if (peg$silentFails === 0) {
38564
+ peg$fail(peg$e1);
38565
+ }
38566
+ }
38567
+ if (s5 !== peg$FAILED) {
38568
+ s6 = [];
38569
+ s7 = peg$parse_();
38570
+ if (s7 !== peg$FAILED) {
38571
+ while (s7 !== peg$FAILED) {
38572
+ s6.push(s7);
38573
+ s7 = peg$parse_();
38574
+ }
38575
+ }
38576
+ else {
38577
+ s6 = peg$FAILED;
38578
+ }
38579
+ if (s6 !== peg$FAILED) {
38580
+ s7 = peg$parseExpr1();
38581
+ if (s7 !== peg$FAILED) {
38582
+ s3 = s7;
38583
+ }
38584
+ else {
38585
+ peg$currPos = s3;
38586
+ s3 = peg$FAILED;
38587
+ }
38588
+ }
38589
+ else {
38590
+ peg$currPos = s3;
38591
+ s3 = peg$FAILED;
38592
+ }
38593
+ }
38594
+ else {
38595
+ peg$currPos = s3;
38596
+ s3 = peg$FAILED;
38597
+ }
38598
+ }
38599
+ else {
38600
+ peg$currPos = s3;
38601
+ s3 = peg$FAILED;
38602
+ }
38603
+ while (s3 !== peg$FAILED) {
38604
+ s2.push(s3);
38605
+ s3 = peg$currPos;
38606
+ s4 = [];
38607
+ s5 = peg$parse_();
38608
+ if (s5 !== peg$FAILED) {
38609
+ while (s5 !== peg$FAILED) {
38610
+ s4.push(s5);
38611
+ s5 = peg$parse_();
38612
+ }
38613
+ }
38614
+ else {
38615
+ s4 = peg$FAILED;
38616
+ }
38617
+ if (s4 !== peg$FAILED) {
38618
+ if (input.substr(peg$currPos, 2) === peg$c1) {
38619
+ s5 = peg$c1;
38620
+ peg$currPos += 2;
38621
+ }
38622
+ else {
38623
+ s5 = peg$FAILED;
38624
+ if (peg$silentFails === 0) {
38625
+ peg$fail(peg$e1);
38626
+ }
38627
+ }
38628
+ if (s5 !== peg$FAILED) {
38629
+ s6 = [];
38630
+ s7 = peg$parse_();
38631
+ if (s7 !== peg$FAILED) {
38632
+ while (s7 !== peg$FAILED) {
38633
+ s6.push(s7);
38634
+ s7 = peg$parse_();
38635
+ }
38636
+ }
38637
+ else {
38638
+ s6 = peg$FAILED;
38639
+ }
38640
+ if (s6 !== peg$FAILED) {
38641
+ s7 = peg$parseExpr1();
38642
+ if (s7 !== peg$FAILED) {
38643
+ s3 = s7;
38644
+ }
38645
+ else {
38646
+ peg$currPos = s3;
38647
+ s3 = peg$FAILED;
38648
+ }
38649
+ }
38650
+ else {
38651
+ peg$currPos = s3;
38652
+ s3 = peg$FAILED;
38653
+ }
38654
+ }
38655
+ else {
38656
+ peg$currPos = s3;
38657
+ s3 = peg$FAILED;
38658
+ }
38659
+ }
38660
+ else {
38661
+ peg$currPos = s3;
38662
+ s3 = peg$FAILED;
38663
+ }
38664
+ }
38665
+ peg$savedPos = s0;
38666
+ s0 = peg$f1(s1, s2);
38667
+ }
38668
+ else {
38669
+ peg$currPos = s0;
38670
+ s0 = peg$FAILED;
38671
+ }
38672
+ return s0;
38673
+ }
38674
+ function peg$parseExpr1() {
38675
+ var s0, s1, s2;
38676
+ s0 = peg$currPos;
38677
+ if (input.charCodeAt(peg$currPos) === 33) {
38678
+ s1 = peg$c2;
38679
+ peg$currPos++;
38680
+ }
38681
+ else {
38682
+ s1 = peg$FAILED;
38683
+ if (peg$silentFails === 0) {
38684
+ peg$fail(peg$e2);
38685
+ }
38686
+ }
38687
+ if (s1 !== peg$FAILED) {
38688
+ s2 = peg$parseExpr1();
38689
+ if (s2 !== peg$FAILED) {
38690
+ peg$savedPos = s0;
38691
+ s0 = peg$f2(s2);
38692
+ }
38693
+ else {
38694
+ peg$currPos = s0;
38695
+ s0 = peg$FAILED;
38696
+ }
38697
+ }
38698
+ else {
38699
+ peg$currPos = s0;
38700
+ s0 = peg$FAILED;
38701
+ }
38702
+ if (s0 === peg$FAILED) {
38703
+ s0 = peg$parseExpr2();
38704
+ }
38705
+ return s0;
38706
+ }
38707
+ function peg$parseExpr2() {
38708
+ var s0, s1, s2, s3, s4, s5;
38709
+ s0 = peg$currPos;
38710
+ if (input.charCodeAt(peg$currPos) === 40) {
38711
+ s1 = peg$c3;
38712
+ peg$currPos++;
38713
+ }
38714
+ else {
38715
+ s1 = peg$FAILED;
38716
+ if (peg$silentFails === 0) {
38717
+ peg$fail(peg$e3);
38718
+ }
38719
+ }
38720
+ if (s1 !== peg$FAILED) {
38721
+ s2 = [];
38722
+ s3 = peg$parse_();
38723
+ if (s3 !== peg$FAILED) {
38724
+ while (s3 !== peg$FAILED) {
38725
+ s2.push(s3);
38726
+ s3 = peg$parse_();
38727
+ }
38728
+ }
38729
+ else {
38730
+ s2 = peg$FAILED;
38731
+ }
38732
+ if (s2 !== peg$FAILED) {
38733
+ s3 = peg$parseExpr();
38734
+ if (s3 !== peg$FAILED) {
38735
+ s4 = [];
38736
+ s5 = peg$parse_();
38737
+ if (s5 !== peg$FAILED) {
38738
+ while (s5 !== peg$FAILED) {
38739
+ s4.push(s5);
38740
+ s5 = peg$parse_();
38741
+ }
38742
+ }
38743
+ else {
38744
+ s4 = peg$FAILED;
38745
+ }
38746
+ if (s4 !== peg$FAILED) {
38747
+ if (input.charCodeAt(peg$currPos) === 41) {
38748
+ s5 = peg$c4;
38749
+ peg$currPos++;
38750
+ }
38751
+ else {
38752
+ s5 = peg$FAILED;
38753
+ if (peg$silentFails === 0) {
38754
+ peg$fail(peg$e4);
38755
+ }
38756
+ }
38757
+ if (s5 !== peg$FAILED) {
38758
+ s0 = s3;
38759
+ }
38760
+ else {
38761
+ peg$currPos = s0;
38762
+ s0 = peg$FAILED;
38763
+ }
38764
+ }
38765
+ else {
38766
+ peg$currPos = s0;
38767
+ s0 = peg$FAILED;
38768
+ }
38769
+ }
38770
+ else {
38771
+ peg$currPos = s0;
38772
+ s0 = peg$FAILED;
38773
+ }
38774
+ }
38775
+ else {
38776
+ peg$currPos = s0;
38777
+ s0 = peg$FAILED;
38778
+ }
38779
+ }
38780
+ else {
38781
+ peg$currPos = s0;
38782
+ s0 = peg$FAILED;
38783
+ }
38784
+ if (s0 === peg$FAILED) {
38785
+ s0 = peg$parseTerm();
38786
+ }
38787
+ return s0;
38788
+ }
38789
+ function peg$parseTerm() {
38790
+ var s0;
38791
+ s0 = peg$parsePrimaryFieldTerm();
38792
+ if (s0 === peg$FAILED) {
38793
+ s0 = peg$parseMetadataFieldTerm();
38794
+ if (s0 === peg$FAILED) {
38795
+ s0 = peg$parseTagTerm();
38796
+ }
38797
+ }
38798
+ return s0;
38799
+ }
38800
+ function peg$parseMetadataFieldTerm() {
38801
+ var s0, s1, s2, s3, s4, s5;
38802
+ peg$silentFails++;
38803
+ s0 = peg$currPos;
38804
+ s1 = peg$parsePathSegment();
38805
+ if (s1 !== peg$FAILED) {
38806
+ s2 = [];
38807
+ s3 = peg$currPos;
38808
+ if (input.charCodeAt(peg$currPos) === 46) {
38809
+ s4 = peg$c5;
38810
+ peg$currPos++;
38811
+ }
38812
+ else {
38813
+ s4 = peg$FAILED;
38814
+ if (peg$silentFails === 0) {
38815
+ peg$fail(peg$e6);
38816
+ }
38817
+ }
38818
+ if (s4 !== peg$FAILED) {
38819
+ s5 = peg$parsePathSegment();
38820
+ if (s5 !== peg$FAILED) {
38821
+ s3 = s5;
38822
+ }
38823
+ else {
38824
+ peg$currPos = s3;
38825
+ s3 = peg$FAILED;
38826
+ }
38827
+ }
38828
+ else {
38829
+ peg$currPos = s3;
38830
+ s3 = peg$FAILED;
38831
+ }
38832
+ while (s3 !== peg$FAILED) {
38833
+ s2.push(s3);
38834
+ s3 = peg$currPos;
38835
+ if (input.charCodeAt(peg$currPos) === 46) {
38836
+ s4 = peg$c5;
38837
+ peg$currPos++;
38838
+ }
38839
+ else {
38840
+ s4 = peg$FAILED;
38841
+ if (peg$silentFails === 0) {
38842
+ peg$fail(peg$e6);
38843
+ }
38844
+ }
38845
+ if (s4 !== peg$FAILED) {
38846
+ s5 = peg$parsePathSegment();
38847
+ if (s5 !== peg$FAILED) {
38848
+ s3 = s5;
38849
+ }
38850
+ else {
38851
+ peg$currPos = s3;
38852
+ s3 = peg$FAILED;
38853
+ }
38854
+ }
38855
+ else {
38856
+ peg$currPos = s3;
38857
+ s3 = peg$FAILED;
38858
+ }
38859
+ }
38860
+ s3 = peg$parsePredicate();
38861
+ if (s3 !== peg$FAILED) {
38862
+ peg$savedPos = s0;
38863
+ s0 = peg$f3(s1, s2, s3);
38864
+ }
38865
+ else {
38866
+ peg$currPos = s0;
38867
+ s0 = peg$FAILED;
38868
+ }
38869
+ }
38870
+ else {
38871
+ peg$currPos = s0;
38872
+ s0 = peg$FAILED;
38873
+ }
38874
+ peg$silentFails--;
38875
+ if (s0 === peg$FAILED) {
38876
+ s1 = peg$FAILED;
38877
+ if (peg$silentFails === 0) {
38878
+ peg$fail(peg$e5);
38879
+ }
38880
+ }
38881
+ return s0;
38882
+ }
38883
+ function peg$parseTagTerm() {
38884
+ var s0, s1, s2;
38885
+ peg$silentFails++;
38886
+ s0 = peg$currPos;
38887
+ if (input.charCodeAt(peg$currPos) === 35) {
38888
+ s1 = peg$c6;
38889
+ peg$currPos++;
38890
+ }
38891
+ else {
38892
+ s1 = peg$FAILED;
38893
+ if (peg$silentFails === 0) {
38894
+ peg$fail(peg$e8);
38895
+ }
38896
+ }
38897
+ if (s1 !== peg$FAILED) {
38898
+ s2 = peg$parsePredicateRHS();
38899
+ if (s2 !== peg$FAILED) {
38900
+ peg$savedPos = s0;
38901
+ s0 = peg$f4(s2);
38902
+ }
38903
+ else {
38904
+ peg$currPos = s0;
38905
+ s0 = peg$FAILED;
38906
+ }
38907
+ }
38908
+ else {
38909
+ peg$currPos = s0;
38910
+ s0 = peg$FAILED;
38911
+ }
38912
+ peg$silentFails--;
38913
+ if (s0 === peg$FAILED) {
38914
+ s1 = peg$FAILED;
38915
+ if (peg$silentFails === 0) {
38916
+ peg$fail(peg$e7);
38917
+ }
38918
+ }
38919
+ return s0;
38920
+ }
38921
+ function peg$parsePrimaryFieldTerm() {
38922
+ var s0, s1, s2, s3, s4, s5;
38923
+ peg$silentFails++;
38924
+ s0 = peg$currPos;
38925
+ s1 = peg$parseAttributeType();
38926
+ if (s1 !== peg$FAILED) {
38927
+ s2 = [];
38928
+ s3 = peg$currPos;
38929
+ if (input.charCodeAt(peg$currPos) === 46) {
38930
+ s4 = peg$c5;
38931
+ peg$currPos++;
38932
+ }
38933
+ else {
38934
+ s4 = peg$FAILED;
38935
+ if (peg$silentFails === 0) {
38936
+ peg$fail(peg$e6);
38937
+ }
38938
+ }
38939
+ if (s4 !== peg$FAILED) {
38940
+ s5 = peg$parsePathSegment();
38941
+ if (s5 !== peg$FAILED) {
38942
+ s3 = s5;
38943
+ }
38944
+ else {
38945
+ peg$currPos = s3;
38946
+ s3 = peg$FAILED;
38947
+ }
38948
+ }
38949
+ else {
38950
+ peg$currPos = s3;
38951
+ s3 = peg$FAILED;
38952
+ }
38953
+ if (s3 !== peg$FAILED) {
38954
+ while (s3 !== peg$FAILED) {
38955
+ s2.push(s3);
38956
+ s3 = peg$currPos;
38957
+ if (input.charCodeAt(peg$currPos) === 46) {
38958
+ s4 = peg$c5;
38959
+ peg$currPos++;
38960
+ }
38961
+ else {
38962
+ s4 = peg$FAILED;
38963
+ if (peg$silentFails === 0) {
38964
+ peg$fail(peg$e6);
38965
+ }
38966
+ }
38967
+ if (s4 !== peg$FAILED) {
38968
+ s5 = peg$parsePathSegment();
38969
+ if (s5 !== peg$FAILED) {
38970
+ s3 = s5;
38971
+ }
38972
+ else {
38973
+ peg$currPos = s3;
38974
+ s3 = peg$FAILED;
38975
+ }
38976
+ }
38977
+ else {
38978
+ peg$currPos = s3;
38979
+ s3 = peg$FAILED;
38980
+ }
38981
+ }
38982
+ }
38983
+ else {
38984
+ s2 = peg$FAILED;
38985
+ }
38986
+ if (s2 !== peg$FAILED) {
38987
+ s3 = peg$parsePredicate();
38988
+ if (s3 !== peg$FAILED) {
38989
+ peg$savedPos = s0;
38990
+ s0 = peg$f5(s1, s2, s3);
38991
+ }
38992
+ else {
38993
+ peg$currPos = s0;
38994
+ s0 = peg$FAILED;
38995
+ }
38996
+ }
38997
+ else {
38998
+ peg$currPos = s0;
38999
+ s0 = peg$FAILED;
39000
+ }
39001
+ }
39002
+ else {
39003
+ peg$currPos = s0;
39004
+ s0 = peg$FAILED;
39005
+ }
39006
+ if (s0 === peg$FAILED) {
39007
+ s0 = peg$currPos;
39008
+ s1 = peg$parseAttributeType();
39009
+ if (s1 !== peg$FAILED) {
39010
+ s2 = peg$parsePredicate();
39011
+ if (s2 !== peg$FAILED) {
39012
+ peg$savedPos = s0;
39013
+ s0 = peg$f6(s1, s2);
39014
+ }
39015
+ else {
39016
+ peg$currPos = s0;
39017
+ s0 = peg$FAILED;
39018
+ }
39019
+ }
39020
+ else {
39021
+ peg$currPos = s0;
39022
+ s0 = peg$FAILED;
39023
+ }
39024
+ if (s0 === peg$FAILED) {
39025
+ s0 = peg$currPos;
39026
+ s1 = peg$parseAttributeType();
39027
+ if (s1 !== peg$FAILED) {
39028
+ peg$savedPos = s0;
39029
+ s1 = peg$f7(s1);
39030
+ }
39031
+ s0 = s1;
39032
+ }
39033
+ }
39034
+ peg$silentFails--;
39035
+ if (s0 === peg$FAILED) {
39036
+ s1 = peg$FAILED;
39037
+ if (peg$silentFails === 0) {
39038
+ peg$fail(peg$e9);
39039
+ }
39040
+ }
39041
+ return s0;
39042
+ }
39043
+ function peg$parsePredicate() {
39044
+ var s0, s1, s2;
39045
+ s0 = peg$currPos;
39046
+ if (peg$r0.test(input.charAt(peg$currPos))) {
39047
+ s1 = input.charAt(peg$currPos);
39048
+ peg$currPos++;
39049
+ }
39050
+ else {
39051
+ s1 = peg$FAILED;
39052
+ if (peg$silentFails === 0) {
39053
+ peg$fail(peg$e10);
39054
+ }
39055
+ }
39056
+ if (s1 !== peg$FAILED) {
39057
+ s2 = peg$parsePredicateRHS();
39058
+ if (s2 !== peg$FAILED) {
39059
+ peg$savedPos = s0;
39060
+ s0 = peg$f8(s1, s2);
39061
+ }
39062
+ else {
39063
+ peg$currPos = s0;
39064
+ s0 = peg$FAILED;
39065
+ }
39066
+ }
39067
+ else {
39068
+ peg$currPos = s0;
39069
+ s0 = peg$FAILED;
39070
+ }
39071
+ if (s0 === peg$FAILED) {
39072
+ s0 = peg$currPos;
39073
+ if (peg$r1.test(input.charAt(peg$currPos))) {
39074
+ s1 = input.charAt(peg$currPos);
39075
+ peg$currPos++;
39076
+ }
39077
+ else {
39078
+ s1 = peg$FAILED;
39079
+ if (peg$silentFails === 0) {
39080
+ peg$fail(peg$e11);
39081
+ }
39082
+ }
39083
+ if (s1 !== peg$FAILED) {
39084
+ peg$savedPos = s0;
39085
+ s1 = peg$f9(s1);
39086
+ }
39087
+ s0 = s1;
39088
+ }
39089
+ return s0;
39090
+ }
39091
+ function peg$parsePredicateRHS() {
39092
+ var s0, s1, s2, s3;
39093
+ s0 = peg$currPos;
39094
+ if (input.charCodeAt(peg$currPos) === 39) {
39095
+ s1 = peg$c7;
39096
+ peg$currPos++;
39097
+ }
39098
+ else {
39099
+ s1 = peg$FAILED;
39100
+ if (peg$silentFails === 0) {
39101
+ peg$fail(peg$e12);
39102
+ }
39103
+ }
39104
+ if (s1 !== peg$FAILED) {
39105
+ s2 = [];
39106
+ if (input.substr(peg$currPos, 2) === peg$c8) {
39107
+ s3 = peg$c8;
39108
+ peg$currPos += 2;
39109
+ }
39110
+ else {
39111
+ s3 = peg$FAILED;
39112
+ if (peg$silentFails === 0) {
39113
+ peg$fail(peg$e13);
39114
+ }
39115
+ }
39116
+ if (s3 === peg$FAILED) {
39117
+ if (input.substr(peg$currPos, 2) === peg$c9) {
39118
+ s3 = peg$c9;
39119
+ peg$currPos += 2;
39120
+ }
39121
+ else {
39122
+ s3 = peg$FAILED;
39123
+ if (peg$silentFails === 0) {
39124
+ peg$fail(peg$e14);
39125
+ }
39126
+ }
39127
+ if (s3 === peg$FAILED) {
39128
+ if (peg$r2.test(input.charAt(peg$currPos))) {
39129
+ s3 = input.charAt(peg$currPos);
39130
+ peg$currPos++;
39131
+ }
39132
+ else {
39133
+ s3 = peg$FAILED;
39134
+ if (peg$silentFails === 0) {
39135
+ peg$fail(peg$e15);
39136
+ }
39137
+ }
39138
+ }
39139
+ }
39140
+ while (s3 !== peg$FAILED) {
39141
+ s2.push(s3);
39142
+ if (input.substr(peg$currPos, 2) === peg$c8) {
39143
+ s3 = peg$c8;
39144
+ peg$currPos += 2;
39145
+ }
39146
+ else {
39147
+ s3 = peg$FAILED;
39148
+ if (peg$silentFails === 0) {
39149
+ peg$fail(peg$e13);
39150
+ }
39151
+ }
39152
+ if (s3 === peg$FAILED) {
39153
+ if (input.substr(peg$currPos, 2) === peg$c9) {
39154
+ s3 = peg$c9;
39155
+ peg$currPos += 2;
39156
+ }
39157
+ else {
39158
+ s3 = peg$FAILED;
39159
+ if (peg$silentFails === 0) {
39160
+ peg$fail(peg$e14);
39161
+ }
39162
+ }
39163
+ if (s3 === peg$FAILED) {
39164
+ if (peg$r2.test(input.charAt(peg$currPos))) {
39165
+ s3 = input.charAt(peg$currPos);
39166
+ peg$currPos++;
39167
+ }
39168
+ else {
39169
+ s3 = peg$FAILED;
39170
+ if (peg$silentFails === 0) {
39171
+ peg$fail(peg$e15);
39172
+ }
39173
+ }
39174
+ }
39175
+ }
39176
+ }
39177
+ if (input.charCodeAt(peg$currPos) === 39) {
39178
+ s3 = peg$c7;
39179
+ peg$currPos++;
39180
+ }
39181
+ else {
39182
+ s3 = peg$FAILED;
39183
+ if (peg$silentFails === 0) {
39184
+ peg$fail(peg$e12);
39185
+ }
39186
+ }
39187
+ if (s3 !== peg$FAILED) {
39188
+ peg$savedPos = s0;
39189
+ s0 = peg$f10(s2);
39190
+ }
39191
+ else {
39192
+ peg$currPos = s0;
39193
+ s0 = peg$FAILED;
39194
+ }
39195
+ }
39196
+ else {
39197
+ peg$currPos = s0;
39198
+ s0 = peg$FAILED;
39199
+ }
39200
+ if (s0 === peg$FAILED) {
39201
+ s0 = peg$currPos;
39202
+ s1 = [];
39203
+ if (input.substr(peg$currPos, 2) === peg$c8) {
39204
+ s2 = peg$c8;
39205
+ peg$currPos += 2;
39206
+ }
39207
+ else {
39208
+ s2 = peg$FAILED;
39209
+ if (peg$silentFails === 0) {
39210
+ peg$fail(peg$e13);
39211
+ }
39212
+ }
39213
+ if (s2 === peg$FAILED) {
39214
+ if (input.substr(peg$currPos, 2) === peg$c9) {
39215
+ s2 = peg$c9;
39216
+ peg$currPos += 2;
39217
+ }
39218
+ else {
39219
+ s2 = peg$FAILED;
39220
+ if (peg$silentFails === 0) {
39221
+ peg$fail(peg$e14);
39222
+ }
39223
+ }
39224
+ if (s2 === peg$FAILED) {
39225
+ if (peg$r3.test(input.charAt(peg$currPos))) {
39226
+ s2 = input.charAt(peg$currPos);
39227
+ peg$currPos++;
39228
+ }
39229
+ else {
39230
+ s2 = peg$FAILED;
39231
+ if (peg$silentFails === 0) {
39232
+ peg$fail(peg$e16);
39233
+ }
39234
+ }
39235
+ }
39236
+ }
39237
+ while (s2 !== peg$FAILED) {
39238
+ s1.push(s2);
39239
+ if (input.substr(peg$currPos, 2) === peg$c8) {
39240
+ s2 = peg$c8;
39241
+ peg$currPos += 2;
39242
+ }
39243
+ else {
39244
+ s2 = peg$FAILED;
39245
+ if (peg$silentFails === 0) {
39246
+ peg$fail(peg$e13);
39247
+ }
39248
+ }
39249
+ if (s2 === peg$FAILED) {
39250
+ if (input.substr(peg$currPos, 2) === peg$c9) {
39251
+ s2 = peg$c9;
39252
+ peg$currPos += 2;
39253
+ }
39254
+ else {
39255
+ s2 = peg$FAILED;
39256
+ if (peg$silentFails === 0) {
39257
+ peg$fail(peg$e14);
39258
+ }
39259
+ }
39260
+ if (s2 === peg$FAILED) {
39261
+ if (peg$r3.test(input.charAt(peg$currPos))) {
39262
+ s2 = input.charAt(peg$currPos);
39263
+ peg$currPos++;
39264
+ }
39265
+ else {
39266
+ s2 = peg$FAILED;
39267
+ if (peg$silentFails === 0) {
39268
+ peg$fail(peg$e16);
39269
+ }
39270
+ }
39271
+ }
39272
+ }
39273
+ }
39274
+ peg$savedPos = s0;
39275
+ s1 = peg$f11(s1);
39276
+ s0 = s1;
39277
+ }
39278
+ return s0;
39279
+ }
39280
+ function peg$parsePathSegment() {
39281
+ var s0, s1, s2, s3, s4;
39282
+ s0 = peg$currPos;
39283
+ s1 = peg$currPos;
39284
+ if (peg$r4.test(input.charAt(peg$currPos))) {
39285
+ s2 = input.charAt(peg$currPos);
39286
+ peg$currPos++;
39287
+ }
39288
+ else {
39289
+ s2 = peg$FAILED;
39290
+ if (peg$silentFails === 0) {
39291
+ peg$fail(peg$e17);
39292
+ }
39293
+ }
39294
+ if (s2 !== peg$FAILED) {
39295
+ s3 = [];
39296
+ if (peg$r5.test(input.charAt(peg$currPos))) {
39297
+ s4 = input.charAt(peg$currPos);
39298
+ peg$currPos++;
39299
+ }
39300
+ else {
39301
+ s4 = peg$FAILED;
39302
+ if (peg$silentFails === 0) {
39303
+ peg$fail(peg$e18);
39304
+ }
39305
+ }
39306
+ if (s4 !== peg$FAILED) {
39307
+ while (s4 !== peg$FAILED) {
39308
+ s3.push(s4);
39309
+ if (peg$r5.test(input.charAt(peg$currPos))) {
39310
+ s4 = input.charAt(peg$currPos);
39311
+ peg$currPos++;
39312
+ }
39313
+ else {
39314
+ s4 = peg$FAILED;
39315
+ if (peg$silentFails === 0) {
39316
+ peg$fail(peg$e18);
39317
+ }
39318
+ }
39319
+ }
39320
+ }
39321
+ else {
39322
+ s3 = peg$FAILED;
39323
+ }
39324
+ if (s3 !== peg$FAILED) {
39325
+ s2 = [s2, s3];
39326
+ s1 = s2;
39327
+ }
39328
+ else {
39329
+ peg$currPos = s1;
39330
+ s1 = peg$FAILED;
39331
+ }
39332
+ }
39333
+ else {
39334
+ peg$currPos = s1;
39335
+ s1 = peg$FAILED;
39336
+ }
39337
+ if (s1 !== peg$FAILED) {
39338
+ s0 = input.substring(s0, peg$currPos);
39339
+ }
39340
+ else {
39341
+ s0 = s1;
39342
+ }
39343
+ return s0;
39344
+ }
39345
+ function peg$parseAttributeType() {
39346
+ var s0, s1, s2, s3, s4;
39347
+ peg$silentFails++;
39348
+ s0 = peg$currPos;
39349
+ s1 = peg$currPos;
39350
+ if (peg$r6.test(input.charAt(peg$currPos))) {
39351
+ s2 = input.charAt(peg$currPos);
39352
+ peg$currPos++;
39353
+ }
39354
+ else {
39355
+ s2 = peg$FAILED;
39356
+ if (peg$silentFails === 0) {
39357
+ peg$fail(peg$e20);
39358
+ }
39359
+ }
39360
+ if (s2 !== peg$FAILED) {
39361
+ s3 = [];
39362
+ if (peg$r7.test(input.charAt(peg$currPos))) {
39363
+ s4 = input.charAt(peg$currPos);
39364
+ peg$currPos++;
39365
+ }
39366
+ else {
39367
+ s4 = peg$FAILED;
39368
+ if (peg$silentFails === 0) {
39369
+ peg$fail(peg$e21);
39370
+ }
39371
+ }
39372
+ while (s4 !== peg$FAILED) {
39373
+ s3.push(s4);
39374
+ if (peg$r7.test(input.charAt(peg$currPos))) {
39375
+ s4 = input.charAt(peg$currPos);
39376
+ peg$currPos++;
39377
+ }
39378
+ else {
39379
+ s4 = peg$FAILED;
39380
+ if (peg$silentFails === 0) {
39381
+ peg$fail(peg$e21);
39382
+ }
39383
+ }
39384
+ }
39385
+ s2 = [s2, s3];
39386
+ s1 = s2;
39387
+ }
39388
+ else {
39389
+ peg$currPos = s1;
39390
+ s1 = peg$FAILED;
39391
+ }
39392
+ if (s1 !== peg$FAILED) {
39393
+ s0 = input.substring(s0, peg$currPos);
39394
+ }
39395
+ else {
39396
+ s0 = s1;
39397
+ }
39398
+ peg$silentFails--;
39399
+ if (s0 === peg$FAILED) {
39400
+ s1 = peg$FAILED;
39401
+ if (peg$silentFails === 0) {
39402
+ peg$fail(peg$e19);
39403
+ }
39404
+ }
39405
+ return s0;
39406
+ }
39407
+ function peg$parse_() {
39408
+ var s0, s1;
39409
+ peg$silentFails++;
39410
+ if (peg$r8.test(input.charAt(peg$currPos))) {
39411
+ s0 = input.charAt(peg$currPos);
39412
+ peg$currPos++;
39413
+ }
39414
+ else {
39415
+ s0 = peg$FAILED;
39416
+ if (peg$silentFails === 0) {
39417
+ peg$fail(peg$e23);
39418
+ }
39419
+ }
39420
+ peg$silentFails--;
39421
+ if (s0 === peg$FAILED) {
39422
+ s1 = peg$FAILED;
39423
+ if (peg$silentFails === 0) {
39424
+ peg$fail(peg$e22);
39425
+ }
39426
+ }
39427
+ return s0;
39428
+ }
39429
+ peg$result = peg$startRuleFunction();
39430
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
39431
+ return peg$result;
39432
+ }
39433
+ else {
39434
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
39435
+ peg$fail(peg$endExpectation());
39436
+ }
39437
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
39438
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
39439
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
39440
+ }
39441
+ }
39442
+ module.exports = {
39443
+ SyntaxError: peg$SyntaxError,
39444
+ parse: peg$parse
39445
+ };
39446
+ //# sourceMappingURL=iql.js.map
39447
+
39448
+ /***/ }),
39449
+
39450
+ /***/ "./node_modules/@nmshd/iql/dist/src/index.js":
39451
+ /*!***************************************************!*\
39452
+ !*** ./node_modules/@nmshd/iql/dist/src/index.js ***!
39453
+ \***************************************************/
39454
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
39455
+
39456
+ "use strict";
39457
+
39458
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
39459
+ exports.validate = exports.execute = void 0;
39460
+ const iql_js_1 = __webpack_require__(/*! ../generated/iql.js */ "./node_modules/@nmshd/iql/dist/generated/iql.js");
39461
+ /**
39462
+ * Executes IQL query, returning array of indicies of matched attributes in
39463
+ * attribute array.
39464
+ */
39465
+ function execute(iqlQuery, attributes) {
39466
+ return (0, iql_js_1.parse)(iqlQuery, { attributes });
39467
+ }
39468
+ exports.execute = execute;
39469
+ function validate(iqlQuery) {
39470
+ try {
39471
+ (0, iql_js_1.parse)(iqlQuery, { attributes: [] });
39472
+ return { isValid: true };
39473
+ }
39474
+ catch (error) {
39475
+ // FIXME: Is there a cleaner way to catch IQL SyntaxErrors?
39476
+ // For the sake of backwards compatibility peggy compiles to old
39477
+ // js without the use of classes. Thus the static type inference
39478
+ // for the SyntaxError type is severely crippled.
39479
+ if (error instanceof iql_js_1.SyntaxError) {
39480
+ const err = error; // see FIXME above.
39481
+ return {
39482
+ isValid: false,
39483
+ error: {
39484
+ message: err.message,
39485
+ location: {
39486
+ start: err.location.start,
39487
+ end: err.location.end
39488
+ }
39489
+ }
39490
+ };
39491
+ }
39492
+ return {
39493
+ isValid: false,
39494
+ error: {
39495
+ message: JSON.stringify(error),
39496
+ location: {
39497
+ start: {
39498
+ column: 0,
39499
+ line: 0,
39500
+ offset: 0
39501
+ },
39502
+ end: {
39503
+ column: 0,
39504
+ line: 0,
39505
+ offset: 0
39506
+ }
39507
+ }
39508
+ }
39509
+ };
39510
+ }
39511
+ }
39512
+ exports.validate = validate;
39513
+ //# sourceMappingURL=index.js.map
39514
+
39515
+ /***/ }),
39516
+
37818
39517
  /***/ "./node_modules/ajv-errors/dist/index.js":
37819
39518
  /*!***********************************************!*\
37820
39519
  !*** ./node_modules/ajv-errors/dist/index.js ***!