@sendproof/core 0.1.0-alpha.1 → 0.1.0-alpha.2
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.
- package/assets/api.js +2 -1
- package/assets/app.css +612 -1
- package/assets/app.js +89 -13
- package/assets/bar-fit.js +91 -0
- package/assets/commands.js +27 -4
- package/assets/dialog.css +125 -0
- package/assets/dialog.js +191 -0
- package/assets/fields/lookup-source.js +5 -2
- package/assets/fields/lookup.js +3 -2
- package/assets/i18n.js +13 -2
- package/assets/icons.js +18 -0
- package/assets/index.html +1 -0
- package/assets/journeys/compare.js +225 -0
- package/assets/journeys/expressions.js +89 -0
- package/assets/journeys/index.js +7 -0
- package/assets/journeys/run.js +152 -0
- package/assets/journeys/steps.js +163 -0
- package/assets/journeys-code.js +193 -0
- package/assets/journeys-dialog-model.js +172 -0
- package/assets/journeys-dialogs.js +301 -0
- package/assets/journeys-model.js +259 -0
- package/assets/journeys-runs.js +109 -0
- package/assets/journeys-session.js +135 -0
- package/assets/journeys-view.js +961 -0
- package/assets/journeys.js +962 -0
- package/assets/locales/ar-journeys.js +468 -0
- package/assets/locales/ar.js +2 -0
- package/assets/locales/cs-journeys.js +468 -0
- package/assets/locales/cs.js +2 -0
- package/assets/locales/da-journeys.js +465 -0
- package/assets/locales/da.js +2 -0
- package/assets/locales/de-journeys.js +465 -0
- package/assets/locales/de.js +2 -0
- package/assets/locales/el-journeys.js +465 -0
- package/assets/locales/el.js +2 -0
- package/assets/locales/en-journeys.js +467 -0
- package/assets/locales/en.js +2 -0
- package/assets/locales/es-journeys.js +467 -0
- package/assets/locales/es.js +2 -0
- package/assets/locales/fa-journeys.js +465 -0
- package/assets/locales/fa.js +2 -0
- package/assets/locales/fi-journeys.js +465 -0
- package/assets/locales/fi.js +2 -0
- package/assets/locales/fr-journeys.js +467 -0
- package/assets/locales/fr.js +2 -0
- package/assets/locales/he-journeys.js +468 -0
- package/assets/locales/he.js +2 -0
- package/assets/locales/hi-journeys.js +465 -0
- package/assets/locales/hi.js +2 -0
- package/assets/locales/id-journeys.js +466 -0
- package/assets/locales/id.js +2 -0
- package/assets/locales/it-journeys.js +467 -0
- package/assets/locales/it.js +2 -0
- package/assets/locales/ja-journeys.js +466 -0
- package/assets/locales/ja.js +2 -0
- package/assets/locales/ko-journeys.js +465 -0
- package/assets/locales/ko.js +2 -0
- package/assets/locales/nb-journeys.js +465 -0
- package/assets/locales/nb.js +2 -0
- package/assets/locales/nl-journeys.js +465 -0
- package/assets/locales/nl.js +2 -0
- package/assets/locales/pl-journeys.js +468 -0
- package/assets/locales/pl.js +2 -0
- package/assets/locales/pt-BR-journeys.js +467 -0
- package/assets/locales/pt-BR.js +2 -0
- package/assets/locales/pt-PT-journeys.js +467 -0
- package/assets/locales/pt-PT.js +2 -0
- package/assets/locales/ru-journeys.js +468 -0
- package/assets/locales/ru.js +2 -0
- package/assets/locales/sv-journeys.js +465 -0
- package/assets/locales/sv.js +2 -0
- package/assets/locales/th-journeys.js +466 -0
- package/assets/locales/th.js +2 -0
- package/assets/locales/tr-journeys.js +468 -0
- package/assets/locales/tr.js +2 -0
- package/assets/locales/uk-journeys.js +468 -0
- package/assets/locales/uk.js +2 -0
- package/assets/locales/vi-journeys.js +466 -0
- package/assets/locales/vi.js +2 -0
- package/assets/locales/zh-Hans-journeys.js +466 -0
- package/assets/locales/zh-Hans.js +2 -0
- package/assets/locales/zh-Hant-journeys.js +466 -0
- package/assets/locales/zh-Hant.js +2 -0
- package/assets/manifest.json +349 -104
- package/assets/markdown.js +27 -2
- package/assets/request-editor.js +7 -1
- package/assets/result-states.js +2 -2
- package/assets/results.js +41 -14
- package/assets/router.js +25 -1
- package/assets/seeded-menu.js +2 -1
- package/assets/shortcuts-sheet.js +3 -1
- package/assets/shortcuts.js +6 -0
- package/assets/sidebar.js +54 -5
- package/assets/signin.js +6 -3
- package/assets/styles.css +8 -2
- package/assets/toast.js +29 -0
- package/assets/vendor/arazzo-runtime-expression.js +136 -0
- package/assets/vendor/json-pointer.js +48 -0
- package/assets/vendor/jsonpath-rfc9535.js +15 -0
- package/assets/view.js +11 -3
- package/assets/views.css +7 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +217 -26
- package/dist/journey-builder.d.ts +178 -0
- package/dist/journey-builder.js +169 -0
- package/dist/journeys.d.ts +24 -0
- package/dist/journeys.js +157 -0
- package/dist/node-http.d.ts +2 -0
- package/dist/node-http.js +17 -0
- package/dist/sessions.d.ts +43 -0
- package/dist/sessions.js +145 -0
- package/dist/statements.js +2 -2
- package/dist/stores/tables.d.ts +213 -0
- package/dist/stores/tables.js +213 -0
- package/dist/types.d.ts +34 -2
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @swaggerexpert/arazzo-runtime-expression v3.4.0 (Apache-2.0)
|
|
3
|
+
* https://github.com/swaggerexpert/arazzo-runtime-expression#readme
|
|
4
|
+
* Vendored for the browser by tools/vendor-journeys-libs.mjs; bundled and minified, unmodified otherwise.
|
|
5
|
+
*/
|
|
6
|
+
function B(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"expression",lower:"expression",index:0,isBkr:!1},this.rules[1]={name:"source",lower:"source",index:1,isBkr:!1},this.rules[2]={name:"header-reference",lower:"header-reference",index:2,isBkr:!1},this.rules[3]={name:"query-reference",lower:"query-reference",index:3,isBkr:!1},this.rules[4]={name:"path-reference",lower:"path-reference",index:4,isBkr:!1},this.rules[5]={name:"body-reference",lower:"body-reference",index:5,isBkr:!1},this.rules[6]={name:"payload-reference",lower:"payload-reference",index:6,isBkr:!1},this.rules[7]={name:"inputs-reference",lower:"inputs-reference",index:7,isBkr:!1},this.rules[8]={name:"outputs-reference",lower:"outputs-reference",index:8,isBkr:!1},this.rules[9]={name:"input-name",lower:"input-name",index:9,isBkr:!1},this.rules[10]={name:"output-name",lower:"output-name",index:10,isBkr:!1},this.rules[11]={name:"steps-reference",lower:"steps-reference",index:11,isBkr:!1},this.rules[12]={name:"step-id",lower:"step-id",index:12,isBkr:!1},this.rules[13]={name:"workflows-reference",lower:"workflows-reference",index:13,isBkr:!1},this.rules[14]={name:"workflows-value-reference",lower:"workflows-value-reference",index:14,isBkr:!1},this.rules[15]={name:"workflows-steps-reference",lower:"workflows-steps-reference",index:15,isBkr:!1},this.rules[16]={name:"workflow-id",lower:"workflow-id",index:16,isBkr:!1},this.rules[17]={name:"workflow-field",lower:"workflow-field",index:17,isBkr:!1},this.rules[18]={name:"workflow-field-name",lower:"workflow-field-name",index:18,isBkr:!1},this.rules[19]={name:"source-reference",lower:"source-reference",index:19,isBkr:!1},this.rules[20]={name:"source-name",lower:"source-name",index:20,isBkr:!1},this.rules[21]={name:"source-reference-id",lower:"source-reference-id",index:21,isBkr:!1},this.rules[22]={name:"components-reference",lower:"components-reference",index:22,isBkr:!1},this.rules[23]={name:"component-type",lower:"component-type",index:23,isBkr:!1},this.rules[24]={name:"component-name",lower:"component-name",index:24,isBkr:!1},this.rules[25]={name:"identifier-strict",lower:"identifier-strict",index:25,isBkr:!1},this.rules[26]={name:"identifier",lower:"identifier",index:26,isBkr:!1},this.rules[27]={name:"name",lower:"name",index:27,isBkr:!1},this.rules[28]={name:"json-pointer",lower:"json-pointer",index:28,isBkr:!1},this.rules[29]={name:"reference-token",lower:"reference-token",index:29,isBkr:!1},this.rules[30]={name:"unescaped",lower:"unescaped",index:30,isBkr:!1},this.rules[31]={name:"escaped",lower:"escaped",index:31,isBkr:!1},this.rules[32]={name:"token",lower:"token",index:32,isBkr:!1},this.rules[33]={name:"tchar",lower:"tchar",index:33,isBkr:!1},this.rules[34]={name:"CHAR",lower:"char",index:34,isBkr:!1},this.rules[35]={name:"escape",lower:"escape",index:35,isBkr:!1},this.rules[36]={name:"unescape",lower:"unescape",index:36,isBkr:!1},this.rules[37]={name:"expression-string",lower:"expression-string",index:37,isBkr:!1},this.rules[38]={name:"embedded-expression",lower:"embedded-expression",index:38,isBkr:!1},this.rules[39]={name:"literal-char",lower:"literal-char",index:39,isBkr:!1},this.rules[40]={name:"ALPHA",lower:"alpha",index:40,isBkr:!1},this.rules[41]={name:"DIGIT",lower:"digit",index:41,isBkr:!1},this.rules[42]={name:"HEXDIG",lower:"hexdig",index:42,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:1,children:[1,2,3,4,7,10,13,16,19,22,25,28,31]},this.rules[0].opcodes[1]={type:7,string:[36,117,114,108]},this.rules[0].opcodes[2]={type:7,string:[36,109,101,116,104,111,100]},this.rules[0].opcodes[3]={type:7,string:[36,115,116,97,116,117,115,99,111,100,101]},this.rules[0].opcodes[4]={type:2,children:[5,6]},this.rules[0].opcodes[5]={type:7,string:[36,114,101,113,117,101,115,116,46]},this.rules[0].opcodes[6]={type:4,index:1},this.rules[0].opcodes[7]={type:2,children:[8,9]},this.rules[0].opcodes[8]={type:7,string:[36,114,101,115,112,111,110,115,101,46]},this.rules[0].opcodes[9]={type:4,index:1},this.rules[0].opcodes[10]={type:2,children:[11,12]},this.rules[0].opcodes[11]={type:7,string:[36,109,101,115,115,97,103,101,46]},this.rules[0].opcodes[12]={type:4,index:1},this.rules[0].opcodes[13]={type:2,children:[14,15]},this.rules[0].opcodes[14]={type:7,string:[36,105,110,112,117,116,115,46]},this.rules[0].opcodes[15]={type:4,index:7},this.rules[0].opcodes[16]={type:2,children:[17,18]},this.rules[0].opcodes[17]={type:7,string:[36,111,117,116,112,117,116,115,46]},this.rules[0].opcodes[18]={type:4,index:8},this.rules[0].opcodes[19]={type:2,children:[20,21]},this.rules[0].opcodes[20]={type:7,string:[36,115,116,101,112,115,46]},this.rules[0].opcodes[21]={type:4,index:11},this.rules[0].opcodes[22]={type:2,children:[23,24]},this.rules[0].opcodes[23]={type:7,string:[36,119,111,114,107,102,108,111,119,115,46]},this.rules[0].opcodes[24]={type:4,index:13},this.rules[0].opcodes[25]={type:2,children:[26,27]},this.rules[0].opcodes[26]={type:7,string:[36,115,111,117,114,99,101,100,101,115,99,114,105,112,116,105,111,110,115,46]},this.rules[0].opcodes[27]={type:4,index:19},this.rules[0].opcodes[28]={type:2,children:[29,30]},this.rules[0].opcodes[29]={type:7,string:[36,99,111,109,112,111,110,101,110,116,115,46]},this.rules[0].opcodes[30]={type:4,index:22},this.rules[0].opcodes[31]={type:7,string:[36,115,101,108,102]},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:3},this.rules[1].opcodes[3]={type:4,index:4},this.rules[1].opcodes[4]={type:4,index:5},this.rules[1].opcodes[5]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2]},this.rules[2].opcodes[1]={type:7,string:[104,101,97,100,101,114,46]},this.rules[2].opcodes[2]={type:4,index:32},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[113,117,101,114,121,46]},this.rules[3].opcodes[2]={type:4,index:27},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:2,children:[1,2]},this.rules[4].opcodes[1]={type:7,string:[112,97,116,104,46]},this.rules[4].opcodes[2]={type:4,index:27},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:2,children:[1,2]},this.rules[5].opcodes[1]={type:7,string:[98,111,100,121]},this.rules[5].opcodes[2]={type:3,min:0,max:1},this.rules[5].opcodes[3]={type:2,children:[4,5]},this.rules[5].opcodes[4]={type:7,string:[35]},this.rules[5].opcodes[5]={type:4,index:28},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:2,children:[1,2]},this.rules[6].opcodes[1]={type:7,string:[112,97,121,108,111,97,100]},this.rules[6].opcodes[2]={type:3,min:0,max:1},this.rules[6].opcodes[3]={type:2,children:[4,5]},this.rules[6].opcodes[4]={type:7,string:[35]},this.rules[6].opcodes[5]={type:4,index:28},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:2,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:3,min:0,max:1},this.rules[7].opcodes[3]={type:2,children:[4,5]},this.rules[7].opcodes[4]={type:7,string:[35]},this.rules[7].opcodes[5]={type:4,index:28},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:2,children:[1,2]},this.rules[8].opcodes[1]={type:4,index:10},this.rules[8].opcodes[2]={type:3,min:0,max:1},this.rules[8].opcodes[3]={type:2,children:[4,5]},this.rules[8].opcodes[4]={type:7,string:[35]},this.rules[8].opcodes[5]={type:4,index:28},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:4,index:26},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:4,index:26},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[11].opcodes[1]={type:4,index:12},this.rules[11].opcodes[2]={type:7,string:[46,111,117,116,112,117,116,115,46]},this.rules[11].opcodes[3]={type:4,index:10},this.rules[11].opcodes[4]={type:3,min:0,max:1},this.rules[11].opcodes[5]={type:2,children:[6,7]},this.rules[11].opcodes[6]={type:7,string:[35]},this.rules[11].opcodes[7]={type:4,index:28},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:4,index:25},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:2,children:[1,2,3]},this.rules[13].opcodes[1]={type:4,index:16},this.rules[13].opcodes[2]={type:7,string:[46]},this.rules[13].opcodes[3]={type:1,children:[4,5]},this.rules[13].opcodes[4]={type:4,index:14},this.rules[13].opcodes[5]={type:4,index:15},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[14].opcodes[1]={type:4,index:17},this.rules[14].opcodes[2]={type:7,string:[46]},this.rules[14].opcodes[3]={type:4,index:18},this.rules[14].opcodes[4]={type:3,min:0,max:1},this.rules[14].opcodes[5]={type:2,children:[6,7]},this.rules[14].opcodes[6]={type:7,string:[35]},this.rules[14].opcodes[7]={type:4,index:28},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2,3]},this.rules[15].opcodes[1]={type:7,string:[115,116,101,112,115]},this.rules[15].opcodes[2]={type:7,string:[46]},this.rules[15].opcodes[3]={type:4,index:12},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:4,index:25},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,2]},this.rules[17].opcodes[1]={type:7,string:[105,110,112,117,116,115]},this.rules[17].opcodes[2]={type:7,string:[111,117,116,112,117,116,115]},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:4,index:26},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:2,children:[1,2,3]},this.rules[19].opcodes[1]={type:4,index:20},this.rules[19].opcodes[2]={type:7,string:[46]},this.rules[19].opcodes[3]={type:4,index:21},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:4,index:25},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:3,min:1,max:1/0},this.rules[21].opcodes[1]={type:4,index:34},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:2,children:[1,2,3]},this.rules[22].opcodes[1]={type:4,index:23},this.rules[22].opcodes[2]={type:7,string:[46]},this.rules[22].opcodes[3]={type:4,index:24},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:1,children:[1,2,3]},this.rules[23].opcodes[1]={type:7,string:[112,97,114,97,109,101,116,101,114,115]},this.rules[23].opcodes[2]={type:7,string:[115,117,99,99,101,115,115,97,99,116,105,111,110,115]},this.rules[23].opcodes[3]={type:7,string:[102,97,105,108,117,114,101,97,99,116,105,111,110,115]},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:4,index:26},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:3,min:1,max:1/0},this.rules[25].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[25].opcodes[2]={type:4,index:40},this.rules[25].opcodes[3]={type:4,index:41},this.rules[25].opcodes[4]={type:7,string:[45]},this.rules[25].opcodes[5]={type:7,string:[95]},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5,6]},this.rules[26].opcodes[2]={type:4,index:40},this.rules[26].opcodes[3]={type:4,index:41},this.rules[26].opcodes[4]={type:7,string:[46]},this.rules[26].opcodes[5]={type:7,string:[45]},this.rules[26].opcodes[6]={type:7,string:[95]},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:3,min:0,max:1/0},this.rules[27].opcodes[1]={type:4,index:34},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:3,min:0,max:1/0},this.rules[28].opcodes[1]={type:2,children:[2,3]},this.rules[28].opcodes[2]={type:7,string:[47]},this.rules[28].opcodes[3]={type:4,index:29},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:3,min:0,max:1/0},this.rules[29].opcodes[1]={type:1,children:[2,3]},this.rules[29].opcodes[2]={type:4,index:30},this.rules[29].opcodes[3]={type:4,index:31},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[30].opcodes[1]={type:5,min:0,max:46},this.rules[30].opcodes[2]={type:5,min:48,max:122},this.rules[30].opcodes[3]={type:6,string:[124]},this.rules[30].opcodes[4]={type:5,min:127,max:1114111},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:2,children:[1,2]},this.rules[31].opcodes[1]={type:7,string:[126]},this.rules[31].opcodes[2]={type:1,children:[3,4]},this.rules[31].opcodes[3]={type:7,string:[48]},this.rules[31].opcodes[4]={type:7,string:[49]},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:3,min:1,max:1/0},this.rules[32].opcodes[1]={type:4,index:33},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]},this.rules[33].opcodes[1]={type:7,string:[33]},this.rules[33].opcodes[2]={type:7,string:[35]},this.rules[33].opcodes[3]={type:7,string:[36]},this.rules[33].opcodes[4]={type:7,string:[37]},this.rules[33].opcodes[5]={type:7,string:[38]},this.rules[33].opcodes[6]={type:7,string:[39]},this.rules[33].opcodes[7]={type:7,string:[42]},this.rules[33].opcodes[8]={type:7,string:[43]},this.rules[33].opcodes[9]={type:7,string:[45]},this.rules[33].opcodes[10]={type:7,string:[46]},this.rules[33].opcodes[11]={type:7,string:[94]},this.rules[33].opcodes[12]={type:7,string:[95]},this.rules[33].opcodes[13]={type:7,string:[96]},this.rules[33].opcodes[14]={type:7,string:[124]},this.rules[33].opcodes[15]={type:7,string:[126]},this.rules[33].opcodes[16]={type:4,index:41},this.rules[33].opcodes[17]={type:4,index:40},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:1,children:[1,2]},this.rules[34].opcodes[1]={type:4,index:36},this.rules[34].opcodes[2]={type:2,children:[3,4]},this.rules[34].opcodes[3]={type:4,index:35},this.rules[34].opcodes[4]={type:1,children:[5,6,7,8,9,10,11,12,13]},this.rules[34].opcodes[5]={type:6,string:[34]},this.rules[34].opcodes[6]={type:6,string:[92]},this.rules[34].opcodes[7]={type:6,string:[47]},this.rules[34].opcodes[8]={type:6,string:[98]},this.rules[34].opcodes[9]={type:6,string:[102]},this.rules[34].opcodes[10]={type:6,string:[110]},this.rules[34].opcodes[11]={type:6,string:[114]},this.rules[34].opcodes[12]={type:6,string:[116]},this.rules[34].opcodes[13]={type:2,children:[14,15]},this.rules[34].opcodes[14]={type:6,string:[117]},this.rules[34].opcodes[15]={type:3,min:4,max:4},this.rules[34].opcodes[16]={type:4,index:42},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[92]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[36].opcodes[1]={type:5,min:32,max:33},this.rules[36].opcodes[2]={type:5,min:35,max:91},this.rules[36].opcodes[3]={type:5,min:93,max:122},this.rules[36].opcodes[4]={type:6,string:[124]},this.rules[36].opcodes[5]={type:5,min:126,max:1114111},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:3,min:0,max:1/0},this.rules[37].opcodes[1]={type:1,children:[2,3]},this.rules[37].opcodes[2]={type:4,index:39},this.rules[37].opcodes[3]={type:4,index:38},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2,3]},this.rules[38].opcodes[1]={type:7,string:[123]},this.rules[38].opcodes[2]={type:4,index:0},this.rules[38].opcodes[3]={type:7,string:[125]},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:1,children:[1,2,3]},this.rules[39].opcodes[1]={type:5,min:0,max:122},this.rules[39].opcodes[2]={type:6,string:[124]},this.rules[39].opcodes[3]={type:5,min:126,max:1114111},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:5,min:65,max:90},this.rules[40].opcodes[2]={type:5,min:97,max:122},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:5,min:48,max:57},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[42].opcodes[1]={type:4,index:41},this.rules[42].opcodes[2]={type:7,string:[97]},this.rules[42].opcodes[3]={type:7,string:[98]},this.rules[42].opcodes[4]={type:7,string:[99]},this.rules[42].opcodes[5]={type:7,string:[100]},this.rules[42].opcodes[6]={type:7,string:[101]},this.rules[42].opcodes[7]={type:7,string:[102]},this.toString=function(){let e="";return e+=`; Arazzo runtime expression ABNF syntax
|
|
7
|
+
`,e+=`; Rule order mirrors the Arazzo 1.1.0 specification (Runtime Expressions section).
|
|
8
|
+
`,e+=`
|
|
9
|
+
`,e+=`; Top-level expression
|
|
10
|
+
`,e+=`expression = (
|
|
11
|
+
`,e+=` "$url" /
|
|
12
|
+
`,e+=` "$method" /
|
|
13
|
+
`,e+=` "$statusCode" /
|
|
14
|
+
`,e+=` "$request." source /
|
|
15
|
+
`,e+=` "$response." source /
|
|
16
|
+
`,e+=` "$message." source /
|
|
17
|
+
`,e+=` "$inputs." inputs-reference /
|
|
18
|
+
`,e+=` "$outputs." outputs-reference /
|
|
19
|
+
`,e+=` "$steps." steps-reference /
|
|
20
|
+
`,e+=` "$workflows." workflows-reference /
|
|
21
|
+
`,e+=` "$sourceDescriptions." source-reference /
|
|
22
|
+
`,e+=` "$components." components-reference /
|
|
23
|
+
`,e+=` "$self"
|
|
24
|
+
`,e+=` )
|
|
25
|
+
`,e+=`
|
|
26
|
+
`,e+=`; Request/Response/Message sources
|
|
27
|
+
`,e+=`source = ( header-reference / query-reference / path-reference / body-reference / payload-reference )
|
|
28
|
+
`,e+=`header-reference = "header." token
|
|
29
|
+
`,e+=`query-reference = "query." name
|
|
30
|
+
`,e+=`path-reference = "path." name
|
|
31
|
+
`,e+=`body-reference = "body" ["#" json-pointer ]
|
|
32
|
+
`,e+=`payload-reference = "payload" ["#" json-pointer ]
|
|
33
|
+
`,e+=`
|
|
34
|
+
`,e+=`; Input/Output references
|
|
35
|
+
`,e+=`inputs-reference = input-name [ "#" json-pointer ]
|
|
36
|
+
`,e+=`outputs-reference = output-name [ "#" json-pointer ]
|
|
37
|
+
`,e+=`input-name = identifier
|
|
38
|
+
`,e+=`output-name = identifier
|
|
39
|
+
`,e+=`
|
|
40
|
+
`,e+=`; Steps expressions
|
|
41
|
+
`,e+=`steps-reference = step-id ".outputs." output-name [ "#" json-pointer ]
|
|
42
|
+
`,e+=`step-id = identifier-strict
|
|
43
|
+
`,e+=`
|
|
44
|
+
`,e+=`; Workflows expressions
|
|
45
|
+
`,e+=`workflows-reference = workflow-id "." ( workflows-value-reference / workflows-steps-reference )
|
|
46
|
+
`,e+=`workflows-value-reference = workflow-field "." workflow-field-name [ "#" json-pointer ]
|
|
47
|
+
`,e+=`workflows-steps-reference = "steps" "." step-id
|
|
48
|
+
`,e+=`workflow-id = identifier-strict
|
|
49
|
+
`,e+=`workflow-field = "inputs" / "outputs"
|
|
50
|
+
`,e+=`workflow-field-name = identifier
|
|
51
|
+
`,e+=`
|
|
52
|
+
`,e+=`; Source descriptions expressions
|
|
53
|
+
`,e+=`source-reference = source-name "." source-reference-id
|
|
54
|
+
`,e+=`source-name = identifier-strict
|
|
55
|
+
`,e+=`source-reference-id = 1*CHAR
|
|
56
|
+
`,e+=` ; operationIds have no character restrictions in OpenAPI/AsyncAPI
|
|
57
|
+
`,e+=`
|
|
58
|
+
`,e+=`; Components expressions
|
|
59
|
+
`,e+=`components-reference = component-type "." component-name
|
|
60
|
+
`,e+=`component-type = "parameters" / "successActions" / "failureActions"
|
|
61
|
+
`,e+=`component-name = identifier
|
|
62
|
+
`,e+=`
|
|
63
|
+
`,e+=`; Identifier rules
|
|
64
|
+
`,e+=`identifier-strict = 1*( ALPHA / DIGIT / "-" / "_" )
|
|
65
|
+
`,e+=` ; Alphanumeric with hyphens, underscores (no dots)
|
|
66
|
+
`,e+=`identifier = 1*( ALPHA / DIGIT / "." / "-" / "_" )
|
|
67
|
+
`,e+=` ; Alphanumeric with dots, hyphens, underscores
|
|
68
|
+
`,e+=`
|
|
69
|
+
`,e+=`; Unconstrained name rule for query/path references
|
|
70
|
+
`,e+=`name = *( CHAR )
|
|
71
|
+
`,e+=`
|
|
72
|
+
`,e+=`; JSON Pointer (RFC 6901, adapted)
|
|
73
|
+
`,e+=`; { (%x7B) and } (%x7D) are excluded from 'unescaped' for unambiguous embedded expression parsing
|
|
74
|
+
`,e+=`json-pointer = *( "/" reference-token )
|
|
75
|
+
`,e+=`reference-token = *( unescaped / escaped )
|
|
76
|
+
`,e+=`unescaped = %x00-2E / %x30-7A / %x7C / %x7F-10FFFF
|
|
77
|
+
`,e+=` ; %x2F ('/'), %x7E ('~'), %x7B ('{'), %x7D ('}') are excluded
|
|
78
|
+
`,e+=`escaped = "~" ( "0" / "1" )
|
|
79
|
+
`,e+=` ; representing '~' and '/', respectively
|
|
80
|
+
`,e+=`
|
|
81
|
+
`,e+=`; https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
|
|
82
|
+
`,e+=`token = 1*tchar
|
|
83
|
+
`,e+=`tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
84
|
+
`,e+=' / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"\n',e+=` / DIGIT / ALPHA
|
|
85
|
+
`,e+=` ; any VCHAR, except delimiters
|
|
86
|
+
`,e+=`
|
|
87
|
+
`,e+=`; https://www.rfc-editor.org/rfc/rfc7159#section-7
|
|
88
|
+
`,e+=`CHAR = unescape /
|
|
89
|
+
`,e+=` escape (
|
|
90
|
+
`,e+=` %x22 / ; " quotation mark U+0022
|
|
91
|
+
`,e+=` %x5C / ; \\ reverse solidus U+005C
|
|
92
|
+
`,e+=` %x2F / ; / solidus U+002F
|
|
93
|
+
`,e+=` %x62 / ; b backspace U+0008
|
|
94
|
+
`,e+=` %x66 / ; f form feed U+000C
|
|
95
|
+
`,e+=` %x6E / ; n line feed U+000A
|
|
96
|
+
`,e+=` %x72 / ; r carriage return U+000D
|
|
97
|
+
`,e+=` %x74 / ; t tab U+0009
|
|
98
|
+
`,e+=` %x75 4HEXDIG ) ; uXXXX U+XXXX
|
|
99
|
+
`,e+=`escape = %x5C ; \\
|
|
100
|
+
`,e+=`unescape = %x20-21 / %x23-5B / %x5D-7A / %x7C / %x7E-10FFFF
|
|
101
|
+
`,e+=` ; %x7B ('{') and %x7D ('}') are excluded from 'unescape'
|
|
102
|
+
`,e+=`
|
|
103
|
+
`,e+=`; Grammar for parsing template strings with embedded expressions
|
|
104
|
+
`,e+=`expression-string = *( literal-char / embedded-expression )
|
|
105
|
+
`,e+=`embedded-expression = "{" expression "}"
|
|
106
|
+
`,e+=`literal-char = %x00-7A / %x7C / %x7E-10FFFF ; anything except { (%x7B) and } (%x7D)
|
|
107
|
+
`,e+=`
|
|
108
|
+
`,e+=`; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1
|
|
109
|
+
`,e+=`ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
|
|
110
|
+
`,e+=`DIGIT = %x30-39 ; 0-9
|
|
111
|
+
`,e+=`HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
|
112
|
+
`,e}}var U=function(){let e=g,r=_,s=this,n="parser.js: Parser(): ",p=function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};s.ast=void 0,s.stats=void 0,s.trace=void 0,s.callbacks=[];let l=0,y=0,m=0,u=0,A=0,f,E,c,d,o=new p,i,h,b,$=()=>{l=0,y=0,m=0,u=0,A=0,f=void 0,E=void 0,c=void 0,d=void 0,o.refresh(),i=void 0,h=void 0,b=void 0},C=()=>{let x=`${n}initializeCallbacks(): `,a;for(i=[],h=[],a=0;a<f.length;a+=1)i[a]=void 0;for(a=0;a<E.length;a+=1)h[a]=void 0;let w,T=[];for(a=0;a<f.length;a+=1)T.push(f[a].lower);for(a=0;a<E.length;a+=1)T.push(E[a].lower);for(let k in s.callbacks)if(s.callbacks.hasOwnProperty(k)){if(a=T.indexOf(k.toLowerCase()),a<0)throw new Error(`${x}syntax callback '${k}' not a rule or udt name`);if(w=s.callbacks[k]?s.callbacks[k]:void 0,typeof w=="function"||w===void 0)a<f.length?i[a]=w:h[a-f.length]=w;else throw new Error(`${x}syntax callback[${k}] must be function reference or falsy)`)}};s.parse=(x,a,w,T)=>{let k=`${n}parse(): `;$(),d=r.stringToChars(w),f=x.rules,E=x.udts;let S=a.toLowerCase(),M;for(let F in f)if(f.hasOwnProperty(F)&&S===f[F].lower){M=f[F].index;break}if(M===void 0)throw new Error(`${k}start rule name '${startRule}' not recognized`);C(),s.trace&&s.trace.init(f,E,d),s.stats&&s.stats.init(f,E),s.ast&&s.ast.init(f,E,d),b=T,c=[{type:e.RNM,index:M}],D(0,0),c=void 0;let R=!1;switch(o.state){case e.ACTIVE:throw new Error(`${k}final state should never be 'ACTIVE'`);case e.NOMATCH:R=!1;break;case e.EMPTY:case e.MATCH:o.phraseLength===d.length?R=!0:R=!1;break;default:throw new Error("unrecognized state")}return{success:R,state:o.state,stateName:e.idName(o.state),length:d.length,matched:o.phraseLength,maxMatched:A,maxTreeDepth:m,nodeHits:u}};let O=(x,a)=>{let w=c[x];for(let T=0;T<w.children.length&&(D(w.children[T],a),o.state===e.NOMATCH);T+=1);},I=(x,a)=>{let w,T,k,S,M=c[x];s.ast&&(T=s.ast.getLength()),w=!0,k=a,S=0;for(let R=0;R<M.children.length;R+=1)if(D(M.children[R],k),o.state===e.NOMATCH){w=!1;break}else k+=o.phraseLength,S+=o.phraseLength;w?(o.state=S===0?e.EMPTY:e.MATCH,o.phraseLength=S):(o.state=e.NOMATCH,o.phraseLength=0,s.ast&&s.ast.setLength(T))},j=(x,a)=>{let w,T,k,S,M=c[x];if(M.max===0){o.state=e.EMPTY,o.phraseLength=0;return}for(T=a,k=0,S=0,s.ast&&(w=s.ast.getLength());!(T>=d.length||(D(x+1,T),o.state===e.NOMATCH)||o.state===e.EMPTY||(S+=1,k+=o.phraseLength,T+=o.phraseLength,S===M.max)););o.state===e.EMPTY||S>=M.min?(o.state=k===0?e.EMPTY:e.MATCH,o.phraseLength=k):(o.state=e.NOMATCH,o.phraseLength=0,s.ast&&s.ast.setLength(w))},G=(x,a,w,T)=>{if(a.phraseLength>w){let k=`${n}opRNM(${x.name}): callback function error: `;throw k+=`sysData.phraseLength: ${a.phraseLength}`,k+=` must be <= remaining chars: ${w}`,new Error(k)}switch(a.state){case e.ACTIVE:if(!T)throw new Error(`${n}opRNM(${x.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:a.phraseLength=0;break;case e.MATCH:a.phraseLength===0&&(a.state=e.EMPTY);break;case e.NOMATCH:a.phraseLength=0;break;default:throw new Error(`${n}opRNM(${x.name}): callback function return error. Unrecognized return state: ${a.state}`)}},Y=(x,a)=>{let w,T,k,S=c[x],M=f[S.index],R=i[M.index];if(l||(T=s.ast&&s.ast.ruleDefined(S.index),T&&(w=s.ast.getLength(),s.ast.down(S.index,f[S.index].name))),R){let F=d.length-a;R(o,d,a,b),G(M,o,F,!0),o.state===e.ACTIVE&&(k=c,c=M.opcodes,D(0,a),c=k,R(o,d,a,b),G(M,o,F,!1))}else k=c,c=M.opcodes,D(0,a,o),c=k;l||T&&(o.state===e.NOMATCH?s.ast.setLength(w):s.ast.up(S.index,M.name,a,o.phraseLength))},z=(x,a)=>{let w=c[x];o.state=e.NOMATCH,a<d.length&&w.min<=d[a]&&d[a]<=w.max&&(o.state=e.MATCH,o.phraseLength=1)},X=(x,a)=>{let w=c[x],T=w.string.length;if(o.state=e.NOMATCH,a+T<=d.length){for(let k=0;k<T;k+=1)if(d[a+k]!==w.string[k])return;o.state=e.MATCH,o.phraseLength=T}},xe=(x,a)=>{let w,T=c[x];o.state=e.NOMATCH;let k=T.string.length;if(k===0){o.state=e.EMPTY;return}if(a+k<=d.length){for(let S=0;S<k;S+=1)if(w=d[a+S],w>=65&&w<=90&&(w+=32),w!==T.string[S])return;o.state=e.MATCH,o.phraseLength=k}},ge=(x,a,w)=>{if(a.phraseLength>w){let T=`${n}opUDT(${x.name}): callback function error: `;throw T+=`sysData.phraseLength: ${a.phraseLength}`,T+=` must be <= remaining chars: ${w}`,new Error(T)}switch(a.state){case e.ACTIVE:throw new Error(`${n}opUDT(${x.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(x.empty)a.phraseLength=0;else throw new Error(`${n}opUDT(${x.name}) may not return EMPTY.`);break;case e.MATCH:if(a.phraseLength===0)if(x.empty)a.state=e.EMPTY;else throw new Error(`${n}opUDT(${x.name}) may not return EMPTY.`);break;case e.NOMATCH:a.phraseLength=0;break;default:throw new Error(`${n}opUDT(${x.name}): callback function return error. Unrecognized return state: ${a.state}`)}},we=(x,a)=>{let w,T,k,S=c[x],M=E[S.index];o.UdtIndex=M.index,l||(k=s.ast&&s.ast.udtDefined(S.index),k&&(T=f.length+S.index,w=s.ast.getLength(),s.ast.down(T,M.name)));let R=d.length-a;h[S.index](o,d,a,b),ge(M,o,R),l||k&&(o.state===e.NOMATCH?s.ast.setLength(w):s.ast.up(T,M.name,a,o.phraseLength))},Te=(x,a)=>{switch(l+=1,D(x+1,a),l-=1,o.phraseLength=0,o.state){case e.EMPTY:o.state=e.EMPTY;break;case e.MATCH:o.state=e.EMPTY;break;case e.NOMATCH:o.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${o.state}`)}},ke=(x,a)=>{switch(l+=1,D(x+1,a),l-=1,o.phraseLength=0,o.state){case e.EMPTY:case e.MATCH:o.state=e.NOMATCH;break;case e.NOMATCH:o.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${o.state}`)}},D=(x,a)=>{let w=`${n}opExecute(): `,T=c[x];switch(u+=1,y>m&&(m=y),y+=1,o.refresh(),s.trace&&s.trace.down(T,a),T.type){case e.ALT:O(x,a);break;case e.CAT:I(x,a);break;case e.REP:j(x,a);break;case e.RNM:Y(x,a);break;case e.TRG:z(x,a);break;case e.TBS:X(x,a);break;case e.TLS:xe(x,a);break;case e.UDT:we(x,a);break;case e.AND:Te(x,a);break;case e.NOT:ke(x,a);break;default:throw new Error(`${w}unrecognized operator`)}l||a+o.phraseLength>A&&(A=a+o.phraseLength),s.stats&&s.stats.collect(T,o),s.trace&&s.trace.up(T,o.state,a,o.phraseLength),y-=1}},pe=function(){let e="parser.js: Ast()): ",r=g,s=_,n=this,p,l,y,m=0,u=[],A=[],f=[];n.callbacks=[],n.init=(c,d,o)=>{A.length=0,f.length=0,m=0,p=c,l=d,y=o;let i,h=[];for(i=0;i<p.length;i+=1)h.push(p[i].lower);for(i=0;i<l.length;i+=1)h.push(l[i].lower);for(m=p.length+l.length,i=0;i<m;i+=1)u[i]=void 0;for(let b in n.callbacks)if(n.callbacks.hasOwnProperty(b)){let $=b.toLowerCase();if(i=h.indexOf($),i<0)throw new Error(`${e}init: node '${b}' not a rule or udt name`);u[i]=n.callbacks[b]}},n.ruleDefined=c=>!!u[c],n.udtDefined=c=>!!u[p.length+c],n.down=(c,d)=>{let o=f.length;return A.push(o),f.push({name:d,thisIndex:o,thatIndex:void 0,state:r.SEM_PRE,callbackIndex:c,phraseIndex:void 0,phraseLength:void 0,stack:A.length}),o},n.up=(c,d,o,i)=>{let h=f.length,b=A.pop();return f.push({name:d,thisIndex:h,thatIndex:b,state:r.SEM_POST,callbackIndex:c,phraseIndex:o,phraseLength:i,stack:A.length}),f[b].thatIndex=h,f[b].phraseIndex=o,f[b].phraseLength=i,h},n.translate=c=>{let d,o,i;for(let h=0;h<f.length;h+=1)i=f[h],o=u[i.callbackIndex],o&&(i.state===r.SEM_PRE?o(r.SEM_PRE,y,i.phraseIndex,i.phraseLength,c):o&&o(r.SEM_POST,y,i.phraseIndex,i.phraseLength,c))},n.setLength=c=>{f.length=c,c>0?A.length=f[c-1].stack:A.length=0},n.getLength=()=>f.length;function E(c){let d="";for(;c-- >0;)d+=" ";return d}n.toXml=()=>{let c="",d=0;return c+=`<?xml version="1.0" encoding="utf-8"?>
|
|
113
|
+
`,c+=`<root nodes="${f.length/2}" characters="${y.length}">
|
|
114
|
+
`,c+=`<!--
|
|
115
|
+
`,c+=` Caveat: AST node phrases may not be faithfully represented.
|
|
116
|
+
`,c+=` Invalid XML characters are replaced with 0xFFFD.
|
|
117
|
+
`,c+=` Special characters &<>"' are escaped with XML entities.
|
|
118
|
+
`,c+=`-->
|
|
119
|
+
`,c+=`<!-- input string -->
|
|
120
|
+
`,c+=E(d+2),c+=s.charsToXmlString(y),c+=`
|
|
121
|
+
`,f.forEach(o=>{o.state===r.SEM_PRE?(d+=1,c+=E(d),c+=`<node name="${o.name}" index="${o.phraseIndex}" length="${o.phraseLength}">
|
|
122
|
+
`,c+=E(d+2),c+=s.charsToXmlString(y,o.phraseIndex,o.phraseLength),c+=`
|
|
123
|
+
`):(c+=E(d),c+=`</node><!-- name="${o.name}" -->
|
|
124
|
+
`,d-=1)}),c+=`</root>
|
|
125
|
+
`,c}},de=function(){let e=g,r=_,s="parser.js: Trace(): ",n,p,l,y="",m=0,u=100,A=this,f=c=>{let d="",o=0;if(c>=0)for(;c--;)o+=1,o===5?(d+="|",o=0):d+=".";return d};A.init=(c,d,o)=>{p=c,l=d,n=o};let E=c=>{let d;switch(c.type){case e.ALT:d="ALT";break;case e.CAT:d="CAT";break;case e.REP:c.max===1/0?d=`REP(${c.min},inf)`:d=`REP(${c.min},${c.max})`;break;case e.RNM:d=`RNM(${p[c.index].name})`;break;case e.TRG:d=`TRG(${c.min},${c.max})`;break;case e.TBS:c.string.length>6?d=`TBS(${r.charsToString(c.string,0,3)}...)`:d=`TBS(${r.charsToString(c.string,0,6)})`;break;case e.TLS:c.string.length>6?d=`TLS(${r.charsToString(c.string,0,3)}...)`:d=`TLS(${r.charsToString(c.string,0,6)})`;break;case e.UDT:d=`UDT(${l[c.index].name})`;break;case e.AND:d="AND";break;case e.NOT:d="NOT";break;default:throw new Error(`${s}Trace: opName: unrecognized opcode`)}return d};A.down=(c,d)=>{let o=f(m),i=Math.min(u,n.length-d),h=r.charsToString(n,d,i);i<n.length-d&&(h+="..."),h=`${o}|-|[${E(c)}]${h}
|
|
126
|
+
`,y+=h,m+=1},A.up=(c,d,o,i)=>{let h=`${s}trace.up: `;m-=1;let b=f(m),$,C,O;switch(d){case e.EMPTY:O="|E|",C="''";break;case e.MATCH:O="|M|",$=Math.min(u,i),$<i?C=`'${r.charsToString(n,o,$)}...'`:C=`'${r.charsToString(n,o,$)}'`;break;case e.NOMATCH:O="|N|",C="";break;default:throw new Error(`${h} unrecognized state`)}C=`${b}${O}[${E(c)}]${C}
|
|
127
|
+
`,y+=C},A.displayTrace=()=>y},ue=function(){let e=g,r="parser.js: Stats(): ",s,n,p,l=[],y=[],m=[];this.init=(i,h)=>{s=i,n=h,d()},this.collect=(i,h)=>{o(p,h.state,h.phraseLength),o(l[i.type],h.state,h.phraseLength),i.type===e.RNM&&o(y[i.index],h.state,h.phraseLength),i.type===e.UDT&&o(m[i.index],h.state,h.phraseLength)},this.displayStats=()=>{let i="",h={match:0,empty:0,nomatch:0,total:0},b=($,C,O,I,j)=>{h.match+=C,h.empty+=O,h.nomatch+=I,h.total+=j;let G=u(C),Y=u(O),z=u(I),X=u(j);return`${$} | ${G} | ${Y} | ${z} | ${X} |
|
|
128
|
+
`};return i+=` OPERATOR STATS
|
|
129
|
+
`,i+=` | MATCH | EMPTY | NOMATCH | TOTAL |
|
|
130
|
+
`,i+=b(" ALT",l[e.ALT].match,l[e.ALT].empty,l[e.ALT].nomatch,l[e.ALT].total),i+=b(" CAT",l[e.CAT].match,l[e.CAT].empty,l[e.CAT].nomatch,l[e.CAT].total),i+=b(" REP",l[e.REP].match,l[e.REP].empty,l[e.REP].nomatch,l[e.REP].total),i+=b(" RNM",l[e.RNM].match,l[e.RNM].empty,l[e.RNM].nomatch,l[e.RNM].total),i+=b(" TRG",l[e.TRG].match,l[e.TRG].empty,l[e.TRG].nomatch,l[e.TRG].total),i+=b(" TBS",l[e.TBS].match,l[e.TBS].empty,l[e.TBS].nomatch,l[e.TBS].total),i+=b(" TLS",l[e.TLS].match,l[e.TLS].empty,l[e.TLS].nomatch,l[e.TLS].total),i+=b(" UDT",l[e.UDT].match,l[e.UDT].empty,l[e.UDT].nomatch,l[e.UDT].total),i+=b(" AND",l[e.AND].match,l[e.AND].empty,l[e.AND].nomatch,l[e.AND].total),i+=b(" NOT",l[e.NOT].match,l[e.NOT].empty,l[e.NOT].nomatch,l[e.NOT].total),i+=b("TOTAL",h.match,h.empty,h.nomatch,h.total),i},this.displayHits=i=>{let h="",b=($,C,O,I,j)=>{p.match+=$,p.empty+=C,p.nomatch+=O,p.total+=I;let G=u($),Y=u(C),z=u(O),X=u(I);return`| ${G} | ${Y} | ${z} | ${X} | ${j}
|
|
131
|
+
`};typeof i=="string"&&i.toLowerCase()[0]==="a"?(y.sort(A),m.sort(A),h+=` RULES/UDTS ALPHABETICALLY
|
|
132
|
+
`):typeof i=="string"&&i.toLowerCase()[0]==="i"?(y.sort(E),m.sort(E),h+=` RULES/UDTS BY INDEX
|
|
133
|
+
`):(y.sort(f),m.sort(f),h+=` RULES/UDTS BY HIT COUNT
|
|
134
|
+
`),h+=`| MATCH | EMPTY | NOMATCH | TOTAL | NAME
|
|
135
|
+
`;for(let $=0;$<y.length;$+=1){let C=y[$];C.total&&(h+=b(C.match,C.empty,C.nomatch,C.total,C.name))}for(let $=0;$<m.length;$+=1){let C=m[$];C.total&&(h+=b(C.match,C.empty,C.nomatch,C.total,C.name))}return h};let u=i=>i<10?` ${i}`:i<100?` ${i}`:i<1e3?` ${i}`:i<1e4?` ${i}`:i<1e5?` ${i}`:i<1e6?` ${i}`:`${i}`,A=(i,h)=>i.lower<h.lower?-1:i.lower>h.lower?1:0,f=(i,h)=>i.total<h.total?1:i.total>h.total?-1:A(i,h),E=(i,h)=>i.index<h.index?-1:i.index>h.index?1:0,c=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},d=()=>{l.length=0,p=new c,l[e.ALT]=new c,l[e.CAT]=new c,l[e.REP]=new c,l[e.RNM]=new c,l[e.TRG]=new c,l[e.TBS]=new c,l[e.TLS]=new c,l[e.UDT]=new c,l[e.AND]=new c,l[e.NOT]=new c,y.length=0;for(let i=0;i<s.length;i+=1)y.push({empty:0,match:0,nomatch:0,total:0,name:s[i].name,lower:s[i].lower,index:s[i].index});if(n.length>0){m.length=0;for(let i=0;i<n.length;i+=1)m.push({empty:0,match:0,nomatch:0,total:0,name:n[i].name,lower:n[i].lower,index:n[i].index})}},o=(i,h)=>{switch(i.total+=1,h){case e.EMPTY:i.empty+=1;break;case e.MATCH:i.match+=1;break;case e.NOMATCH:i.nomatch+=1;break;default:throw new Error(`${r}collect(): incStat(): unrecognized state: ${h}`)}}},_={stringToChars:t=>[...t].map(e=>e.codePointAt(0)),charsToString:(t,e,r)=>{let s=t;for(;!(e===void 0||e<0);){if(r===void 0){s=t.slice(e);break}if(r<=0)return"";s=t.slice(e,e+r);break}return String.fromCodePoint(...s)},charsToXmlString:(t,e,r)=>{function s(u){return!Number.isFinite(u)||u<0||u>1114111||u>=0&&u<=8||u>=11&&u<=12||u>=14&&u<=31||u>=55296&&u<=57343||u>=65534&&u<=65535}let n=0,p=t.length;if(typeof e=="number"){if(e>=t.length)return"";n=e<0?0:e}if(typeof r=="number"){if(r<=0)return"";p=r>t.length-n?t.length:n+r}let l=t.slice(n,p).map(u=>s(u)?65533:u),y=32768,m="";for(let u=0;u<l.length;u+=y)m+=String.fromCodePoint.apply(null,l.slice(u,u+y));return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}},g={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:t=>{switch(t){case g.ALT:return"ALT";case g.CAT:return"CAT";case g.REP:return"REP";case g.RNM:return"RNM";case g.TRG:return"TRG";case g.TBS:return"TBS";case g.TLS:return"TLS";case g.UDT:return"UDT";case g.AND:return"AND";case g.NOT:return"NOT";case g.ACTIVE:return"ACTIVE";case g.EMPTY:return"EMPTY";case g.MATCH:return"MATCH";case g.NOMATCH:return"NOMATCH";case g.SEM_PRE:return"SEM_PRE";case g.SEM_POST:return"SEM_POST";case g.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};var Ae=t=>(e,r,s,n,p)=>{if(e===g.SEM_PRE){let l={type:t,text:_.charsToString(r,s,n),start:s,length:n,children:[]};p.stack.length>0?p.stack[p.stack.length-1].children.push(l):p.root=l,p.stack.push(l)}e===g.SEM_POST&&p.stack.pop()},N=Ae;var J=class extends pe{constructor(){super(),this.callbacks["expression-string"]=N("expression-string"),this.callbacks["embedded-expression"]=N("embedded-expression"),this.callbacks["literal-char"]=N("literal-char"),this.callbacks.expression=N("expression"),this.callbacks.source=N("source"),this.callbacks["header-reference"]=N("header-reference"),this.callbacks["query-reference"]=N("query-reference"),this.callbacks["path-reference"]=N("path-reference"),this.callbacks["body-reference"]=N("body-reference"),this.callbacks["payload-reference"]=N("payload-reference"),this.callbacks["json-pointer"]=N("json-pointer"),this.callbacks["reference-token"]=N("reference-token"),this.callbacks["inputs-reference"]=N("inputs-reference"),this.callbacks["input-name"]=N("input-name"),this.callbacks["outputs-reference"]=N("outputs-reference"),this.callbacks["output-name"]=N("output-name"),this.callbacks["steps-reference"]=N("steps-reference"),this.callbacks["workflows-reference"]=N("workflows-reference"),this.callbacks["workflows-value-reference"]=N("workflows-value-reference"),this.callbacks["workflows-steps-reference"]=N("workflows-steps-reference"),this.callbacks["workflow-id"]=N("workflow-id"),this.callbacks["workflow-field"]=N("workflow-field"),this.callbacks["workflow-field-name"]=N("workflow-field-name"),this.callbacks["source-reference"]=N("source-reference"),this.callbacks["source-name"]=N("source-name"),this.callbacks["source-reference-id"]=N("source-reference-id"),this.callbacks["components-reference"]=N("components-reference"),this.callbacks["component-type"]=N("component-type"),this.callbacks["component-name"]=N("component-name"),this.callbacks.name=N("name"),this.callbacks.token=N("token"),this.callbacks["step-id"]=N("step-id")}getTree(){let e={stack:[],root:null};return this.translate(e),e.root}},H=J;var be=new B,L=(t,e)=>{let r=e[t.type];if(!r)throw new Error(`No transformer for CST node type: ${t.type}`);return r(t)},Ee=t=>{let e=new U;e.ast=new H;let r;try{r=e.parse(be,"workflows-reference",t)}catch{return}if(!r.success)return;let s=e.ast.getTree(),n=s.children.find(y=>y.type==="workflows-steps-reference");if(!n)return;let p=s.children.find(y=>y.type==="workflow-id"),l=n.children.find(y=>y.type==="step-id");return{type:"WorkflowsStepsExpression",workflowId:p.text,stepId:l.text}},P={expression(t){let e=t.text;if(e==="$url")return{type:"UrlExpression"};if(e==="$method")return{type:"MethodExpression"};if(e==="$statusCode")return{type:"StatusCodeExpression"};if(e==="$self")return{type:"SelfExpression"};if(e.startsWith("$request.")){let r=t.children.find(s=>s.type==="source");return{type:"RequestExpression",source:L(r,P)}}if(e.startsWith("$response.")){let r=t.children.find(s=>s.type==="source");return{type:"ResponseExpression",source:L(r,P)}}if(e.startsWith("$message.")){let r=t.children.find(s=>s.type==="source");return{type:"MessageExpression",source:L(r,P)}}if(e.startsWith("$inputs.")){let r=t.children.find(s=>s.type==="inputs-reference");return L(r,P)}if(e.startsWith("$outputs.")){let r=t.children.find(s=>s.type==="outputs-reference");return L(r,P)}if(e.startsWith("$steps.")){let r=t.children.find(s=>s.type==="steps-reference");return L(r,P)}if(e.startsWith("$workflows.")){let r=t.children.find(s=>s.type==="workflows-reference");return L(r,P)}if(e.startsWith("$sourceDescriptions.")){let r=t.children.find(s=>s.type==="source-reference");return L(r,P)}if(e.startsWith("$components.")){let r=t.children.find(s=>s.type==="components-reference");return L(r,P)}},source(t){let e=t.children[0];return{type:"Source",reference:L(e,P)}},"header-reference"(t){return{type:"HeaderReference",token:t.children.find(r=>r.type==="token").text.toLowerCase()}},"query-reference"(t){return{type:"QueryReference",name:t.children.find(r=>r.type==="name").text}},"path-reference"(t){return{type:"PathReference",name:t.children.find(r=>r.type==="name").text}},"body-reference"(t){let e=t.children.find(r=>r.type==="json-pointer");return e?{type:"BodyReference",jsonPointer:L(e,P)}:{type:"BodyReference"}},"payload-reference"(t){let e=t.children.find(r=>r.type==="json-pointer");return e?{type:"PayloadReference",jsonPointer:L(e,P)}:{type:"PayloadReference"}},"json-pointer"(t){let e=t.children.filter(r=>r.type==="reference-token").map(r=>L(r,P));return{type:"JsonPointer",value:t.text,referenceTokens:e}},"reference-token"(t){return{type:"ReferenceToken",value:t.text}},"inputs-reference"(t){let e=t.children.find(n=>n.type==="input-name"),r=t.children.find(n=>n.type==="json-pointer"),s={type:"InputsExpression",name:e.text};return r&&(s.jsonPointer=L(r,P)),s},"outputs-reference"(t){let e=t.children.find(n=>n.type==="output-name"),r=t.children.find(n=>n.type==="json-pointer"),s={type:"OutputsExpression",name:e.text};return r&&(s.jsonPointer=L(r,P)),s},"steps-reference"(t){let e=t.children.find(p=>p.type==="step-id"),r=t.children.find(p=>p.type==="output-name"),s=t.children.find(p=>p.type==="json-pointer"),n={type:"StepsExpression",stepId:e.text,field:"outputs",outputName:r.text};return s&&(n.jsonPointer=L(s,P)),n},"workflows-reference"(t){let e=t.children.find(m=>m.type==="workflow-id"),r=t.children.find(m=>m.type==="workflows-steps-reference");if(r){let m=r.children.find(u=>u.type==="step-id");return{type:"WorkflowsStepsExpression",workflowId:e.text,stepId:m.text}}let s=t.children.find(m=>m.type==="workflows-value-reference"),n=s.children.find(m=>m.type==="workflow-field"),p=s.children.find(m=>m.type==="workflow-field-name"),l=s.children.find(m=>m.type==="json-pointer"),y={type:"WorkflowsExpression",workflowId:e.text,field:n.text,fieldName:p.text};return l&&(y.jsonPointer=L(l,P)),y},"source-reference"(t){let e=t.children.find(p=>p.type==="source-name"),r=t.children.find(p=>p.type==="source-reference-id"),s={type:"SourceDescriptionsExpression",sourceName:e.text,reference:r.text},n=Ee(r.text);return n&&(s.stepsReference=n),s},"components-reference"(t){let e=t.children.find(s=>s.type==="component-type"),r=t.children.find(s=>s.type==="component-name");return{type:"ComponentsExpression",componentType:e.text,componentName:r.text}}},he=P;var K=class extends H{getTree(){let e=super.getTree();return L(e,he)}},Z=K;var Q=class extends Array{toString(){return this.map(e=>JSON.stringify(String(e))).join(", ")}},fe=Q;var te=new Map;for(let[,t]of String(new B).matchAll(/"([^"\n]*)"/g)){let e=t.toLowerCase();te.has(e)||te.set(e,t)}var ee=t=>t.toString(16).toUpperCase().padStart(2,"0"),me=t=>{switch(t.type){case g.TLS:{let e=String.fromCodePoint(...t.string);return te.get(e)??e}case g.TBS:return String.fromCodePoint(...t.string);case g.TRG:return t.min===t.max?`%x${ee(t.min)}`:`%x${ee(t.min)}-${ee(t.max)}`;default:return}},v=(t,e,r,s=new Set)=>{let n=e[r];switch(n.type){case g.ALT:{let p=[],l=!1;for(let y of n.children){let m=v(t,e,y,s);p.push(...m.terminals),l=l||m.nullable}return{terminals:p,nullable:l}}case g.CAT:{let p=[];for(let l of n.children){let y=v(t,e,l,s);if(p.push(...y.terminals),!y.nullable)return{terminals:p,nullable:!1}}return{terminals:p,nullable:!0}}case g.REP:{let p=v(t,e,r+1,s);return{terminals:p.terminals,nullable:n.min===0||p.nullable}}case g.RNM:{if(s.has(n.index))return{terminals:[],nullable:!1};s.add(n.index);let p=v(t,t[n.index].opcodes,0,s);return s.delete(n.index),p}case g.TLS:case g.TBS:return{terminals:n.string.length>0?[n]:[],nullable:n.string.length===0};case g.TRG:return{terminals:[n],nullable:!1};default:return{terminals:[],nullable:!0}}},ye=Symbol("trace state"),se=class extends de{constructor(){super();let e=this.init,r=this.down,s=this.up,n=[],p=0,l=new Map,y=0,m=[],u={maxMatched:0,failures:[]};this[ye]=u;let A=(f,E)=>{E===u.maxMatched&&u.failures.push({op:f,offset:E})};this.init=(f,E,c)=>{n=f,p=c.length,l=new Map;for(let d of f)d.opcodes.forEach((o,i)=>{o.type===g.REP&&l.set(o,{opcodes:d.opcodes,index:i})});y=0,m=[],u.maxMatched=0,u.failures=[],e(f,E,c)},this.down=(f,E)=>{if((f.type===g.AND||f.type===g.NOT)&&(y+=1),f.type===g.REP){let{opcodes:c,index:d}=l.get(f);m.push({child:c[d+1],opcodes:c,index:d,position:E,count:0})}r(f,E)},this.up=(f,E,c,d)=>{(f.type===g.AND||f.type===g.NOT)&&(y-=1),y===0&&(E===g.MATCH&&c+d>u.maxMatched&&(u.maxMatched=c+d,u.failures=[]),E===g.NOMATCH&&me(f)!==void 0&&A(f,c));let o=m[m.length-1];if(o&&f===o.child&&E===g.MATCH&&(o.position=c+d,o.count+=1),f.type===g.REP&&(m.pop(),y===0&&o.position===p&&o.count<f.max)){let{opcodes:i,index:h}=o;for(let b of v(n,i,h+1).terminals)A(b,p)}s(f,E,c,d)}}inferExpectations(){let{maxMatched:e,failures:r}=this[ye],s=new Set;for(let{op:n,offset:p}of r)p===e&&s.add(me(n));return new fe(...s)}},re=se;var ne=class extends Error{constructor(e,r=void 0){if(super(e,r),this.name=this.constructor.name,typeof e=="string"&&(this.message=e),typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,r!=null&&typeof r=="object"&&Object.hasOwn(r,"cause")&&!("cause"in this)){let{cause:s}=r;this.cause=s,s instanceof Error&&"stack"in s&&(this.stack=`${this.stack}
|
|
136
|
+
CAUSE: ${s.stack}`)}if(r!=null&&typeof r=="object"){let{cause:s,...n}=r;Object.assign(this,n)}}},oe=ne;var ie=class extends oe{},q=ie;var Ne=new B,Ce=(t,{stats:e=!1,trace:r=!1,translator:s=new Z}={})=>{if(typeof t!="string")throw new TypeError("Runtime expression must be a string");try{let n=new U;s&&(n.ast=s),e&&(n.stats=new ue),r&&(n.trace=new re);let p=n.parse(Ne,"expression",t);return{result:p,tree:p.success&&s?n.ast.getTree():void 0,stats:n.stats,trace:n.trace}}catch(n){throw new q("Unexpected error during Arazzo Runtime Expression parsing",{cause:n,runtimeExpression:t})}},ce=Ce;var Se=t=>{if(typeof t!="string")return!1;try{let{result:e}=ce(t);return e.success}catch{return!1}},le=Se;var Me=t=>{let e=[],r=0,s=n=>{n>r&&e.push({type:"literal",text:t.slice(r,n),start:r,length:n-r})};for(;r<t.length;){let n=t.indexOf("{$",r);if(n===-1){s(t.length);break}s(n);let p=n+2;for(;p<t.length&&t[p]!=="{"&&t[p]!=="}";)p+=1;if(t[p]==="}"){let l=t.slice(n,p+1),y=l.slice(1,-1),m=p+1-n;le(y)?e.push({type:"expression",text:l,expression:y,start:n,length:m}):e.push({type:"invalid",text:l,expression:y,terminated:!0,start:n,length:m}),r=p+1}else{let l=t.slice(n,p);e.push({type:"invalid",text:l,expression:l.slice(1),terminated:!1,start:n,length:p-n}),r=p}}return e},W=({text:t,expression:e,start:r,length:s,terminated:n})=>{let p;return{text:t,start:r,length:s,get error(){if(p===void 0){let l=n?`Invalid runtime expression "${t}" at position ${r}`:`Unterminated runtime expression "${t}" at position ${r}`;p=new q(l,{runtimeExpression:e,start:r,length:s})}return p}}},V=Me;var $e=new B,Le=(t,{strict:e=!0,onError:r}={})=>{if(typeof t!="string")return[];if(e===!1){let m=[];for(let u of V(t))u.type==="expression"?m.push(u.expression):u.type==="invalid"&&typeof r=="function"&&r(W(u));return m}let s=new U;if(s.ast=new H,!s.parse($e,"expression-string",t).success)return[];let p=s.ast.getTree(),l=[],y=m=>{if(m.type==="embedded-expression"){let u=m.children.find(A=>A.type==="expression");u&&l.push(u.text)}for(let u of m.children||[])y(u)};return y(p),l},Pe=Le;var Re=new B,Oe=t=>t==null?"":typeof t=="string"?t:typeof t=="object"?JSON.stringify(t)??"":String(t),Be=({text:t})=>t,He=(t,e,{strict:r=!0,stringify:s=Oe,onError:n=Be}={})=>{if(typeof t!="string")throw new TypeError("Template must be a string");if(typeof e!="function")throw new TypeError("Resolver must be a function");if(typeof n!="function")throw new TypeError("onError must be a function");if(r===!1){let u="";for(let A of V(t))if(A.type==="expression")u+=s(e(A.expression));else if(A.type==="invalid"){let f=n(W(A));if(typeof f!="string")throw new TypeError("onError must return a string");u+=f}else u+=A.text;return u}let p=new U;if(p.ast=new H,!p.parse(Re,"expression-string",t).success)return t;let y=p.ast.getTree(),m="";for(let u of y.children||[]){let A=u.type==="embedded-expression"?u.children.find(f=>f.type==="expression"):void 0;A?m+=s(e(A.text)):m+=u.text}return m},De=He;var ae=class extends H{getTree(){return this.toXml()}},Ue=ae;export{Z as ASTTranslator,oe as ArazzoRuntimeExpressionError,q as ArazzoRuntimeExpressionParseError,H as CSTTranslator,B as Grammar,re as Trace,Ue as XMLTranslator,Pe as extract,De as interpolate,ce as parse,le as test};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @swaggerexpert/json-pointer v3.0.2 (Apache-2.0)
|
|
3
|
+
* https://github.com/swaggerexpert/json-pointer#readme
|
|
4
|
+
* Vendored for the browser by tools/vendor-journeys-libs.mjs; bundled and minified, unmodified otherwise.
|
|
5
|
+
*/
|
|
6
|
+
var jt=Object.defineProperty;var At=(e,t)=>{for(var n in t)jt(e,n,{get:t[n],enumerable:!0})};var St={};At(St,{from:()=>It,to:()=>Bt});var Bt=e=>JSON.stringify(e),It=e=>{try{return String(JSON.parse(e))}catch{return e}};var Ot={};At(Ot,{from:()=>Nt,fromURIReference:()=>zt,to:()=>_t});var _t=e=>`#${[...e].map(n=>/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/.test(n)?n:encodeURIComponent(n)).join("")}`,Nt=e=>{try{let t=e.startsWith("#")?e.slice(1):e;return decodeURIComponent(t)}catch{return e}},zt=e=>{let t=e.indexOf("#"),n=t===-1?"#":e.substring(t);return Nt(n)};function R(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"json-pointer",lower:"json-pointer",index:0,isBkr:!1},this.rules[1]={name:"reference-token",lower:"reference-token",index:1,isBkr:!1},this.rules[2]={name:"unescaped",lower:"unescaped",index:2,isBkr:!1},this.rules[3]={name:"escaped",lower:"escaped",index:3,isBkr:!1},this.rules[4]={name:"array-location",lower:"array-location",index:4,isBkr:!1},this.rules[5]={name:"array-index",lower:"array-index",index:5,isBkr:!1},this.rules[6]={name:"array-dash",lower:"array-dash",index:6,isBkr:!1},this.rules[7]={name:"slash",lower:"slash",index:7,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:2,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:7},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3]},this.rules[2].opcodes[1]={type:5,min:0,max:46},this.rules[2].opcodes[2]={type:5,min:48,max:125},this.rules[2].opcodes[3]={type:5,min:127,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[126]},this.rules[3].opcodes[2]={type:1,children:[3,4]},this.rules[3].opcodes[3]={type:7,string:[48]},this.rules[3].opcodes[4]={type:7,string:[49]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2]},this.rules[5].opcodes[1]={type:6,string:[48]},this.rules[5].opcodes[2]={type:2,children:[3,4]},this.rules[5].opcodes[3]={type:5,min:49,max:57},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:7,string:[45]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:7,string:[47]},this.toString=function(){let t="";return t+=`; JavaScript Object Notation (JSON) Pointer ABNF syntax
|
|
7
|
+
`,t+=`; https://datatracker.ietf.org/doc/html/rfc6901
|
|
8
|
+
`,t+=`json-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used
|
|
9
|
+
`,t+=`reference-token = *( unescaped / escaped )
|
|
10
|
+
`,t+=`unescaped = %x00-2E / %x30-7D / %x7F-10FFFF
|
|
11
|
+
`,t+=` ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
|
|
12
|
+
`,t+=`escaped = "~" ( "0" / "1" )
|
|
13
|
+
`,t+=` ; representing '~' and '/', respectively
|
|
14
|
+
`,t+=`
|
|
15
|
+
`,t+=`; https://datatracker.ietf.org/doc/html/rfc6901#section-4
|
|
16
|
+
`,t+=`array-location = array-index / array-dash
|
|
17
|
+
`,t+=`array-index = %x30 / ( %x31-39 *(%x30-39) )
|
|
18
|
+
`,t+=` ; "0", or digits without a leading "0"
|
|
19
|
+
`,t+=`array-dash = "-"
|
|
20
|
+
`,t+=`
|
|
21
|
+
`,t+=`; Surrogate named rules
|
|
22
|
+
`,t+=`slash = "/"
|
|
23
|
+
`,t}}var v=function(){let t=O,n=V,l=this,c="parser.js: Parser(): ",d=function(){this.state=t.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=t.ACTIVE,this.phraseLength=0}};l.ast=void 0,l.stats=void 0,l.trace=void 0,l.callbacks=[];let i=0,g=0,S=0,p=0,b=0,f,y,r,u,a=new d,s,h,E,$=()=>{i=0,g=0,S=0,p=0,b=0,f=void 0,y=void 0,r=void 0,u=void 0,a.refresh(),s=void 0,h=void 0,E=void 0},A=()=>{let m=`${c}initializeCallbacks(): `,o;for(s=[],h=[],o=0;o<f.length;o+=1)s[o]=void 0;for(o=0;o<y.length;o+=1)h[o]=void 0;let T,w=[];for(o=0;o<f.length;o+=1)w.push(f[o].lower);for(o=0;o<y.length;o+=1)w.push(y[o].lower);for(let x in l.callbacks)if(l.callbacks.hasOwnProperty(x)){if(o=w.indexOf(x.toLowerCase()),o<0)throw new Error(`${m}syntax callback '${x}' not a rule or udt name`);if(T=l.callbacks[x]?l.callbacks[x]:void 0,typeof T=="function"||T===void 0)o<f.length?s[o]=T:h[o-f.length]=T;else throw new Error(`${m}syntax callback[${x}] must be function reference or falsy)`)}};l.parse=(m,o,T,w)=>{let x=`${c}parse(): `;$(),u=n.stringToChars(T),f=m.rules,y=m.udts;let N=o.toLowerCase(),M;for(let B in f)if(f.hasOwnProperty(B)&&N===f[B].lower){M=f[B].index;break}if(M===void 0)throw new Error(`${x}start rule name '${startRule}' not recognized`);A(),l.trace&&l.trace.init(f,y,u),l.stats&&l.stats.init(f,y),l.ast&&l.ast.init(f,y,u),E=w,r=[{type:t.RNM,index:M}],H(0,0),r=void 0;let C=!1;switch(a.state){case t.ACTIVE:throw new Error(`${x}final state should never be 'ACTIVE'`);case t.NOMATCH:C=!1;break;case t.EMPTY:case t.MATCH:a.phraseLength===u.length?C=!0:C=!1;break;default:throw new Error("unrecognized state")}return{success:C,state:a.state,stateName:t.idName(a.state),length:u.length,matched:a.phraseLength,maxMatched:b,maxTreeDepth:S,nodeHits:p}};let k=(m,o)=>{let T=r[m];for(let w=0;w<T.children.length&&(H(T.children[w],o),a.state===t.NOMATCH);w+=1);},U=(m,o)=>{let T,w,x,N,M=r[m];l.ast&&(w=l.ast.getLength()),T=!0,x=o,N=0;for(let C=0;C<M.children.length;C+=1)if(H(M.children[C],x),a.state===t.NOMATCH){T=!1;break}else x+=a.phraseLength,N+=a.phraseLength;T?(a.state=N===0?t.EMPTY:t.MATCH,a.phraseLength=N):(a.state=t.NOMATCH,a.phraseLength=0,l.ast&&l.ast.setLength(w))},Y=(m,o)=>{let T,w,x,N,M=r[m];if(M.max===0){a.state=t.EMPTY,a.phraseLength=0;return}for(w=o,x=0,N=0,l.ast&&(T=l.ast.getLength());!(w>=u.length||(H(m+1,w),a.state===t.NOMATCH)||a.state===t.EMPTY||(N+=1,x+=a.phraseLength,w+=a.phraseLength,N===M.max)););a.state===t.EMPTY||N>=M.min?(a.state=x===0?t.EMPTY:t.MATCH,a.phraseLength=x):(a.state=t.NOMATCH,a.phraseLength=0,l.ast&&l.ast.setLength(T))},j=(m,o,T,w)=>{if(o.phraseLength>T){let x=`${c}opRNM(${m.name}): callback function error: `;throw x+=`sysData.phraseLength: ${o.phraseLength}`,x+=` must be <= remaining chars: ${T}`,new Error(x)}switch(o.state){case t.ACTIVE:if(!w)throw new Error(`${c}opRNM(${m.name}): callback function return error. ACTIVE state not allowed.`);break;case t.EMPTY:o.phraseLength=0;break;case t.MATCH:o.phraseLength===0&&(o.state=t.EMPTY);break;case t.NOMATCH:o.phraseLength=0;break;default:throw new Error(`${c}opRNM(${m.name}): callback function return error. Unrecognized return state: ${o.state}`)}},_=(m,o)=>{let T,w,x,N=r[m],M=f[N.index],C=s[M.index];if(i||(w=l.ast&&l.ast.ruleDefined(N.index),w&&(T=l.ast.getLength(),l.ast.down(N.index,f[N.index].name))),C){let B=u.length-o;C(a,u,o,E),j(M,a,B,!0),a.state===t.ACTIVE&&(x=r,r=M.opcodes,H(0,o),r=x,C(a,u,o,E),j(M,a,B,!1))}else x=r,r=M.opcodes,H(0,o,a),r=x;i||w&&(a.state===t.NOMATCH?l.ast.setLength(T):l.ast.up(N.index,M.name,o,a.phraseLength))},z=(m,o)=>{let T=r[m];a.state=t.NOMATCH,o<u.length&&T.min<=u[o]&&u[o]<=T.max&&(a.state=t.MATCH,a.phraseLength=1)},F=(m,o)=>{let T=r[m],w=T.string.length;if(a.state=t.NOMATCH,o+w<=u.length){for(let x=0;x<w;x+=1)if(u[o+x]!==T.string[x])return;a.state=t.MATCH,a.phraseLength=w}},Ht=(m,o)=>{let T,w=r[m];a.state=t.NOMATCH;let x=w.string.length;if(x===0){a.state=t.EMPTY;return}if(o+x<=u.length){for(let N=0;N<x;N+=1)if(T=u[o+N],T>=65&&T<=90&&(T+=32),T!==w.string[N])return;a.state=t.MATCH,a.phraseLength=x}},Dt=(m,o,T)=>{if(o.phraseLength>T){let w=`${c}opUDT(${m.name}): callback function error: `;throw w+=`sysData.phraseLength: ${o.phraseLength}`,w+=` must be <= remaining chars: ${T}`,new Error(w)}switch(o.state){case t.ACTIVE:throw new Error(`${c}opUDT(${m.name}) ACTIVE state return not allowed.`);case t.EMPTY:if(m.empty)o.phraseLength=0;else throw new Error(`${c}opUDT(${m.name}) may not return EMPTY.`);break;case t.MATCH:if(o.phraseLength===0)if(m.empty)o.state=t.EMPTY;else throw new Error(`${c}opUDT(${m.name}) may not return EMPTY.`);break;case t.NOMATCH:o.phraseLength=0;break;default:throw new Error(`${c}opUDT(${m.name}): callback function return error. Unrecognized return state: ${o.state}`)}},Ut=(m,o)=>{let T,w,x,N=r[m],M=y[N.index];a.UdtIndex=M.index,i||(x=l.ast&&l.ast.udtDefined(N.index),x&&(w=f.length+N.index,T=l.ast.getLength(),l.ast.down(w,M.name)));let C=u.length-o;h[N.index](a,u,o,E),Dt(M,a,C),i||x&&(a.state===t.NOMATCH?l.ast.setLength(T):l.ast.up(w,M.name,o,a.phraseLength))},Jt=(m,o)=>{switch(i+=1,H(m+1,o),i-=1,a.phraseLength=0,a.state){case t.EMPTY:a.state=t.EMPTY;break;case t.MATCH:a.state=t.EMPTY;break;case t.NOMATCH:a.state=t.NOMATCH;break;default:throw new Error(`opAND: invalid state ${a.state}`)}},Yt=(m,o)=>{switch(i+=1,H(m+1,o),i-=1,a.phraseLength=0,a.state){case t.EMPTY:case t.MATCH:a.state=t.NOMATCH;break;case t.NOMATCH:a.state=t.EMPTY;break;default:throw new Error(`opNOT: invalid state ${a.state}`)}},H=(m,o)=>{let T=`${c}opExecute(): `,w=r[m];switch(p+=1,g>S&&(S=g),g+=1,a.refresh(),l.trace&&l.trace.down(w,o),w.type){case t.ALT:k(m,o);break;case t.CAT:U(m,o);break;case t.REP:Y(m,o);break;case t.RNM:_(m,o);break;case t.TRG:z(m,o);break;case t.TBS:F(m,o);break;case t.TLS:Ht(m,o);break;case t.UDT:Ut(m,o);break;case t.AND:Jt(m,o);break;case t.NOT:Yt(m,o);break;default:throw new Error(`${T}unrecognized operator`)}i||o+a.phraseLength>b&&(b=o+a.phraseLength),l.stats&&l.stats.collect(w,a),l.trace&&l.trace.up(w,a.state,o,a.phraseLength),g-=1}},Mt=function(){let t="parser.js: Ast()): ",n=O,l=V,c=this,d,i,g,S=0,p=[],b=[],f=[];c.callbacks=[],c.init=(r,u,a)=>{b.length=0,f.length=0,S=0,d=r,i=u,g=a;let s,h=[];for(s=0;s<d.length;s+=1)h.push(d[s].lower);for(s=0;s<i.length;s+=1)h.push(i[s].lower);for(S=d.length+i.length,s=0;s<S;s+=1)p[s]=void 0;for(let E in c.callbacks)if(c.callbacks.hasOwnProperty(E)){let $=E.toLowerCase();if(s=h.indexOf($),s<0)throw new Error(`${t}init: node '${E}' not a rule or udt name`);p[s]=c.callbacks[E]}},c.ruleDefined=r=>!!p[r],c.udtDefined=r=>!!p[d.length+r],c.down=(r,u)=>{let a=f.length;return b.push(a),f.push({name:u,thisIndex:a,thatIndex:void 0,state:n.SEM_PRE,callbackIndex:r,phraseIndex:void 0,phraseLength:void 0,stack:b.length}),a},c.up=(r,u,a,s)=>{let h=f.length,E=b.pop();return f.push({name:u,thisIndex:h,thatIndex:E,state:n.SEM_POST,callbackIndex:r,phraseIndex:a,phraseLength:s,stack:b.length}),f[E].thatIndex=h,f[E].phraseIndex=a,f[E].phraseLength=s,h},c.translate=r=>{let u,a,s;for(let h=0;h<f.length;h+=1)s=f[h],a=p[s.callbackIndex],a&&(s.state===n.SEM_PRE?a(n.SEM_PRE,g,s.phraseIndex,s.phraseLength,r):a&&a(n.SEM_POST,g,s.phraseIndex,s.phraseLength,r))},c.setLength=r=>{f.length=r,r>0?b.length=f[r-1].stack:b.length=0},c.getLength=()=>f.length;function y(r){let u="";for(;r-- >0;)u+=" ";return u}c.toXml=()=>{let r="",u=0;return r+=`<?xml version="1.0" encoding="utf-8"?>
|
|
24
|
+
`,r+=`<root nodes="${f.length/2}" characters="${g.length}">
|
|
25
|
+
`,r+=`<!--
|
|
26
|
+
`,r+=` Caveat: AST node phrases may not be faithfully represented.
|
|
27
|
+
`,r+=` Invalid XML characters are replaced with 0xFFFD.
|
|
28
|
+
`,r+=` Special characters &<>"' are escaped with XML entities.
|
|
29
|
+
`,r+=`-->
|
|
30
|
+
`,r+=`<!-- input string -->
|
|
31
|
+
`,r+=y(u+2),r+=l.charsToXmlString(g),r+=`
|
|
32
|
+
`,f.forEach(a=>{a.state===n.SEM_PRE?(u+=1,r+=y(u),r+=`<node name="${a.name}" index="${a.phraseIndex}" length="${a.phraseLength}">
|
|
33
|
+
`,r+=y(u+2),r+=l.charsToXmlString(g,a.phraseIndex,a.phraseLength),r+=`
|
|
34
|
+
`):(r+=y(u),r+=`</node><!-- name="${a.name}" -->
|
|
35
|
+
`,u-=1)}),r+=`</root>
|
|
36
|
+
`,r}},$t=function(){let t=O,n=V,l="parser.js: Trace(): ",c,d,i,g="",S=0,p=100,b=this,f=r=>{let u="",a=0;if(r>=0)for(;r--;)a+=1,a===5?(u+="|",a=0):u+=".";return u};b.init=(r,u,a)=>{d=r,i=u,c=a};let y=r=>{let u;switch(r.type){case t.ALT:u="ALT";break;case t.CAT:u="CAT";break;case t.REP:r.max===1/0?u=`REP(${r.min},inf)`:u=`REP(${r.min},${r.max})`;break;case t.RNM:u=`RNM(${d[r.index].name})`;break;case t.TRG:u=`TRG(${r.min},${r.max})`;break;case t.TBS:r.string.length>6?u=`TBS(${n.charsToString(r.string,0,3)}...)`:u=`TBS(${n.charsToString(r.string,0,6)})`;break;case t.TLS:r.string.length>6?u=`TLS(${n.charsToString(r.string,0,3)}...)`:u=`TLS(${n.charsToString(r.string,0,6)})`;break;case t.UDT:u=`UDT(${i[r.index].name})`;break;case t.AND:u="AND";break;case t.NOT:u="NOT";break;default:throw new Error(`${l}Trace: opName: unrecognized opcode`)}return u};b.down=(r,u)=>{let a=f(S),s=Math.min(p,c.length-u),h=n.charsToString(c,u,s);s<c.length-u&&(h+="..."),h=`${a}|-|[${y(r)}]${h}
|
|
37
|
+
`,g+=h,S+=1},b.up=(r,u,a,s)=>{let h=`${l}trace.up: `;S-=1;let E=f(S),$,A,k;switch(u){case t.EMPTY:k="|E|",A="''";break;case t.MATCH:k="|M|",$=Math.min(p,s),$<s?A=`'${n.charsToString(c,a,$)}...'`:A=`'${n.charsToString(c,a,$)}'`;break;case t.NOMATCH:k="|N|",A="";break;default:throw new Error(`${h} unrecognized state`)}A=`${E}${k}[${y(r)}]${A}
|
|
38
|
+
`,g+=A},b.displayTrace=()=>g},Ct=function(){let t=O,n="parser.js: Stats(): ",l,c,d,i=[],g=[],S=[];this.init=(s,h)=>{l=s,c=h,u()},this.collect=(s,h)=>{a(d,h.state,h.phraseLength),a(i[s.type],h.state,h.phraseLength),s.type===t.RNM&&a(g[s.index],h.state,h.phraseLength),s.type===t.UDT&&a(S[s.index],h.state,h.phraseLength)},this.displayStats=()=>{let s="",h={match:0,empty:0,nomatch:0,total:0},E=($,A,k,U,Y)=>{h.match+=A,h.empty+=k,h.nomatch+=U,h.total+=Y;let j=p(A),_=p(k),z=p(U),F=p(Y);return`${$} | ${j} | ${_} | ${z} | ${F} |
|
|
39
|
+
`};return s+=` OPERATOR STATS
|
|
40
|
+
`,s+=` | MATCH | EMPTY | NOMATCH | TOTAL |
|
|
41
|
+
`,s+=E(" ALT",i[t.ALT].match,i[t.ALT].empty,i[t.ALT].nomatch,i[t.ALT].total),s+=E(" CAT",i[t.CAT].match,i[t.CAT].empty,i[t.CAT].nomatch,i[t.CAT].total),s+=E(" REP",i[t.REP].match,i[t.REP].empty,i[t.REP].nomatch,i[t.REP].total),s+=E(" RNM",i[t.RNM].match,i[t.RNM].empty,i[t.RNM].nomatch,i[t.RNM].total),s+=E(" TRG",i[t.TRG].match,i[t.TRG].empty,i[t.TRG].nomatch,i[t.TRG].total),s+=E(" TBS",i[t.TBS].match,i[t.TBS].empty,i[t.TBS].nomatch,i[t.TBS].total),s+=E(" TLS",i[t.TLS].match,i[t.TLS].empty,i[t.TLS].nomatch,i[t.TLS].total),s+=E(" UDT",i[t.UDT].match,i[t.UDT].empty,i[t.UDT].nomatch,i[t.UDT].total),s+=E(" AND",i[t.AND].match,i[t.AND].empty,i[t.AND].nomatch,i[t.AND].total),s+=E(" NOT",i[t.NOT].match,i[t.NOT].empty,i[t.NOT].nomatch,i[t.NOT].total),s+=E("TOTAL",h.match,h.empty,h.nomatch,h.total),s},this.displayHits=s=>{let h="",E=($,A,k,U,Y)=>{d.match+=$,d.empty+=A,d.nomatch+=k,d.total+=U;let j=p($),_=p(A),z=p(k),F=p(U);return`| ${j} | ${_} | ${z} | ${F} | ${Y}
|
|
42
|
+
`};typeof s=="string"&&s.toLowerCase()[0]==="a"?(g.sort(b),S.sort(b),h+=` RULES/UDTS ALPHABETICALLY
|
|
43
|
+
`):typeof s=="string"&&s.toLowerCase()[0]==="i"?(g.sort(y),S.sort(y),h+=` RULES/UDTS BY INDEX
|
|
44
|
+
`):(g.sort(f),S.sort(f),h+=` RULES/UDTS BY HIT COUNT
|
|
45
|
+
`),h+=`| MATCH | EMPTY | NOMATCH | TOTAL | NAME
|
|
46
|
+
`;for(let $=0;$<g.length;$+=1){let A=g[$];A.total&&(h+=E(A.match,A.empty,A.nomatch,A.total,A.name))}for(let $=0;$<S.length;$+=1){let A=S[$];A.total&&(h+=E(A.match,A.empty,A.nomatch,A.total,A.name))}return h};let p=s=>s<10?` ${s}`:s<100?` ${s}`:s<1e3?` ${s}`:s<1e4?` ${s}`:s<1e5?` ${s}`:s<1e6?` ${s}`:`${s}`,b=(s,h)=>s.lower<h.lower?-1:s.lower>h.lower?1:0,f=(s,h)=>s.total<h.total?1:s.total>h.total?-1:b(s,h),y=(s,h)=>s.index<h.index?-1:s.index>h.index?1:0,r=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},u=()=>{i.length=0,d=new r,i[t.ALT]=new r,i[t.CAT]=new r,i[t.REP]=new r,i[t.RNM]=new r,i[t.TRG]=new r,i[t.TBS]=new r,i[t.TLS]=new r,i[t.UDT]=new r,i[t.AND]=new r,i[t.NOT]=new r,g.length=0;for(let s=0;s<l.length;s+=1)g.push({empty:0,match:0,nomatch:0,total:0,name:l[s].name,lower:l[s].lower,index:l[s].index});if(c.length>0){S.length=0;for(let s=0;s<c.length;s+=1)S.push({empty:0,match:0,nomatch:0,total:0,name:c[s].name,lower:c[s].lower,index:c[s].index})}},a=(s,h)=>{switch(s.total+=1,h){case t.EMPTY:s.empty+=1;break;case t.MATCH:s.match+=1;break;case t.NOMATCH:s.nomatch+=1;break;default:throw new Error(`${n}collect(): incStat(): unrecognized state: ${h}`)}}},V={stringToChars:e=>[...e].map(t=>t.codePointAt(0)),charsToString:(e,t,n)=>{let l=e;for(;!(t===void 0||t<0);){if(n===void 0){l=e.slice(t);break}if(n<=0)return"";l=e.slice(t,t+n);break}return String.fromCodePoint(...l)},charsToXmlString:(e,t,n)=>{function l(p){return!Number.isFinite(p)||p<0||p>1114111||p>=0&&p<=8||p>=11&&p<=12||p>=14&&p<=31||p>=55296&&p<=57343||p>=65534&&p<=65535}let c=0,d=e.length;if(typeof t=="number"){if(t>=e.length)return"";c=t<0?0:t}if(typeof n=="number"){if(n<=0)return"";d=n>e.length-c?e.length:c+n}let i=e.slice(c,d).map(p=>l(p)?65533:p),g=32768,S="";for(let p=0;p<i.length;p+=g)S+=String.fromCodePoint.apply(null,i.slice(p,p+g));return S.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}},O={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case O.ALT:return"ALT";case O.CAT:return"CAT";case O.REP:return"REP";case O.RNM:return"RNM";case O.TRG:return"TRG";case O.TBS:return"TBS";case O.TLS:return"TLS";case O.UDT:return"UDT";case O.AND:return"AND";case O.NOT:return"NOT";case O.ACTIVE:return"ACTIVE";case O.EMPTY:return"EMPTY";case O.MATCH:return"MATCH";case O.NOMATCH:return"NOMATCH";case O.SEM_PRE:return"SEM_PRE";case O.SEM_POST:return"SEM_POST";case O.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};var Q=class extends Error{constructor(t,n=void 0){if(super(t,n),this.name=this.constructor.name,typeof t=="string"&&(this.message=t),typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack,n!=null&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"cause")&&!("cause"in this)){let{cause:l}=n;this.cause=l,l instanceof Error&&"stack"in l&&(this.stack=`${this.stack}
|
|
47
|
+
CAUSE: ${l.stack}`)}if(n!=null&&typeof n=="object"){let{cause:l,...c}=n;Object.assign(this,c)}}},L=Q;var tt=class extends L{},J=tt;var Ft=e=>(t,n,l,c,d)=>{if(!(typeof d=="object"&&d!==null&&!Array.isArray(d)))throw new J("parser's user data must be an object");if(t===O.SEM_PRE){let i={type:e,text:V.charsToString(n,l,c),start:l,length:c,children:[]};d.stack.length>0?d.stack[d.stack.length-1].children.push(i):d.root=i,d.stack.push(i)}t===O.SEM_POST&&d.stack.pop()},q=Ft;var et=class extends Mt{constructor(){super(),this.callbacks["json-pointer"]=q("json-pointer"),this.callbacks["reference-token"]=q("reference-token"),this.callbacks.slash=q("text")}getTree(){let t={stack:[],root:null};return this.translate(t),delete t.stack,t}},G=et;var Vt=e=>{if(typeof e!="string")throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")},rt=Vt;var st=class extends G{getTree(){let{root:t}=super.getTree();return t.children.filter(({type:n})=>n==="reference-token").map(({text:n})=>rt(n))}},at=st;var nt=class extends Array{toString(){return this.map(t=>`"${String(t)}"`).join(", ")}},Lt=nt;var it=class extends $t{inferExpectations(){let t=this.displayTrace().split(`
|
|
48
|
+
`),n=new Set,l=!1,c=-1;for(let d=0;d<t.length;d++){let i=t[d];if(!l&&i.includes("M|")){let g=i.match(/]'(.*)'$/);g&&g[1]&&(c=d)}if(d>c){let g=i.match(/N\|\[TLS\(([^)]+)\)]/);g&&n.add(g[1])}}return new Lt(...n)}},kt=it;var Gt=new R,Xt=(e,{translator:t=new at,stats:n=!1,trace:l=!1}={})=>{if(typeof e!="string")throw new TypeError("JSON Pointer must be a string");try{let c=new v;t&&(c.ast=t),n&&(c.stats=new Ct),l&&(c.trace=new kt);let d=c.parse(Gt,"json-pointer",e);return{result:d,tree:d.success&&t?c.ast.getTree():void 0,stats:c.stats,trace:c.trace}}catch(c){throw new J("Unexpected error during JSON Pointer parsing",{cause:c,jsonPointer:e})}},X=Xt;var ot=class extends G{getTree(){return this.toXml()}},Kt=ot;var Wt=e=>{try{return X(e,{translator:null}).result.success}catch{return!1}},Zt=Wt;var qt=new R,Qt=new v,te=e=>{if(typeof e!="string")return!1;try{return Qt.parse(qt,"reference-token",e).success}catch{return!1}},ee=te;var re=new R,se=new v,ae=e=>{if(typeof e!="string")return!1;try{return se.parse(re,"array-location",e).success}catch{return!1}},ne=ae;var ie=new R,oe=new v,le=e=>{if(typeof e!="string")return!1;try{return oe.parse(ie,"array-index",e).success}catch{return!1}},lt=le;var ce=new R,ue=new v,he=e=>{if(typeof e!="string")return!1;try{return ue.parse(ce,"array-dash",e).success}catch{return!1}},ct=he;var fe=e=>{if(typeof e!="string"&&typeof e!="number")throw new TypeError("Reference token must be a string or number");return String(e).replace(/~/g,"~0").replace(/\//g,"~1")},ut=fe;var ht=class extends L{},ft=ht;var pe=e=>{if(!Array.isArray(e))throw new TypeError("Reference tokens must be a list of strings or numbers");try{return e.length===0?"":`/${e.map(t=>{if(typeof t!="string"&&typeof t!="number")throw new TypeError("Reference token must be a string or number");return ut(String(t))}).join("/")}`}catch(t){throw new ft("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}},me=pe;var pt=class{#t;#e;#r;constructor(t,n={}){this.#t=t,this.#t.steps=[],this.#t.failed=!1,this.#t.failedAt=-1,this.#t.message=`JSON Pointer "${n.jsonPointer}" was successfully evaluated against the provided value`,this.#t.context={...n,realm:n.realm.name},this.#e=[],this.#r=n.realm}step({referenceToken:t,input:n,output:l,success:c=!0,reason:d}){let i=this.#e.length;this.#e.push(t);let g={referenceToken:t,referenceTokenPosition:i,input:n,inputType:this.#r.isObject(n)?"object":this.#r.isArray(n)?"array":"unrecognized",output:l,success:c};d&&(g.reason=d),this.#t.steps.push(g),c||(this.#t.failed=!0,this.#t.failedAt=i,this.#t.message=d)}},Rt=pt;var mt=class{name="";isArray(t){throw new L("Realm.isArray(node) must be implemented in a subclass")}isObject(t){throw new L("Realm.isObject(node) must be implemented in a subclass")}sizeOf(t){throw new L("Realm.sizeOf(node) must be implemented in a subclass")}has(t,n){throw new L("Realm.has(node) must be implemented in a subclass")}evaluate(t,n){throw new L("Realm.evaluate(node) must be implemented in a subclass")}},K=mt;var dt=class extends L{},P=dt;var gt=class extends P{},D=gt;var Tt=class extends K{name="json";isArray(t){return Array.isArray(t)}isObject(t){return typeof t=="object"&&t!==null&&!this.isArray(t)}sizeOf(t){return this.isArray(t)?t.length:this.isObject(t)?Object.keys(t).length:0}has(t,n){if(this.isArray(t)){let l=Number(n),c=l>>>0;if(l!==c)throw new D(`Invalid array index "${n}": index must be an unsinged 32-bit integer`,{referenceToken:n,currentValue:t,realm:this.name});return c<this.sizeOf(t)&&Object.prototype.hasOwnProperty.call(t,l)}return this.isObject(t)?Object.prototype.hasOwnProperty.call(t,n):!1}evaluate(t,n){return this.isArray(t)?t[Number(n)]:t[n]}},Pt=Tt;var wt=class extends P{},xt=wt;var yt=class extends P{},bt=yt;var de=(e,t,{strictArrays:n=!0,strictObjects:l=!0,realm:c=new Pt,trace:d=!0}={})=>{let{result:i,tree:g,trace:S}=X(t,{trace:!!d});if(!i.success){let b=`Invalid JSON Pointer: "${t}". Syntax error at position ${i.maxMatched}`;throw b+=S?`, expected ${S.inferExpectations()}`:"",new J(b,{jsonPointer:t})}let p=typeof d=="object"&&d!==null?new Rt(d,{jsonPointer:t,referenceTokens:g,strictArrays:n,strictObjects:l,realm:c,value:e}):null;try{let b;return g.reduce((f,y,r)=>{if(c.isArray(f)){if(ct(y)){if(n)throw new D(`Invalid array index "-" at position ${r} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name});return b=c.evaluate(f,String(c.sizeOf(f))),p?.step({referenceToken:y,input:f,output:b}),b}if(!lt(y))throw new D(`Invalid array index "${y}" at position ${r} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name});let u=Number(y);if(!Number.isSafeInteger(u))throw new D(`Invalid array index "${y}" at position ${r} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name});if(!c.has(f,y)&&n)throw new D(`Invalid array index "${y}" at position ${r} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name});return b=c.evaluate(f,y),p?.step({referenceToken:y,input:f,output:b}),b}if(c.isObject(f)){if(!c.has(f,y)&&l)throw new bt(`Invalid object key "${y}" at position ${r} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name});return b=c.evaluate(f,y),p?.step({referenceToken:y,input:f,output:b}),b}throw new xt(`Invalid reference token "${y}" at position ${r} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:g,referenceToken:y,referenceTokenPosition:r,currentValue:f,realm:c.name})},e)}catch(b){throw p?.step({referenceToken:b.referenceToken,input:b.currentValue,success:!1,reason:b.message}),b instanceof P?b:new P("Unexpected error during JSON Pointer evaluation",{cause:b,jsonPointer:t,referenceTokens:g})}},ge=de;function Te(e,t){we(e,t),t.add(e)}function we(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function vt(e,t,n){return(t=xe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xe(e){var t=ye(e,"string");return typeof t=="symbol"?t:t+""}function ye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var l=n.call(e,t||"default");if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var I=new WeakSet,Et=class extends K{constructor(t){super(),Te(this,I),vt(this,"name","composite"),vt(this,"realms",[]),this.realms=t}isArray(t){return W(I,this,Z).call(this,t).isArray(t)}isObject(t){return W(I,this,Z).call(this,t).isObject(t)}sizeOf(t){return W(I,this,Z).call(this,t).sizeOf(t)}has(t,n){return W(I,this,Z).call(this,t).has(t,n)}evaluate(t,n){return W(I,this,Z).call(this,t).evaluate(t,n)}};function Z(e){for(let t of this.realms)if(t.isArray(e)||t.isObject(e))return t;throw new P("No suitable evaluation realm found for value",{currentValue:e})}var be=(...e)=>new Et(e),Ee=be;export{at as ASTTranslator,G as CSTTranslator,K as EvaluationRealm,R as Grammar,ft as JSONPointerCompileError,L as JSONPointerError,P as JSONPointerEvaluateError,D as JSONPointerIndexError,bt as JSONPointerKeyError,J as JSONPointerParseError,xt as JSONPointerTypeError,St as JSONString,Ot as URIFragmentIdentifier,Kt as XMLTranslator,me as compile,Ee as composeRealms,ut as escape,ge as evaluate,X as parse,ct as testArrayDash,lt as testArrayIndex,ne as testArrayLocation,Zt as testJSONPointer,ee as testReferenceToken,rt as unescape};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jsonpath-rfc9535 v1.3.0 (Apache-2.0)
|
|
3
|
+
* https://github.com/P0lip/jsonpath-rfc9535
|
|
4
|
+
* Vendored for the browser by tools/vendor-journeys-libs.mjs; bundled and minified, unmodified otherwise.
|
|
5
|
+
*/
|
|
6
|
+
function In(n,i){function r(){this.constructor=n}r.prototype=i.prototype,n.prototype=new r}function B(n,i,r,o){var g=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(g,B.prototype),g.expected=i,g.found=r,g.location=o,g.name="SyntaxError",g}In(B,Error);function qe(n,i,r){return r=r||" ",n.length>i?n:(i-=n.length,r+=r.repeat(i),n+r.slice(0,i))}B.prototype.format=function(n){var i="Error: "+this.message;if(this.location){var r=null,o;for(o=0;o<n.length;o++)if(n[o].source===this.location.source){r=n[o].text.split(/\r\n|\n|\r/g);break}var g=this.location.start,h=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(g):g,x=this.location.source+":"+h.line+":"+h.column;if(r){var S=this.location.end,T=qe("",h.line.toString().length," "),$=r[g.line-1],d=g.line===S.line?S.column:$.length+1,C=d-g.column||1;i+=`
|
|
7
|
+
--> `+x+`
|
|
8
|
+
`+T+` |
|
|
9
|
+
`+h.line+" | "+$+`
|
|
10
|
+
`+T+" | "+qe("",g.column-1," ")+qe("",C,"^")}else i+=`
|
|
11
|
+
at `+x}return i};B.buildMessage=function(n,i){var r={literal:function($){return'"'+g($.text)+'"'},class:function($){var d=$.parts.map(function(C){return Array.isArray(C)?h(C[0])+"-"+h(C[1]):h(C)});return"["+($.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function o($){return $.charCodeAt(0).toString(16).toUpperCase()}function g($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+o(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+o(d)})}function h($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+o(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+o(d)})}function x($){return r[$.type]($)}function S($){var d=$.map(x),C,_;if(d.sort(),d.length>0){for(C=1,_=1;C<d.length;C++)d[C-1]!==d[C]&&(d[_]=d[C],_++);d.length=_}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function T($){return $?'"'+g($)+'"':"end of input"}return"Expected "+S(n)+" but "+T(i)+" found."};function Xr(n,i){i=i!==void 0?i:{};var r={},o=i.grammarSource,g={jsonpath_query:ke},h=ke,x="$",S=".",T="..",$="[",d=",",C="]",_="*",L=":",gt="?",ue='"',ce="'",ht="0",mt="-",pe="||",Xe="\\",Ye="u",ge="&&",Ne="d",er="(",rr=")",vt="!",tr="==",sr="!=",nr="<=",ar=">=",ir="-0",fr="true",or="false",lr="null",$t="@",dt="e",yt=/^[\t-\n\r ]/,xt=/^[A-Z_a-z\x80-\uD7FF\uE000-\uFFFF]/,ur=/^[\uD800-\uDBFF]/,cr=/^[\uDC00-\uDFFF]/,At=/^[A-Za-z]/,bt=/^[0-9]/,Ct=/^[1-9]/,Et=/^[ -!#-&(-[\]-\uD7FF\uE000-\uFFFF]/,wt=/^[\/\\bfnrt]/,St=/^[A-CE-F]/i,Ft=/^[0-7]/,Nt=/^[8-9]/,_t=/^[A-B]/i,Ot=/^[C-F]/i,Tt=/^[A-F]/i,jt=/^[<>]/,kt=/^[0-9_a-z]/,Lt=/^[+\-]/,Pt=/^[a-z]/,Dt=b("$",!1),It=F([[" ",`
|
|
12
|
+
`],"\r"," "],!1,!1),_e=b(".",!1),Vt=b("..",!1),Oe=b("[",!1),he=b(",",!1),Te=b("]",!1),Wt=b("*",!1),Qt=F([["A","Z"],"_",["a","z"],["\x80","\uD7FF"],["\uE000","\uFFFF"]],!1,!1),pr=F([["\uD800","\uDBFF"]],!1,!1),gr=F([["\uDC00","\uDFFF"]],!1,!1),hr=b(":",!1),Rt=b("?",!1),qt=F([["A","Z"],["a","z"]],!1,!1),zt=F([["0","9"]],!1,!1),me=b('"',!1),ve=b("'",!1),Mt=b("0",!1),Kt=b("-",!1),Bt=F([["1","9"]],!1,!1),mr=b("||",!1),Ut=F([[" ","!"],["#","&"],["(","["],["]","\uD7FF"],["\uE000","\uFFFF"]],!1,!1),vr=b("\\",!1),Gt=F(["/","\\","b","f","n","r","t"],!1,!1),$r=b("u",!1),dr=b("&&",!1),Ht=F([["A","C"],["E","F"]],!1,!0),je=b("D",!0),Jt=F([["0","7"]],!1,!1),Zt=F([["8","9"]],!1,!1),Xt=F([["A","B"]],!1,!0),Yt=F([["C","F"]],!1,!0),yr=b("(",!1),xr=b(")",!1),es=F([["A","F"]],!1,!0),rs=b("!",!1),ts=b("==",!1),ss=b("!=",!1),ns=b("<=",!1),as=b(">=",!1),is=F(["<",">"],!1,!1),fs=b("-0",!1),os=b("true",!1),ls=b("false",!1),us=b("null",!1),cs=b("@",!1),ps=F([["0","9"],"_",["a","z"]],!1,!1),gs=b("e",!0),hs=F(["+","-"],!1,!1),ms=F([["a","z"]],!1,!1),vs=function(e){return{type:"JsonPathQuery",segments:e}},Ar=function(e){return e},$s=function(e){return e},ds=function(e){return{type:"ChildSegment",node:e}},ys=function(e){return{type:"DescendantSegment",node:e}},br=function(e,t){return t},xs=function(e,t){return[e,...t]},As=function(e){return{type:"BracketedSelection",selectors:e}},bs=function(){return{type:"WildcardSelector"}},Cs=function(e){return{type:"MemberNameShorthand",value:e}},Es=function(e){return{type:"NameSelector",value:e}},ws=function(e,t,a){return a},Ss=function(e,t,a){return{start:e,end:t,step:a}},Fs=function(e){return{type:"SliceSelector",start:e.start===""?null:Number.parseInt(e.start.trim(),10),end:e.end===""?null:Number.parseInt(e.end.trim(),10),step:e.step===""||e.step===null?null:Number.parseInt(e.step.trim(),10)}},Ns=function(e){return{type:"IndexSelector",value:Number.parseInt(e,10)}},_s=function(e){return{type:"FilterSelector",value:e}},Os=function(e){return e},Ts=function(e){return e},js=function(e){return e.join("")},ks=function(){return'"'},Ls=function(e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
13
|
+
`;case"r":return"\r";case"t":return" ";case"/":return"/";case"\\":return"\\";default:return e.slice(1)}},Ps=function(){return"'"},Ds=function(e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
14
|
+
`;case"r":return"\r";case"t":return" ";case"/":return"/";case"\\":return"\\";default:return e.slice(1)}},Cr=function(e,t){return t},Is=function(e,t){return t.length===0?e:{type:"LogicalOrExpr",left:e,right:t.length===1?t[0]:t.slice(1).reduce((a,f)=>({type:"LogicalOrExpr",left:a,right:f}),t[0])}},Er=function(e,t){return t},Vs=function(e,t){return[e,...t]},Ws=function(e){return e.length===1?e[0]:{type:"LogicalAndExpr",left:e[0],right:e.length===2?e[1]:e.slice(2).reduce((t,a)=>({type:"LogicalOrExpr",left:t,right:a}),e[1])}},Qs=function(){return String.fromCharCode(Number.parseInt(on(),16))},Rs=function(e,t){return String.fromCharCode(Number.parseInt(e,16))+String.fromCharCode(Number.parseInt(t,16))},qs=function(e){return e},zs=function(e,t){return e!==null?{type:"LogicalNotExpr",expression:t}:t},Ms=function(e,t,a){return{type:"ComparisonExpr",left:e,op:t,right:a}},Ks=function(e,t){return e!==null?{type:"LogicalNotExpr",expression:{type:"TestExpr",expression:t}}:{type:"TestExpr",expression:t}},Bs=function(e){return{type:"FilterQuery",value:e}},wr=function(e,t,a){return a},Us=function(e,t,a){return[t,...a]},Gs=function(e,t){return{type:"FunctionExpr",name:e,arguments:t}},Hs=function(e){return{type:"Literal",value:e}},Js=function(e){return{type:"RelQuery",segments:e}},Zs=function(e){return Number(e)},Xs=function(){return!0},Ys=function(){return!1},en=function(){return null},rn=function(e){return{type:"RelSingularQuery",segments:e}},tn=function(e){return{type:"AbsSingularQuery",segments:e}},Sr=function(e){return{type:"SingularQuerySegment",node:e}},sn=function(e){return e},nn=function(e){return e},an=function(e){return e},fn=function(e){return{type:"IndexSelector",selector:e}},s=i.peg$currPos|0,m=s,J=[{line:1,column:1}],I=s,$e=i.peg$maxFailExpected||[],c=i.peg$silentFails|0,ee;if(i.startRule){if(!(i.startRule in g))throw new Error(`Can't start parsing from rule "`+i.startRule+'".');h=g[i.startRule]}function on(){return n.substring(m,s)}function Yn(){return m}function ea(){return{source:o,start:m,end:s}}function ra(){return re(m,s)}function ta(e,t){throw t=t!==void 0?t:re(m,s),Nr([un(e)],n.substring(m,s),t)}function sa(e,t){throw t=t!==void 0?t:re(m,s),cn(e,t)}function b(e,t){return{type:"literal",text:e,ignoreCase:t}}function F(e,t,a){return{type:"class",parts:e,inverted:t,ignoreCase:a}}function na(){return{type:"any"}}function ln(){return{type:"end"}}function un(e){return{type:"other",description:e}}function Fr(e){var t=J[e],a;if(t)return t;if(e>=J.length)a=J.length-1;else for(a=e;!J[--a];);for(t=J[a],t={line:t.line,column:t.column};a<e;)n.charCodeAt(a)===10?(t.line++,t.column=1):t.column++,a++;return J[e]=t,t}function re(e,t,a){var f=Fr(e),l=Fr(t),p={source:o,start:{offset:e,line:f.line,column:f.column},end:{offset:t,line:l.line,column:l.column}};return a&&o&&typeof o.offset=="function"&&(p.start=o.offset(p.start),p.end=o.offset(p.end)),p}function u(e){s<I||(s>I&&(I=s,$e=[]),$e.push(e))}function cn(e,t){return new B(e,null,null,t)}function Nr(e,t,a){return new B(B.buildMessage(e,t),e,t,a)}function ke(){var e,t,a;return e=s,t=_r(),t!==r?(a=Or(),m=e,e=vs(a)):(s=e,e=r),e}function _r(){var e;return n.charCodeAt(s)===36?(e=x,s++):(e=r,c===0&&u(Dt)),e}function Or(){var e,t,a,f;for(e=[],t=s,a=A(),f=Tr(),f!==r?(m=t,t=Ar(f)):(s=t,t=r);t!==r;)e.push(t),t=s,a=A(),f=Tr(),f!==r?(m=t,t=Ar(f)):(s=t,t=r);return e}function A(){var e,t;for(e=[],t=jr();t!==r;)e.push(t),t=jr();return e}function Tr(){var e;return e=pn(),e===r&&(e=gn()),e}function jr(){var e;return e=n.charAt(s),yt.test(e)?s++:(e=r,c===0&&u(It)),e}function pn(){var e,t,a,f;return e=s,t=kr(),t===r&&(t=s,n.charCodeAt(s)===46?(a=S,s++):(a=r,c===0&&u(_e)),a!==r?(f=Le(),f===r&&(f=Pe()),f!==r?(m=t,t=$s(f)):(s=t,t=r)):(s=t,t=r)),t!==r&&(m=e,t=ds(t)),e=t,e}function gn(){var e,t,a;return e=s,n.substr(s,2)===T?(t=T,s+=2):(t=r,c===0&&u(Vt)),t!==r?(a=kr(),a===r&&(a=Le(),a===r&&(a=Pe())),a!==r?(m=e,e=ys(a)):(s=e,e=r)):(s=e,e=r),e}function kr(){var e,t,a,f,l,p,v,y,E,P,j;if(e=s,n.charCodeAt(s)===91?(t=$,s++):(t=r,c===0&&u(Oe)),t!==r){if(a=s,f=A(),l=De(),l!==r){for(p=[],v=s,y=A(),n.charCodeAt(s)===44?(E=d,s++):(E=r,c===0&&u(he)),E!==r?(P=A(),j=De(),j!==r?(m=v,v=br(l,j)):(s=v,v=r)):(s=v,v=r);v!==r;)p.push(v),v=s,y=A(),n.charCodeAt(s)===44?(E=d,s++):(E=r,c===0&&u(he)),E!==r?(P=A(),j=De(),j!==r?(m=v,v=br(l,j)):(s=v,v=r)):(s=v,v=r);m=a,a=xs(l,p)}else s=a,a=r;a!==r?(f=A(),n.charCodeAt(s)===93?(l=C,s++):(l=r,c===0&&u(Te)),l!==r?(m=e,e=As(a)):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;return e}function Le(){var e,t;return e=s,n.charCodeAt(s)===42?(t=_,s++):(t=r,c===0&&u(Wt)),t!==r&&(m=e,t=bs()),e=t,e}function Pe(){var e,t,a,f,l,p;if(e=s,t=s,a=s,f=Lr(),f!==r){for(l=[],p=Pr();p!==r;)l.push(p),p=Pr();f=[f,l],a=f}else s=a,a=r;return a!==r?t=n.substring(t,s):t=a,t!==r&&(m=e,t=Cs(t)),e=t,e}function De(){var e;return e=Dr(),e===r&&(e=Le(),e===r&&(e=hn(),e===r&&(e=Ir(),e===r&&(e=mn())))),e}function Lr(){var e,t,a;return e=n.charAt(s),xt.test(e)?s++:(e=r,c===0&&u(Qt)),e===r&&(e=s,t=n.charAt(s),ur.test(t)?s++:(t=r,c===0&&u(pr)),t!==r?(a=n.charAt(s),cr.test(a)?s++:(a=r,c===0&&u(gr)),a!==r?(t=[t,a],e=t):(s=e,e=r)):(s=e,e=r)),e}function Pr(){var e;return e=Lr(),e===r&&(e=R()),e}function Dr(){var e,t;return e=s,t=Vr(),t!==r&&(m=e,t=Es(t)),e=t,e}function hn(){var e,t,a,f,l,p,v,y,E,P,j,V;return e=s,t=s,a=s,f=s,l=te(),l!==r?(p=A(),l=[l,p],f=l):(s=f,f=r),f===r&&(f=null),a=n.substring(a,s),n.charCodeAt(s)===58?(f=L,s++):(f=r,c===0&&u(hr)),f!==r?(l=A(),p=s,v=s,y=te(),y!==r?(E=A(),y=[y,E],v=y):(s=v,v=r),v===r&&(v=null),p=n.substring(p,s),v=s,n.charCodeAt(s)===58?(y=L,s++):(y=r,c===0&&u(hr)),y!==r?(E=s,P=s,j=A(),V=te(),V===r&&(V=null),j=[j,V],P=j,E=n.substring(E,s),m=v,v=ws(a,p,E)):(s=v,v=r),v===r&&(v=null),m=t,t=Ss(a,p,v)):(s=t,t=r),t!==r&&(m=e,t=Fs(t)),e=t,e}function Ir(){var e,t,a;return e=s,t=s,a=te(),a!==r?t=n.substring(t,s):t=a,t!==r&&(m=e,t=Ns(t)),e=t,e}function mn(){var e,t,a,f;return e=s,n.charCodeAt(s)===63?(t=gt,s++):(t=r,c===0&&u(Rt)),t!==r?(a=A(),f=Ie(),f!==r?(m=e,e=_s(f)):(s=e,e=r)):(s=e,e=r),e}function aa(){var e;return e=n.charAt(s),At.test(e)?s++:(e=r,c===0&&u(qt)),e}function R(){var e;return e=n.charAt(s),bt.test(e)?s++:(e=r,c===0&&u(zt)),e}function Vr(){var e,t,a,f,l;if(e=s,t=s,n.charCodeAt(s)===34?(a=ue,s++):(a=r,c===0&&u(me)),a!==r){for(f=[],l=Wr();l!==r;)f.push(l),l=Wr();n.charCodeAt(s)===34?(l=ue,s++):(l=r,c===0&&u(me)),l!==r?(m=t,t=Os(f)):(s=t,t=r)}else s=t,t=r;if(t===r)if(t=s,n.charCodeAt(s)===39?(a=ce,s++):(a=r,c===0&&u(ve)),a!==r){for(f=[],l=Qr();l!==r;)f.push(l),l=Qr();n.charCodeAt(s)===39?(l=ce,s++):(l=r,c===0&&u(ve)),l!==r?(m=t,t=Ts(f)):(s=t,t=r)}else s=t,t=r;return t!==r&&(m=e,t=js(t)),e=t,e}function te(){var e,t,a,f,l;if(n.charCodeAt(s)===48?(e=ht,s++):(e=r,c===0&&u(Mt)),e===r)if(e=s,n.charCodeAt(s)===45?(t=mt,s++):(t=r,c===0&&u(Kt)),t===r&&(t=null),a=vn(),a!==r){for(f=[],l=R();l!==r;)f.push(l),l=R();t=[t,a,f],e=t}else s=e,e=r;return e}function Wr(){var e,t,a;return e=s,t=Rr(),t!==r?e=n.substring(e,s):e=t,e===r&&(n.charCodeAt(s)===39?(e=ce,s++):(e=r,c===0&&u(ve)),e===r&&(e=s,t=de(),t!==r?(n.charCodeAt(s)===34?(a=ue,s++):(a=r,c===0&&u(me)),a!==r?(m=e,e=ks()):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t=de(),t!==r?(a=qr(),a!==r?(m=e,e=Ls(a)):(s=e,e=r)):(s=e,e=r)))),e}function Qr(){var e,t,a;return e=s,t=Rr(),t!==r?e=n.substring(e,s):e=t,e===r&&(n.charCodeAt(s)===34?(e=ue,s++):(e=r,c===0&&u(me)),e===r&&(e=s,t=de(),t!==r?(n.charCodeAt(s)===39?(a=ce,s++):(a=r,c===0&&u(ve)),a!==r?(m=e,e=Ps()):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t=de(),t!==r?(a=qr(),a!==r?(m=e,e=Ds(a)):(s=e,e=r)):(s=e,e=r)))),e}function vn(){var e;return e=n.charAt(s),Ct.test(e)?s++:(e=r,c===0&&u(Bt)),e}function Ie(){var e,t,a,f,l,p,v,y;if(e=s,t=Ve(),t!==r){for(a=[],f=s,l=A(),n.substr(s,2)===pe?(p=pe,s+=2):(p=r,c===0&&u(mr)),p!==r?(v=A(),y=Ve(),y!==r?(m=f,f=Cr(t,y)):(s=f,f=r)):(s=f,f=r);f!==r;)a.push(f),f=s,l=A(),n.substr(s,2)===pe?(p=pe,s+=2):(p=r,c===0&&u(mr)),p!==r?(v=A(),y=Ve(),y!==r?(m=f,f=Cr(t,y)):(s=f,f=r)):(s=f,f=r);m=e,e=Is(t,a)}else s=e,e=r;return e}function Rr(){var e,t,a;return e=n.charAt(s),Et.test(e)?s++:(e=r,c===0&&u(Ut)),e===r&&(e=s,t=n.charAt(s),ur.test(t)?s++:(t=r,c===0&&u(pr)),t!==r?(a=n.charAt(s),cr.test(a)?s++:(a=r,c===0&&u(gr)),a!==r?(t=[t,a],e=t):(s=e,e=r)):(s=e,e=r)),e}function de(){var e;return n.charCodeAt(s)===92?(e=Xe,s++):(e=r,c===0&&u(vr)),e}function qr(){var e,t,a;return e=n.charAt(s),wt.test(e)?s++:(e=r,c===0&&u(Gt)),e===r&&(e=s,n.charCodeAt(s)===117?(t=Ye,s++):(t=r,c===0&&u($r)),t!==r?(a=$n(),a!==r?(t=[t,a],e=t):(s=e,e=r)):(s=e,e=r)),e}function Ve(){var e,t,a,f,l,p,v,y,E;if(e=s,t=s,a=We(),a!==r){for(f=[],l=s,p=A(),n.substr(s,2)===ge?(v=ge,s+=2):(v=r,c===0&&u(dr)),v!==r?(y=A(),E=We(),E!==r?(m=l,l=Er(a,E)):(s=l,l=r)):(s=l,l=r);l!==r;)f.push(l),l=s,p=A(),n.substr(s,2)===ge?(v=ge,s+=2):(v=r,c===0&&u(dr)),v!==r?(y=A(),E=We(),E!==r?(m=l,l=Er(a,E)):(s=l,l=r)):(s=l,l=r);m=t,t=Vs(a,f)}else s=t,t=r;return t!==r&&(m=e,t=Ws(t)),e=t,e}function $n(){var e,t,a,f,l,p,v;return e=s,t=s,a=dn(),a!==r&&(m=t,a=Qs()),t=a,t===r&&(t=s,a=s,f=yn(),f!==r?a=n.substring(a,s):a=f,a!==r?(n.charCodeAt(s)===92?(f=Xe,s++):(f=r,c===0&&u(vr)),f!==r?(n.charCodeAt(s)===117?(l=Ye,s++):(l=r,c===0&&u($r)),l!==r?(p=s,v=xn(),v!==r?p=n.substring(p,s):p=v,p!==r?(m=t,t=Rs(a,p)):(s=t,t=r)):(s=t,t=r)):(s=t,t=r)):(s=t,t=r)),t!==r&&(m=e,t=qs(t)),e=t,e}function We(){var e;return e=An(),e===r&&(e=bn(),e===r&&(e=Cn())),e}function dn(){var e,t,a,f,l,p;if(e=s,t=R(),t===r&&(t=n.charAt(s),St.test(t)?s++:(t=r,c===0&&u(Ht))),t!==r){for(a=s,f=[],l=M();l!==r;)f.push(l),f.length>=3?l=r:l=M();f.length<3?(s=a,a=r):a=f,a!==r?(t=[t,a],e=t):(s=e,e=r)}else s=e,e=r;if(e===r)if(e=s,t=n.charAt(s),t.toLowerCase()===Ne?s++:(t=r,c===0&&u(je)),t!==r)if(a=n.charAt(s),Ft.test(a)?s++:(a=r,c===0&&u(Jt)),a!==r){for(f=s,l=[],p=M();p!==r;)l.push(p),l.length>=2?p=r:p=M();l.length<2?(s=f,f=r):f=l,f!==r?(t=[t,a,f],e=t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function yn(){var e,t,a,f,l,p;if(e=s,t=n.charAt(s),t.toLowerCase()===Ne?s++:(t=r,c===0&&u(je)),t!==r)if(a=n.charAt(s),Nt.test(a)?s++:(a=r,c===0&&u(Zt)),a===r&&(a=n.charAt(s),_t.test(a)?s++:(a=r,c===0&&u(Xt))),a!==r){for(f=s,l=[],p=M();p!==r;)l.push(p),l.length>=2?p=r:p=M();l.length<2?(s=f,f=r):f=l,f!==r?(t=[t,a,f],e=t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function xn(){var e,t,a,f,l,p;if(e=s,t=n.charAt(s),t.toLowerCase()===Ne?s++:(t=r,c===0&&u(je)),t!==r)if(a=n.charAt(s),Ot.test(a)?s++:(a=r,c===0&&u(Yt)),a!==r){for(f=s,l=[],p=M();p!==r;)l.push(p),l.length>=2?p=r:p=M();l.length<2?(s=f,f=r):f=l,f!==r?(t=[t,a,f],e=t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function An(){var e,t,a,f,l,p,v;return e=s,t=s,a=zr(),a!==r?(f=A(),a=[a,f],t=a):(s=t,t=r),t===r&&(t=null),n.charCodeAt(s)===40?(a=er,s++):(a=r,c===0&&u(yr)),a!==r?(f=A(),l=Ie(),l!==r?(p=A(),n.charCodeAt(s)===41?(v=rr,s++):(v=r,c===0&&u(xr)),v!==r?(m=e,e=zs(t,l)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function bn(){var e,t,a,f,l,p;return e=s,t=Mr(),t!==r?(a=A(),f=En(),f!==r?(l=A(),p=Mr(),p!==r?(m=e,e=Ms(t,f,p)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Cn(){var e,t,a,f;return e=s,t=s,a=zr(),a!==r?(f=A(),a=[a,f],t=a):(s=t,t=r),t===r&&(t=null),a=Kr(),a===r&&(a=Qe()),a!==r?(m=e,e=Ks(t,a)):(s=e,e=r),e}function M(){var e;return e=R(),e===r&&(e=n.charAt(s),Tt.test(e)?s++:(e=r,c===0&&u(es))),e}function zr(){var e;return n.charCodeAt(s)===33?(e=vt,s++):(e=r,c===0&&u(rs)),e}function Mr(){var e;return e=Br(),e===r&&(e=wn(),e===r&&(e=Qe())),e}function En(){var e;return n.substr(s,2)===tr?(e=tr,s+=2):(e=r,c===0&&u(ts)),e===r&&(n.substr(s,2)===sr?(e=sr,s+=2):(e=r,c===0&&u(ss)),e===r&&(n.substr(s,2)===nr?(e=nr,s+=2):(e=r,c===0&&u(ns)),e===r&&(n.substr(s,2)===ar?(e=ar,s+=2):(e=r,c===0&&u(as)),e===r&&(e=n.charAt(s),jt.test(e)?s++:(e=r,c===0&&u(is)))))),e}function Kr(){var e,t;return e=s,t=Sn(),t===r&&(t=ke()),t!==r&&(m=e,t=Bs(t)),e=t,e}function Qe(){var e,t,a,f,l,p,v,y,E,P,j,V;if(e=s,t=Fn(),t!==r)if(n.charCodeAt(s)===40?(a=er,s++):(a=r,c===0&&u(yr)),a!==r){if(f=A(),l=s,p=Re(),p!==r){for(v=[],y=s,E=A(),n.charCodeAt(s)===44?(P=d,s++):(P=r,c===0&&u(he)),P!==r?(j=A(),V=Re(),V!==r?(m=y,y=wr(t,p,V)):(s=y,y=r)):(s=y,y=r);y!==r;)v.push(y),y=s,E=A(),n.charCodeAt(s)===44?(P=d,s++):(P=r,c===0&&u(he)),P!==r?(j=A(),V=Re(),V!==r?(m=y,y=wr(t,p,V)):(s=y,y=r)):(s=y,y=r);m=l,l=Us(t,p,v)}else s=l,l=r;l===r&&(l=null),p=A(),n.charCodeAt(s)===41?(v=rr,s++):(v=r,c===0&&u(xr)),v!==r?(m=e,e=Gs(t,l)):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function Br(){var e,t;return e=s,t=Nn(),t===r&&(t=Vr(),t===r&&(t=_n(),t===r&&(t=On(),t===r&&(t=Tn())))),t!==r&&(m=e,t=Hs(t)),e=t,e}function wn(){var e;return e=jn(),e===r&&(e=kn()),e}function Sn(){var e,t,a;return e=s,t=Ur(),t!==r?(a=Or(),a!==r?(m=e,e=Js(a)):(s=e,e=r)):(s=e,e=r),e}function Fn(){var e,t,a,f,l;if(e=s,t=s,a=Dn(),a!==r){for(f=[],l=Gr();l!==r;)f.push(l),l=Gr();a=[a,f],t=a}else s=t,t=r;return t!==r?e=n.substring(e,s):e=t,e}function Re(){var e;return e=Br(),e===r&&(e=Kr(),e===r&&(e=Qe(),e===r&&(e=Ie()))),e}function Nn(){var e,t,a,f,l,p;return e=s,t=s,a=s,f=te(),f===r&&(n.substr(s,2)===ir?(f=ir,s+=2):(f=r,c===0&&u(fs))),f!==r?(l=Ln(),l===r&&(l=null),p=Pn(),p===r&&(p=null),f=[f,l,p],a=f):(s=a,a=r),a!==r?t=n.substring(t,s):t=a,t!==r&&(m=e,t=Zs(t)),e=t,e}function _n(){var e,t;return e=s,n.substr(s,4)===fr?(t=fr,s+=4):(t=r,c===0&&u(os)),t!==r&&(m=e,t=Xs()),e=t,e}function On(){var e,t;return e=s,n.substr(s,5)===or?(t=or,s+=5):(t=r,c===0&&u(ls)),t!==r&&(m=e,t=Ys()),e=t,e}function Tn(){var e,t;return e=s,n.substr(s,4)===lr?(t=lr,s+=4):(t=r,c===0&&u(us)),t!==r&&(m=e,t=en()),e=t,e}function jn(){var e,t,a;return e=s,t=Ur(),t!==r?(a=Hr(),m=e,e=rn(a)):(s=e,e=r),e}function kn(){var e,t,a;return e=s,t=_r(),t!==r?(a=Hr(),m=e,e=tn(a)):(s=e,e=r),e}function Ur(){var e;return n.charCodeAt(s)===64?(e=$t,s++):(e=r,c===0&&u(cs)),e}function Gr(){var e;return e=n.charAt(s),kt.test(e)?s++:(e=r,c===0&&u(ps)),e}function Ln(){var e,t,a,f;if(e=s,n.charCodeAt(s)===46?(t=S,s++):(t=r,c===0&&u(_e)),t!==r){if(a=[],f=R(),f!==r)for(;f!==r;)a.push(f),f=R();else a=r;a!==r?(t=[t,a],e=t):(s=e,e=r)}else s=e,e=r;return e}function Pn(){var e,t,a,f,l;if(e=s,t=n.charAt(s),t.toLowerCase()===dt?s++:(t=r,c===0&&u(gs)),t!==r){if(a=n.charAt(s),Lt.test(a)?s++:(a=r,c===0&&u(hs)),a===r&&(a=null),f=[],l=R(),l!==r)for(;l!==r;)f.push(l),l=R();else f=r;f!==r?(t=[t,a,f],e=t):(s=e,e=r)}else s=e,e=r;return e}function Hr(){var e,t,a,f,l;for(e=s,t=[],a=s,f=A(),l=Jr(),l===r&&(l=Zr()),l!==r?(m=a,a=Sr(l)):(s=a,a=r);a!==r;)t.push(a),a=s,f=A(),l=Jr(),l===r&&(l=Zr()),l!==r?(m=a,a=Sr(l)):(s=a,a=r);return m=e,t=sn(t),e=t,e}function Dn(){var e;return e=n.charAt(s),Pt.test(e)?s++:(e=r,c===0&&u(ms)),e}function Jr(){var e,t,a,f;return e=s,n.charCodeAt(s)===91?(t=$,s++):(t=r,c===0&&u(Oe)),t!==r?(a=Dr(),a!==r?(n.charCodeAt(s)===93?(f=C,s++):(f=r,c===0&&u(Te)),f!==r?(m=e,e=nn(a)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,n.charCodeAt(s)===46?(t=S,s++):(t=r,c===0&&u(_e)),t!==r?(a=Pe(),a!==r?(m=e,e=an(a)):(s=e,e=r)):(s=e,e=r)),e}function Zr(){var e,t,a,f;return e=s,n.charCodeAt(s)===91?(t=$,s++):(t=r,c===0&&u(Oe)),t!==r?(a=Ir(),a!==r?(n.charCodeAt(s)===93?(f=C,s++):(f=r,c===0&&u(Te)),f!==r?(m=e,e=fn(a)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}if(ee=h(),i.peg$library)return{peg$result:ee,peg$currPos:s,peg$FAILED:r,peg$maxFailExpected:$e,peg$maxFailPos:I};if(ee!==r&&s===n.length)return ee;throw ee!==r&&s<n.length&&u(ln()),Nr($e,I<n.length?n.charAt(I):null,I<n.length?re(I,I+1):re(I,I))}function Yr(n){return Xr(n)}var Z=class{head=null;tail=null;size=0;push(i){let r={value:i,next:null};this.tail!==null&&(this.tail.next=r),this.tail=r,this.head===null&&(this.head=r),this.size++}pop(){if(this.head===null)return;let i=this.head.value;return this.head=this.head.next,this.head===null&&(this.tail=null),this.size--,i}};function q(n){if(typeof n!="object"||n===null)return!1;let i=Object.getPrototypeOf(n);return i===null||i===Object.prototype}var X=n=>Array.isArray(n.value),Y=n=>q(n.value);var et=new WeakSet,w=n=>typeof n=="object"&&n!==null&&et.has(n),rt=n=>{switch(typeof n){case"string":case"number":case"boolean":return!0;case"object":return n===null||q(n)||ze(n);default:return!1}},ze=n=>Array.isArray(n)&&!w(n),ye=()=>{let n=[];return et.add(n),n},D=Symbol("Nothing");var tt={declaration:function(i,r){return w(r)?r.length:0},definition:{parameters:["NodesType"],returnType:"ValueType"}};function Vn(n){let i=0;for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);(o>=0&&o<=55295||o>=57344&&o<=1114111)&&i++}return i}var st={declaration:function(i,r){return typeof r=="string"?Vn(r):Array.isArray(r)?r.length:q(r)?Object.keys(r).length:D},definition:{parameters:["ValueType"],returnType:"ValueType"}};function nt(n){return n===92}function Wn(n,i){let r=!1,o=i;for(;o<n.length;){let g=n.charCodeAt(o);if(o++,nt(g)){r=!0;continue}if(g===93){if(!r)break;r=!1}}return o}function Qn(n){let i=n;for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);nt(o)?r++:o===91?r=Wn(n,r):o===46&&(i=`${n.slice(0,r)}[^
|
|
15
|
+
\r]${n.slice(r+1)}`)}return i}function se({cache:n},i){let r=n.get("regexps")??{};if(n.has("regexps")||n.set("regexps",r),Object.hasOwn(r,i))return r[i];try{let o=RegExp(Qn(i),"u");return r[i]=o,o}catch{return r[i]=null,null}}var at={declaration:function(i,r,o){return typeof r!="string"||typeof o!="string"?!1:se(i,`^${o}$`)?.test(r)===!0},definition:{parameters:["ValueType","ValueType"],returnType:"LogicalType"}};var it={declaration:function(i,r,o){return typeof r!="string"||typeof o!="string"?!1:se(i,o)?.test(r)===!0},definition:{parameters:["ValueType","ValueType"],returnType:"LogicalType"}};var ft={declaration:function(i,r){return r.length===1?r[0]:D},definition:{parameters:["NodesType"],returnType:"ValueType"}};var Me=[];function N(n,i){return n===Me?Me:typeof i=="number"?[...n,i]:[...n,zn(i)]}function ot(n){return n?[]:Me}var Rn=/[\u0000-\u001f'\\]/g;function qn(n){let i=n.charCodeAt(0);switch(i){case 8:return"\\b";case 12:return"\\f";case 10:return"\\n";case 13:return"\\r";case 9:return"\\t";case 39:return"\\'";case 92:return"\\\\";default:return`\\u${i.toString(16).padStart(4,"0")}`}}function zn(n){return n.replace(Rn,qn)}function lt(n){let i="$";for(let r of n)typeof r=="number"?i+=`[${r}]`:i+=`['${r}']`;return i}function k(n){throw new TypeError(`Unexpected node type: ${n.type}`)}function O(n){throw new TypeError(`Unexpected comparison operator: ${n}`)}function xe(n,i){throw new Error(i)}function U(n){switch(typeof n){case"object":if(n===null)return"null";if(w(n))return"NodeList";if(ze(n))return"array";if(q(n))return"object";throw new TypeError(`Unknown type: ${n}`);case"string":return"string";case"number":return"number";case"boolean":return"boolean";default:if(n===D)return"Nothing";throw new TypeError(`Unknown type: ${n}`)}}function Mn(n,i){if(n.length!==i.length)return!1;for(let r=0;r<n.length;r++)if(!W(n[r],i[r]))return!1;return!0}function Kn(n,i){let r=Object.keys(n),o=Object.keys(i);if(r.length!==o.length)return!1;for(let g of r)if(!Object.hasOwn(i,g)||!W(n[g],i[g]))return!1;return!0}function W(n,i){if(U(n)!==U(i))return!1;switch(U(n)){case"string":case"number":case"boolean":case"null":return n===i;case"object":return Kn(n,i);case"array":case"NodeList":return Mn(n,i);default:return!1}}function Ae(n,i,r){switch(r){case"==":case">=":case"<=":return!w(n)&&!w(i)&&W(n,i);case"<":case">":return!1;case"!=":return!Ae(n,i,"==");default:O(r)}}function be(n,i,r){switch(r){case"==":case"<=":case">=":return w(n)&&(w(i)&&W(n,i)||i===D);case"<":case">":return!1;case"!=":return!be(n,i,"==");default:O(r)}}function Ce(n,i,r){switch(r){case"==":case"<=":case">=":return i===D||w(i)&&i.length===0;case"<":case">":return!1;case"!=":return!Ce(n,i,"==");default:O(r)}}function z(n,i,r){switch(r){case"==":return n===i;case"<":return typeof i=="number"&&n<i;case"!=":return!z(n,i,"==");case"<=":return z(n,i,"<")||z(n,i,"==");case">":return typeof i=="number"&&z(i,n,"<");case">=":return typeof i=="number"&&z(i,n,"<")||z(n,i,"==");default:O(r)}}function Ke(n,i,r){switch(r){case"==":case"<=":case">=":return W(n,i);case"<":case">":return!1;case"!=":return!W(n,i);default:O(r)}}function Ee(n,i,r){switch(r){case"==":case"<=":case">=":return n===i;case"<":case">":return!1;case"!=":return!Ee(n,i,"==");default:O(r)}}function G(n,i,r){if(typeof n!="string"||typeof i!="string")return!1;switch(r){case"==":return n===i;case"<":{let o=0;for(;n.length>o&&i.length>o;){let g=n.charCodeAt(o),h=i.charCodeAt(o);if(g===h){o++;continue}return n.charCodeAt(o)<i.charCodeAt(o)}return n.length<i.length}default:O(r)}}function ut(n,i,r){switch(r){case"==":case"<":return G(n,i,r);case"!=":return!G(n,i,"==");case"<=":return G(n,i,"<")||G(n,i,"==");case">":return G(i,n,"<");case">=":return G(i,n,"<")||G(n,i,"==");default:O(r)}}function Be(n,i,r){let o=w(n)&&n.length===1?n[0]:n,g=U(o),h=w(i)&&i.length===1?i[0]:i;switch(g){case"string":return ut(o,h,r);case"number":return z(o,h,r);case"boolean":case"null":return Ee(o,h,r);case"object":return Ke(o,h,r);case"array":return Ae(o,h,r);case"Nothing":return Ce(o,h,r);case"NodeList":return be(o,h,r);default:xe(g,"Unknown type")}}function ne(n,i,r){let o=ye();switch(r.value.type){case"RelQuery":K(n,i.root,i.value,r.value,g=>{o.push(g)});break;case"JsonPathQuery":K(n,i.root,i.root,r.value,g=>{o.push(g)});break;default:k(r.value)}return o}function Ue(n,i,r){switch(r.expression.type){case"FilterQuery":return ne(n,i,r.expression).length>0;case"FunctionExpr":return H(n,i,r.expression)===!0;default:k(r.expression)}}function Q(n,i,r){switch(r.type){case"LogicalNotExpr":return!Q(n,i,r.expression);case"LogicalAndExpr":return Q(n,i,r.left)&&Q(n,i,r.right);case"LogicalOrExpr":return Q(n,i,r.left)||Q(n,i,r.right);case"TestExpr":return Ue(n,i,r);case"ComparisonExpr":return ae(n,i,r);default:k(r)}}function Ge(n,i,r){switch(r.type){case"FunctionExpr":return H(n,i,r);case"FilterQuery":return ne(n,i,r);case"LogicalNotExpr":case"LogicalAndExpr":case"LogicalOrExpr":case"TestExpr":return Q(n,i,r);case"Literal":return r.value;default:k(r)}}function Bn(n){return w(n)?n.length===1?n[0]:D:n}function H(n,i,r){if(!Un(n.functions,r.name))return!1;let o=n.functions[r.name];if(o.definition.parameters.length!==r.arguments.length)return!1;let g=[];for(let h=0;h<r.arguments.length;h++){let x=Ge(n,i,r.arguments[h]),S=o.definition.parameters[h];switch(S){case"ValueType":if(!w(x)&&!rt(x))return!1;g.push(Bn(x));break;case"NodesType":if(!w(x))return!1;g.push(x);break;case"LogicalType":if(typeof x=="boolean")g.push(x);else if(w(x))g.push(x.length>0);else return!1;break;default:xe(S,"Unknown function argument type")}}return o.declaration(n,...g)}function Un(n,i){return Object.hasOwn(n,i)}function we(n,i,r){switch(r.type){case"Literal":return r.value;case"RelSingularQuery":case"AbsSingularQuery":{let o=r.type==="RelSingularQuery"?i.value:i.root;if(r.segments.length===0)return o;let g=ye();return K(n,i.root,o,r,h=>{g.push(h)}),g}case"FunctionExpr":return H(n,i,r);default:k(r)}}function ae(n,i,r){let o=we(n,i,r.left),g=we(n,i,r.right);return Be(o,g,r.op)}function Se(n,i,r){if(r.value.type==="ComparisonExpr"){if(!ae(n,i,r.value))return}else if(!Q(n,i,r.value))return;n.stack.push({root:i.root,path:i.path,value:i.value,index:i.index+1})}function Gn(n,i){return n<0?i+n:n}function ie(n,i,r){let o=Gn(r.value,i.value.length);o>=0&&o<i.value.length&&n.stack.push({root:i.root,path:N(i.path,o),value:i.value[o],index:i.index+1})}function fe(n,{root:i,path:r,value:o,index:g},h){Object.hasOwn(o,h.value)&&n.stack.push({root:i,path:N(r,h.value),value:o[h.value],index:g+1})}function Fe(n,i){return n>=0?n:i+n}function Hn(n,i,r,o){let g=Fe(n,o),h=Fe(i,o);if(r>=0){let T=Math.min(Math.max(g,0),o),$=Math.min(Math.max(h,0),o);return[T,$]}let x=Math.min(Math.max(g,-1),o-1);return[Math.min(Math.max(h,-1),o-1),x]}function He(n,{root:i,path:r,value:o,index:g},h){let x=h.step??1,S=x>=0?0:o.length-1,T=x>=0?o.length:-o.length-1,$=h.start===null?S:Fe(h.start,o.length),d=h.end===null?T:Fe(h.end,o.length),[C,_]=Hn($,d,x,o.length);if(x>0){let L=C;for(;L<_;)n.stack.push({root:i,path:N(r,L),value:o[L],index:g+1}),L+=x}else if(x<0){let L=_;for(;C<L;)n.stack.push({root:i,path:N(r,L),value:o[L],index:g+1}),L+=x}}function oe(n,{root:i,path:r,value:o,index:g}){if(Array.isArray(o))for(let h=0;h<o.length;h++)n.stack.push({root:i,path:N(r,h),value:o[h],index:g+1});else if(q(o))for(let h of Object.keys(o))n.stack.push({root:i,path:N(r,h),value:o[h],index:g+1})}function Je(n,i,r){for(let o of r.selectors)switch(o.type){case"NameSelector":Y(i)&&fe(n,i,o);break;case"SliceSelector":X(i)&&He(n,i,o);break;case"IndexSelector":{X(i)&&ie(n,i,o);break}case"WildcardSelector":oe(n,i);break;case"FilterSelector":{X(i)?Jn(n,i,o):Y(i)&&Zn(n,i,o);break}default:k(o)}}function Jn(n,{root:i,path:r,value:o,index:g},h){for(let x=0;x<o.length;x++)Se(n,{root:i,path:N(r,x),value:o[x],index:g},h)}function Zn(n,{root:i,path:r,value:o,index:g},h){for(let x of Object.keys(o))Se(n,{root:i,path:N(r,x),value:o[x],index:g},h)}function Ze(n,{root:i,path:r,value:o,index:g},h){Object.hasOwn(o,h.value)&&n.stack.push({root:i,path:N(r,h.value),value:o[h.value],index:g+1})}function ct(n,i,r){switch(r.type){case"BracketedSelection":return Je(n,i,r);case"WildcardSelector":return oe(n,i);case"MemberNameShorthand":Y(i)&&Ze(n,i,r);break;case"NameSelector":Y(i)&&fe(n,i,r);break;case"IndexSelector":X(i)&&ie(n,i,r);break;default:k(r)}}function K(n,i,r,o,g){let h=new Z;h.push({root:i,path:ot(n.capturePaths),value:r,index:0});let x={cache:n.cache,capturePaths:!1,functions:n.functions,regexp:n.regexp,stack:h};for(;h.size>0;){let S=h.pop();if(S.index===o.segments.length){g(S.value,S.path);continue}let{path:T,value:$,index:d}=S,C=o.segments[d];if(ct(x,S,C.node),C.type==="DescendantSegment"){if(Array.isArray($))for(let _=0;_<$.length;_++)h.push({root:i,path:N(T,_),value:$[_],index:d});else if($!==null&&typeof $=="object")for(let _ of Object.keys($))h.push({root:i,path:N(T,_),value:$[_],index:d})}}}function le(n,i,r,o){let g={cache:new Map,capturePaths:r.capturePaths,functions:{count:tt,search:it,value:ft,match:at,length:st},regexp:"i-regexp",stack:new Z};K(g,n,n,Yr(i),o)}var pt={capturePaths:!0};function Tf(n,i){let r=[];return le(n,i,{capturePaths:!1},o=>{r.push(o)}),r}function jf(n,i){let r=[];return le(n,i,pt,(o,g)=>{r.push(lt(g))}),r}function Xn(n,i,r){le(n,i,pt,r)}function kf(n,i,r){for(let[o,g]of i)try{Xn(n,o,g)}catch(h){r?.(h instanceof Error?h:new Error(String(h)),o)}}export{kf as batchExec,Xn as exec,jf as paths,Tf as query};
|
package/assets/view.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { esc, icon, method, tab } from './components.js';
|
|
4
4
|
import { t } from './i18n.js';
|
|
5
5
|
import { shortcutAttrs, shortcutHint, shortcutLong, shortcutLabel } from './shortcuts.js';
|
|
6
|
+
import { journeysEnabled } from './journeys-model.js';
|
|
7
|
+
import { modeSwitch } from './journeys-view.js';
|
|
6
8
|
|
|
7
9
|
export { esc, icon, method };
|
|
8
10
|
|
|
@@ -42,8 +44,9 @@ function topbar(cap, info) {
|
|
|
42
44
|
<span class="crumb-sep desktop-only" aria-hidden="true">/</span>
|
|
43
45
|
<span class="api-switch"><span class="name" lang="en" dir="auto">${esc(cap.apiName || info.title || 'API')}</span>${version}</span>
|
|
44
46
|
${cap.environment || database ? envChip(cap, database) : ''}
|
|
47
|
+
${journeysEnabled(cap) ? `<span class="mode7-wrap desktop-only">${modeSwitch('spec')}</span>` : ''}
|
|
45
48
|
<div class="spacer"></div>
|
|
46
|
-
<button type="button" class="search-trigger" data-action="palette" ${shortcutAttrs('palette')}>
|
|
49
|
+
<button type="button" class="search-trigger" data-action="palette" title="${esc(t('shell.search'))}" ${shortcutAttrs('palette')}>
|
|
47
50
|
${icon('search', true)}<span class="grow">${esc(t('shell.search'))}</span>${shortcutHint('palette')}
|
|
48
51
|
</button>
|
|
49
52
|
${toolButton('display', 'sliders', t('shell.display'))}
|
|
@@ -53,8 +56,12 @@ function topbar(cap, info) {
|
|
|
53
56
|
</header>`;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
function sidebar() {
|
|
59
|
+
function sidebar(cap) {
|
|
60
|
+
// With journeys, phones put the mode switch at the top of the drawer; Journeys mode swaps the
|
|
61
|
+
// tab row for a head row of the same height that names where the journeys come from.
|
|
62
|
+
const journeys = journeysEnabled(cap);
|
|
57
63
|
return `<nav class="sidebar" id="operations" aria-label="${esc(t('side.operations'))}">
|
|
64
|
+
${journeys ? `<div class="mode7-drawer mobile-only">${modeSwitch('spec', { drawer: true })}</div><div class="jh7" data-journeys-head hidden></div>` : ''}
|
|
58
65
|
<div class="tabs" role="tablist" aria-label="${esc(t('side.browse'))}">
|
|
59
66
|
${tab(t('side.operations'), { selected: true, count: '–', id: 'side-tab-operations', controls: 'nav', shortcut: 'sidebar-operations', data: `data-side-tab="operations" title="${esc(t('side.operations'))}"` })}
|
|
60
67
|
${tab(t('side.models'), { count: '–', id: 'side-tab-models', controls: 'nav', shortcut: 'sidebar-models', data: `data-side-tab="models" title="${esc(t('side.models'))}"` })}
|
|
@@ -83,9 +90,10 @@ export function shell(capabilities, info = {}) {
|
|
|
83
90
|
</div>
|
|
84
91
|
</div>
|
|
85
92
|
<div class="workspace" data-view="request">
|
|
86
|
-
${sidebar()}
|
|
93
|
+
${sidebar(capabilities)}
|
|
87
94
|
<main class="pane request" id="request" aria-labelledby="op-title" tabindex="-1">
|
|
88
95
|
<div id="context"></div>
|
|
96
|
+
${journeysEnabled(capabilities) ? '<div id="journey-strip" hidden></div>' : ''}
|
|
89
97
|
<div class="pane-scroll">
|
|
90
98
|
<div id="operation"></div>
|
|
91
99
|
<div class="tabs scrolls"><div class="request-tabs" role="tablist" aria-label="${esc(t('shell.request'))}"></div><div class="end request-tools"></div></div>
|
package/assets/views.css
CHANGED
|
@@ -292,6 +292,13 @@
|
|
|
292
292
|
.doc-pane .prose ul, .doc-pane .prose ol { margin: 0.5rem 0; padding-inline-start: 1.25rem; }
|
|
293
293
|
.doc-pane .prose li { margin: 0.2rem 0; }
|
|
294
294
|
.doc-pane .prose h4 { margin: 1rem 0 0.25rem; font-size: var(--fs-base); color: var(--text); }
|
|
295
|
+
/* A description's table: scrolls sideways on its own when it can't fit, never the page. */
|
|
296
|
+
.prose .md-table { overflow-x: auto; margin: 0.75rem 0; border: 1px solid var(--line); border-radius: var(--r-lg); }
|
|
297
|
+
.prose .md-table table { border-collapse: collapse; inline-size: 100%; font-size: var(--fs-sm); line-height: 1.5; }
|
|
298
|
+
.prose .md-table :is(th, td) { padding: 0.5rem 0.75rem; text-align: start; vertical-align: top; border-block-end: 1px solid var(--line); }
|
|
299
|
+
.prose .md-table tbody tr:last-child td { border-block-end: 0; }
|
|
300
|
+
.prose .md-table th { background: var(--panel); color: var(--text); font-weight: 500; white-space: nowrap; }
|
|
301
|
+
.prose .md-table td:first-child { white-space: nowrap; }
|
|
295
302
|
.doc-pane .doc-meta { margin-block-start: 0.75rem; }
|
|
296
303
|
.doc-pane .doc-meta code { font-size: var(--fs-md); }
|
|
297
304
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { BenchBinding, BenchOptions, BenchRequest, DispatchResponse, LookupResponse, Observation, RegisteredOperation, TransportResponse, UnavailableOperation, UnavailableOptions } from './types.js';
|
|
1
|
+
import type { BenchBinding, BenchOptions, BenchRequest, DispatchResponse, LookupResponse, Observation, RegisteredOperation, SessionAccess, TransportResponse, UnavailableOperation, UnavailableOptions } from './types.js';
|
|
2
2
|
export type * from './types.js';
|
|
3
|
+
export { defineJourney, match } from './journey-builder.js';
|
|
4
|
+
export type { ApprovedDifference, CodeJourney, ExpectedEffect, ExpectedWrite, JourneyBuilder, JourneyOptions, JourneyStep, Ref } from './journey-builder.js';
|
|
5
|
+
export { PreviewSessionEndedError, PreviewStoreBusyError } from './sessions.js';
|
|
3
6
|
export { attributeRequest, Capture, currentCapture, currentPreview, deliverEffect, detached } from './capture.js';
|
|
4
7
|
export { looksSecret, redacted, redactDeep, redactRow } from './secrets.js';
|
|
5
8
|
export { classifyDynamo, classifyMongo, classifyRedis, partiqlVerb, type CommandKind, type MongoClassification } from './stores/classify.js';
|
|
@@ -17,8 +20,9 @@ export declare function unavailableOperation(method: string, path: string, optio
|
|
|
17
20
|
* capabilities, so the workbench writes guidance such as the `preview: false` snippet in its idiom.
|
|
18
21
|
*/
|
|
19
22
|
export declare function createBench<Raw = unknown>(options?: BenchOptions<Raw>, registered?: () => RegisteredOperation[], binding?: BenchBinding): {
|
|
20
|
-
lookup: (context: BenchRequest<Raw>) => Promise<LookupResponse>;
|
|
21
|
-
preview: (context: BenchRequest<Raw>, dispatch: () => Promise<DispatchResponse
|
|
23
|
+
lookup: (context: BenchRequest<Raw>, readBody?: () => Promise<unknown>) => Promise<LookupResponse>;
|
|
24
|
+
preview: (context: BenchRequest<Raw>, dispatch: () => Promise<DispatchResponse>, session?: SessionAccess) => Promise<TransportResponse>;
|
|
22
25
|
observation: (context: BenchRequest<Raw>) => Promise<Observation | null>;
|
|
23
26
|
maxResponseBytes: number;
|
|
27
|
+
close: () => Promise<void | undefined>;
|
|
24
28
|
};
|