diff --git a/gulpfile.js b/gulpfile.js index 8e40b0a..fd3d4ad 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -60,6 +60,26 @@ function watchTemplates () { } exports["watch:tmpl"] = watchTemplates +const fore = [ + "node_modules/@jinntec/fore/dist/fore.js", + "node_modules/@jinntec/fore/dist/fore.js.map", +] + +function copyFore() { + return src(fore, {base:"node_modules/@jinntec/fore/dist"}) + .pipe(dest('build/resources/js')) +} + +const foreStyles = [ + "node_modules/@jinntec/fore/resources/*.css", +] + +function copyForeStyles() { + return src(foreStyles, {base:"node_modules/@jinntec/fore/resources"}) + .pipe(dest('build/resources/css')) +} + +const copyNodeModules = parallel(copyFore, copyForeStyles) const static = 'src/**/*.{xml,html,xq,xquery,xql,xqm,xsl,xconf,json,svg,js,css,png,jpg,map}' @@ -117,7 +137,8 @@ function installXar () { const build = series( clean, templates, - copyStatic + copyStatic, + copyNodeModules ) const watchAll = parallel( watchStatic, diff --git a/package-lock.json b/package-lock.json index 5edfb75..431fb56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,12 @@ "name": "tuttle", "version": "1.2.0", "license": "GPL-3.0", + "dependencies": { + "@jinntec/fore": "^1.5.0" + }, "devDependencies": { - "@existdb/gulp-exist": "^4.0.0", - "@existdb/gulp-replace-tmpl": "^1.0.0", + "@existdb/gulp-exist": "^4.4.0", + "@existdb/gulp-replace-tmpl": "^1.0.4", "@semantic-release/exec": "^5.0.0", "@semantic-release/git": "^9.0.0", "@semantic-release/github": "^7.2.0", @@ -207,6 +210,24 @@ "xmlrpc": "^1.3.1" } }, + "node_modules/@jinntec/fore": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jinntec/fore/-/fore-1.5.0.tgz", + "integrity": "sha512-DABf6IFaBed3WTtdzVMbf4uazQYbay10lmIX+RVN5WPoQh+NWAj8mw9kO8FY+UO+YB+1e6xxfD6bIr6nOS9iUA==", + "dependencies": { + "@jinntec/jinn-toast": "^1.0.4", + "fontoxpath": "^3.27.1" + } + }, + "node_modules/@jinntec/jinn-toast": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@jinntec/jinn-toast/-/jinn-toast-1.0.5.tgz", + "integrity": "sha512-FVZsDUXS7wzXyl6s1oj0UwCtZ/fBn+T/GPSXxZ9eYBKVhgWUrLqrLDO7zeWuS/0D3/BrTiuTNcnk0d+c4nCKyw==", + "dependencies": { + "lit-html": "^1.4.1", + "toastify-js": "^1.11.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3379,6 +3400,15 @@ } } }, + "node_modules/fontoxpath": { + "version": "3.30.1", + "resolved": "https://registry.npmjs.org/fontoxpath/-/fontoxpath-3.30.1.tgz", + "integrity": "sha512-prYHbxMwhLrhlpcSYuKxkHxcCV84W/Eo16nyZ/oVVBI7Pq1p1RMOTaIrz2m35yIfgr/bRVW9Ng8fMRVnJ9HriQ==", + "dependencies": { + "prsc": "4.0.0", + "xspattern": "^3.1.0" + } + }, "node_modules/for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -5435,6 +5465,11 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/lit-html": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.4.1.tgz", + "integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==" + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -10275,6 +10310,11 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "node_modules/prsc": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/prsc/-/prsc-4.0.0.tgz", + "integrity": "sha512-OmXQ2v76RlXNx/gqv7+oB6jyKnudJ/rsMfAIVexhbDFxXAJPoWKMxJkZU2ohlu4miCiSQCG+horf2DV4/kNc1Q==" + }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -12391,6 +12431,11 @@ "xtend": "~4.0.1" } }, + "node_modules/toastify-js": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.12.0.tgz", + "integrity": "sha512-HeMHCO9yLPvP9k0apGSdPUWrUbLnxUKNFzgUoZp1PHCLploIX/4DSQ7V8H25ef+h4iO9n0he7ImfcndnN6nDrQ==" + }, "node_modules/tough-cookie": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", @@ -13016,6 +13061,11 @@ "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==", "dev": true }, + "node_modules/whynot": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whynot/-/whynot-5.0.0.tgz", + "integrity": "sha512-cGGfDPYYqoHoMWqXVc3G+N74u1FhFhrBa+pOO906b9ktRc/JFUdwroTkfPqjKzyoCLVcKr6yy6bYIcWT7jTg2A==" + }, "node_modules/wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -13211,6 +13261,14 @@ "npm": ">=1.0.0" } }, + "node_modules/xspattern": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/xspattern/-/xspattern-3.1.0.tgz", + "integrity": "sha512-rxtOX8ORJizRqswIdZ72G3thKrHd0Q+TvyUCMByc5VdjDz1nkuZKfPXM3xGdrGi0fwEy+DDJN7DqtAZ06Re4bA==", + "dependencies": { + "whynot": "^5.0.0" + } + }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -13700,6 +13758,24 @@ "xmlrpc": "^1.3.1" } }, + "@jinntec/fore": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jinntec/fore/-/fore-1.5.0.tgz", + "integrity": "sha512-DABf6IFaBed3WTtdzVMbf4uazQYbay10lmIX+RVN5WPoQh+NWAj8mw9kO8FY+UO+YB+1e6xxfD6bIr6nOS9iUA==", + "requires": { + "@jinntec/jinn-toast": "^1.0.4", + "fontoxpath": "^3.27.1" + } + }, + "@jinntec/jinn-toast": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@jinntec/jinn-toast/-/jinn-toast-1.0.5.tgz", + "integrity": "sha512-FVZsDUXS7wzXyl6s1oj0UwCtZ/fBn+T/GPSXxZ9eYBKVhgWUrLqrLDO7zeWuS/0D3/BrTiuTNcnk0d+c4nCKyw==", + "requires": { + "lit-html": "^1.4.1", + "toastify-js": "^1.11.0" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -16233,6 +16309,15 @@ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "dev": true }, + "fontoxpath": { + "version": "3.30.1", + "resolved": "https://registry.npmjs.org/fontoxpath/-/fontoxpath-3.30.1.tgz", + "integrity": "sha512-prYHbxMwhLrhlpcSYuKxkHxcCV84W/Eo16nyZ/oVVBI7Pq1p1RMOTaIrz2m35yIfgr/bRVW9Ng8fMRVnJ9HriQ==", + "requires": { + "prsc": "4.0.0", + "xspattern": "^3.1.0" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -17868,6 +17953,11 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "lit-html": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.4.1.tgz", + "integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==" + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -21457,6 +21547,11 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "prsc": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/prsc/-/prsc-4.0.0.tgz", + "integrity": "sha512-OmXQ2v76RlXNx/gqv7+oB6jyKnudJ/rsMfAIVexhbDFxXAJPoWKMxJkZU2ohlu4miCiSQCG+horf2DV4/kNc1Q==" + }, "psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -23160,6 +23255,11 @@ } } }, + "toastify-js": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.12.0.tgz", + "integrity": "sha512-HeMHCO9yLPvP9k0apGSdPUWrUbLnxUKNFzgUoZp1PHCLploIX/4DSQ7V8H25ef+h4iO9n0he7ImfcndnN6nDrQ==" + }, "tough-cookie": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", @@ -23690,6 +23790,11 @@ "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==", "dev": true }, + "whynot": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whynot/-/whynot-5.0.0.tgz", + "integrity": "sha512-cGGfDPYYqoHoMWqXVc3G+N74u1FhFhrBa+pOO906b9ktRc/JFUdwroTkfPqjKzyoCLVcKr6yy6bYIcWT7jTg2A==" + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -23838,6 +23943,14 @@ "xmlbuilder": "8.2.x" } }, + "xspattern": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/xspattern/-/xspattern-3.1.0.tgz", + "integrity": "sha512-rxtOX8ORJizRqswIdZ72G3thKrHd0Q+TvyUCMByc5VdjDz1nkuZKfPXM3xGdrGi0fwEy+DDJN7DqtAZ06Re4bA==", + "requires": { + "whynot": "^5.0.0" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 3876e61..00cddbd 100644 --- a/package.json +++ b/package.json @@ -40,5 +40,8 @@ "mocha": { "timeout": 10000, "slow": 1000 + }, + "dependencies": { + "@jinntec/fore": "^1.5.0" } } diff --git a/src/index.html b/src/index.html index d5ad0db..218ed4d 100644 --- a/src/index.html +++ b/src/index.html @@ -209,7 +209,7 @@

Git Repositories

- + \ No newline at end of file diff --git a/src/resources/css/fore.css b/src/resources/css/fore.css deleted file mode 100644 index bfc4351..0000000 --- a/src/resources/css/fore.css +++ /dev/null @@ -1,86 +0,0 @@ -@import 'toastify.css'; -[unresolved]{ - display: none; -} -[disabled] { - pointer-events: none; - cursor: default; -} -fx-trigger a[disabled] { - color:lightgrey; -} -fx-trigger img[disabled]{ - filter:blur(2px); -} - -.error{ - background: var(--paper-red-500); -} -fx-alert{ - color:darkred; - font-size: 0.9rem; -} - -fx-model, fx-model *, fx-model ::slotted(fx-instance), fx-instance{ - display:none; -} - -fx-control, fx-trigger{ - white-space: nowrap; - position: relative; -} -fx-hint{ - display: none; -} -fx-repeatitem{ - position:relative; - /* - opacity:1; - -webkit-transition: opacity 3s; - -moz-transition: opacity 3s; - transition: opacity 3s; - */ -} -.hidden { - visibility: hidden; - opacity: 0; - transition: visibility 0s 2s, opacity 2s linear; -} -/* -.visible { - visibility: visible; - opacity: 1; - transition: opacity 2s linear; -} -*/ - -.required:after { - content: '*'; - color: red; - padding-left: 4px; - right:3px; - top:3px; - z-index: 1; -} - -[required]:after { - content: "*"; - display: inline; - color: red; -} -.logtree details{ - padding:0.1rem 1rem; - margin:0; -} -.logtree details summary{ - -} -.non-relevant{ - opacity: 0; - height: 0; - transition: opacity 1s; -} -.vertical label{ - display: block; -} - diff --git a/src/resources/css/toastify.css b/src/resources/css/toastify.css deleted file mode 100644 index 9c86c48..0000000 --- a/src/resources/css/toastify.css +++ /dev/null @@ -1,85 +0,0 @@ -/*! - * Toastify js 1.11.0 - * https://github.com/apvarun/toastify-js - * @license MIT licensed - * - * Copyright (C) 2018 Varun A P - */ - -.toastify { - padding: 12px 20px; - color: #ffffff; - display: inline-block; - box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3); - background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5); - background: linear-gradient(135deg, #73a5ff, #5477f5); - position: fixed; - opacity: 0; - transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); - border-radius: 2px; - cursor: pointer; - text-decoration: none; - max-width: calc(50% - 20px); - z-index: 2147483647; -} - -.toastify.on { - opacity: 1; -} - -.toast-close { - opacity: 0.8; - padding: 0 5px; -} - -.toastify-right { - right: 15px; -} -.toastify-right .toast-close { - margin-right:-10px; -} - -.toastify-left { - left: 15px; -} -.toastify-left .toast-close{ - margin-left:-10px; -} - -.toastify-top { - top: -150px; -} - -.toastify-bottom { - bottom: -150px; -} - -.toastify-rounded { - border-radius: 25px; -} - -.toastify-avatar { - width: 1.5em; - height: 1.5em; - margin: -7px 5px; - border-radius: 2px; -} - -.toastify-center { - margin-left: auto; - margin-right: auto; - left: 0; - right: 0; - max-width: fit-content; - max-width: -moz-fit-content; -} - -@media only screen and (max-width: 360px) { - .toastify-right, .toastify-left { - margin-left: auto; - margin-right: auto; - left: 0; - right: 0; - max-width: fit-content; - } -} diff --git a/src/resources/css/vars.css b/src/resources/css/vars.css deleted file mode 100644 index 2f7a1d1..0000000 --- a/src/resources/css/vars.css +++ /dev/null @@ -1,320 +0,0 @@ -/* Material Design color palette for Google products */ -html { - --google-red-100: #f4c7c3; - --google-red-300: #e67c73; - --google-red-500: #db4437; - --google-red-700: #c53929; - - --google-blue-100: #c6dafc; - --google-blue-300: #7baaf7; - --google-blue-500: #4285f4; - --google-blue-700: #3367d6; - - --google-green-100: #b7e1cd; - --google-green-300: #57bb8a; - --google-green-500: #0f9d58; - --google-green-700: #0b8043; - - --google-yellow-100: #fce8b2; - --google-yellow-300: #f7cb4d; - --google-yellow-500: #f4b400; - --google-yellow-700: #f09300; - - --google-grey-100: #f5f5f5; - --google-grey-300: #e0e0e0; - --google-grey-500: #9e9e9e; - --google-grey-700: #616161; - - /* Material Design color palette from online spec document */ - - --paper-red-50: #ffebee; - --paper-red-100: #ffcdd2; - --paper-red-200: #ef9a9a; - --paper-red-300: #e57373; - --paper-red-400: #ef5350; - --paper-red-500: #f44336; - --paper-red-600: #e53935; - --paper-red-700: #d32f2f; - --paper-red-800: #c62828; - --paper-red-900: #b71c1c; - --paper-red-a100: #ff8a80; - --paper-red-a200: #ff5252; - --paper-red-a400: #ff1744; - --paper-red-a700: #d50000; - - --paper-pink-50: #fce4ec; - --paper-pink-100: #f8bbd0; - --paper-pink-200: #f48fb1; - --paper-pink-300: #f06292; - --paper-pink-400: #ec407a; - --paper-pink-500: #e91e63; - --paper-pink-600: #d81b60; - --paper-pink-700: #c2185b; - --paper-pink-800: #ad1457; - --paper-pink-900: #880e4f; - --paper-pink-a100: #ff80ab; - --paper-pink-a200: #ff4081; - --paper-pink-a400: #f50057; - --paper-pink-a700: #c51162; - - --paper-purple-50: #f3e5f5; - --paper-purple-100: #e1bee7; - --paper-purple-200: #ce93d8; - --paper-purple-300: #ba68c8; - --paper-purple-400: #ab47bc; - --paper-purple-500: #9c27b0; - --paper-purple-600: #8e24aa; - --paper-purple-700: #7b1fa2; - --paper-purple-800: #6a1b9a; - --paper-purple-900: #4a148c; - --paper-purple-a100: #ea80fc; - --paper-purple-a200: #e040fb; - --paper-purple-a400: #d500f9; - --paper-purple-a700: #aa00ff; - - --paper-deep-purple-50: #ede7f6; - --paper-deep-purple-100: #d1c4e9; - --paper-deep-purple-200: #b39ddb; - --paper-deep-purple-300: #9575cd; - --paper-deep-purple-400: #7e57c2; - --paper-deep-purple-500: #673ab7; - --paper-deep-purple-600: #5e35b1; - --paper-deep-purple-700: #512da8; - --paper-deep-purple-800: #4527a0; - --paper-deep-purple-900: #311b92; - --paper-deep-purple-a100: #b388ff; - --paper-deep-purple-a200: #7c4dff; - --paper-deep-purple-a400: #651fff; - --paper-deep-purple-a700: #6200ea; - - --paper-indigo-50: #e8eaf6; - --paper-indigo-100: #c5cae9; - --paper-indigo-200: #9fa8da; - --paper-indigo-300: #7986cb; - --paper-indigo-400: #5c6bc0; - --paper-indigo-500: #3f51b5; - --paper-indigo-600: #3949ab; - --paper-indigo-700: #303f9f; - --paper-indigo-800: #283593; - --paper-indigo-900: #1a237e; - --paper-indigo-a100: #8c9eff; - --paper-indigo-a200: #536dfe; - --paper-indigo-a400: #3d5afe; - --paper-indigo-a700: #304ffe; - - --paper-blue-50: #e3f2fd; - --paper-blue-100: #bbdefb; - --paper-blue-200: #90caf9; - --paper-blue-300: #64b5f6; - --paper-blue-400: #42a5f5; - --paper-blue-500: #2196f3; - --paper-blue-600: #1e88e5; - --paper-blue-700: #1976d2; - --paper-blue-800: #1565c0; - --paper-blue-900: #0d47a1; - --paper-blue-a100: #82b1ff; - --paper-blue-a200: #448aff; - --paper-blue-a400: #2979ff; - --paper-blue-a700: #2962ff; - - --paper-light-blue-50: #e1f5fe; - --paper-light-blue-100: #b3e5fc; - --paper-light-blue-200: #81d4fa; - --paper-light-blue-300: #4fc3f7; - --paper-light-blue-400: #29b6f6; - --paper-light-blue-500: #03a9f4; - --paper-light-blue-600: #039be5; - --paper-light-blue-700: #0288d1; - --paper-light-blue-800: #0277bd; - --paper-light-blue-900: #01579b; - --paper-light-blue-a100: #80d8ff; - --paper-light-blue-a200: #40c4ff; - --paper-light-blue-a400: #00b0ff; - --paper-light-blue-a700: #0091ea; - - --paper-cyan-50: #e0f7fa; - --paper-cyan-100: #b2ebf2; - --paper-cyan-200: #80deea; - --paper-cyan-300: #4dd0e1; - --paper-cyan-400: #26c6da; - --paper-cyan-500: #00bcd4; - --paper-cyan-600: #00acc1; - --paper-cyan-700: #0097a7; - --paper-cyan-800: #00838f; - --paper-cyan-900: #006064; - --paper-cyan-a100: #84ffff; - --paper-cyan-a200: #18ffff; - --paper-cyan-a400: #00e5ff; - --paper-cyan-a700: #00b8d4; - - --paper-teal-50: #e0f2f1; - --paper-teal-100: #b2dfdb; - --paper-teal-200: #80cbc4; - --paper-teal-300: #4db6ac; - --paper-teal-400: #26a69a; - --paper-teal-500: #009688; - --paper-teal-600: #00897b; - --paper-teal-700: #00796b; - --paper-teal-800: #00695c; - --paper-teal-900: #004d40; - --paper-teal-a100: #a7ffeb; - --paper-teal-a200: #64ffda; - --paper-teal-a400: #1de9b6; - --paper-teal-a700: #00bfa5; - - --paper-green-50: #e8f5e9; - --paper-green-100: #c8e6c9; - --paper-green-200: #a5d6a7; - --paper-green-300: #81c784; - --paper-green-400: #66bb6a; - --paper-green-500: #4caf50; - --paper-green-600: #43a047; - --paper-green-700: #388e3c; - --paper-green-800: #2e7d32; - --paper-green-900: #1b5e20; - --paper-green-a100: #b9f6ca; - --paper-green-a200: #69f0ae; - --paper-green-a400: #00e676; - --paper-green-a700: #00c853; - - --paper-light-green-50: #f1f8e9; - --paper-light-green-100: #dcedc8; - --paper-light-green-200: #c5e1a5; - --paper-light-green-300: #aed581; - --paper-light-green-400: #9ccc65; - --paper-light-green-500: #8bc34a; - --paper-light-green-600: #7cb342; - --paper-light-green-700: #689f38; - --paper-light-green-800: #558b2f; - --paper-light-green-900: #33691e; - --paper-light-green-a100: #ccff90; - --paper-light-green-a200: #b2ff59; - --paper-light-green-a400: #76ff03; - --paper-light-green-a700: #64dd17; - - --paper-lime-50: #f9fbe7; - --paper-lime-100: #f0f4c3; - --paper-lime-200: #e6ee9c; - --paper-lime-300: #dce775; - --paper-lime-400: #d4e157; - --paper-lime-500: #cddc39; - --paper-lime-600: #c0ca33; - --paper-lime-700: #afb42b; - --paper-lime-800: #9e9d24; - --paper-lime-900: #827717; - --paper-lime-a100: #f4ff81; - --paper-lime-a200: #eeff41; - --paper-lime-a400: #c6ff00; - --paper-lime-a700: #aeea00; - - --paper-yellow-50: #fffde7; - --paper-yellow-100: #fff9c4; - --paper-yellow-200: #fff59d; - --paper-yellow-300: #fff176; - --paper-yellow-400: #ffee58; - --paper-yellow-500: #ffeb3b; - --paper-yellow-600: #fdd835; - --paper-yellow-700: #fbc02d; - --paper-yellow-800: #f9a825; - --paper-yellow-900: #f57f17; - --paper-yellow-a100: #ffff8d; - --paper-yellow-a200: #ffff00; - --paper-yellow-a400: #ffea00; - --paper-yellow-a700: #ffd600; - - --paper-amber-50: #fff8e1; - --paper-amber-100: #ffecb3; - --paper-amber-200: #ffe082; - --paper-amber-300: #ffd54f; - --paper-amber-400: #ffca28; - --paper-amber-500: #ffc107; - --paper-amber-600: #ffb300; - --paper-amber-700: #ffa000; - --paper-amber-800: #ff8f00; - --paper-amber-900: #ff6f00; - --paper-amber-a100: #ffe57f; - --paper-amber-a200: #ffd740; - --paper-amber-a400: #ffc400; - --paper-amber-a700: #ffab00; - - --paper-orange-50: #fff3e0; - --paper-orange-100: #ffe0b2; - --paper-orange-200: #ffcc80; - --paper-orange-300: #ffb74d; - --paper-orange-400: #ffa726; - --paper-orange-500: #ff9800; - --paper-orange-600: #fb8c00; - --paper-orange-700: #f57c00; - --paper-orange-800: #ef6c00; - --paper-orange-900: #e65100; - --paper-orange-a100: #ffd180; - --paper-orange-a200: #ffab40; - --paper-orange-a400: #ff9100; - --paper-orange-a700: #ff6500; - - --paper-deep-orange-50: #fbe9e7; - --paper-deep-orange-100: #ffccbc; - --paper-deep-orange-200: #ffab91; - --paper-deep-orange-300: #ff8a65; - --paper-deep-orange-400: #ff7043; - --paper-deep-orange-500: #ff5722; - --paper-deep-orange-600: #f4511e; - --paper-deep-orange-700: #e64a19; - --paper-deep-orange-800: #d84315; - --paper-deep-orange-900: #bf360c; - --paper-deep-orange-a100: #ff9e80; - --paper-deep-orange-a200: #ff6e40; - --paper-deep-orange-a400: #ff3d00; - --paper-deep-orange-a700: #dd2c00; - - --paper-brown-50: #efebe9; - --paper-brown-100: #d7ccc8; - --paper-brown-200: #bcaaa4; - --paper-brown-300: #a1887f; - --paper-brown-400: #8d6e63; - --paper-brown-500: #795548; - --paper-brown-600: #6d4c41; - --paper-brown-700: #5d4037; - --paper-brown-800: #4e342e; - --paper-brown-900: #3e2723; - - --paper-grey-50: #fafafa; - --paper-grey-100: #f5f5f5; - --paper-grey-200: #eeeeee; - --paper-grey-300: #e0e0e0; - --paper-grey-400: #bdbdbd; - --paper-grey-500: #9e9e9e; - --paper-grey-600: #757575; - --paper-grey-700: #616161; - --paper-grey-800: #424242; - --paper-grey-900: #212121; - - --paper-blue-grey-50: #eceff1; - --paper-blue-grey-100: #cfd8dc; - --paper-blue-grey-200: #b0bec5; - --paper-blue-grey-300: #90a4ae; - --paper-blue-grey-400: #78909c; - --paper-blue-grey-500: #607d8b; - --paper-blue-grey-600: #546e7a; - --paper-blue-grey-700: #455a64; - --paper-blue-grey-800: #37474f; - --paper-blue-grey-900: #263238; - - /* opacity for dark text on a light background */ - --dark-divider-opacity: 0.12; - --dark-disabled-opacity: 0.38; /* or hint text or icon */ - --dark-secondary-opacity: 0.54; - --dark-primary-opacity: 0.87; - - /* opacity for light text on a dark background */ - --light-divider-opacity: 0.12; - --light-disabled-opacity: 0.3; /* or hint text or icon */ - --light-secondary-opacity: 0.7; - --light-primary-opacity: 1.0; - - - /* model element styles for debugging */ - --model-element-padding:10px; - --model-element-margin:10px; -} - diff --git a/src/resources/js/fore-all.js b/src/resources/js/fore-all.js deleted file mode 100644 index f3487c9..0000000 --- a/src/resources/js/fore-all.js +++ /dev/null @@ -1,140 +0,0 @@ -function e(e,t,n,r){const a={op:t,func:n,data:r};return e.push(a),a}function t(e,t){return e}class n{constructor(){this.program=[]}test(t,n){return e(this.program,5,t,void 0===n?null:n)}jump(t){return e(this.program,3,null,t)}record(n,r){return e(this.program,4,void 0===r?t:r,n)}bad(t=1){return e(this.program,1,null,t)}accept(){return e(this.program,0,null,null)}fail(t){return e(this.program,2,t||null,null)}}class r{constructor(e,t,n){this.programLength=e,this.maxFromByPc=t,this.maxSurvivorFromByPc=n}static fromProgram(e){const t=e.length,n=[],a=[];return e.forEach(e=>{n.push(0),a.push(0)}),e.forEach((e,r)=>{switch(e.op){case 2:if(null===e.func)return;if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 1:case 4:if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 3:e.data.forEach(e=>{if(e<0||e>=t)throw new Error("Invalid program: program could run past end");n[e]+=1});break;case 5:if(r+1>=t)throw new Error("Invalid program: program could run past end");a[r+1]+=1;break;case 0:a[r]+=1}}),new r(t,n,a)}static createStub(e){const t=[],n=[];for(let r=0;r0}}class o{constructor(e){this.t=0,this.i=0,this.h=new Uint16Array(e),this.l=new Uint8Array(e)}getBadness(e){return this.l[e]}add(e,t){this.l[e]=t>255?255:t;const n=function(e,t,n,r,a){let o=r,i=a;for(;o>>1;n255?255:t);if(this.l[e]!==n){const t=this.h.indexOf(e,this.i);if(t<0||t>=this.t)return void(this.l[e]=n);this.h.copyWithin(t,t+1,this.t),this.t-=1,this.add(e,n)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class i{constructor(e){this.o=[];let t=e.length;e.forEach(e=>{this.o.push(e>0?t:-1),t+=e}),this.u=new Uint16Array(t)}clear(){this.u.fill(0,0,this.o.length)}add(e,t){const n=this.u[t],r=this.o[t];this.u[t]+=1,this.u[r+n]=e}has(e){return this.u[e]>0}forEach(e,t){const n=this.u[e],r=this.o[e];for(let e=r;e{const n=this.trace(t,r,a,o);var u,c,l;c=n,l=i,e=null===(u=e)?c:null===c?u:Array.isArray(c)?c.reduce((e,t)=>s(e,t,e===c),u):s(u,c,l),i=e===n}),e}trace(e,t,n,r){switch(this.p[e]){case 2:return this.v[e];case 1:return null}this.p[e]=1;let a=null;const o=t[e];if(null!==o)a=o;else if(!n.has(e))throw new Error("Trace without source at pc "+e);if(a=this.mergeTraces(a,e,n,t,n,r),null!==a){const t=r[e];null!==t&&(a=c(a,t))}return this.v[e]=a,this.p[e]=2,a}buildSurvivorTraces(e,t,n,r,a){for(let o=0,i=e.length;os(e,this.k[t]),null);return null===t?[]:Array.isArray(t)?t:[t]}}class h{constructor(e){this.I=[],this.N=new o(e.programLength),this.M=new o(e.programLength),this.P=new p(e)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(e,t,n){const r=this.P.has(t);this.P.add(e,t);const a=this.N.getBadness(e)+n;r?this.N.reschedule(t,a):this.N.add(t,a)}stepToNextGeneration(e,t){const n=this.P.hasSurvivor(t);this.P.addSurvivor(e,t);const r=this.N.getBadness(e);n?this.M.reschedule(t,r):this.M.add(t,r)}accept(e){this.I.push(e),this.P.addSurvivor(e,e)}fail(e){}record(e,t){this.P.record(e,t)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const e=this.N;e.reset(),this.N=this.M,this.M=e}getAcceptingTraces(){return this.P.getTraces(this.I)}}class f{constructor(e){this.U=[],this.G=e,this.V=r.fromProgram(e),this.U.push(new h(this.V))}execute(e,t){const n=this.U.pop()||new h(this.V);n.reset();const r=e.length;let o,i=-1;do{let a=n.getNextThreadPc();if(null===a)break;for(++i,o=i>=r?null:e[i];null!==a;){const e=this.G[a];switch(e.op){case 0:null===o?n.accept(a):n.fail(a);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(a);break}n.step(a,a+1,0);break}case 1:n.step(a,a+1,e.data);break;case 5:if(null===o){n.fail(a);break}if(!(0,e.func)(o,e.data,t)){n.fail(a);break}n.stepToNextGeneration(a,a+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(a);break}for(let e=0;et===e}function m(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(te<=n&&n<=t}function g(e){return!0}function y(){return!1}function v(e,t){return n=>e(n)||t(n)}function w(e,t){switch(t.kind){case"predicate":return void e.test(t.value);case"regexp":return void x(e,t.value,!1)}}function x(e,t,n){const r=e.program.length,a=e.jump([]);n&&(a.data.push(e.program.length),e.test(()=>!0),e.jump([r]));const o=[];if(t.forEach(t=>{a.data.push(e.program.length),function(e,t){t.forEach(t=>{!function(e,t){const[n,{min:r,max:a}]=t;if(null!==a){for(let t=0;t0){for(let t=0;t{t.data.push(e.program.length)}),n){const t=e.program.length,n=e.jump([]);n.data.push(e.program.length),e.test(()=>!0),e.jump([t]),n.data.push(e.program.length)}}function A(e,t){return{success:!0,offset:e,value:t}}function b(e){return A(e,void 0)}function E(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function N(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?A(r,e):E(n,[e])}}function B(e,t){return(n,r)=>{const a=e(n,r);return a.success?A(a.offset,t(a.value)):a}}function T(e,t,n){return(r,a)=>{const o=e(r,a);return o.success?t(o.value)?o:E(a,n):o.offset===a?E(a,n):o}}function I(e){return(t,n)=>{let r=null;for(const a of e){const e=a(t,n);if(e.success)return e;if(null===r||e.offset>r.offset?r=e:e.offset===r.offset&&(r.expected=r.expected.concat(e.expected)),e.fatal)break}return r||E(n,[])}}function C(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:A(n,null)}}function S(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}r.push(n.value),a=n.offset}return A(a,r)}}function O(e,t,n){return(r,a)=>{const o=e(r,a);if(!o.success)return o;const i=t(r,o.offset);return i.success?A(i.offset,n(o.value,i.value)):i}}function R(e){return O(e,S(e),(e,t)=>[e].concat(t))}function D(e,t){return e}function U(e,t){return t}function M(e,t){return O(e,t,U)}function G(e,t){return O(e,t,D)}function k(e,t,n,r=!1){return M(e,r?P(G(t,n)):G(t,n))}function F(e,t){return(n,r)=>e(n,r).success?E(r,t):b(r)}function P(e){return(t,n)=>{const r=e(t,n);return r.success?r:E(r.offset,r.expected,!0)}}const H=(e,t)=>e.length===t?b(t):E(t,["end of input"]),j=["Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Zs","Zl","Zp","Sm","Sc","Sk","So","Cc","Cf","Co","Cn"],X={};function _(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach((e,t)=>{X[e]=t});const L=e=>-1===e||-2===e;function V(e){return t=>!L(t)&&!e(t)}function Y(e,t){return null===t?e:n=>e(n)&&!t(n)}const q=function(e,t){const n=new Map;let r=0;return["BasicLatin","Latin-1Supplement","LatinExtended-A","LatinExtended-B","IPAExtensions","SpacingModifierLetters","CombiningDiacriticalMarks","GreekandCoptic|Greek","Cyrillic","CyrillicSupplement","Armenian","Hebrew","Arabic","Syriac","ArabicSupplement","Thaana","NKo","Samaritan","Mandaic","SyriacSupplement",null,"ArabicExtended-A","Devanagari","Bengali","Gurmukhi","Gujarati","Oriya","Tamil","Telugu","Kannada","Malayalam","Sinhala","Thai","Lao","Tibetan","Myanmar","Georgian","HangulJamo","Ethiopic","EthiopicSupplement","Cherokee","UnifiedCanadianAboriginalSyllabics","Ogham","Runic","Tagalog","Hanunoo","Buhid","Tagbanwa","Khmer","Mongolian","UnifiedCanadianAboriginalSyllabicsExtended","Limbu","TaiLe","NewTaiLue","KhmerSymbols","Buginese","TaiTham","CombiningDiacriticalMarksExtended","Balinese","Sundanese","Batak","Lepcha","OlChiki","CyrillicExtended-C","GeorgianExtended","SundaneseSupplement","VedicExtensions","PhoneticExtensions","PhoneticExtensionsSupplement","CombiningDiacriticalMarksSupplement","LatinExtendedAdditional","GreekExtended","GeneralPunctuation","SuperscriptsandSubscripts","CurrencySymbols","CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols","LetterlikeSymbols","NumberForms","Arrows","MathematicalOperators","MiscellaneousTechnical","ControlPictures","OpticalCharacterRecognition","EnclosedAlphanumerics","BoxDrawing","BlockElements","GeometricShapes","MiscellaneousSymbols","Dingbats","MiscellaneousMathematicalSymbols-A","SupplementalArrows-A","BraillePatterns","SupplementalArrows-B","MiscellaneousMathematicalSymbols-B","SupplementalMathematicalOperators","MiscellaneousSymbolsandArrows","Glagolitic","LatinExtended-C","Coptic","GeorgianSupplement","Tifinagh","EthiopicExtended","CyrillicExtended-A","SupplementalPunctuation","CJKRadicalsSupplement","KangxiRadicals",null,"IdeographicDescriptionCharacters","CJKSymbolsandPunctuation","Hiragana","Katakana","Bopomofo","HangulCompatibilityJamo","Kanbun","BopomofoExtended","CJKStrokes","KatakanaPhoneticExtensions","EnclosedCJKLettersandMonths","CJKCompatibility","CJKUnifiedIdeographsExtensionA","YijingHexagramSymbols","CJKUnifiedIdeographs","YiSyllables","YiRadicals","Lisu","Vai","CyrillicExtended-B","Bamum","ModifierToneLetters","LatinExtended-D","SylotiNagri","CommonIndicNumberForms","Phags-pa","Saurashtra","DevanagariExtended","KayahLi","Rejang","HangulJamoExtended-A","Javanese","MyanmarExtended-B","Cham","MyanmarExtended-A","TaiViet","MeeteiMayekExtensions","EthiopicExtended-A","LatinExtended-E","CherokeeSupplement","MeeteiMayek","HangulSyllables","HangulJamoExtended-B","HighSurrogates","HighPrivateUseSurrogates","LowSurrogates","PrivateUseArea|PrivateUse","CJKCompatibilityIdeographs","AlphabeticPresentationForms","ArabicPresentationForms-A","VariationSelectors","VerticalForms","CombiningHalfMarks","CJKCompatibilityForms","SmallFormVariants","ArabicPresentationForms-B","HalfwidthandFullwidthForms","Specials","LinearBSyllabary","LinearBIdeograms","AegeanNumbers","AncientGreekNumbers","AncientSymbols","PhaistosDisc",null,"Lycian","Carian","CopticEpactNumbers","OldItalic","Gothic","OldPermic","Ugaritic","OldPersian",null,"Deseret","Shavian","Osmanya","Osage","Elbasan","CaucasianAlbanian",null,"LinearA",null,"CypriotSyllabary","ImperialAramaic","Palmyrene","Nabataean",null,"Hatran","Phoenician","Lydian",null,"MeroiticHieroglyphs","MeroiticCursive","Kharoshthi","OldSouthArabian","OldNorthArabian",null,"Manichaean","Avestan","InscriptionalParthian","InscriptionalPahlavi","PsalterPahlavi",null,"OldTurkic",null,"OldHungarian","HanifiRohingya",null,"RumiNumeralSymbols",null,"OldSogdian","Sogdian",null,"Elymaic","Brahmi","Kaithi","SoraSompeng","Chakma","Mahajani","Sharada","SinhalaArchaicNumbers","Khojki",null,"Multani","Khudawadi","Grantha",null,"Newa","Tirhuta",null,"Siddham","Modi","MongolianSupplement","Takri",null,"Ahom",null,"Dogra",null,"WarangCiti",null,"Nandinagari","ZanabazarSquare","Soyombo",null,"PauCinHau",null,"Bhaiksuki","Marchen",null,"MasaramGondi","GunjalaGondi",null,"Makasar",null,"TamilSupplement","Cuneiform","CuneiformNumbersandPunctuation","EarlyDynasticCuneiform",null,"EgyptianHieroglyphs","EgyptianHieroglyphFormatControls",null,"AnatolianHieroglyphs",null,"BamumSupplement","Mro",null,"BassaVah","PahawhHmong",null,"Medefaidrin",null,"Miao",null,"IdeographicSymbolsandPunctuation","Tangut","TangutComponents",null,"KanaSupplement","KanaExtended-A","SmallKanaExtension","Nushu",null,"Duployan","ShorthandFormatControls",null,"ByzantineMusicalSymbols","MusicalSymbols","AncientGreekMusicalNotation",null,"MayanNumerals","TaiXuanJingSymbols","CountingRodNumerals",null,"MathematicalAlphanumericSymbols","SuttonSignWriting",null,"GlagoliticSupplement",null,"NyiakengPuachueHmong",null,"Wancho",null,"MendeKikakui",null,"Adlam",null,"IndicSiyaqNumbers",null,"OttomanSiyaqNumbers",null,"ArabicMathematicalAlphabeticSymbols",null,"MahjongTiles","DominoTiles","PlayingCards","EnclosedAlphanumericSupplement","EnclosedIdeographicSupplement","MiscellaneousSymbolsandPictographs","Emoticons","OrnamentalDingbats","TransportandMapSymbols","AlchemicalSymbols","GeometricShapesExtended","SupplementalArrows-C","SupplementalSymbolsandPictographs","ChessSymbols","SymbolsandPictographsExtended-A",null,"CJKUnifiedIdeographsExtensionB",null,"CJKUnifiedIdeographsExtensionC","CJKUnifiedIdeographsExtensionD","CJKUnifiedIdeographsExtensionE","CJKUnifiedIdeographsExtensionF",null,"CJKCompatibilityIdeographsSupplement",null,"Tags",null,"VariationSelectorsSupplement",null,"SupplementaryPrivateUseArea-A|PrivateUse","SupplementaryPrivateUseArea-B|PrivateUse"].forEach((e,a)=>{const o=t[a];null!==e&&e.split("|").forEach(e=>{const t=n.get(e),a=m(r,r+o-1);n.set(e,t?v(t,a):a)}),r+=o}),n}(0,[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),Q=function(e){const t=new Map,n="bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA".split(""),r=j.map(()=>[]);let a=0,o=0;for(;o{const a=r[n].reduce(v,y);t.set(e,a);const o=e.charAt(0),s=i.get(o)||[];i.set(o,s),s.push(a)}),i.forEach((e,n)=>{t.set(n,e.reduce(v,y))}),t}();function J(e){return 32===e||9===e||10===e||13===e}const K=[d(_(":")),m(_("A"),_("Z")),d(_("_")),m(_("a"),_("z")),m(192,214),m(216,246),m(192,214),m(216,246),m(248,767),m(880,893),m(895,8191),m(8204,8205),m(8304,8591),m(11264,12271),m(12289,55295),m(63744,64975),m(65008,65533),m(65536,983039)].reduce(v),z=[K,d(_("-")),d(_(".")),m(_("0"),_("9")),d(183),m(768,879),m(8255,8256)].reduce(v),W=Q.get("Nd"),$=V(W),Z=Y(m(0,1114111),[Q.get("P"),Q.get("Z"),Q.get("C")].reduce(v)),ee=V(Z);function te(e){return 10!==e&&13!==e&&!L(e)}const ne={s:J,S:V(J),i:K,I:V(K),c:z,C:V(z),d:W,D:$,w:Z,W:ee},re=N("*"),ae=N("\\"),oe=N("{"),ie=N("}"),se=N("["),ue=N("]"),ce=N("^"),le=N("$"),pe=N(","),he=N("-"),fe=N("("),de=N(")"),me=N("."),ge=N("|"),ye=N("+"),ve=N("?"),we=N("-["),xe=_("0");function Ae(e){function t(e){return new Set(e.split("").map(e=>_(e)))}function n(e,t){const n=e.codePointAt(t);return void 0===n?E(t,["any character"]):A(t+String.fromCodePoint(n).length,n)}const r="xpath"===e.language?M(ae,I([B(N("n"),()=>10),B(N("r"),()=>13),B(N("t"),()=>9),B(I([ae,ge,me,he,ce,ve,re,ye,oe,ie,le,fe,de,se,ue]),e=>_(e))])):M(ae,I([B(N("n"),()=>10),B(N("r"),()=>13),B(N("t"),()=>9),B(I([ae,ge,me,he,ce,ve,re,ye,oe,ie,fe,de,se,ue]),e=>_(e))]));function a(e,r){const a=t(r);return O(N(e),C(T(n,e=>a.has(e),r.split(""))),(e,t)=>function(e){const t=Q.get(e);if(null==t)throw new Error(e+" is not a valid unicode category");return t}(null===t?e:e+String.fromCodePoint(t)))}const o=I([a("L","ultmo"),a("M","nce"),a("N","dlo"),a("P","cdseifo"),a("Z","slp"),a("S","mcko"),a("C","cfon")]),i=[m(_("a"),_("z")),m(_("A"),_("Z")),m(_("0"),_("9")),d(45)].reduce(v),s=I([o,B(M(N("Is"),function(e){return(t,n)=>{const r=e(t,n);return r.success?A(r.offset,t.slice(n,r.offset)):r}}(R(T(n,i,["block identifier"])))),t=>function(e,t){const n=q.get(e);if(void 0===n){if(t)return g;throw new Error(`The unicode block identifier "${e}" is not known.`)}return n}(t,"xpath"!==e.language))]),u=k(N("\\p{"),s,ie,!0),c=B(k(N("\\P{"),s,ie,!0),V),l=M(ae,B(I("sSiIcCdDwW".split("").map(e=>N(e))),e=>ne[e])),p=B(me,()=>te),h=I([l,u,c]),f=t("\\[]"),y=I([r,T(n,e=>!f.has(e),["unescaped character"])]),w=I([B(he,()=>null),y]),x=O(w,M(he,w),m);function b(e,t){return[e].concat(t||[])}const U=B(function(e){return(t,n)=>{const r=e(t,n);return r.success?A(n,r.value):r}}(I([ue,we])),()=>null),j=_("-"),X=I([B(G(G(he,F(se,["not ["])),U),()=>j),M(F(he,["not -"]),y)]),L=I([O(B(X,d),I([function(e,t){return L(e,t)},U]),b),O(I([x,h]),I([K,U]),b)]),J=I([O(B(y,d),I([L,U]),b),O(I([x,h]),I([K,U]),b)]);function K(e,t){return J(e,t)}const z=B(J,e=>e.reduce(v)),W=B(M(ce,z),V),$=O(I([M(F(ce,["not ^"]),z),W]),C(M(he,(function(e,t){return Z(e,t)}))),Y),Z=k(se,$,ue,!0),ee="xpath"===e.language?I([B(r,d),h,Z,p,B(ce,()=>e=>-1===e),B(le,()=>e=>-2===e)]):I([B(r,d),h,Z,p]),Ae="xpath"===e.language?t(".\\?*+{}()|^$[]"):t(".\\?*+{}()|[]"),be=T(n,e=>!Ae.has(e),["NormalChar"]),Ee=B(M(ae,O(B(T(n,m(_("1"),_("9")),["digit"]),e=>e-xe),S(B(T(n,m(xe,_("9")),["digit"]),e=>e-xe)),(e,t)=>{t.reduce((e,t)=>10*e+t,e)})),e=>{throw new Error("Backreferences in XPath patterns are not yet implemented.")}),Ne="xpath"===e.language?I([B(be,e=>({kind:"predicate",value:d(e)})),B(ee,e=>({kind:"predicate",value:e})),B(k(fe,M(C(N("?:")),Oe),de,!0),e=>({kind:"regexp",value:e})),Ee]):I([B(be,e=>({kind:"predicate",value:d(e)})),B(ee,e=>({kind:"predicate",value:e})),B(k(fe,Oe,de,!0),e=>({kind:"regexp",value:e}))]),Be=B(R(B(T(n,m(xe,_("9")),["digit"]),e=>e-xe)),e=>e.reduce((e,t)=>10*e+t)),Te=I([O(Be,M(pe,Be),(e,t)=>{if(t({min:e,max:null})),B(Be,e=>({min:e,max:e}))]),Ie="xpath"===e.language?O(I([B(ve,()=>({min:0,max:1})),B(re,()=>({min:0,max:null})),B(ye,()=>({min:1,max:null})),k(oe,Te,ie,!0)]),C(ve),(e,t)=>e):I([B(ve,()=>({min:0,max:1})),B(re,()=>({min:0,max:null})),B(ye,()=>({min:1,max:null})),k(oe,Te,ie,!0)]),Ce=S(O(Ne,B(C(Ie),e=>null===e?{min:1,max:1}:e),(e,t)=>[e,t])),Se=O(Ce,S(M(ge,P(Ce))),(e,t)=>[e].concat(t));function Oe(e,t){return Se(e,t)}const Re=function(e){return O(e,H,D)}(Se);return function(e){let t;try{t=Re(e,0)}catch(t){throw new Error(`Error parsing pattern "${e}": ${t.message}`)}return t.success?t.value:function(e,t,n){const r=n.map(e=>`"${e}"`);throw new Error(`Error parsing pattern "${e}" at offset ${t}: expected ${r.length>1?"one of "+r.join(", "):r[0]} but found "${e.slice(t,t+1)}"`)}(e,t.offset,t.expected)}}function be(e){return[...e].map(e=>e.codePointAt(0))}function Ee(e,t){return{success:!0,offset:e,value:t}}function Ne(e){return Ee(e,void 0)}function Be(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function Te(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}r.push(n.value),a=n.offset}return Ee(a,r)}}function Ie(e,t,n){return(r,a)=>{const o=e(r,a);if(!o.success)return o;const i=t(r,o.offset);return i.success?Ee(i.offset,n(o.value,i.value)):i}}function Ce(e,t){return e}function Se(e,t){return t}function Oe(e,t){return Ie(e,t,Se)}function Re(e,t){return Ie(e,t,Ce)}function De(e){return(t,n)=>{const r=e(t,n);return r.success?r:Be(r.offset,r.expected,!0)}}const Ue=(e,t)=>e.length===t?Ne(t):Be(t,["end of input"]);const Me=function(e,t){const n={};var r;function a(e){var t=0;return function(){return t>>0)+"_",r=0;return function e(a){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(a||"")+"_"+r++,a)}})),s("Symbol.iterator",(function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var t="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),n=0;nn.length?a?1:-1:t.lengthn?a?1:-1:t(t=r.padEnd(t,"0"))?a?1:-1:nD(e,t)},Kc:function(e,t){return 0>D(e,t)},sa:function(e,t){return-1e||1342177279>>=1)&&(t+=t);return n}})),s("String.prototype.padEnd",(function(e){return e||function(e,t){var n=I(this,null,"padStart");return n+C(t,e-n.length)}})),s("WeakMap",(function(e){function t(e){if(this.h=(u+=Math.random()+1).toString(),e){e=c(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(){}function r(e){var t=typeof e;return"object"===t&&null!==e||"function"===t}function a(e){if(!B(e,s)){var t=new n;o(e,s,{value:t})}}function i(e){var t=Object[e];t&&(Object[e]=function(e){return e instanceof n?e:(Object.isExtensible(e)&&a(e),t(e))})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),r=new e([[t,2],[n,3]]);return 2==r.get(t)&&3==r.get(n)&&(r.delete(t),r.set(n,4),!r.has(t)&&4==r.get(n))}catch(e){return!1}}())return e;var s="$jscomp_hidden_"+Math.random();i("freeze"),i("preventExtensions"),i("seal");var u=0;return t.prototype.set=function(e,t){if(!r(e))throw Error("Invalid WeakMap key");if(a(e),!B(e,s))throw Error("WeakMap key fail: "+e);return e[s][this.h]=t,this},t.prototype.get=function(e){return r(e)&&B(e,s)?e[s][this.h]:void 0},t.prototype.has=function(e){return r(e)&&B(e,s)&&B(e[s],this.h)},t.prototype.delete=function(e){return!!(r(e)&&B(e,s)&&B(e[s],this.h))&&delete e[s][this.h]},t})),s("Map",(function(e){function t(){var e={};return e.Ba=e.next=e.head=e}function n(e,t){var n=e.h;return u((function(){if(n){for(;n.head!=e.h;)n=n.Ba;for(;n.next!=n.head;)return n=n.next,{done:!1,value:t(n)};n=null}return{done:!0,value:void 0}}))}function r(e,t){var n=t&&typeof t;"object"==n||"function"==n?o.has(t)?n=o.get(t):(n=""+ ++i,o.set(t,n)):n="p_"+t;var r=e.s[n];if(r&&B(e.s,n))for(e=0;e=a}})),s("Array.prototype.fill",(function(e){return e||function(e,t,n){var r=this.length||0;for(0>t&&(t=Math.max(0,r+t)),(null==n||n>r)&&(n=r),0>(n=Number(n))&&(n=Math.max(0,r+n)),t=Number(t||0);t(t=t||0)&&(t=Math.max(t+r,0));te?-t:t}})),s("Number.isFinite",(function(e){return e||function(e){return"number"==typeof e&&(!isNaN(e)&&1/0!==e&&-1/0!==e)}})),s("String.prototype.padStart",(function(e){return e||function(e,t){var n=I(this,null,"padStart");return C(t,e-n.length)+n}})),s("Array.prototype.keys",(function(e){return e||function(){return R(this,(function(e){return e}))}})),s("Number.isInteger",(function(e){return e||function(e){return!!Number.isFinite(e)&&e===Math.floor(e)}})),s("Number.isSafeInteger",(function(e){return e||function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER}})),s("Array.prototype.findIndex",(function(e){return e||function(e,t){return S(this,e,t).Fb}})),s("String.prototype.endsWith",(function(e){return e||function(e,t){var n=I(this,e,"endsWith");void 0===t&&(t=n.length),t=Math.max(0,Math.min(0|t,n.length));for(var r=e.length;0=r}})),s("String.fromCodePoint",(function(e){return e||function(e){for(var t="",n=0;nr||1114111=r?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(r>>>10&1023|55296),t+=String.fromCharCode(1023&r|56320))}return t}})),s("String.prototype.codePointAt",(function(e){return e||function(e){var t=I(this,null,"codePointAt"),n=t.length;if(0<=(e=Number(e)||0)&&er||56319(e=t.charCodeAt(e+1))||57343=e.length?W:$(e[t])}}}function te(){this.value={next:function(){return W}}}function ne(e){var t=e.value;if(Z(e.type,53))return!0;if(Z(e.type,0))return t;if(Z(e.type,1)||Z(e.type,20)||Z(e.type,19))return 0!==t.length;if(Z(e.type,2))return!isNaN(t)&&0!==t;throw K()}function re(e,t){var n=this;this.j=ue,this.value={next:function(t){return null!==n.s&&n.h>=n.s?W:void 0!==n.A[n.h]?$(n.A[n.h++]):(t=e.next(t)).done?(n.s=n.h,t):((n.u||2>n.h)&&(n.A[n.h]=t.value),n.h++,t)}},this.u=!1,this.A=[],this.h=0,this.s=void 0===t?null:t}function ae(e,t){e.h=void 0===t?0:t}function oe(e){this.A=ue,this.h=e;var t=!1;this.value={next:function(){return t?W:(t=!0,$(e))}},this.s=null}(r=ee.prototype).ob=function(){return this},r.filter=function(e){var t=this,n=-1;return this.s.create({next:function(){for(n++;n=t.h.length?W:$(t.h[n])}})},r.first=function(){return this.h[0]},r.N=function(){return this.h},r.getEffectiveBooleanValue=function(){if(Z(this.h[0].type,53))return!0;throw K()},r.Na=function(){return this.h.length},r.G=function(){return!1},r.ya=function(){return!1},r.map=function(e){var t=this,n=-1;return this.s.create({next:function(){return++n>=t.h.length?W:$(e(t.h[n],n,t))}},this.h.length)},r.L=function(e){return e(this.h)},r.$=function(e){return e.multiple?e.multiple(this):e.default(this)},(r=te.prototype).ob=function(){return this},r.filter=function(){return this},r.first=function(){return null},r.N=function(){return[]},r.getEffectiveBooleanValue=function(){return!1},r.Na=function(){return 0},r.G=function(){return!0},r.ya=function(){return!1},r.map=function(){return this},r.L=function(e){return e([])},r.$=function(e){return e.empty?e.empty(this):e.default(this)},(r=re.prototype).ob=function(){return this.j.create(this.N())},r.filter=function(e){var t=this,n=-1,r=this.value;return this.j.create({next:function(a){for(n++,a=r.next(a);!a.done&&!e(a.value,n,t);)n++,a=r.next(0);return a}})},r.first=function(){if(void 0!==this.A[0])return this.A[0];var e=this.value.next(0);return ae(this),e.done?null:e.value},r.N=function(){if(this.h>this.A.length&&this.s!==this.A.length)throw Error("Implementation error: Sequence Iterator has progressed.");var e=this.value;this.u=!0;for(var t=e.next(0);!t.done;)t=e.next(0);return this.A},r.getEffectiveBooleanValue=function(){var e=this.value,t=this.h;ae(this);var n=e.next(0);if(n.done)return ae(this,t),!1;if(Z((n=n.value).type,53))return ae(this,t),!0;if(!e.next(0).done)throw K();return ae(this,t),ne(n)},r.Na=function(e){if(null!==this.s)return this.s;if(void 0!==e&&e)return-1;e=this.h;var t=this.N().length;return ae(this,e),t},r.G=function(){return 0===this.s||null===this.first()},r.ya=function(){if(null!==this.s)return 1===this.s;var e=this.value,t=this.h;return ae(this),e.next(0).done?(ae(this,t),!1):(e=e.next(0),ae(this,t),e.done)},r.map=function(e){var t=this,n=0,r=this.value;return this.j.create({next:function(a){return(a=r.next(a)).done?W:$(e(a.value,n++,t))}},this.s)},r.L=function(e,t){var n,r=this.value,a=[],o=!0;return function(){for(var i=r.next(o?0:t);!i.done;i=r.next(t))o=!1,a.push(i.value);n=e(a).value}(),this.j.create({next:function(){return n.next(0)}})},r.$=function(e){function t(e){r=e.value,-1!==(e=e.Na(!0))&&(n.s=e)}var n=this,r=null;return this.j.create({next:function(a){return r?r.next(a):n.G()?(t(e.empty?e.empty(n):e.default(n)),r.next(a)):n.ya()?(t(e.o?e.o(n):e.default(n)),r.next(a)):(t(e.multiple?e.multiple(n):e.default(n)),r.next(a))}})},(r=oe.prototype).ob=function(){return this},r.filter=function(e){return e(this.h,0,this)?this:this.A.create()},r.first=function(){return this.h},r.N=function(){return[this.h]},r.getEffectiveBooleanValue=function(){return null===this.s&&(this.s=ne(this.h)),this.s},r.Na=function(){return 1},r.G=function(){return!1},r.ya=function(){return!0},r.map=function(e){return this.A.create(e(this.h,0,this))},r.L=function(e){return e([this.h])},r.$=function(e){return e.o?e.o(this):e.default(this)};var ie=new te;function se(e,t){if(null===(e=void 0===e?null:e))return ie;if(Array.isArray(e))switch(e.length){case 0:return ie;case 1:return new oe(e[0]);default:return new ee(e)}return e.next?new re(e,void 0===t?null:t):new oe(e)}var ue={create:se,o:function(e){return new oe(e)},empty:function(){return se()},ca:function(){return se(Q)},X:function(){return se(J)}};function ce(e){var t=[],n=e.value;return function(){var e=0;return ue.create({next:function(){if(void 0!==t[e])return t[e++];var r=n.next(0);return r.done?r:t[e++]=r}})}}function le(e,t){this.type=e,this.value=t}var pe={},he=(pe[0]="xs:boolean",pe[1]="xs:string",pe[2]="xs:numeric",pe[3]="xs:double",pe[4]="xs:decimal",pe[5]="xs:integer",pe[6]="xs:float",pe[7]="xs:date",pe[8]="xs:time",pe[9]="xs:dateTime",pe[10]="xs:dateTimeStamp",pe[11]="xs:gYearMonth",pe[12]="xs:gYear",pe[13]="xs:gMonthDay",pe[14]="xs:gMonth",pe[15]="xs:gDay",pe[16]="xs:yearMonthDuration",pe[17]="xs:dayTimeDuration",pe[18]="xs:duration",pe[19]="xs:untypedAtomic",pe[20]="xs:anyURI",pe[21]="xs:base64Binary",pe[22]="xs:hexBinary",pe[23]="xs:QName",pe[24]="xs:NCName",pe[25]="xs:Name",pe[26]="xs:ENTITY",pe[27]="xs:nonPositiveInteger",pe[28]="xs:negativeInteger",pe[29]="xs:positiveInteger",pe[30]="xs:nonNegativeInteger",pe[31]="xs:long",pe[32]="xs:int",pe[33]="xs:short",pe[34]="xs:byte",pe[35]="xs:unsignedInt",pe[36]="xs:unsignedLong",pe[37]="xs:unsignedByte",pe[38]="xs:unsignedShort",pe[39]="xs:error",pe[40]="xs:ENTITIES",pe[41]="xs:IDREF",pe[42]="xs:ID",pe[43]="xs:IDREFS",pe[44]="xs:NOTATION",pe[45]="xs:anySimpleType",pe[46]="xs:anyAtomicType",pe[47]="attribute()",pe[48]="xs:normalizedString",pe[49]="xs:NMTOKENS",pe[50]="xs:NMTOKEN",pe[51]="xs:language",pe[52]="xs:token",pe[53]="node()",pe[54]="element()",pe[55]="document-node()",pe[56]="text()",pe[57]="processing-instruction()",pe[58]="comment()",pe[59]="item()",pe[60]="function(*)",pe[61]="map(*)",pe[62]="array(*)",pe[63]="none",pe),fe={"xs:boolean":0,"xs:string":1,"xs:numeric":2,"xs:double":3,"xs:decimal":4,"xs:integer":5,"xs:float":6,"xs:date":7,"xs:time":8,"xs:dateTime":9,"xs:dateTimeStamp":10,"xs:gYearMonth":11,"xs:gYear":12,"xs:gMonthDay":13,"xs:gMonth":14,"xs:gDay":15,"xs:yearMonthDuration":16,"xs:dayTimeDuration":17,"xs:duration":18,"xs:untypedAtomic":19,"xs:anyURI":20,"xs:base64Binary":21,"xs:hexBinary":22,"xs:QName":23,"xs:NCName":24,"xs:Name":25,"xs:ENTITY":26,"xs:nonPositiveInteger":27,"xs:negativeInteger":28,"xs:positiveInteger":29,"xs:nonNegativeInteger":30,"xs:long":31,"xs:int":32,"xs:short":33,"xs:byte":34,"xs:unsignedInt":35,"xs:unsignedLong":36,"xs:unsignedByte":37,"xs:unsignedShort":38,"xs:error":39,"xs:ENTITIES":40,"xs:IDREF":41,"xs:ID":42,"xs:IDREFS":43,"xs:NOTATION":44,"xs:anySimpleType":45,"xs:anyAtomicType":46,"attribute()":47,"xs:normalizedString":48,"xs:NMTOKENS":49,"xs:NMTOKEN":50,"xs:language":51,"xs:token":52,"node()":53,"element()":54,"document-node()":55,"text()":56,"processing-instruction()":57,"comment()":58,"item()":59,"function(*)":60,"map(*)":61,"array(*)":62};function de(e){return 2===e.g?he[e.type]+"*":1===e.g?he[e.type]+"+":0===e.g?he[e.type]+"?":he[e.type]}function me(e){if("none"===e)throw Error('XPST0051: The type "none" could not be found');if(!e.startsWith("xs:")&&0<=e.indexOf(":"))throw Error("XPST0081: Invalid prefix for input "+e);var t=fe[e];if(void 0===t)throw Error('XPST0051: The type "'+e+'" could not be found');return t}function ge(e){switch(e[e.length-1]){case"*":return{type:me(e.substr(0,e.length-1)),g:2};case"?":return{type:me(e.substr(0,e.length-1)),g:0};case"+":return{type:me(e.substr(0,e.length-1)),g:1};default:return{type:me(e),g:3}}}function ye(e,t,n){this.namespaceURI=t||null,this.prefix=e||"",this.localName=n}function ve(e){var t=e.l,n=e.arity,r=void 0!==e.Pa&&e.Pa,a=void 0!==e.I&&e.I,o=e.localName,i=e.namespaceURI,s=e.i;for(e=e.value,le.call(this,60,null),this.value=e,this.I=a,a=-1,e=0;e=n||n>e.R.length)throw Error("FOAY0001: array position out of bounds.");return e.R[n-1]()}))}))}function He(e){ve.call(this,{value:function(e,n,r,a){return Pe(0,0,0,ue.o(t),a)},localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/array",l:[{type:5,g:3}],arity:1,i:{type:59,g:2}});var t=this;this.type=62,this.R=e}function je(e){switch(e.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function Xe(e){return{type:je(e),value:e}}function _e(e,t){return t(e=e.map((function(e){return e.first()})))}function Le(e,t){var n=Z(e.type,1)||Z(e.type,20)||Z(e.type,19),r=Z(t.type,1)||Z(t.type,20)||Z(t.type,19);return n&&r?e.value===t.value:(n=Z(e.type,4)||Z(e.type,3)||Z(e.type,6),r=Z(t.type,4)||Z(t.type,3)||Z(t.type,6),n&&r?!(!isNaN(e.value)||!isNaN(t.value))||e.value===t.value:(n=Z(e.type,0)||Z(e.type,22)||Z(e.type,18)||Z(e.type,23)||Z(e.type,44),r=Z(t.type,0)||Z(t.type,22)||Z(t.type,18)||Z(t.type,23)||Z(t.type,44),!(!n||!r)&&e.value===t.value))}function Ve(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return(e=t.h.find((function(e){return Le(e.key,n)})))?e.value():ue.empty()}))}function Ye(e){ve.call(this,{l:[{type:59,g:3}],arity:1,localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/map",value:function(e,n,r,a){return Ve(0,0,0,ue.o(t),a)},i:{type:59,g:2}});var t=this;this.type=61,this.h=e}function qe(){}function Qe(e,t){return e.ab()===t.ab()&&e.bb()===t.bb()}function Je(e){if(e>Number.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration");return new Je(ee||273860t.pa?1:-1:r>n?1:-1}function lt(e,t,n){return 0===ct(e,t,n)}function pt(e,t,n){return new Je(e=(st(e,n).getTime()-st(t,n).getTime())/1e3)}function ht(e){throw Error("Not implemented: adding durations to "+he[e.type])}function ft(e){throw Error("Not implemented: subtracting durations from "+he[e.type])}function dt(e,t){if("number"!=typeof e&&("string"!=typeof e||!V.get(t)(e)))throw Error("Cannot convert JavaScript value '"+e+"' to the XPath type "+he[t]+" since it is not valid.")}function mt(e,t,n){if(null===t)return null;switch(e){case 0:return t?Q:J;case 1:return q(t+"",1);case 3:case 2:return dt(t,3),q(+t,3);case 4:return dt(t,e),q(+t,4);case 5:return dt(t,e),q(0|t,5);case 6:return dt(t,e),q(+t,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(t instanceof Date))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+he[e]+".");return q(it(ut(t.toISOString()),e),e);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if("object"!=typeof t||!("nodeType"in t))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+he[e]+".");return Xe({node:t,F:null});case 59:return function e(t,n){if(null===t)return null;switch(typeof t){case"boolean":return t?Q:J;case"number":return q(t,3);case"string":return q(t,1);case"object":return"nodeType"in t?Xe({node:t,F:null}):Array.isArray(t)?new He(t.map((function(t){return void 0===t?function(){return ue.empty()}:ce(t=null===(t=e(t))?ue.empty():ue.o(t))}))):new Ye(Object.keys(t).filter((function(e){return void 0!==t[e]})).map((function(n){var r=e(t[n]);return r=null===r?ue.empty():ue.o(r),{key:q(n,1),value:ce(r)}})))}throw Error("Value "+String(t)+' of type "'+typeof t+'" is not adaptable to an XPath value.')}(t);default:throw Error('Values of the type "'+e+'" can not be adapted to equivalent XPath values.')}}function gt(e,t,n){if(0===n.g)return null===(t=mt(n.type,t))?[]:[t];if(2===n.g||1===n.g){if(!Array.isArray(t))throw Error("The JavaScript value "+t+" should be an array if it is to be converted to "+de(n)+".");return t.map((function(e){return mt(n.type,e)})).filter((function(e){return null!==e}))}var r=mt(n.type,t);if(null===r)throw Error("The JavaScript value "+t+" should be a single entry if it is to be converted to "+de(n)+".");return[r]}function yt(e,t,n){return n=void 0===n?{type:59,g:0}:n,ue.create(gt(0,t,n))}function vt(e,t){this.h=t=void 0===t?{vb:null,Ab:null,pb:!1}:t,this.Ja=e.Ja,this.Ga=e.Ga,this.M=e.M,this.Ea=e.Ea||Object.create(null)}function wt(e,t){var n=0,r=t.value;return{next:function(a){return(a=r.next(a)).done?W:$(bt(e,n++,a.value,t))}}}function xt(e){return e.h.pb||(e.h.pb=!0,e.h.vb=ut((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.vb}function At(e){return e.h.pb||(e.h.pb=!0,e.h.vb=ut((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.Ab}function bt(e,t,n,r){return new vt({M:n,Ja:t,Ga:r||e.Ga,Ea:e.Ea},e.h)}function Et(e,t){return new vt({M:e.M,Ja:e.Ja,Ga:e.Ga,Ea:Object.assign(Object.create(null),e.Ea,t)},e.h)}function Nt(e,t,n,r,a,o,i,s){var u=new Map;this.debug=e,this.Ha=t,this.h=n,this.s=r,this.A=a,this.u=o,this.ha=u,this.O=i,this.j=s}function Bt(e){var t=0,n=null,r=!0;return ue.create({next:function(a){for(;tNumber.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(t))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");e=new Ft(e||0===t?t:-t)}else e=null;return e}function jt(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot multiply xs:yearMonthDuration by NaN");if((e=Math.round(e.ga*t))>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");return new Ft(ee?"-":"")+"INF"}}}return e(9)||e(7)||e(8)||e(15)||e(14)||e(13)||e(12)||e(11)||e(16)||e(17)||e(18)?function(e){return{v:!0,value:e.toString()}}:e(22)?function(e){return{v:!0,value:e.toUpperCase()}}:function(e){return{v:!0,value:e+""}}}var Vt=[2,5,17,16];function Yt(e,t){function n(t){return Z(e,t)}if(39===t)return function(){return{v:!1,error:Error("FORG0001: Casting to xs:error is always invalid.")}};switch(t){case 19:return function(e){var t=Lt(e);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,19)}:e}}(n);case 1:return function(e){var t=Lt(e);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,1)}:e}}(n);case 6:return function(e){var t=kt(e,6);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,6)}:e}}(n);case 3:return function(e){var t=kt(e,3);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,3)}:e}}(n);case 4:return function(e){return e(5)?function(e){return{v:!0,value:q(e,4)}}:e(6)||e(3)?function(e){return isNaN(e)||!isFinite(e)?{v:!1,error:Error("FOCA0002: Can not cast "+e+" to xs:decimal")}:Math.abs(e)>Number.MAX_VALUE?{v:!1,error:Error("FOAR0002: Can not cast "+e+" to xs:decimal, it is out of bounds for JavaScript numbers")}:{v:!0,value:q(e,4)}}:e(0)?function(e){return{v:!0,value:q(e?1:0,4)}}:e(1)||e(19)?function(e){var t=parseFloat(e);return!isNaN(t)||isFinite(t)?{v:!0,value:q(t,4)}:{v:!1,error:Error("FORG0001: Can not cast "+e+" to xs:decimal")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.")}}}(n);case 5:return function(e){return e(0)?function(e){return{v:!0,value:q(e?1:0,5)}}:e(2)?function(e){var t=Math.trunc(e);return!isFinite(t)||isNaN(t)?{v:!1,error:Error("FOCA0002: can not cast "+e+" to xs:integer")}:Number.isSafeInteger(t)?{v:!0,value:q(t,5)}:{v:!1,error:Error("FOAR0002: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:e(1)||e(19)?function(e){var t=parseInt(e,10);return isNaN(t)?{v:!1,error:Tt(e,5)}:Number.isSafeInteger(t)?{v:!0,value:q(t,5)}:{v:!1,error:Error("FOCA0003: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:integer or any of its derived types.")}}}(n);case 2:return function(e){var t=Yt;return function(n){for(var r=c(_t),a=r.next();!a.done;a=r.next())if((a=t(e,a.value)(n)).v)return a;return{v:!1,error:Error('XPTY0004: Casting not supported from "'+n+'" given type to xs:numeric or any of its derived types.')}}}(e);case 18:return function(e){return e(16)?function(e){return{v:!0,value:q(new Xt(e,new Je(e.oa()?0:-0)),18)}}:e(17)?function(e){return{v:!0,value:q(e=new Xt(new Ft(e.oa()?0:-0),e),18)}}:e(18)?function(e){return{v:!0,value:q(e,18)}}:e(19)||e(1)?function(e){return{v:!0,value:q(new Xt(Ht(e),We(e)),18)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:duration or any of its derived types.")}}}(n);case 16:return function(e){return e(18)&&!e(17)?function(e){return{v:!0,value:q(e.Sa,16)}}:e(17)?function(){return{v:!0,value:q(Ht("P0M"),16)}}:e(19)||e(1)?function(e){var t=Ht(e);return t?{v:!0,value:q(t,16)}:{v:!1,error:Tt(e,16)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.")}}}(n);case 17:return function(e){return e(18)&&!e(16)?function(e){return{v:!0,value:q(e.Fa,17)}}:e(16)?function(){return{v:!0,value:q(We("PT0.0S"),17)}}:e(19)||e(1)?function(e){var t=We(e);return t?{v:!0,value:q(t,17)}:{v:!1,error:Error("FORG0001: Can not cast "+e+" to xs:dayTimeDuration")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dayTimeDuration or any of its derived types.")}}}(n);case 9:return function(e){return e(7)?function(e){return{v:!0,value:q(it(e,9),9)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),9)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dateTime or any of its derived types.")}}}(n);case 8:return function(e){return e(9)?function(e){return{v:!0,value:q(it(e,8),8)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),8)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:time or any of its derived types.")}}}(n);case 7:return function(e){return e(9)?function(e){return{v:!0,value:q(it(e,7),7)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),7)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:date or any of its derived types.")}}}(n);case 11:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,11),11)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),11)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYearMonth or any of its derived types.")}}}(n);case 12:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,12),12)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),12)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYear or any of its derived types.")}}}(n);case 13:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,13),13)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),13)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonthDay or any of its derived types.")}}}(n);case 15:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,15),15)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),15)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gDay or any of its derived types.")}}}(n);case 14:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,14),14)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),14)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonth or any of its derived types.")}}}(n);case 0:return function(e){return e(2)?function(e){return{v:!0,value:0===e||isNaN(e)?J:Q}}:e(1)||e(19)?function(e){switch(e){case"true":case"1":return{v:!0,value:Q};case"false":case"0":return{v:!0,value:J};default:return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}(n);case 21:return function(e){return e(22)?function(e){for(var t="",n=0;nr.value.node.localName?1:-1;n=ke(t,n.value),r=ke(t,r.value)}else n=n.value,r=r.value;return en(e,t,n,r)}function nn(e,t,n){return tn(e.s,e,t,n)}function rn(e,t){return function e(t,n){if(n=void 0===n?an:n,1>=t.length)return t;var r=Math.floor(t.length/2),a=e(t.slice(0,r),n);for(t=e(t.slice(r),n),r=[];a.length&&t.length;)0>n(a[0],t[0])?r.push(a.shift()):r.push(t.shift());return r.concat(a.concat(t))}(t,(function(t,n){return tn(e.s,e,t,n)})).filter((function(e,t,n){return 0===t||!Wt(e.value,n[t-1].value)}))}function an(e,t){return e(e=t-parseInt(e[3],10))?0:e:t}(n.value)(a=a.first().value)?ue.o(q(1,5)):e=e||57344<=e&&65533>=e||65536<=e&&1114111>=e)return String.fromCodePoint(e);throw Error("FOCH0001")})).join(""),ue.o(q(e,1))}))},localName:"codepoints-to-string",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return 0===(e=(e=c(e).next().value)?e.value.split(""):[]).length?ue.empty():ue.create(e.map((function(e){return q(e.codePointAt(0),5)})))}))},localName:"string-to-codepoints",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ue.create(q("",1)):ue.create(q(encodeURIComponent(e.value).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})),1))}))},localName:"encode-for-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ue.create(q("",1)):ue.create(q(e.value.replace(/([\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFEF "<>{}|\\^`/\n\u007f\u0080-\u009f]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,(function(e){return encodeURI(e)})),1))}))},localName:"iri-to-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,null===e||null===t)return ue.empty();if(e=e.value,t=t.value,e.length!==t.length)return ue.X();e=e.split(""),t=t.split("");for(var n=0;nt.node.nodeName?1:-1})).map((function(e){return Xe(e)})),a=Se(t.h,a.value).filter((function(e){return"http://www.w3.org/2000/xmlns/"!==e.node.namespaceURI})).sort((function(e,t){return e.node.nodeName>t.node.nodeName?1:-1})).map((function(e){return Xe(e)}));var s=Ln(e,t,n,ue.create(r),ue.create(a)),u=!1;return{next:function(){if(u)return W;var e=o.next(0);return(e.done||!1!==e.value)&&((e=s.next(0)).done||!1!==e.value)?(e=i.next(0),u=!0,e):(u=!0,e)}}}(e,t,n,r,a);if(Z(r.type,47)&&Z(a.type,47)||Z(r.type,57)&&Z(a.type,57)||Z(r.type,58)&&Z(a.type,58))return function(e,t,n,r,a){var o=Ln(e,t,n,Cn(0,0,0,ue.o(r)),Cn(0,0,0,ue.o(a))),i=!1;return{next:function(){if(i)return W;var e=o.next(0);return e.done||!1!==e.value?$(jn(Ot(r,t).first(),Ot(a,t).first())):(i=!0,e)}}}(e,t,n,r,a)}return zt(!1)}function qn(e){return Error("XUST0001: "+(void 0===e?"Can not execute an updating expression in a non-updating context.":e))}function Qn(e){return Error("XUTY0004: The attribute "+e.name+'="'+e.value+'" follows a node that is not an attribute node.')}function Jn(){return Error("XUTY0005: The target of a insert expression with into must be a single element or document node.")}function Kn(){return Error("XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.")}function zn(){return Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.")}function Wn(){return Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.")}function $n(e){return Error("XUDY0017: The target "+e.outerHTML+" is used in more than one replace value of expression.")}function Zn(e){return Error("XUDY0021: Applying the updates will result in the XDM instance violating constraint: '"+e+"'")}function er(e){return Error("XUDY0023: The namespace binding "+e+" is conflicting.")}function tr(e){return Error("XUDY0024: The namespace binding "+e+" is conflicting.")}function nr(){return Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.")}function rr(e,t,n,r,a){n=void 0===n?{C:!1,Y:!1,S:"unsorted",subtree:!1}:n,this.s=e,this.O=n.S||"unsorted",this.subtree=!!n.subtree,this.Y=!!n.Y,this.C=!!n.C,this.ha=t,this.I=!1,this.Ya=null,this.bc=void 0!==r&&r,this.type=a}function ar(e,t,n){return t&&null!==t.M&&e.C?(null===e.Ya&&(e.Ya=ce(e.h(null,n).ob())),e=e.Ya()):e=e.h(t,n),e}function or(e,t){this.H=e,this.fa=t}function ir(e){e&&"object"==typeof e&&"nodeType"in e&&("function"==typeof(e=e.ownerDocument||e).createElementNS&&"function"==typeof e.createProcessingInstruction&&"function"==typeof e.createTextNode&&"function"==typeof e.createComment&&(this.h=e)),this.h||(this.h=null)}function sr(e,t,n){t.forEach((function(t){n.insertBefore(e.node,t.node,null)}))}function ur(e,t,n,r){var a=ke(n,e),o=e.node.nodeType;if(2===o){if(t.some((function(e){return 2!==e.node.nodeType})))throw Error('Constraint "If $target is an attribute node, $replacement must consist of zero or more attribute nodes." failed.');var i=a?a.node:null;r.removeAttributeNS(i,e.node.namespaceURI,e.node.nodeName),t.forEach((function(e){var t=e.node.nodeName;if(Oe(n,a,t))throw Zn("An attribute "+t+" already exists.");r.setAttributeNS(i,e.node.namespaceURI,t,De(n,e))}))}if(1===o||3===o||8===o||7===o){var s=(o=Ge(n,e))?o.node:null;r.removeChild(a.node,e.node),t.forEach((function(e){r.insertBefore(a.node,e.node,s)}))}}function cr(e,t,n,r){if(function(e,t){function n(e){return new ye(e.node.prefix,e.node.namespaceURI,e.node.localName)}function r(t,n){var r=new Set;e.filter((function(e){return e.type===t})).map((function(e){return e.target})).forEach((function(e){e=e?e.node:null,r.has(e)&&n(e),r.add(e)}))}r("rename",(function(e){throw Error("XUDY0015: The target "+e.outerHTML+" is used in more than one rename expression.")})),r("replaceNode",(function(e){throw Error("XUDY0016: The target "+e.outerHTML+" is used in more than one replace expression.")})),r("replaceValue",(function(e){throw $n(e)})),r("replaceElementContent",(function(e){throw $n(e)}));var a=new Map;e.filter((function(e){return"replaceNode"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var r=ke(t,e.target);r=r?r.node:null;var o=a.get(r);o?o.push.apply(o,p(e.s.map(n))):a.set(r,e.s.map(n))})),e.filter((function(e){return"rename"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var n=ke(t,e.target);if(n){n=n.node;var r=a.get(n);r?r.push(e.s):a.set(n,[e.s])}})),a.forEach((function(e){var t={};e.forEach((function(e){if(t[e.prefix]||(t[e.prefix]=e.namespaceURI),t[e.prefix]!==e.namespaceURI)throw tr(e.namespaceURI)}))}))}(e,t),e.filter((function(e){return-1!==["insertInto","insertAttributes","replaceValue","rename"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertInto":sr(e.target,e.content,r);break;case"insertAttributes":!function(e,t,n,r){t.forEach((function(t){var a=t.node.nodeName;if(Oe(n,e,a))throw Zn("An attribute "+a+" already exists.");r.setAttributeNS(e.node,t.node.namespaceURI,a,De(n,t))}))}(e.target,e.content,t,r);break;case"rename":!function(e,t,n,r,a){switch(r||(r=new ir(e?e.node:null)),e.node.nodeType){case 1:var o=n.getAllAttributes(e.node),i=n.getChildNodes(e.node),s=r.createElementNS(t.namespaceURI,t.va()),u={node:s,F:null};o.forEach((function(e){a.setAttributeNS(s,e.namespaceURI,e.nodeName,e.value)})),i.forEach((function(e){a.insertBefore(s,e,null)}));break;case 2:(t=r.createAttributeNS(t.namespaceURI,t.va())).value=De(n,e),u={node:t,F:null};break;case 7:u={node:r.createProcessingInstruction(t.va(),De(n,e)),F:null}}if(!ke(n,e))throw Error("Not supported: renaming detached nodes.");ur(e,[u],n,a)}(e.target,e.s,t,n,r);break;case"replaceValue":var a=e.target;if(e=e.s,2===a.node.nodeType){var o=ke(t,a);o?r.setAttributeNS(o.node,a.node.namespaceURI,a.node.nodeName,e):a.node.value=e}else r.setData(a.node,e)}})),e.filter((function(e){return-1!==["insertBefore","insertAfter","insertIntoAsFirst","insertIntoAsLast"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertAfter":!function(e,t,n,r){var a=ke(n,e).node,o=(e=Ge(n,e))?e.node:null;t.forEach((function(e){r.insertBefore(a,e.node,o)}))}(e.target,e.content,t,r);break;case"insertBefore":!function(e,t,n,r){var a=ke(n,e).node;t.forEach((function(t){r.insertBefore(a,t.node,e.node)}))}(e.target,e.content,t,r);break;case"insertIntoAsFirst":!function(e,t,n,r){var a=(n=Ue(n,e))?n.node:null;t.forEach((function(t){r.insertBefore(e.node,t.node,a)}))}(e.target,e.content,t,r);break;case"insertIntoAsLast":sr(e.target,e.content,r)}})),e.filter((function(e){return"replaceNode"===e.type})).forEach((function(e){ur(e.target,e.s,t,r)})),e.filter((function(e){return"replaceElementContent"===e.type})).forEach((function(e){!function(e,t,n,r){n.getChildNodes(e.node).forEach((function(t){return r.removeChild(e.node,t)})),t&&r.insertBefore(e.node,t.node,null)}(e.target,e.text,t,r)})),e.filter((function(e){return"delete"===e.type})).forEach((function(e){e=e.target;var n=ke(t,e);(n=n?n.node:null)&&(2===e.node.nodeType?r.removeAttributeNS(n,e.node.namespaceURI,e.node.nodeName):r.removeChild(n,e.node))})),e.some((function(e){return"put"===e.type})))throw Error('Not implemented: the execution for pendingUpdate "put" is not yet implemented.')}function lr(e,t){for(var n=[],r=1;re.h[n])return-1}return 0}function wr(){return It("Expected base expression of a function call to evaluate to a sequence of single function item")}function xr(e,t,n,r){for(var a=[],o=0;oe.R.length||0>=n)throw Error("FOAY0001: subarray start out of bounds.");if(0>t)throw Error("FOAY0002: subarray length out of bounds.");if(n+t>e.R.length+1)throw Error("FOAY0001: subarray start + length out of bounds.");return ue.o(new He(e.R.slice(n-1,t+n-1)))}))}function Br(e,t,n,r,a){return _e([r],(function(e){var t=c(e).next().value;return a.L((function(e){e=e.map((function(e){return e.value})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n[t-1]!==e}));for(var n=t.R.concat(),r=0,a=e.length;rt.R.length||0>=o)throw Error("FOAY0001: subarray position out of bounds.");n.splice(o-1,1)}return ue.o(new He(n))}))}))}function Tr(e){return Z(e,1)||Z(e,20)||Z(e,19)}function Ir(e,t,n,r){return r.sort((function(r,a){return Ln(e,t,n,ue.create(r),ue.create(a)).next(0).value?0:function e(t,n,r,a,o){return 0===a.length?0!==o.length:0!==o.length&&Yn(t,n,r,a[0],o[0]).next(0).value?e(t,n,r,a.slice(1),o.slice(1)):a[0].value!=a[0].value||(Tr(a[0].type)&&0!==o.length&&Tr(o[0].type)||0!==o.length)&&a[0].value=(e=e.value)||e>t.R.length)throw Error("FOAY0001: array position out of bounds.");return(t=t.R.concat()).splice(e-1,1,ce(o)),ue.o(new He(t))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"append",l:[{type:62,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){return e=c(e).next().value.R.concat([ce(a)]),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],i:{type:62,g:3},m:Nr},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){var o=ue.o(q(r.first().value.length-a.first().value+1,5));return Nr(0,0,0,r,a,o)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"remove",l:[{type:62,g:3},{type:5,g:2}],i:{type:62,g:3},m:Br},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"insert-before",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,a,o){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,(t=t.next().value.value)>e.R.length+1||0>=t)throw Error("FOAY0001: subarray position out of bounds.");return(e=e.R.concat()).splice(t-1,0,ce(o)),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"head",l:[{type:62,g:3}],i:{type:59,g:2},m:function(e,t,n,r){return Pe(0,0,0,r,ue.o(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"tail",l:[{type:62,g:3}],i:{type:59,g:2},m:function(e,t,n,r){return Br(0,0,0,r,ue.o(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"reverse",l:[{type:62,g:3}],i:{type:62,g:3},m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.o(new He(e.R.concat().reverse()))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"join",l:[{type:62,g:2}],i:{type:62,g:3},m:function(e,t,n,r){return r.L((function(e){return e=e.reduce((function(e,t){return e.concat(t.R)}),[]),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"for-each",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;if(1!==o.A)throw It("The callback passed into array:for-each has a wrong arity.");return r=a.R.map((function(r){return ce(o.value.call(void 0,e,t,n,xr(o.s,[r()],t,"array:for-each")[0]))})),ue.o(new He(r))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"filter",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;if(1!==o.A)throw It("The callback passed into array:filter has a wrong arity.");var i=a.R.map((function(r){return r=xr(o.s,[r()],t,"array:filter")[0],(0,o.value)(e,t,n,r)})),s=[],u=!1;return ue.create({next:function(){if(u)return W;for(var e=0,t=a.R.length;e=n.start.line&&o<=n.end.line){var i=on.start.line?a.length:n.start.la-1+a.length,e.push(Array(a.length+t.length).fill(" ",0,o).fill("^",o,i).join(""))}return e}),[]),t=function e(t){var n=t.h instanceof Yr?["Inner error:",t.h.message]:t.h instanceof Error?[t.h.toString()]:e(t.h);return n.push(" at <"+t.s+">:"+t.location.start.line+":"+t.location.start.la+" - "+t.location.end.line+":"+t.location.end.la),n}(t).join("\n"),new Yr(e.join("\n")+"\n\n"+t,n)}y(Yr,Error);var Qr=Object.create(null);function Jr(e,t){for(var n=[],r=0;re.length?"":"object"==typeof e[1]?e[2]||"":e[1]||""}function Aa(e,t){return Array.isArray(e)?"object"!=typeof(e=e[1])||Array.isArray(e)?null:t in e?e[t]:null:null}function ba(e,t){return t.reduce(wa,e)}function Ea(e,t){for(var n=[],r=1;rNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration");return new Ft(eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration");return new Je(ea;a++)if(i=ja(r[a],t,n[o]))return 59!==i.type&&Ta(e,"type",i),i;default:return{type:59,g:2}}}return 59!==r.type&&Ta(e,"type",r),r}(e,_a(wa(e,"argExpr")[1],t),Ea(e,"typeswitchExprCaseClause").map((function(e){return _a(ba(e,["resultExpr"])[1],t)})),_a(ba(e,["typeswitchExprDefaultClause","resultExpr"])[1],t))}],["quantifiedExpr",function(e,t){return Ea(e,"*").map((function(e){return _a(e,t)})),function(e){var t={type:0,g:3};return Ta(e,"type",t),t}(e)}],["x:stackTrace",function(e,t){return _a((e=Ea(e,"*"))[0],t)}],["queryBody",function(e,t){return _a(e[1],t)}],["flworExpr",function(e,t){return function(e,t){for(var n=_a,r=!1,a=1;ae.W.value};case"geOp":return function(e,n){return(e=t(e,n)).V.value>=e.W.value}}}(e,r);if(void 0!==u)return u}if(a(16)&&void 0!==(u=function(e,t){switch(e){case"ltOp":return function(e,n){return(e=t(e,n)).V.value.gae.W.value.ga};case"geOp":return function(e,n){return e=(n=t(e,n)).V,n=n.W,Qe(e.value,n.value)||e.value.ga>n.value.ga}}}(e,r))||a(17)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Qe((e=t(e,n)).V.value,e.W.value)};case"ltOp":return function(e,n){return(e=t(e,n)).V.value.eae.W.value.ea};case"geOp":return function(e,n){return e=(n=t(e,n)).V,n=n.W,Qe(e.value,n.value)||e.value.ea>n.value.ea}}}(e,r))||a(18)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Qe((e=t(e,n)).V.value,e.W.value)};case"neOp":return function(e,n){return!Qe((e=t(e,n)).V.value,e.W.value)}}}(e,r)))return u;if((a(9)||a(7)||a(8))&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return lt((e=t(e,n)).V.value,e.W.value,At(r))};case"neOp":return function(e,n,r){return!lt((e=t(e,n)).V.value,e.W.value,At(r))};case"ltOp":return function(e,n,r){return e=t(e,n),r=At(r),0>ct(e.V.value,e.W.value,r)};case"leOp":return function(e,n,r){var a;return e=(n=t(e,n)).V,n=n.W,(a=lt(e.value,n.value,At(r)))||(r=At(r),a=0>ct(e.value,n.value,r)),a};case"gtOp":return function(e,n,r){return e=t(e,n),r=At(r),0nn(t,e.first(),n.first())}:void 0;case"nodeAfterOp":return t?function(e,n){return 0=r)throw Error("FOAY0001: Array index out of bounds");n.push(e.R[r-1]())}else{if(!Z(e.type,61))throw ea("The provided context item is not a map or an array.");"*"===t?n.push.apply(n,p(e.h.map((function(e){return e.value()})))):(e=e.h.find((function(e){return Le(e.key,t)})))&&n.push(e.value())}return Bt(n)}function ui(e,t,n,r,a){return"*"===t?si(e,t,n):Bt([n,t=ce(t=ar(t,r,a))().L((function(t){return t.reduce((function(t,n){return si(e,n,t)}),new te)}))])}function ci(e,t){rr.call(this,e.s,[e].concat("*"===t?[]:[t]),{C:e.C,S:e.O,subtree:e.subtree}),this.j=e,this.u=t}function li(e,t){var n={};rr.call(this,new yr((n.external=1,n)),"*"===e?[]:[e],{C:!1},!1,t),this.j=e}function pi(e,t,n,r){var a=t.map((function(e){return e.eb}));t=t.map((function(e){return e.name}));var o=a.reduce((function(e,t){return e.add(t.s)}),n.s);rr.call(this,o,a.concat(n),{C:!1},!1,r),this.u=e,this.B=t,this.J=a,this.T=n,this.j=null}function hi(e){rr.call(this,e,[],{C:!1})}function fi(e){var t={};hi.call(this,new yr((t.nodeType=1,t))),this.u=e}function di(e,t){t=void 0===t?{kind:null}:t;var n=e.prefix,r=e.namespaceURI,a={};"*"!==(e=e.localName)&&(a.nodeName=1),a.nodeType=1,hi.call(this,new yr(a)),this.u=e,this.J=r,this.B=n,this.T=t.kind}function mi(e){var t={};hi.call(this,new yr((t.nodeName=1,t))),this.u=e}function gi(e){hi.call(this,new yr({})),this.u=e}function yi(e,t,n){rr.call(this,new yr({}),[],{C:!1,S:"unsorted"}),this.B=n,this.u=t,this.J=e,this.j=null}function vi(e,t){var n=new yr({});Ao.call(this,n,[e,t],{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function wi(e,t){var n=t.h,r=t.s,a=t.A;switch(e.node.nodeType){case 1:var o=r.createElementNS(e.node.namespaceURI,e.node.nodeName);for(n.getAllAttributes(e.node).forEach((function(e){return a.setAttributeNS(o,e.namespaceURI,e.nodeName,e.value)})),e=(r=c(Re(n,e))).next();!e.done;e=r.next())e=wi(e.value,t),a.insertBefore(o,e.node,null);return{node:o,F:null};case 2:return(t=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(n,e),{node:t,F:null};case 4:return{node:r.createCDATASection(De(n,e)),F:null};case 8:return{node:r.createComment(De(n,e)),F:null};case 9:for(r=r.createDocument(),e=(n=c(Re(n,e))).next();!e.done;e=n.next())e=wi(e.value,t),a.insertBefore(r,e.node,null);return{node:r,F:null};case 7:return{node:r.createProcessingInstruction(e.node.target,De(n,e)),F:null};case 3:return{node:r.createTextNode(De(n,e)),F:null}}}function xi(e,t){var n=t.A,r=t.s,a=t.h;if(!Te(e.node))return wi(e,t).node;switch(e.node.nodeType){case 2:return(r=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(a,e),r;case 8:return r.createComment(De(a,e));case 1:var o=e.node.prefix,i=e.node.localName,s=r.createElementNS(e.node.namespaceURI,o?o+":"+i:i);return Re(a,e).forEach((function(e){e=xi(e,t),n.insertBefore(s,e,null)})),Se(a,e).forEach((function(e){n.setAttributeNS(s,e.node.namespaceURI,e.node.nodeName,De(a,e))})),s.normalize(),s;case 7:return r.createProcessingInstruction(e.node.target,De(a,e));case 3:return r.createTextNode(De(a,e))}}function Ai(e,t,n){var r=e.node;if(!(Te(r)||n||e.F))return r;r=t.ha;var a=[];return n?xi(e,t):(e=function(e,t,n){var r=e;for(e=ke(n,r);null!==e;){if(2===r.node.nodeType)t.push(r.node.nodeName);else{var a=Re(n,e);t.push(a.findIndex((function(e){return Wt(e,r)})))}e=ke(n,r=e)}return r}(e,a,t.h),(n=r.get(e.node))||(n={node:xi(e,t),F:null},r.set(e.node,n)),function(e,t,n){for(var r={};0nn(t.h,i,s)){if(e=$(i),i=null,"exceptOp"===n.j)return e}else s=null}return"exceptOp"===n.j?null!==i?(e=$(i),i=null,e):a.next(0):(u=!0,W)}})},y(Yo,dr),Yo.prototype.B=function(e,t,n){return n.length?Bt(n.map((function(t){return t(e)}))):ue.empty()},y(qo,rr),qo.prototype.h=function(e,t){var n=this,r=wt(e,ar(this.j,e,t)),a=null,o=null,i=!1;return ue.create({next:function(e){for(;!i;){if(!a&&(a=r.next(e)).done)return i=!0,W;o||(o=ar(n.u,a.value,t));var s=o.value.next(e);if(!s.done)return s;a=o=null}}})},y(Qo,rr),Qo.prototype.h=function(e,t){var n=this,r=Rt(ar(this.B,e,t),t);return r.$({empty:function(){return n.u?ue.ca():ue.X()},o:function(){return r.map((function(e){return Jt(e,n.j).v?Q:J}))},multiple:function(){return ue.X()}})},y(Jo,rr),Jo.prototype.h=function(e,t){var n=this,r=Rt(ar(this.B,e,t),t);return r.$({empty:function(){if(!n.u)throw Error("XPTY0004: Sequence to cast is empty while target type is singleton.");return ue.empty()},o:function(){return r.map((function(e){return Kt(e,n.j)}))},multiple:function(){throw Error("XPTY0004: Sequence to cast is not singleton or empty.")}})},y(zo,rr),zo.prototype.h=function(e,t){var n=this,r=ar(this.B,e,t);return r.$({empty:function(){return"?"===n.j||"*"===n.j?ue.ca():ue.X()},multiple:function(){return"+"===n.j||"*"===n.j?Ko(r,(function(r){var a=ue.o(r);return r=bt(e,0,r,a),ar(n.u,r,t)})):ue.X()},o:function(){return Ko(r,(function(r){var a=ue.o(r);return r=bt(e,0,r,a),ar(n.u,r,t)}))}})},y(ei,rr),ei.prototype.h=function(e,t){var n=this;if(this.j.every((function(e){return"sorted"===e.O}))){var r=0;return Zo(t.h,{next:function(){return r>=n.j.length?W:$(ar(n.j[r++],e,t))}}).map((function(e){if(!Z(e.type,53))throw Error("XPTY0004: The sequences to union are not of type node()*");return e}))}return Bt(this.j.map((function(n){return ar(n,e,t)}))).L((function(e){if(e.some((function(e){return!Z(e.type,53)})))throw Error("XPTY0004: The sequences to union are not of type node()*");return e=rn(t.h,e),ue.create(e)}))},y(ni,Ao),ni.prototype.J=function(e,t,n,r){if(this.B[1])throw Error("More than one order spec is not supported for the order by clause.");var a,o,i=[],s=!1,u=null,l=this.B[0];return ue.create({next:function(){if(!s){for(var p=t.next(0);!p.done;)i.push(p.value),p=t.next(0);if((p=i.map((function(e){return l.da.h(e,n)})).map((function(e){return Rt(e,n)}))).find((function(e){return!e.G()&&!e.ya()})))throw ea("Order by only accepts empty or singleton sequences");if(function(e){return(e=e.find((function(e){return!!e})))?Dt(e.type):null}(a=(a=p.map((function(e){return e.first()}))).map((function(e){return null===e?e:Z(19,e.type)?Kt(e,1):e})))&&!(a=ti(a)))throw ea("Could not cast values");p=a.length,o=a.map((function(e,t){return t}));for(var h=0;h=a.length?W:$(i[o[v++]]):0>v?W:$(i[o[v--]])}}).value,s=!0}return u.next(0)}})},y(ri,rr),ri.prototype.h=function(e,t){if(null===e.M)throw Error("XPDY0002: context is absent, it needs to be present to use paths.");for(var n=t.h,r=e.M.value;9!==r.node.nodeType;)if(null===(r=ke(n,r)))throw Error("XPDY0050: the root node of the context node is not a document node.");return n=ue.o(Xe(r)),this.j?ar(this.j,bt(e,0,n.first(),n),t):n},y(ai,rr),ai.prototype.h=function(e){if(null===e.M)throw Error('XPDY0002: context is absent, it needs to be present to use the "." operator');return ue.o(e.M)},y(oi,rr),oi.prototype.h=function(e,t){var n=this,r=!0;return this.j.reduce((function(a,o,i){var s=null===a?zt(e):wt(e,a);if(a={next:function(e){if((e=s.next(e)).done)return W;if(null!==e.value.M&&!Z(e.value.M.type,53)&&0c.length-1)){for(i=Object.create(null),s={},u=0;u"))throw Error('XQDY0026: The content "'+u+'" for a processing instruction node contains "?>".');return s=!0,$({H:[],fa:lr([new Mi(r.value,u)],i,a)})}}}}(t,n,e):function(e,t,n){var r,a,o;return{next:function(){if(!r){var i=n.next(0),s=Fi([i.value.H],e,tr);r={attributes:s.attributes.map((function(e){return{node:e,F:null}})),Ta:s.Ta.map((function(e){return{node:e,F:null}}))},a=i.value.fa}if(0===(s=t.next(0)).value.H.length)throw nr();if(1!==s.value.H.length)throw zn();if(!(Z(s.value.H[0].type,54)||Z(s.value.H[0].type,47)||Z(s.value.H[0].type,56)||Z(s.value.H[0].type,58)||Z(s.value.H[0].type,57)))throw zn();if(null===(o=ke(e.h,s.value.H[0].value,null)))throw Error("XUDY0009: The target "+s.value.H[0].value.outerHTML+" for replacing a node must have a parent.");if(i=s.value.H[0],s=s.value.fa,Z(i.type,47)){if(r.Ta.length)throw Error("XUTY0011: When replacing an attribute the new value must be zero or more attribute nodes.");r.attributes.reduce((function(e,t){var n=t.node.prefix||"";t=t.node.namespaceURI;var r=o.node.lookupNamespaceURI(n);if(r&&r!==t)throw er(t);if((r=e[n])&&t!==r)throw tr(t);return e[n]=t,e}),{})}else if(r.attributes.length)throw Error("XUTY0010: When replacing an an element, text, comment, or processing instruction node the new value must be a single node.");return $({H:[],fa:lr([Gi(i.value,[].concat(r.attributes,r.Ta))],a,s)})}}}(t,n,e)},y(Ki,pr),Ki.prototype.h=function(e,t){return fr(e=this.u(e,t),(function(){}))},Ki.prototype.u=function(e,t){var n,r,a,o=this,i=t.h,s=t.s,u=t.A,c=[],l=[],h=[];return{next:function(){if(l.length!==o.j.length)for(var f={},d=l.length;d"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"');if(null!==n.j.Jb)return es(r=n.j.Jb),ue.o(Xe(ts(r,a)));r=ar(n.j.Cb,e,t);var o=Vi(t,r);return ue.create({next:function(){var e=o.next(0);return e.done?e:(es(e=e.value.value),$(Xe(ts(e,a))))}})}))},y(rs,rr),rs.prototype.h=function(e,t){return this.j?Rt(e=ar(this.j,e,t),t).L((function(e){return 0===e.length?ue.empty():(e={node:{data:e.map((function(e){return Kt(e,1).value})).join(" "),Qa:!0,nodeType:3},F:null},ue.o(Xe(e)))})):ue.empty()},y(as,dr),as.prototype.B=function(e,t,n){var r=this;return n[0](e).L((function(a){for(var o=0;oa.length)return!1;break;default:if(1!==a.length)return!1}var r=ue.create(a);return a.every((function(a,o){return a=bt(e,o,a,r),ar(n.Kb,a,t).getEffectiveBooleanValue()}))})))return n[o+1](e);return n[r.j+1](e)}))},as.prototype.P=function(e){if(dr.prototype.P.call(this,e),this.J.I)throw qn()};var os={aa:!1,qa:!1},is={aa:!0,qa:!1},ss={aa:!0,qa:!0};function us(e){return e.aa?e.qa?ss:is:os}function cs(e,t){switch(e[0]){case"andOp":var n=Aa(e,"type");return new Ro(ps("andOp",e,us(t)),n);case"orOp":return n=Aa(e,"type"),new Do(ps("orOp",e,us(t)),n);case"unaryPlusOp":return n=wa(wa(e,"operand"),"*"),e=Aa(e,"type"),new Oo("+",cs(n,t),e);case"unaryMinusOp":return n=wa(wa(e,"operand"),"*"),e=Aa(e,"type"),new Oo("-",cs(n,t),e);case"addOp":case"subtractOp":case"multiplyOp":case"divOp":case"idivOp":case"modOp":var r=e[0],a=cs(ba(e,["firstOperand","*"]),us(t));t=cs(ba(e,["secondOperand","*"]),us(t));var o=Aa(e,"type"),i=Aa(ba(e,["firstOperand","*"]),"type"),s=Aa(ba(e,["secondOperand","*"]),"type");return i&&s&&Aa(e,"type")&&(n=Ma(r,i.type,s.type)),new Fa(r,a,t,o,n);case"sequenceExpr":return function(e,t){var n=Ea(e,"*").map((function(e){return cs(e,t)}));return 1===n.length?n[0]:(n=Aa(e,"type"),new Yo(Ea(e,"*").map((function(e){return cs(e,t)})),n))}(e,t);case"unionOp":return n=Aa(e,"type"),new ei([cs(ba(e,["firstOperand","*"]),us(t)),cs(ba(e,["secondOperand","*"]),us(t))],n);case"exceptOp":case"intersectOp":return n=Aa(e,"type"),new Vo(e[0],cs(ba(e,["firstOperand","*"]),us(t)),cs(ba(e,["secondOperand","*"]),us(t)),n);case"stringConcatenateOp":return function(e,t){var n=Aa(e,"type");return new Er(new Io({localName:"concat",namespaceURI:"http://www.w3.org/2005/xpath-functions",prefix:""},(e=[ba(e,["firstOperand","*"]),ba(e,["secondOperand","*"])]).length,n),e.map((function(e){return cs(e,us(t))})),n)}(e,t);case"rangeSequenceExpr":return function(e,t){var n=Aa(e,"type");return new Er(new Io({localName:"to",namespaceURI:"http://fontoxpath/operators",prefix:""},(e=[wa(wa(e,"startExpr"),"*"),wa(wa(e,"endExpr"),"*")]).length,n),e.map((function(e){return cs(e,us(t))})),n)}(e,t);case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":return fs("generalCompare",e,t);case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":return fs("valueCompare",e,t);case"isOp":case"nodeBeforeOp":case"nodeAfterOp":return fs("nodeCompare",e,t);case"pathExpr":return function(e,t){var n=Aa(e,"type"),r=Ea(e,"stepExpr"),a=!1,o=r.map((function(e){for(var r=wa(e,"xpathAxis"),o=Ea(e,"*"),i=[],s=null,u=(o=c(o)).next();!u.done;u=o.next())switch(u=u.value,u[0]){case"lookup":i.push(["lookup",hs(u,t)]);break;case"predicate":case"predicates":for(var l=(u=c(Ea(u,"*"))).next();!l.done;l=u.next())s=ao(s,(l=cs(l.value,us(t))).A()),i.push(["predicate",l])}if(r)switch(a=!0,e=wa(e,"attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" ")),e=ls(e),xa(r)){case"ancestor":var p=new no(e,{Oa:!1});break;case"ancestor-or-self":p=new no(e,{Oa:!0});break;case"attribute":p=new oo(e,s);break;case"child":p=new io(e,s);break;case"descendant":p=new uo(e,{Oa:!1});break;case"descendant-or-self":p=new uo(e,{Oa:!0});break;case"parent":p=new fo(e,s);break;case"following-sibling":p=new ho(e,s);break;case"preceding-sibling":p=new go(e,s);break;case"following":p=new po(e);break;case"preceding":p=new mo(e);break;case"self":p=new yo(e,s)}else p=cs(p=ba(e,["filterExpr","*"]),us(t));for(r=(i=c(i)).next();!r.done;r=i.next())switch(r=r.value,r[0]){case"lookup":p=new ci(p,r[1]);break;case"predicate":p=new ii(p,r[1])}return p.type=n,p}));return e=wa(e,"rootExpr"),!(r=a||null!==e||1"),Ws=Es.token("/>"),$s=Es.token(""),ru=Es.token("&#x"),au=Es.token("&#"),ou=Es.token(":*"),iu=Es.token("*:"),su=Es.token(":="),uu=Es.token("&"),cu=Es.token(":"),lu=Es.token(";"),pu=Es.token("*"),hu=Es.token("@"),fu=Es.token("$"),du=Es.token("#"),mu=Es.token("%"),gu=Es.token("?"),yu=Es.token("!"),vu=Es.token("|"),wu=Es.token("||"),xu=Es.token("="),Au=Es.token("!="),bu=Es.token("<"),Eu=Es.token("<<"),Nu=Es.token("<="),Bu=Es.token(">"),Tu=Es.token(">>"),Iu=Es.token(">="),Cu=Es.token(","),Su=Es.token("."),Ou=Es.token(".."),Ru=Es.token("+"),Du=Es.token("-"),Uu=Es.token("/"),Mu=Es.token("//"),Gu=Es.token("=>"),ku=Es.token("e"),Fu=Es.token("E"),Pu=Es.token("l"),Hu=Es.token("L"),ju=Es.token("m"),Xu=Es.token("M"),_u=Es.token("Q"),Lu=Es.token("x"),Vu=Es.token("X"),Yu=Es.token("as"),qu=Es.token("cast"),Qu=Es.token("castable"),Ju=Es.token("treat"),Ku=Es.token("instance"),zu=Es.token("of"),Wu=Es.token("node"),$u=Es.token("nodes"),Zu=Es.token("delete"),ec=Es.token("value"),tc=Es.token("function"),nc=Es.token("map"),rc=Es.token("element"),ac=Es.token("attribute"),oc=Es.token("schema-element"),ic=Es.token("intersect"),sc=Es.token("except"),uc=Es.token("union"),cc=Es.token("to"),lc=Es.token("is"),pc=Es.token("or"),hc=Es.token("and"),fc=Es.token("div"),dc=Es.token("idiv"),mc=Es.token("mod"),gc=Es.token("eq"),yc=Es.token("ne"),vc=Es.token("lt"),wc=Es.token("le"),xc=Es.token("gt"),Ac=Es.token("ge"),bc=Es.token("amp"),Ec=Es.token("quot"),Nc=Es.token("apos"),Bc=Es.token("if"),Tc=Es.token("then"),Ic=Es.token("else"),Cc=Es.token("allowing"),Sc=Es.token("empty"),Oc=Es.token("at"),Rc=Es.token("in"),Dc=Es.token("for"),Uc=Es.token("let"),Mc=Es.token("where"),Gc=Es.token("collation"),kc=Es.token("group"),Fc=Es.token("by"),Pc=Es.token("order"),Hc=Es.token("stable"),jc=Es.token("return"),Xc=Es.token("array"),_c=Es.token("document"),Lc=Es.token("namespace"),Vc=Es.token("text"),Yc=Es.token("comment"),qc=Es.token("processing-instruction"),Qc=Es.token("lax"),Jc=Es.token("strict"),Kc=Es.token("validate"),zc=Es.token("type"),Wc=Es.token("declare"),$c=Es.token("default"),Zc=Es.token("boundary-space"),el=Es.token("strip"),tl=Es.token("preserve"),nl=Es.token("no-preserve"),rl=Es.token("inherit"),al=Es.token("no-inherit"),ol=Es.token("greatest"),il=Es.token("least"),sl=Es.token("copy-namespaces"),ul=Es.token("decimal-format"),cl=Es.token("case"),ll=Es.token("typeswitch"),pl=Es.token("some"),hl=Es.token("every"),fl=Es.token("satisfies"),dl=Es.token("replace"),ml=Es.token("with"),gl=Es.token("copy"),yl=Es.token("modify"),vl=Es.token("first"),wl=Es.token("last"),xl=Es.token("before"),Al=Es.token("after"),bl=Es.token("into"),El=Es.token("insert"),Nl=Es.token("rename"),Bl=Es.token("switch"),Tl=Es.token("variable"),Il=Es.token("external"),Cl=Es.token("updating"),Sl=Es.token("import"),Ol=Es.token("schema"),Rl=Es.token("module"),Dl=Es.token("base-uri"),Ul=Es.token("construction"),Ml=Es.token("ordering"),Gl=Es.token("ordered"),kl=Es.token("unordered"),Fl=Es.token("option"),Pl=Es.token("context"),Hl=Es.token("item"),jl=Es.token("xquery"),Xl=Es.token("version"),_l=Es.token("encoding"),Ll=Es.token("document-node"),Vl=Es.token("namespace-node"),Yl=Es.token("schema-attribute"),ql=Es.token("ascending"),Ql=Es.token("descending"),Jl=Es.token("empty-sequence"),Kl=Es.token("child::"),zl=Es.token("descendant::"),Wl=Es.token("attribute::"),$l=Es.token("self::"),Zl=Es.token("descendant-or-self::"),ep=Es.token("following-sibling::"),tp=Es.token("following::"),np=Es.token("parent::"),rp=Es.token("ancestor::"),ap=Es.token("preceding-sibling::"),op=Es.token("preceding::"),ip=Es.token("ancestor-or-self::"),sp=Es.token("decimal-separator"),up=Es.token("grouping-separator"),cp=Es.token("infinity"),lp=Es.token("minus-sign"),pp=Es.token("NaN"),hp=Es.token("per-mille"),fp=Es.token("zero-digit"),dp=Es.token("digit"),mp=Es.token("pattern-separator"),gp=Es.token("exponent-separator"),yp=Es.token("schema-attribute("),vp=Es.token("document-node("),wp=Es.token("processing-instruction("),xp=Es.token("processing-instruction()"),Ap=Es.token("comment()"),bp=Es.token("text()"),Ep=Es.token("namespace-node()"),Np=Es.token("node()"),Bp=Es.token("item()"),Tp=Es.token("empty-sequence()"),Ip=new Map,Cp=new Map,Sp=Es.or([Rs(/[\t\n\r -\uD7FF\uE000\uFFFD]/),Rs(/[\uD800-\uDBFF][\uDC00-\uDFFF]/)]),Op=Es.preceded(Es.peek(Es.not(Es.or([Us,Ms]),['comment contents cannot contain "(:" or ":)"'])),Sp),Rp=Es.map(Es.delimited(Us,Es.star(Es.or([Op,function(e,t){return Rp(e,t)}])),Ms),(function(e){return e.join("")})),Dp=Es.or([Ds,Rp]),Up=Es.map(Es.plus(Ds),(function(e){return e.join("")})),Mp=Ns(Es.map(Es.star(Dp),(function(e){return e.join("")})),Ip),Gp=Ns(Es.map(Es.plus(Dp),(function(e){return e.join("")})),Cp),kp=Es.or([Rs(/[A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/),Es.then(Rs(/[\uD800-\uDB7F]/),Rs(/[\uDC00-\uDFFF]/),(function(e,t){return e+t}))]),Fp=Es.or([kp,Rs(/[\-\.0-9\xB7\u0300-\u036F\u203F\u2040]/)]),Pp=Es.then(kp,Es.star(Fp),(function(e,t){return e+t.join("")})),Hp=Es.map(Pp,(function(e){return["prefix",e]})),jp=Es.or([kp,cu]),Xp=Es.or([Fp,cu]),_p=Es.then(jp,Es.star(Xp),(function(e,t){return e+t.join("")})),Lp=Es.map(Pp,(function(e){var t={};return[(t.prefix="",t.URI=null,t),e]})),Vp=Es.then(Pp,Es.preceded(cu,Pp),(function(e,t){var n={};return[(n.prefix=e,n.URI=null,n),t]})),Yp=Es.or([Vp,Lp]),qp=Es.followed(Ts([_u,Mp,Xs],Es.map(Es.star(Rs(/[^{}]/)),(function(e){return e.join("").replace(/\s+/g," ").trim()}))),_s),Qp=Es.then(qp,Pp,(function(e,t){return[e,t]})),Jp=Es.or([Es.map(Qp,(function(e){var t={};return[(t.prefix=null,t.URI=e[0],t),e[1]]})),Yp]),Kp=Es.or([Es.map(Jp,(function(e){return["QName"].concat(p(e))})),Es.map(pu,(function(){return["star"]}))]),zp=Es.map(Es.preceded(fu,Jp),(function(e){return["varRef",["name"].concat(p(e))]})),Wp=Es.peek(Es.or([Fs,Qs,Ys,Dp])),$p=Es.map(Es.or([Kl,zl,Wl,$l,Zl,ep,tp]),(function(e){return e.substring(0,e.length-2)})),Zp=Es.map(Es.or([np,rp,ap,op,ip]),(function(e){return e.substring(0,e.length-2)})),eh=Is(uu,Es.or([vc,xc,bc,Ec,Nc]),lu,(function(e,t,n){return e+t+n})),th=Es.or([Is(ru,Rs(/[0-9a-fA-F]+/),lu,(function(e,t,n){return e+t+n})),Is(au,Rs(/[0-9]+/),lu,(function(e,t,n){return e+t+n}))]),nh=Os([Js],'"'),rh=Os([qs],"'"),ah=Ss(Os([Ap],"commentTest")),oh=Ss(Os([bp],"textTest")),ih=Ss(Os([Ep],"namespaceTest")),sh=Ss(Os([Np],"anyKindTest")),uh=Rs(/[0-9]+/),ch=Es.then(Es.or([Es.then(Su,uh,(function(e,t){return e+t})),Es.then(uh,Es.optional(Es.preceded(Su,Rs(/[0-9]*/))),(function(e,t){return e+(null!==t?"."+t:"")}))]),Is(Es.or([ku,Fu]),Es.optional(Es.or([Ru,Du])),uh,(function(e,t,n){return e+(t||"")+n})),(function(e,t){return["doubleConstantExpr",["value",e+t]]})),lh=Es.or([Es.map(Es.preceded(Su,uh),(function(e){return["decimalConstantExpr",["value","."+e]]})),Es.then(Es.followed(uh,Su),Es.optional(uh),(function(e,t){return["decimalConstantExpr",["value",e+"."+(null!==t?t:"")]]}))]),ph=Es.map(uh,(function(e){return["integerConstantExpr",["value",e]]})),hh=Es.followed(Es.or([ch,lh,ph]),Es.peek(Es.not(Rs(/[a-zA-Z]/),["no alphabetical characters after numeric literal"]))),fh=Es.map(Es.followed(Su,Es.peek(Es.not(Su,["context item should not be followed by another ."]))),(function(){return["contextItemExpr"]})),dh=Es.or([Xc,ac,Yc,Ll,rc,Jl,tc,Bc,Hl,nc,Vl,Wu,qc,Yl,oc,Bl,Vc,ll]),mh=Ss(Os([gu],"argumentPlaceholder")),gh=Es.or([gu,pu,Ru]),yh=Es.preceded(Es.peek(Es.not(Rs(/[{}<&]/),["elementContentChar cannot be {, }, <, or &"])),Sp),vh=Es.map(Es.delimited(Ks,Es.star(Es.preceded(Es.peek(Es.not(zs,['CDataSection content may not contain "]]>"'])),Sp)),zs),(function(e){return["CDataSection",e.join("")]})),wh=Es.preceded(Es.peek(Es.not(Rs(/["{}<&]/),['quotAttrValueContentChar cannot be ", {, }, <, or &'])),Sp),xh=Es.preceded(Es.peek(Es.not(Rs(/['{}<&]/),["aposAttrValueContentChar cannot be ', {, }, <, or &"])),Sp),Ah=Es.map(Es.star(Es.or([Es.preceded(Es.peek(Es.not(Du,[])),Sp),Es.map(Ts([Du,Es.peek(Es.not(Du,[]))],Sp),(function(e){return"-"+e}))])),(function(e){return e.join("")})),bh=Es.map(Es.delimited(Zs,Ah,eu),(function(e){return["computedCommentConstructor",["argExpr",["stringConstantExpr",["value",e]]]]})),Eh=Es.preceded(Es.peek(Es.not(Is(Es.or([Vu,Lu]),Es.or([Xu,ju]),Es.or([Hu,Pu]),(function(){return[]})),[])),_p),Nh=Es.map(Es.star(Es.preceded(Es.peek(Es.not(nu,[])),Sp)),(function(e){return e.join("")})),Bh=Es.then(Es.preceded(tu,Eh),Es.followed(Es.optional(Es.preceded(Up,Nh)),nu),(function(e,t){return["computedPIConstructor",["piTarget",e],["piValueExpr",["stringConstantExpr",["value",t]]]]})),Th=Es.map(Mu,(function(){return["stepExpr",["xpathAxis","descendant-or-self"],["anyKindTest"]]})),Ih=Es.or([Qc,Jc]),Ch=Es.map(Es.star(Es.followed(Sp,Es.peek(Es.not(ks,["Pragma contents should not contain '#)'"])))),(function(e){return e.join("")})),Sh=Es.map(Es.followed(Es.or([gc,yc,vc,wc,xc,Ac]),Wp),(function(e){return e+"Op"})),Oh=Es.or([Es.followed(Os([lc],"isOp"),Wp),Os([Eu],"nodeBeforeOp"),Os([Tu],"nodeAfterOp")]),Rh=Es.or([Os([xu],"equalOp"),Os([Au],"notEqualOp"),Os([Nu],"lessThanOrEqualOp"),Os([bu],"lessThanOp"),Os([Iu],"greaterThanOrEqualOp"),Os([Bu],"greaterThanOp")]),Dh=Es.map(Cl,(function(){return["annotation",["annotationName","updating"]]})),Uh=Es.or([tl,nl]),Mh=Es.or([rl,al]),Gh=Es.or([sp,up,cp,lp,pp,mu,hp,fp,dp,mp,gp]),kh=Es.map(Ts([Wc,Gp,Zc,Gp],Es.or([tl,el])),(function(e){return["boundarySpaceDecl",e]})),Fh=Es.map(Ts([Wc,Gp,Ul,Gp],Es.or([tl,el])),(function(e){return["constructionDecl",e]})),Ph=Es.map(Ts([Wc,Gp,Ml,Gp],Es.or([Gl,kl])),(function(e){return["orderingModeDecl",e]})),Hh=Es.map(Ts([Wc,Gp,$c,Gp,Pc,Gp,Sc,Gp],Es.or([ol,il])),(function(e){return["emptyOrderDecl",e]})),jh=Es.then(Ts([Wc,Gp,sl,Gp],Uh),Ts([Mp,Cu,Mp],Mh),(function(e,t){return["copyNamespacesDecl",["preserveMode",e],["inheritMode",t]]}));function Xh(e){switch(e[0]){case"constantExpr":case"varRef":case"contextItemExpr":case"functionCallExpr":case"sequenceExpr":case"elementConstructor":case"computedElementConstructor":case"computedAttributeConstructor":case"computedDocumentConstructor":case"computedTextConstructor":case"computedCommentConstructor":case"computedNamespaceConstructor":case"computedPIConstructor":case"orderedExpr":case"unorderedExpr":case"namedFunctionRef":case"inlineFunctionExpr":case"dynamicFunctionInvocationExpr":case"mapConstructor":case"arrayConstructor":case"stringConstructor":case"unaryLookup":return e}return["sequenceExpr",e]}function _h(e){if(!(1<=e&&55295>=e||57344<=e&&65533>=e||65536<=e&&1114111>=e))throw Error("XQST0090: The character reference "+e+" ("+e.toString(16)+") does not reference a valid codePoint.")}function Lh(e){return e.replace(/(&[^;]+);/g,(function(e){if(/^&#x/.test(e))return _h(e=parseInt(e.slice(3,-1),16)),String.fromCodePoint(e);if(/^&#/.test(e))return _h(e=parseInt(e.slice(2,-1),10)),String.fromCodePoint(e);switch(e){case"<":return"<";case">":return">";case"&":return"&";case""":return String.fromCharCode(34);case"'":return String.fromCharCode(39)}throw Error('XPST0003: Unknown character reference: "'+e+'"')}))}function Vh(e,t,n){if(!e.length)return[];for(var r=[e[0]],a=1;a=t+n?W:(e=a.next(e),r++,e)}},o)}function pf(e){return e.map((function(e){return Z(e.type,19)?Kt(e,3):e}))}function hf(e){if((e=pf(e)).some((function(e){return Number.isNaN(e.value)})))return[q(NaN,3)];if(!(e=ti(e)))throw Error("FORG0006: Incompatible types to be converted to a common type");return e}function ff(e,t,n,r,a,o){return _e([a,o],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,1/0===e.value)return ue.empty();if(-1/0===e.value)return t&&1/0===t.value?ue.empty():r;if(t){if(isNaN(t.value))return ue.empty();1/0===t.value&&(t=null)}return isNaN(e.value)?ue.empty():lf(r,Math.round(e.value),t?Math.round(t.value):null)}))}function df(e,t,n,r,a){if(r.G())return a;if(!(e=ti(e=pf(r.N()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return Z(e.type,2)})))throw Error("FORG0006: items passed to fn:sum are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0),e.every((function(e){return Z(e.type,5)}))?ue.o(q(t,5)):e.every((function(e){return Z(e.type,3)}))?ue.o(q(t,3)):e.every((function(e){return Z(e.type,4)}))?ue.o(q(t,4)):ue.o(q(t,6))}var mf=[].concat(Sr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"boolean",l:[{type:59,g:2}],i:{type:0,g:3},m:function(e,t,n,r){return r.getEffectiveBooleanValue()?ue.ca():ue.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"true",l:[],i:{type:0,g:3},m:function(){return ue.ca()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"not",l:[{type:59,g:2}],i:{type:0,g:3},m:function(e,t,n,r){return!1===r.getEffectiveBooleanValue()?ue.ca():ue.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"false",l:[],i:{type:0,g:3},m:function(){return ue.X()}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"last",l:[],i:{type:5,g:3},m:function(e){if(null===e.M)throw Error("XPDY0002: The fn:last() function depends on dynamic context, which is absent.");var t=!1;return ue.create({next:function(){if(t)return W;var n=e.Ga.Na();return t=!0,$(q(n,5))}},1)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"position",l:[],i:{type:5,g:3},m:function(e){if(null===e.M)throw Error("XPDY0002: The fn:position() function depends on dynamic context, which is absent.");return ue.o(q(e.Ja+1,5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-dateTime",l:[],i:{type:10,g:3},m:function(e){return ue.o(q(xt(e),10))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-date",l:[],i:{type:7,g:3},m:function(e){return ue.o(q(it(xt(e),7),7))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-time",l:[],i:{type:8,g:3},m:function(e){return ue.o(q(it(xt(e),8),8))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"implicit-timezone",l:[],i:{type:17,g:3},m:function(e){return ue.o(q(At(e),17))}}],Rr,Hr,Xr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"years-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.cb(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"months-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.$a(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"days-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.Za(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getHours(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getMinutes(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-duration",l:[{type:18,g:0}],i:{type:4,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getSeconds(),4))}}],Lr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2},{type:53,g:3}],i:{type:54,g:2},m:sf},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2}],i:{type:54,g:2},m:function(e,t,n,r){return sf(e,t,0,r,ue.o(e.M))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2},{type:53,g:3}],i:{type:53,g:2},m:uf},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2}],i:{type:53,g:2},m:function(e,t,n,r){return uf(e,t,0,r,ue.o(e.M))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"parse-json",l:[{type:1,g:3}],i:{type:59,g:0},m:function(e,t,n,r){try{var a=JSON.parse(r.first().value)}catch(e){throw Error("FOJS0001: parsed JSON string contains illegal JSON.")}return function e(t){switch(typeof t){case"object":return Array.isArray(t)?ue.o(new He(t.map((function(t){return ce(e(t))})))):null===t?ue.empty():ue.o(new Ye(Object.keys(t).map((function(n){return{key:q(n,1),value:ce(e(t[n]))}}))));case"number":return ue.o(q(t,3));case"string":return ue.o(q(t,1));case"boolean":return t?ue.ca():ue.X();default:throw Error("Unexpected type in JSON parse")}}(a)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"contains",l:[{type:61,g:3},{type:46,g:3}],i:{type:0,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return t.h.some((function(e){return Le(e.key,n)}))?ue.ca():ue.X()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"entry",l:[{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a){return r.map((function(e){return new Ye([{key:e,value:ce(a)}])}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"for-each",l:[{type:61,g:3},{type:59,g:2}],i:{type:59,g:2},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;return Bt(a.h.map((function(r){return o.value.call(void 0,e,t,n,ue.o(r.key),r.value())})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"get",l:[{type:61,g:3},{type:46,g:3}],i:{type:59,g:2},m:Ve},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"keys",l:[{type:61,g:3}],i:{type:46,g:2},m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.create(e.h.map((function(e){return e.key})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2},{type:61,g:3}],i:{type:61,g:3},m:cf},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2}],i:{type:61,g:3},m:function(e,t,n,r){return cf(e,0,0,r,ue.o(new Ye([{key:q("duplicates",1),value:function(){return ue.o(q("use-first",1))}}])))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"put",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a,o){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return e=t.h.concat(),0<=(t=e.findIndex((function(e){return Le(e.key,n)})))?e.splice(t,1,{key:n,value:ce(o)}):e.push({key:n,value:ce(o)}),ue.o(new Ye(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"remove",l:[{type:61,g:3},{type:46,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){var t=c(e).next().value.h.concat();return a.L((function(e){return e.forEach((function(e){var n=t.findIndex((function(t){return Le(t.key,e)}));0<=n&&t.splice(n,1)})),ue.o(new Ye(t))}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"size",l:[{type:61,g:3}],i:{type:5,g:3},m:function(e,t,n,r){return r.map((function(e){return q(e.h.length,5)}))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pi",l:[],i:{type:3,g:3},m:function(){return ue.o(q(Math.PI,3))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(Math.E,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp10",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(10,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log10",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log10(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pow",l:[{type:3,g:0},{type:2,g:3}],i:{type:3,g:0},m:function(e,t,n,r,a){return a.L((function(e){var t=c(e).next().value;return r.map((function(e){return 1!==Math.abs(e.value)||Number.isFinite(t.value)?q(Math.pow(e.value,t.value),3):q(1,3)}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sqrt",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sqrt(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sin",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"cos",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.cos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"tan",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.tan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"asin",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.asin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"acos",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.acos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.atan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan2",l:[{type:3,g:0},{type:3,g:3}],i:{type:3,g:0},m:function(e,t,n,r,a){return a.L((function(e){var t=c(e).next().value;return r.map((function(e){return q(Math.atan2(e.value,t.value),3)}))}))}}],Fn,dn,[{namespaceURI:"http://fontoxpath/operators",localName:"to",l:[{type:5,g:0},{type:5,g:0}],i:{type:5,g:2},m:function(e,t,n,r,a){if(e=r.first(),a=a.first(),null===e||null===a)return ue.empty();var o=e.value;return a=a.value,o>a?ue.empty():ue.create({next:function(){return $(q(o++,5))}},a-o+1)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"QName",l:[{type:1,g:0},{type:1,g:3}],i:{type:23,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,!Mt(t=t.next().value.value,23))throw Error("FOCA0002: The provided QName is invalid.");if(null===(e=e&&e.value||null)&&t.includes(":"))throw Error("FOCA0002: The URI of a QName may not be empty if a prefix is provided.");if(r.G())return ue.o(q(new ye("",null,t),23));if(!t.includes(":"))return ue.o(q(new ye("",e,t),23));var n=c(t.split(":"));return t=n.next().value,n=n.next().value,ue.o(q(new ye(t,e,n),23))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"prefix-from-QName",l:[{type:23,g:0}],i:{type:24,g:0},m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)?ue.empty():(e=e.value).prefix?ue.o(q(e.prefix,24)):ue.empty()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"local-name-from-QName",l:[{type:23,g:0}],i:{type:24,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.localName,24)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"namespace-uri-from-QName",l:[{type:23,g:0}],i:{type:20,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.namespaceURI||"",20)}))}}],[{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ue.ca()},multiple:function(){return ue.X()},o:function(){return ue.X()}})},localName:"empty",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ue.X()},multiple:function(){return ue.ca()},o:function(){return ue.ca()}})},localName:"exists",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return lf(r,1,1)},localName:"head",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){return lf(r,2,null)},localName:"tail",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(e,t,n,r,a,o){return r.G()?o:o.G()?r:(e=r.N(),0>(a=a.first().value-1)?a=0:a>e.length&&(a=e.length),t=e.slice(a),ue.create(e.slice(0,a).concat(o.N(),t)))},localName:"insert-before",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(e,t,n,r,a){return e=a.first().value,!(r=r.N()).length||1>e||e>r.length||r.splice(e-1,1),ue.create(r)},localName:"remove",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.L((function(e){return ue.create(e.reverse())}))},localName:"reverse",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(e,t,n,r,a){return ff(0,0,0,r,a,ue.empty())},localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:ff,localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r},localName:"unordered",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:46,g:2}],m:function(e,t,n,r){var a=Rt(r,t).N();return ue.create(a).filter((function(e,t){return a.slice(0,t).every((function(t){return!jn(e,t)}))}))},localName:"distinct-values",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"distinct-values",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(e,t,n,r,a){return a.L((function(n){var a=c(n).next().value;return Rt(r,t).map((function(t,n){return ko("eqOp",t.type,a.type)(t,a,e)?q(n+1,5):q(-1,5)})).filter((function(e){return-1!==e.value}))}))},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(e,t,n,r,a){var o=!1,i=Ln(e,t,n,r,a);return ue.create({next:function(){if(o)return W;var e=i.next(0);return e.done?e:(o=!0,$(q(e.value,0)))}})},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){var a=!1;return ue.create({next:function(){if(a)return W;var e=r.Na();return a=!0,$(q(e,5))}})},localName:"count",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}},{l:[{type:46,g:2}],m:function(e,t,n,r){if(r.G())return r;if(!(e=ti(e=pf(r.N()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return Z(e.type,2)})))throw Error("FORG0006: items passed to fn:avg are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0)/e.length,e.every((function(e){return Z(e.type,5)||Z(e.type,3)}))?ue.o(q(t,3)):e.every((function(e){return Z(e.type,4)}))?ue.o(q(t,4)):ue.o(q(t,6))},localName:"avg",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return r.G()?r:(e=hf(r.N()),ue.o(e.reduce((function(e,t){return e.valuet.value?t:e}))))},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return df(e,t,0,r,ue.o(q(0,5)))},localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:df,localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.G()&&!r.ya())throw Error("FORG0003: The argument passed to fn:zero-or-one contained more than one item.");return r},localName:"zero-or-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(r.G())throw Error("FORG0004: The argument passed to fn:one-or-more was empty.");return r},localName:"one-or-more",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:1}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.ya())throw Error("FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.");return r},localName:"exactly-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.G())return r;var o=a.first(),i=o.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.filter((function(r){if(r=cn(i[0],ue.o(r),t,"fn:filter",!1),!(r=o.value.call(void 0,e,t,n,r)).ya()||!Z(r.first().type,0))throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.first().value}))},localName:"filter",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.G())return r;var o=a.first(),i=o.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible.");var s,u=r.value;return ue.create({next:function(r){for(;;){if(!s){var a=u.next(0);if(a.done)return a;a=cn(i[0],ue.o(a.value),t,"fn:for-each",!1),s=o.value.call(void 0,e,t,n,a).value}if(!(a=s.next(r)).done)return a;s=null}}})},localName:"for-each",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,o){if(r.G())return r;var i=o.first(),s=i.s;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-left is incompatible.");return r.L((function(r){return r.reduce((function(r,a){return r=cn(s[0],r,t,"fn:fold-left",!1),a=cn(s[1],ue.o(a),t,"fn:fold-left",!1),i.value.call(void 0,e,t,n,r,a)}),a)}))},localName:"fold-left",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,o){if(r.G())return r;var i=o.first(),s=i.s;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-right is incompatible.");return r.L((function(r){return r.reduceRight((function(r,a){return r=cn(s[0],r,t,"fn:fold-right",!1),a=cn(s[1],ue.o(a),t,"fn:fold-right",!1),i.value.call(void 0,e,t,n,a,r)}),a)}))},localName:"fold-right",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!t.j)throw Error("serialize() called but no xmlSerializer set in execution parameters.");if(!(e=r.N()).every((function(e){return Z(e.type,53)})))throw Error("Expected argument to fn:serialize to resolve to a sequence of Nodes.");return ue.o(q(e.map((function(e){return t.j.serializeToString(Ai(e.value,t,!1))})),1))},localName:"serialize",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}}],Tn,[{l:[{type:59,g:3},{type:61,g:3}],m:function(e,t,n,r,a){var o,i;return ue.create({next:function(){if(!o){var e=function(e,t,n,r){e=e.first();var a=t.first().h.reduce((function(e,t){return e[t.key.value]=ce(t.value()),e}),Object.create(null));t=a["."]?a["."]():ue.empty(),delete a["."];try{if(Z(e.type,1))var o=e.value;else{if(!Z(e.type,54))throw It("Unable to convert selector argument of type "+he[e.type]+" to either an "+he[1]+" or an "+he[54]+" representing an XQueryX program while calling 'fontoxpath:evaluate'");o=e.value.node}var i=af(o,{qa:!1,aa:!0,debug:r.debug,Ha:r.Ha},(function(e){return n.ba(e)}),Object.keys(a).reduce((function(e,t){return e[t]=t,e}),{}),{},"http://www.w3.org/2005/xpath-functions",(function(e,t){return n.Ra(e,t)})),s=i.da,u=i.ia,c=!t.G(),l=new vt({M:c?t.first():null,Ja:c?0:-1,Ga:t,Ea:Object.keys(a).reduce((function(e,t){return e[u.qb(null,t)]=a[t],e}),Object.create(null))});return{Gc:s.h(l,r).value,Dc:e}}catch(t){qr(e.value,t)}}(r,a,n,t);o=e.Gc,i=e.Dc}try{return o.next(0)}catch(e){qr(i.value,e)}}})},localName:"evaluate",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:59,g:2}},{l:[],m:function(){return ue.o(q("3.25.1",1))},localName:"version",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);e=t.next().value,t=t.next().value;var r=n.za(e.value.namespaceURI,e.value.localName,t.value);return null===r?ue.empty():(e=new ve({l:r.l,arity:t.value,localName:e.value.localName,namespaceURI:e.value.namespaceURI,i:r.i,value:r.m}),ue.o(e))}))},localName:"function-lookup",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{g:0,type:60}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return(e=c(e).next().value).Pa()?ue.empty():ue.o(q(new ye("",e.u,e.j),23))}))},localName:"function-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.o(q(e.A,5))}))},localName:"function-arity",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}}]);function gf(e){this.h=e}(r=gf.prototype).createAttributeNS=function(e,t){return this.h.createAttributeNS(e,t)},r.createCDATASection=function(e){return this.h.createCDATASection(e)},r.createComment=function(e){return this.h.createComment(e)},r.createDocument=function(){return this.h.createDocument()},r.createElementNS=function(e,t){return this.h.createElementNS(e,t)},r.createProcessingInstruction=function(e,t){return this.h.createProcessingInstruction(e,t)},r.createTextNode=function(e){return this.h.createTextNode(e)};var yf=Symbol("IS_XPATH_VALUE_SYMBOL");function vf(e){return e&&"object"==typeof e&&"lookupNamespaceURI"in e?function(t){return e.lookupNamespaceURI(t||null)}:function(){return null}}function wf(e){return function(t){var n=t.localName;return t.prefix?null:{namespaceURI:e,localName:n}}}function xf(e,t,n,r,a,o){var i,s,u,l,p,h,f;null==r&&(r=r||{}),a?(i=a.logger||{trace:console.log.bind(console)},s=a.documentWriter,u=a.moduleImports,l=a.namespaceResolver,p=a.functionNameResolver,h=a.nodesFactory,f=a.xmlSerializer):(i={trace:console.log.bind(console)},u={},l=null,h=null,s=null,f=null,p=void 0);var d=new Ce(null===n?new be:n);n=u||Object.create(null),u=void 0===a.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":a.defaultFunctionNamespaceURI;var m=af(e,o,l||vf(t),r,n,u,p||wf(u));for(e=t?yt(0,t):ue.empty(),t=!h&&o.aa?new ir(t):new gf(h),s=s?new Be(s):Ne,h=Object.keys(r).reduce((function(e,t){var n=r[t];return e["Q{}"+t+"[0]"]=n&&"object"==typeof n&&yf in n?function(){return ue.create(n.Db)}:function(){return yt(0,r[t])},e}),Object.create(null)),l={},n=(p=c(Object.keys(m.ia.Da))).next();!n.done;l={Wa:l.Wa},n=p.next())l.Wa=n.value,h[l.Wa]||(h[l.Wa]=function(e){return function(){return(0,m.ia.Da[e.Wa])(g,y)}}(l));var g=new vt({M:e.first(),Ja:0,Ga:e,Ea:h}),y=new Nt(o.debug,o.Ha,d,t,s,a.currentContext,i,f);return{xb:g,zb:y,da:m.da}}function Af(e,t){var n={},r=0,a=!1,o=null;return{next:function(){if(a)return W;for(var i={};r {\n\t\t\t\t\tconst result = "+e+".next();\n\t\t\t\t\treturn result.done ? false : !!result.value;\n\t\t\t\t})()",{type:0});case 5:throw Error("Trying to get value of generated code with type None");default:throw Error("Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.")}}Object.assign(Of,(Rf.ANY_TYPE=0,Rf.NUMBER_TYPE=1,Rf.STRING_TYPE=2,Rf.BOOLEAN_TYPE=3,Rf.NODES_TYPE=7,Rf.FIRST_NODE_TYPE=9,Rf.STRINGS_TYPE=10,Rf.MAP_TYPE=11,Rf.ARRAY_TYPE=12,Rf.ASYNC_ITERATOR_TYPE=99,Rf.NUMBERS_TYPE=13,Rf.XQUERY_UPDATE_3_1_LANGUAGE="XQueryUpdate3.1",Rf.XQUERY_3_1_LANGUAGE="XQuery3.1",Rf.XPATH_3_1_LANGUAGE="XPath3.1",Rf));var Pf={DONE_TOKEN:W,getEffectiveBooleanValue:ne,isSubtypeOf:Z,ready:$},Hf={qc:"pathExpr",Ob:"andOp",pc:"orOp",sc:"stringConstantExpr",Sb:"equalOp",nc:"notEqualOp",dc:"lessThanOrEqualOp",cc:"lessThanOp",Yb:"greaterThanOrEqualOp",Xb:"greaterThanOp",Tb:"eqOp",jc:"neOp",fc:"ltOp",ec:"leOp",Zb:"gtOp",Wb:"geOp",ac:"isOp",mc:"nodeBeforeOp",lc:"nodeAfterOp",Vb:"functionCallExpr"},jf=Object.values(Hf);function Xf(e,t,n,r,a){return e=wa(e,n),(e=wa(e,jf))?(t+=n,n=c(r.yb(e,t,r)),r=n.next().value,n=n.next().value,r.isAstAccepted?0===a?[Ff(t,r.code,r.xa),null]:[Gf(t,r.xa,[r.code]),n]:[r,null]):[kf("Unsupported: a base expression used with an operand."),null]}function _f(e,t,n){return 4===t&&(e+=".next().value"),47===n&&(e="(function () { const attr = "+e+"; return attr ? domFacade.getData(attr) : null})()"),e}function Lf(e,t,n,r,a){var o=Aa(wa(e,"firstOperand")[1],"type");if(e=Aa(wa(e,"secondOperand")[1],"type"),!o||!e)return kf("Left or right type of compare are not found, annotation failed.");var i=[47,1];if(!i.includes(o.type)||!i.includes(e.type))return kf("Unsupported types in compare: ["+he[o.type]+", "+he[e.type]+"]");if(!n.isAstAccepted)return n;if(!r.isAstAccepted)return r;if(!o||!e)return kf("Operands in compare weren't annotated");if(!(i=new Map([["eqOp","==="],["neOp","!=="]])).has(t))return kf(t+" not yet implemented");t=i.get(t),i=Mf(n.code,n.xa);var s=Mf(r.code,r.xa);return Gf("function "+a+"(contextItem) {\n\t\t\t\t"+n.ta.join("\n")+"\n\t\t\t \t"+r.ta.join("\n")+"\n\t \t \treturn "+_f(i[0],i[1].type,o.type)+" "+t+" "+_f(s[0],s[1].type,e.type)+";\n\t\t}",{type:3,i:{type:0}})}var Vf={},Yf=(Vf.equalOp="eqOp",Vf.notEqualOp="neOp",Vf.lessThanOrEqualOp="leOp",Vf.lessThanOp="ltOp",Vf.greaterThanOrEqualOp="geOp",Vf.greaterThanOp="gtOp",Vf),qf={"local-name":function(e,t,n){return Kf(e,t,n,Qf,"local-name()")},name:function(e,t,n){return Kf(e,t,n,Jf,"name()")}};function Qf(e){return"("+e+".localName || "+e+".target || '')"}function Jf(e){return"((("+e+".prefix || '').length !== 0 ? "+e+".prefix + ':' : '')\n\t\t+ ("+e+".localName || "+e+".target || ''))"}function Kf(e,t,n,r,a){if(1===(e=wa(e,"arguments")).length)t="function "+t+"(contextItem) {\n\t\t\tif (contextItem === undefined || contextItem === null) {\n\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\n}\n\t\t\treturn "+r("contextItem")+";\n\t\t}";else{if(2!==e.length)return kf("Incorrect arg count for "+a+" function");if(a=e[1],e=(n=c(n.yb(a,"arg",n))).next().value,n.next(),n=e.isAstAccepted?Gf("arg",e.xa,[e.code]):e,"contextItemExpr"===a[0])t="function "+t+"(contextItem) {\n\t\t\t\tif (contextItem === undefined || contextItem === null) {\n\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\n}\n\t\t\t\treturn "+r("contextItem")+";\n\t\t\t}";else{if(!n.isAstAccepted)return n;t="function "+t+"(contextItem) {\n\t\t\t\t"+n.ta+"\n\t\t\t\tconst value = "+Mf(n.code,n.xa)[0]+';\n\t\t\t\tconst childElement = value.next().value;\n\t\t\t\treturn (value.done ? "" : '+r("childElement")+");\n\t\t\t}"}}return Gf(t,{type:3,i:{type:0}})}function zf(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Wf(e,t,n,r){var a=c(Xf(e,t,"firstOperand",n,0)),o=a.next().value;return a=a.next().value,o.isAstAccepted?(e=(n=c(Xf(e,t,"secondOperand",n,0))).next().value,n=n.next().value,e.isAstAccepted?[Gf("\n\tfunction "+t+"(contextItem) {\n\t\t"+o.ta.join("\n")+"\n\t\t"+e.ta.join("\n")+"\n\t\treturn "+o.code+" "+r+" "+e.code+";\n\t}\n\t",{type:3,i:{type:0}}),"&&"===r?ao(a,n):a||n]:[e,null]):[o,null]}function $f(e){for(var t=[],n=0;n {\n\t\t\t"+e.code+"\n\t\t\treturn DONE_TOKEN;\n\t\t};\n\t\treturn {\n\t\t\tnext,\n\t\t\t[Symbol.iterator]() { return this; }\n\t\t};\n\t}\n\t",{type:3,i:{type:4}}),a]:[e,null];case Hf.Ob:return Wf(e,t,n,"&&");case Hf.pc:return Wf(e,t,n,"||");case Hf.sc:return[Gf("const "+t+" = "+(e=zf(e=wa(e,"value")[1]||""))+";",{type:1}),null];case Hf.Sb:case Hf.nc:case Hf.dc:case Hf.cc:case Hf.Yb:case Hf.Xb:case Hf.Tb:case Hf.jc:case Hf.fc:case Hf.ec:case Hf.Zb:case Hf.Wb:case Hf.ac:case Hf.mc:case Hf.lc:e:{var o=c(Xf(e,t,"firstOperand",n));if(a=o.next().value,o.next(),a.isAstAccepted)if(n=(o=c(Xf(e,t,"secondOperand",n))).next().value,o.next(),n.isAstAccepted)switch(r){case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":t=Lf(e,r,a,n,t);break e;case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":o=Aa(e,"type");var i=Aa(e,"type");t=o&&i?3===o.g&&3===i.g?Lf(e,Yf[r],a,n,t):kf("generalCompare with sequences is still in development"):kf("types of compare are not known");break e;default:t=kf("Unsupported compare type")}else t=n;else t=a}return[t,null];case Hf.Vb:return r=xa(wa(e,"functionName")),[void 0!==qf[r]?qf[r](e,t,n):kf("Unsupported function: "+r),null];default:return[kf("Unsupported: the base expression '"+r+"'."),null]}}function id(e,t,n){var r=wa(e,"mainModule");if(!r)return kf("Unsupported: Can not execute a library module.");if(wa(r,"prolog"))return kf("Unsupported: XQuery.");r=ba(r,["queryBody","*"]),n.yb=od;var a=c(od(r,"compiledXPathExpression",n));return n=a.next().value,a.next(),!1===n.isAstAccepted?n:(a=n.ta?n.ta.join("\n"):"",r=Aa(r,"type"),!1===(t=function(e,t,n){switch(e){case 9:if(e=(n=c(Mf("compiledXPathExpression",t))).next().value,4!==n.next().value.type)throw Error("Trying access generated code as an iterator while this is not the case.");return Gf("\n\tconst firstResult = "+e+".next();\n\tif (!firstResult.done) {\n\t\treturn firstResult.value\n\t}\n\treturn null;\n\t",{type:2});case 7:return e=(n=c(Mf("compiledXPathExpression",t))).next().value,4!==n.next().value.type?kf("Return type was not an iterator"):Gf("\n\tconst nodes = [];\n\tfor (const node of "+e+") {\n\t\tnodes.push(node);\n\t}\n\treturn nodes;\n\t",{type:2});case 3:return(n=Ff("compiledXPathExpression","",t)).isAstAccepted?Gf("return "+n.code+";",{type:2}):n;case 2:return void 0===n?n=kf("Full AST wasn't annotated so we cannot correctly emit a string return"):Z(n,1)||Z(n,47)?n=Gf("return "+_f(e=(t=c(Mf("compiledXPathExpression",t))).next().value,(t=t.next().value).type,n)+" || '';",{type:2}):n=kf("Not implemented: returning anything but strings and attributes from codegen"),n;default:return kf("Unsupported: the return type '"+e+"'.")}}(t,n.xa,r?r.type:void 0)).isAstAccepted?t:(t=a+n.code+t.code,n="\n\treturn (contextItem, domFacade, runtimeLib) => {\n\t\tconst {\n\t\t\tDONE_TOKEN,\n\t\t\tValueType,\n\t\t\tXPDY0002,\n\t\t\tdeterminePredicateTruthValue,\n\t\t\tisSubtypeOf,\n\t\t\tready,\n\t\t\tatomize,\n\t\t} = runtimeLib;",function e(t){var n=Ea(t,"*");if("pathExpr"===t[0])return!0;for(t=c(n),n=t.next();!n.done;n=t.next())if(e(n.value))return!0;return!1}(e)&&(n+='\n\t\tif (!contextItem) {\n\t\t\tthrow XPDY0002("Context is needed to evaluate the given path expression.");\n\t\t}\n\n\t\tif (!contextItem.nodeType) {\n\t\t\tthrow new Error("Context item must be subtype of node().");\n\t\t}\n\t\t'),{code:n+(t+"}\n//# sourceURL=generated.js"),isAstAccepted:!0}))}var sd={},ud=(sd["http://www.w3.org/2005/XQueryX"]="xqx",sd["http://www.w3.org/2007/xquery-update-10"]="xquf",sd["http://fontoxml.com/fontoxpath"]="x",sd);function cd(e,t,n){var r=e.stack;r&&(r.includes(e.message)&&(r=r.substr(r.indexOf(e.message)+e.message.length).trim()),(r=r.split("\n")).splice(10),r=(r=r.map((function(e){return e.startsWith(" ")||e.startsWith("\t")?e:" "+e}))).join("\n")),e=Error.call(this,"Custom XPath function Q{"+n+"}"+t+" raised:\n"+e.message+"\n"+r),this.message=e.message,"stack"in e&&(this.stack=e.stack)}function ld(e,t,n){return 0===t.g?e.G()?null:Ef(e.first(),n).next(0).value:2===t.g||1===t.g?e.N().map((function(e){if(Z(e.type,47))throw Error("Cannot pass attribute nodes to custom functions");return Ef(e,n).next(0).value})):Ef(e.first(),n).next(0).value}y(cd,Error);var pd=new Map;function hd(e){var t;e:{if(t=ms.get(e))for(var n=c(Object.keys(t)),r=n.next();!r.done;r=n.next())if(t[r=r.value]&&t[r].length){t=t[r][0].h;break e}t=null}if(t)return t;if(pd.has(e))return pd.get(e);if(null===(t=ba(t="string"==typeof e?ef(e,{aa:!1}):vs(e),["mainModule","queryBody","*"])))throw Error("Library modules do not have a specificity");return t=ds(t,{qa:!1,aa:!1}),pd.set(e,t),t}var fd=new be;return void 0!==n&&(n.compareSpecificity=function(e,t){return vr(hd(e).s,hd(t).s)},n.compileXPathToJavaScript=function(e,t,n){n=n||{},t=t||0,"string"==typeof e?e=ef(e=bs(e),{aa:"XQuery3.1"===n.language||"XQueryUpdate3.1"===n.language,debug:!1}):e=vs(e);var r=wa(e,"mainModule");return r?wa(r,"prolog")?kf("Unsupported: XQuery Prologs are not supported."):(_a(e,n=new za(new pa(new Zr((r={ba:n.namespaceResolver||vf(null)}).ba,{},void 0===n.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":n.defaultFunctionNamespaceURI,n.functionNameResolver||wf("http://www.w3.org/2005/xpath-functions"))))),id(e,t,r)):kf("Unsupported: XQuery Library modules are not supported.")},n.domFacade=fd,n.evaluateXPath=Of,n.evaluateXPathToArray=function(e,t,n,r,a){return Of(e,t,n,r,Of.Pb,a)},n.evaluateXPathToAsyncIterator=Df,n.evaluateXPathToBoolean=function(e,t,n,r,a){return Of(e,t,n,r,Of.BOOLEAN_TYPE,a)},n.evaluateXPathToFirstNode=function(e,t,n,r,a){return Of(e,t,n,r,Of.Ub,a)},n.evaluateXPathToMap=function(e,t,n,r,a){return Of(e,t,n,r,Of.hc,a)},n.evaluateXPathToNodes=function(e,t,n,r,a){return Of(e,t,n,r,Of.kc,a)},n.evaluateXPathToNumber=function(e,t,n,r,a){return Of(e,t,n,r,Of.NUMBER_TYPE,a)},n.evaluateXPathToNumbers=function(e,t,n,r,a){return Of(e,t,n,r,Of.oc,a)},n.evaluateXPathToString=function(e,t,n,r,a){return Of(e,t,n,r,Of.STRING_TYPE,a)},n.evaluateXPathToStrings=function(e,t,n,r,a){return Of(e,t,n,r,Of.rc,a)},n.evaluateUpdatingExpression=function(e,t,n,r,a){var o,i,s,u,c,l,p,h,f,d;return function(e){function t(t){return e.next(t)}function n(t){return e.throw(t)}return new Promise((function(r,a){!function e(o){o.done?r(o.value):Promise.resolve(o.value).then(t,n).then(e,a)}(e.next())}))}(new N(new A((function(m){switch(m.h){case 1:a=a||{};try{u=xf(e,t,n||null,r||{},a||{},{qa:!0,aa:!0,debug:!!a.debug,Ha:!!a.disableCache}),o=u.xb,i=u.zb,s=u.da}catch(t){qr(e,t)}if(s.I){m.h=2;break}c=[];var g=(l=Df(e,t,n,r,Object.assign(Object.assign({},a),{language:"XQueryUpdate3.1"}))).next();return m.h=3,{value:g};case 3:p=m.u;case 4:if(p.done){m.h=6;break}return c.push(p.value),g=l.next(),m.h=7,{value:g};case 7:p=m.u,m.h=4;break;case 6:return h={},m.return(Promise.resolve((h.pendingUpdateList=[],h.xdmValue=c,h)));case 2:try{d=s.u(o,i),f=d.next(0)}catch(t){qr(e,t)}return m.return(Uf(f.value,e,a.returnType,i))}}))))},n.evaluateUpdatingExpressionSync=function(e,t,n,r,a){a=a||{};try{var o=xf(e,t,n||null,r||{},a||{},{qa:!0,aa:!0,debug:!!a.debug,Ha:!!a.disableCache}),i=o.xb,s=o.zb,u=o.da}catch(t){qr(e,t)}if(!u.I)return i={},(s={}).pendingUpdateList=[],s.xdmValue=Of(e,t,n,r,a.i,Object.assign(Object.assign({},a),(i.language=Of.vc,i))),s;try{var c=u.u(i,s).next(0)}catch(t){qr(e,t)}return Uf(c.value,e,a.returnType,s)},n.executeJavaScriptCompiledXPath=function(e,t,n){return n=n||new be,e()(t,n,Pf)},n.executePendingUpdateList=function(e,t,n,r){t=new Ce(t||new be),r=r?new Be(r):Ne,n=n?n=new gf(n):null,cr(e=e.map(Ji),t,n,r)},n.getBucketForSelector=function(e){return hd(e).A()},n.getBucketsForNode=Ae,n.precompileXPath=function(e){return Promise.resolve(e)},n.registerXQueryModule=function(e,t){if(Xa(t=ef(e,{aa:!0,debug:(t=void 0===t?{debug:!1}:t).debug}),new za(void 0)),!(t=wa(t,"libraryModule")))throw Error("XQuery module must be declared in a library module.");var n=wa(t,"moduleDecl"),r=wa(n,"uri"),a=xa(r);if(r=xa(n=wa(n,"prefix")),ma(n=new pa(new Zr((function(){return null}),Object.create(null),"http://www.w3.org/2005/xpath-functions",wf("http://www.w3.org/2005/xpath-functions"))),r,a),null!==(t=wa(t,"prolog"))){try{var o=nf(t,n)}catch(t){qr(e,t)}o.Ma.forEach((function(e){if(a!==e.namespaceURI)throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace.")})),xs(a,o)}else xs(a,{Ma:[],Ua:[]});return a},n.registerCustomXPathFunction=function(e,t,n,r){var a=(e=function(e){if("object"==typeof e)return e;if(2!==(e=e.split(":")).length)throw Error("Do not register custom functions in the default function namespace");var t=c(e);e=t.next().value,t=t.next().value;var n=$r[e];if(!n){if(n="generated_namespace_uri_"+e,$r[e])throw Error("Prefix already registered: Do not register the same prefix twice.");$r[e]=n}return{localName:t,namespaceURI:n}}(e)).namespaceURI,o=e.localName;if(!a)throw aa();var i=t.map((function(e){return ge(e)})),s=ge(n);zr(a,o,i,s,(function(e,t,n){var u=Array.from(arguments);u.splice(0,3),u=u.map((function(e,n){return ld(e,i[n],t)}));var c={};c.currentContext=t.u,c.domFacade=t.h.h,c=c;try{var l=r.apply(void 0,[c].concat(p(u)))}catch(e){throw new cd(e,o,a)}return l&&"object"==typeof l&&Object.getOwnPropertySymbols(l).includes(yf)?ue.create(l.Db):yt(t.h,l,s)}))},n.parseScript=function(e,t,n,r){r=void 0===r?Ne:r;var a=ef(e=bs(e),{aa:"XQuery3.1"===t.language||"XQueryUpdate3.1"===t.language,debug:t.debug}),o=new Zr(t.namespaceResolver||function(){return null},{},void 0===t.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":t.defaultFunctionNamespaceURI,t.functionNameResolver||function(){return null});o=new pa(o);var i=wa(a,["mainModule","libraryModule"]),s=wa(i,"moduleDecl");return s&&ma(o,xa(wa(s,"prefix")),s=xa(wa(s,"uri"))),(i=wa(i,"prolog"))&&nf(i,o,!1),!1!==t.annotateAst&&Xa(a,new za(o)),o=new be,t=function e(t,n,r,a,o){if("string"==typeof r)return 0===r.length?null:n.createTextNode(r);if(!Array.isArray(r))throw new TypeError("JsonML element should be an array or string");var i=function(e,t){switch(e){case"copySource":case"insertAfter":case"insertAsFirst":case"insertAsLast":case"insertBefore":case"insertInto":case"modifyExpr":case"newNameExpr":case"replacementExpr":case"replaceValue":case"returnExpr":case"sourceExpr":case"targetExpr":case"transformCopies":case"transformCopy":return{localName:e,rb:t||"http://www.w3.org/2005/XQueryX"};case"deleteExpr":case"insertExpr":case"renameExpr":case"replaceExpr":case"transformExpr":return{localName:e,rb:"http://www.w3.org/2007/xquery-update-10"};case"x:stackTrace":return{localName:"stackTrace",rb:"http://fontoxml.com/fontoxpath"};default:return{localName:e,rb:"http://www.w3.org/2005/XQueryX"}}}(r[0],a);a=i.rb,i=n.createElementNS(a,ud[a]+":"+i.localName);var s=r[1],u=1;if("object"==typeof s&&!Array.isArray(s)){if(null!==s)for(var l=(u=c(Object.keys(s))).next();!l.done;l=u.next()){var p=s[l=l.value];null!==p&&("type"===l?void 0!==p&&t.setAttributeNS(i,a,"fontoxpath:"+l,de(p)):o&&"prefix"===l&&""===p||t.setAttributeNS(i,a,ud[a]+":"+l,p))}u=2}for(s=u,u=r.length;s{x(e,r,"xpath"===t.language),e.accept()});return function(e){const n="xpath"===t.language?[-1,...be(e),-2]:be(e);return a.execute(n).success}}}),Object.freeze({__proto__:null,complete:function(e){return Ie(e,Ue,Ce)},cut:De,delimited:function(e,t,n,r=!1){return Oe(e,r?De(Re(t,n)):Re(t,n))},end:Ue,error:Be,filter:function(e,t,n){return(r,a)=>{const o=e(r,a);return o.success?t(o.value)?o:Be(a,n):o.offset===a?Be(a,n):o}},first:Ce,followed:Re,map:function(e,t){return(n,r)=>{const a=e(n,r);return a.success?Ee(a.offset,t(a.value)):a}},not:function(e,t){return(n,r)=>e(n,r).success?Be(r,t):Ne(r)},ok:Ne,okWithValue:Ee,optional:function(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:Ee(n,null)}},or:function(e){return(t,n)=>{let r=null;for(const a of e){const e=a(t,n);if(e.success)return e;if(null===r||e.offset>r.offset?r=e:e.offset===r.offset&&(r.expected=r.expected.concat(e.expected)),e.fatal)break}return r||Be(n,[])}},peek:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(n,r.value):r}},plus:function(e){return Ie(e,Te(e),(e,t)=>[e].concat(t))},preceded:Oe,recognize:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(r.offset,t.slice(n,r.offset)):r}},second:Se,star:Te,start:(e,t)=>0===t?Ne(t):Be(t,["start of input"]),then:Ie,token:function(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?Ee(r,e):Be(n,[e])}}})),Ge=(Me.compareSpecificity,Me.compileXPathToJavaScript,Me.createTypedValueFactory,Me.domFacade,Me.evaluateUpdatingExpression,Me.evaluateUpdatingExpressionSync,Me.evaluateXPath),ke=(Me.evaluateXPathToArray,Me.evaluateXPathToAsyncIterator,Me.evaluateXPathToBoolean),Fe=Me.evaluateXPathToFirstNode,Pe=(Me.evaluateXPathToMap,Me.evaluateXPathToNodes),He=Me.evaluateXPathToNumber,je=(Me.evaluateXPathToNumbers,Me.evaluateXPathToString),Xe=Me.evaluateXPathToStrings,_e=(Me.executeJavaScriptCompiledXPath,Me.executePendingUpdateList,Me.getBucketForSelector,Me.getBucketsForNode),Le=(Me.Language,Me.parseScript),Ve=(Me.precompileXPath,Me.profiler,Me.registerCustomXPathFunction),Ye=Me.registerXQueryModule;Me.ReturnType;class qe{constructor(e){this._onNodeTouched=e}getAllAttributes(e){return Array.from(e.attributes)}getAttribute(e,t){return e.getAttribute(t)}getChildNodes(e,t){const n=Array.from(e.childNodes).filter(e=>!t||_e(e).includes(t));return n.forEach(e=>this._onNodeTouched(e)),n}getData(e){return e.nodeType===Node.ATTRIBUTE_NODE?(this._onNodeTouched(e),e.value):(this._onNodeTouched(e.parentNode),e.data)}getFirstChild(e,t){for(const n of e.childNodes)if(!t||_e(n).includes(t))return this._onNodeTouched(e),n;return null}getLastChild(e,t){const n=e.getChildNodes().filter(e=>!t||_e(e).includes(t)),r=n[n.length-1];return r||null}getNextSibling(e,t){for(let{nextSibling:n}=e;n;n=n.nextSibling)if(_e(n).includes(t))return n;return null}getParentNode(e){return e.parentNode}getPreviousSibling(e,t){for(let{previousSibling:n}=e;n;n=n.previousSibling)if(_e(n).includes(t))return n;return null}}class Qe{static getParentBindingElement(e){if(e.parentNode&&e.parentNode.nodeType!==Node.DOCUMENT_NODE){if(e.parentNode.hasAttribute("ref"))return e.parentNode;Qe.getParentBindingElement(e.parentNode)}return null}static isAbsolutePath(e){return null!=e&&(e.startsWith("/")||e.startsWith("instance("))}static isRepeated(e){return e.parentElement.closest("fx-repeatitem")}static isSelfReference(e){return"."===e||"./text()"===e||"text()"===e||""===e||null===e}static getDefaultInstance(e){const t=Qe.getForeElement(e).querySelector("fx-instance");if(!t)throw new Error("no default instance present");return t}static getForeElement(e){if("FX-FORE"===e.nodeName)return e;if(e.parentNode)return Qe.getForeElement(e.parentNode);throw new Error("no Fore element present")}static getInstanceId(e){if(!e)return"default";if(e.startsWith("instance()"))return"default";if(e.startsWith("instance(")){const t=e.substring(e.indexOf("(")+1);return t.substring(1,t.indexOf(")")-1)}return null}static getPath(e){const t=Ge("path()",e);return Qe.shortenPath(t)}static shortenPath(e){const t=e.replaceAll(/(Q{(.*?)\})/g,""),n=t.substring(1,t.length);return n.substring(n.indexOf("/"),t.length)}static getBasePath(e){return e.split(":")[0]}}function Je(e,t,n,r){const a={};return function(o){if(a[o])return;const i={},s=[],u=[];for(u.push({node:o,processed:!1});u.length>0;){const o=u[u.length-1],{processed:c}=o,{node:l}=o;if(c)u.pop(),s.pop(),i[l]=!1,a[l]=!0,t&&0!==e[l].length||n.push(l);else{if(a[l]){u.pop();continue}if(i[l]){if(r){u.pop();continue}throw s.push(l),window.dispatchEvent(new CustomEvent("compute-exception",{composed:!0,bubbles:!0,detail:{path:s,message:"cyclic graph"}})),new Error("Cyclic at "+s)}i[l]=!0,s.push(l);const t=e[l];for(let e=t.length-1;e>=0;e-=1)u.push({node:t[e],processed:!1});o.processed=!0}}}}function Ke(e){this.nodes={},this.outgoingEdges={},this.incomingEdges={},this.circular=e&&!!e.circular}Ke.prototype={size(){return Object.keys(this.nodes).length},addNode(e,t){this.hasNode(e)||(this.nodes[e]=2===arguments.length?t:e,this.outgoingEdges[e]=[],this.incomingEdges[e]=[])},removeNode(e){this.hasNode(e)&&(delete this.nodes[e],delete this.outgoingEdges[e],delete this.incomingEdges[e],[this.incomingEdges,this.outgoingEdges].forEach(t=>{Object.keys(t).forEach(n=>{const r=t[n].indexOf(e);r>=0&&t[n].splice(r,1)},this)}))},hasNode(e){return Object.prototype.hasOwnProperty.call(this.nodes,e)},getNodeData(e){if(this.hasNode(e))return this.nodes[e];throw new Error("Node does not exist: "+e)},setNodeData(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);this.nodes[e]=t},addDependency(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);if(!this.hasNode(t))throw new Error("Node does not exist: "+t);return-1===this.outgoingEdges[e].indexOf(t)&&this.outgoingEdges[e].push(t),-1===this.incomingEdges[t].indexOf(e)&&this.incomingEdges[t].push(e),!0},removeDependency(e,t){let n;this.hasNode(e)&&(n=this.outgoingEdges[e].indexOf(t),n>=0&&this.outgoingEdges[e].splice(n,1)),this.hasNode(t)&&(n=this.incomingEdges[t].indexOf(e),n>=0&&this.incomingEdges[t].splice(n,1))},clone(){const e=this,t=new Ke;return Object.keys(e.nodes).forEach(n=>{t.nodes[n]=e.nodes[n],t.outgoingEdges[n]=e.outgoingEdges[n].slice(0),t.incomingEdges[n]=e.incomingEdges[n].slice(0)}),t},directDependenciesOf(e){if(this.hasNode(e))return this.outgoingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},directDependantsOf(e){if(this.hasNode(e))return this.incomingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},dependenciesOf(e,t){if(this.hasNode(e)){const n=[];Je(this.outgoingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},dependantsOf(e,t){if(this.hasNode(e)){const n=[];Je(this.incomingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},entryNodes(){const e=this;return Object.keys(this.nodes).filter(t=>0===e.incomingEdges[t].length)},overallOrder(e){const t=this,n=[],r=Object.keys(this.nodes);if(0===r.length)return n;if(!this.circular){const e=Je(this.outgoingEdges,!1,[],this.circular);r.forEach(t=>{e(t)})}const a=Je(this.outgoingEdges,e,n,this.circular);return r.filter(e=>0===t.incomingEdges[e].length).forEach(e=>{a(e)}),this.circular&&r.filter(e=>-1===n.indexOf(e)).forEach(e=>a(e)),n}},Ke.prototype.directDependentsOf=Ke.prototype.directDependantsOf,Ke.prototype.dependentsOf=Ke.prototype.dependantsOf;class ze{static get ACTION_ELEMENTS(){return["FX-DELETE","FX-DISPATCH","FX-HIDE","FX-INSERT","FX-LOAD","FX-MESSAGE","FX-REBUILD","FX-RECALCULATE","FX-REFRESH","FX-RENEW","FX-REPLACE","FX-RESET","FX-RETAIN","FX-RETURN","FX-REVALIDATE","FX-SEND","FX-SETFOCUS","FX-SETINDEX","FX-SETVALUE","FX-SHOW","FX-TOGGLE","FX-UPDATE"]}static createUUID(){const e=[];for(let t=0;t<36;t+=1)e[t]="0123456789abcdef".substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]="0123456789abcdef".substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("")}static get XFORMS_NAMESPACE_URI(){return"http://www.w3.org/2002/xforms"}static isActionElement(e){return ze.ACTION_ELEMENTS.includes(e)}static get UI_ELEMENTS(){return["FX-ALERT","FX-CONTROL","FX-BUTTON","FX-CONTROL","FX-DIALOG","FX-FILENAME","FX-MEDIATYPE","FX-GROUP","FX-HINT","FX-INPUT","FX-ITEMS","FX-LABEL","FX-OUTPUT","FX-RANGE","FX-REPEAT","FX-REPEATITEM","FX-SWITCH","FX-SECRET","FX-SELECT","FX-SUBMIT","FX-TEXTAREA","FX-TRIGGER","FX-UPLOAD","FX-VAR"]}static isUiElement(e){ze.UI_ELEMENTS.includes(e);return ze.UI_ELEMENTS.includes(e)}static async refreshChildren(e,t){return new Promise(n=>{const{children:r}=e;r&&Array.from(r).forEach(e=>{ze.isUiElement(e.nodeName)&&"function"==typeof e.refresh?e.refresh():"FX-MODEL"!==e.nodeName.toUpperCase()&&ze.refreshChildren(e,t)}),n("done")})}static isRepeated(e){return null!==e.closest("fx-repeatitem")}static getRepeatTarget(e,t){return e.closest("fx-repeatitem").querySelector("#"+t)}static getContentType(e,t){return"urlencoded-post"===t?"application/x-www-form-urlencoded; charset=UTF-8":"xml"===e.type?"application/xml; charset=UTF-8":"json"===e.type?"application/json":null}static fadeInElement(e){let t=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),t=e.animate({opacity:[0,1]},600),t.finished);return t()}static fadeOutElement(e,t){let n=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),n=e.animate({opacity:[1,0]},t),n.finished);return n()}static dispatch(e,t,n){const r=new CustomEvent(t,{composed:!0,bubbles:!0,detail:n});e.dispatchEvent(r)}static prettifyXml(e){const t=(new DOMParser).parseFromString(e,"application/xml"),n=(new DOMParser).parseFromString(['',' ',' ',' '," ",' ',' '," ",' ',""].join("\n"),"application/xml"),r=new XSLTProcessor;r.importStylesheet(n);const a=r.transformToDocument(t);return(new XMLSerializer).serializeToString(a)}}ze.READONLY_DEFAULT=!1,ze.REQUIRED_DEFAULT=!1,ze.RELEVANT_DEFAULT=!0,ze.CONSTRAINT_DEFAULT=!0,ze.TYPE_DEFAULT="xs:string";const We="http://www.w3.org/2002/xforms",$e=new Map;function Ze(e,t,n){return $e.has(e)?$e.get(e).set(t,n):$e.set(e,new Map)}const et=e=>{if(!e)return"http://www.w3.org/1999/xhtml"};function tt(e,t){const n=(r=e,a=t,$e.has(r)&&$e.get(r).get(a)||null);var r,a;if(n)return n;const o=(new DOMParser).parseFromString("","text/xml"),i=Le(e,{},o);let s=Xe('descendant::xqx:functionCallExpr\n\t\t\t\t[xqx:functionName = "instance"]\n\t\t\t\t/xqx:arguments\n\t\t\t\t/xqx:stringConstantExpr\n\t\t\t\t/xqx:value',i,null,{},{namespaceResolver:e=>"xqx"===e?"http://www.w3.org/2005/XQueryX":void 0});if(0===s.length){const n=Fe("ancestor::*[@ref][1]",t);if(n){const r=tt(n.getAttribute("ref"),n);return Ze(e,t,r),r}s=["default"]}if(1===s.length){let n;if("default"===s[0]){const e=Fe("ancestor-or-self::fx-fore",t,null,null,{namespaceResolver:et});n=e&&e.querySelector("fx-instance")}else n=pt(s[0],t,"fx-instance");if(n&&n.hasAttribute("xpath-default-namespace")){const r=n.getAttribute("xpath-default-namespace"),a=e=>{if(!e)return r};return Ze(e,t,a),a}}s.length;const u=je("ancestor-or-self::*/@xpath-default-namespace[last()]",t)||"",c=function(e){return""===e?u:je('ancestor-or-self::*/@*[name() = "xmlns:" || $prefix][last()]',t,null,{prefix:e})};return Ze(e,t,c),c}function nt(e,t,n){return(t&&t.ownerDocument||t)===window.document?et:tt(e,n)}function rt({prefix:e,localName:t},n){switch(t){case"context":case"base64encode":case"boolean-from-string":case"current":case"depends":case"event":case"index":case"instance":case"log":case"logtree":return{namespaceURI:We,localName:t};default:return""===e||"fn"===e?{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:t}:"local"===e?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:t}:null}}function at(e){let t=e;for(;t&&!("inScopeVariables"in t);)t=t.parentNode;if(!t)return{};const n={};if(t.inScopeVariables)for(const e of t.inScopeVariables.keys()){const r=t.inScopeVariables.get(e);n[e]=r.value}return n}function ot(e,t,n,r={}){const a=nt(e,t,n),o=at(n);return Ge(e,t,null,{...o,...r},"xs:anyType",{currentContext:{formElement:n,variables:r},moduleImports:{xf:We},functionNameResolver:rt,namespaceResolver:a})}function it(e,t,n){const r=nt(e,t,n),a=at(n);return Fe(e,t,null,a,{defaultFunctionNamespaceURI:We,moduleImports:{xf:We},currentContext:{formElement:n},namespaceResolver:r})}function st(e,t,n){const r=nt(e,t,n),a=at(n);return Pe(e,t,null,a,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:r})}function ut(e,t,n){const r=nt(e,t,n),a=at(n);return ke(e,t,null,a,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:r})}function ct(e,t,n,r=null,a=n){const o=nt(e,t,n),i=at(n);return je(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}function lt(e,t,n,r=null,a=n){const o=nt(e,t,n),i=at(n);return He(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}function pt(e,t,n=null){const r=Pe("outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]",t,null,{id:e},{namespaceResolver:et});if(0===r.length)return null;if(1===r.length&&ke("(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore",r[0],null,null,{namespaceResolver:et})){const e=r[0];return n&&e.localName!==n?null:e}for(const e of Pe("ancestor::fx-repeatitem => reverse()",t,null,null,{namespaceResolver:et})){const t=r.filter(t=>e.contains(t));switch(t.length){case 0:break;case 1:{const e=t[0];return n&&e.localName!==n?null:e}default:{const e=t.find(e=>Pe("every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]",e,null,{}));return e?n&&e.localName!==n?null:e:null}}}return null}const ht=(e,t)=>{const n=e.currentContext.formElement;if(t){const e=pt(t,n);if(e){if("FX-REPEAT"===e.nodeName){const{nodeset:t}=e;for(let r=n;r;r=r.parentNode)if(r.parentNode===e){return t[Array.from(r.parentNode.children).indexOf(r)]}}return e.nodeset}}const r=Qe.getParentBindingElement(n);n.nodeName;return r||n.getInScopeContext()};Ve({namespaceURI:We,localName:"context"},[],"item()?",ht),Ve({namespaceURI:We,localName:"context"},["xs:string"],"item()?",ht),Ve({namespaceURI:We,localName:"log"},["xs:string?"],"xs:string?",(e,t)=>{const{formElement:n}=e.currentContext,r=pt(t,n,"fx-instance");if(r&&"json"!==r.getAttribute("type")){const e=(new XMLSerializer).serializeToString(r.getDefaultContext());return ze.prettifyXml(e)}return null}),Ve({namespaceURI:We,localName:"logtree"},["xs:string?"],"element()?",(e,t)=>{const{formElement:n}=e.currentContext,r=pt(t,n,"fx-instance");if(r){const t=document.createElement("div");t.setAttribute("class","logtree");const n=e.currentContext.formElement,a=n.querySelector(".logtree");a&&a.parentNode.removeChild(a);const o=function e(t,n){if(n&&n.nodeType===Node.ELEMENT_NODE&&n.children){const r=document.createElement("details");r.setAttribute("data-path",n.nodeName);const a=document.createElement("summary");let o,i=" <"+n.nodeName;Array.from(n.attributes).forEach(e=>{i+=` ${e.nodeName}="${e.nodeValue}"`}),n.firstChild&&n.firstChild.nodeType===Node.TEXT_NODE&&""!==n.firstChild.data.trim()?(o=n.firstChild.nodeValue,i+=`>${o}`):i+=">",a.textContent=i,r.appendChild(a),0!==n.childElementCount?r.setAttribute("open","open"):a.setAttribute("style","list-style:none;"),t.appendChild(r),Array.from(n.children).forEach(t=>{e(r,t)})}}(t,r.getDefaultContext());o&&n.appendChild(o)}return null});const ft=(e,t)=>{const n=Fe("ancestor-or-self::fx-fore",e.currentContext.formElement,null,null,{namespaceResolver:et}),r=t?pt(t,n,"fx-instance"):n.querySelector("fx-instance");if(r){return r.getDefaultContext()}return null};Ve({namespaceURI:We,localName:"index"},["xs:string?"],"xs:integer?",(e,t)=>{const{formElement:n}=e.currentContext;if(null===t)return 1;const r=pt(t,n,"fx-repeat");return r?r.getAttribute("index"):Number(1)}),Ve({namespaceURI:We,localName:"instance"},[],"item()?",e=>ft(e,null)),Ve({namespaceURI:We,localName:"instance"},["xs:string?"],"item()?",ft),Ve({namespaceURI:We,localName:"depends"},["node()*"],"item()?",(e,t)=>t[0]),Ve({namespaceURI:We,localName:"event"},["xs:string?"],"item()?",(e,t)=>(e.currentContext.variables[t].nodeType,e.currentContext.variables[t])),Ye(`\n module namespace xf="${We}";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = "true" or $str = "1"\n };\n`),Ve({namespaceURI:We,localName:"base64encode"},["xs:string?"],"xs:string?",(e,t)=>btoa(t));class dt extends HTMLElement{constructor(){super(),this.model=this.parentNode,this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("src")&&(this.src=this.getAttribute("src")),this.hasAttribute("id")?this.id=this.getAttribute("id"):this.id="default",this.hasAttribute("type")?this.type=this.getAttribute("type"):this.type="xml";this.shadowRoot.innerHTML="\n \n \n \n "}async init(){await this._initInstance().then(()=>(this.dispatchEvent(new CustomEvent("instance-loaded",{composed:!0,bubbles:!0,detail:{instance:this}})),this))}evalXPath(e){const t=this.parentElement.parentElement;return it(e,this.getDefaultContext(),t)}getInstanceData(){return this.instanceData||this._createInstanceData(),this.instanceData}setInstanceData(e){e?this.instanceData=e:this._createInstanceData()}getDefaultContext(){return"xml"===this.type?this.instanceData.firstElementChild:this.instanceData}async _initInstance(){if("#querystring"===this.src){const e=new URLSearchParams(location.search),t=(new DOMParser).parseFromString("","application/xml"),n=t.firstElementChild;for(const r of e){const e=t.createElement(r[0]);e.appendChild(t.createTextNode(r[1])),n.appendChild(e)}this.instanceData=t}else this.src?await this._loadData():0!==this.childNodes.length&&this._useInlineData()}_createInstanceData(){if("xml"===this.type){const e=(new DOMParser).parseFromString("","application/xml");this.instanceData=e}"json"===this.type&&(this.instanceData={})}async _loadData(){const e=""+this.src,t=ze.getContentType(this,"get");await fetch(e,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":t}}).then(e=>{const t=e.status;if(t>=400)throw alert(`response status: ${t} - failed to load data for '${this.src}' - stopping.`),new Error("failed to load data - status: "+t);const n=e.headers.get("content-type").toLowerCase();return n.startsWith("text/html")?e.text().then(e=>(new DOMParser).parseFromString(e,"text/html")):n.startsWith("text/plain")||n.startsWith("text/markdown")?e.text():n.startsWith("application/json")?e.json():n.startsWith("application/xml")?e.text().then(e=>(new DOMParser).parseFromString(e,"application/xml")):"done"}).then(e=>{e.nodeType,this.instanceData=e}).catch(e=>{throw new Error("failed loading data "+e)})}_getContentType(){return"xml"===this.type?"application/xml":"json"===this.type?"application/json":null}_useInlineData(){if("xml"===this.type){const e=(new DOMParser).parseFromString(this.innerHTML,"application/xml");this.instanceData=e}else"json"===this.type?this.instanceData=JSON.parse(this.textContent):"html"===this.type?this.instanceData=this.firstElementChild.children:"text"===this.type&&(this.instanceData=this.textContent)}_handleResponse(){const e=this.shadowRoot.getElementById("loader"),t=(new DOMParser).parseFromString(e.lastResponse,"application/xml");this.instanceData=t}_handleError(){this.shadowRoot.getElementById("loader")}}customElements.define("fx-instance",dt);class mt{constructor(e,t,n,r,a,o,i,s,u){this.path=e,this.ref=t,this.constraint=o,this.readonly=n,this.relevant=r,this.required=a,this.type=i,this.node=s,this.bind=u,this.changed=!1,this.alerts=[],this.boundControls=[]}get value(){return this.node.nodeType?this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue:this.node.textContent:this.node}set value(e){e.nodeType===Node.DOCUMENT_NODE?this.node.appendChild(e.firstElementChild):e.nodeType===Node.ELEMENT_NODE?this.node.appendChild(e):this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue=e:this.node.textContent=e}addAlert(e){this.alerts.push(e)}cleanAlerts(){this.alerts=[]}}class gt extends HTMLElement{constructor(){super(),this.instances=[],this.modelItems=[],this.defaultContext={},this.changed=[],this.inited=!1,this.modelConstructed=!1,this.attachShadow({mode:"open"}),this.computes=0}get formElement(){return this.parentElement}connectedCallback(){this.shadowRoot.innerHTML="\n \n ",this.addEventListener("model-construct-done",e=>{this.modelConstructed=!0}),this.skipUpdate=!1}static lazyCreateModelItem(e,t,n){let r,a={};if(null==n)return null;a=n.nodeType===n.TEXT_NODE?n.parentNode:n,n.nodeType?r=Qe.getPath(n):(r=null,a=n);const o=new mt(r,t,ze.READONLY_DEFAULT,ze.RELEVANT_DEFAULT,ze.REQUIRED_DEFAULT,ze.CONSTRAINT_DEFAULT,ze.TYPE_DEFAULT,a,this);return e.registerModelItem(o),o}modelConstruct(){this.dispatchEvent(new CustomEvent("model-construct",{detail:this}));const e=this.querySelectorAll("fx-instance");if(e.length>0){const t=[];e.forEach(e=>{t.push(e.init())}),Promise.all(t).then(()=>{this.instances=Array.from(e),this.updateModel(),this.inited=!0,this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}))})}else this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}));this.inited=!0}registerModelItem(e){this.modelItems.push(e)}updateModel(){this.rebuild(),this.skipUpdate||(this.recalculate(),this.revalidate())}rebuild(){this.mainGraph=new Ke(!1),this.modelItems=[];const e=this.querySelectorAll("fx-model > fx-bind");0!==e.length?(e.forEach(e=>{e.init(this)}),this.dispatchEvent(new CustomEvent("rebuild-done",{detail:{maingraph:this.mainGraph}}))):this.skipUpdate=!0}recalculate(){if(this.computes=0,this.subgraph=new Ke(!1),0!==this.changed.length){this.changed.forEach(e=>{if(this.subgraph.addNode(e.path,e.node),this.mainGraph.hasNode(e.path)){const t=this.mainGraph.dependantsOf(e.path,!1).reverse();0!==t.length&&t.forEach(t=>{const n=this.mainGraph.getNodeData(t);if(this.subgraph.addNode(t,n),t.includes(":")){const r=t.substring(0,t.indexOf(":"));this.subgraph.addNode(r,n);0!==this.mainGraph.dependentsOf(e.path,!1).indexOf(t)&&this.subgraph.addDependency(t,e.path)}})}});this.subgraph.overallOrder(!1).forEach(e=>{if(this.mainGraph.hasNode(e)){const t=this.mainGraph.getNodeData(e);this.compute(t,e)}});const e=[...this.changed];this.formElement.toRefresh=e,this.changed=[],this.dispatchEvent(new CustomEvent("recalculate-done",{detail:{subgraph:this.subgraph}}))}else{this.mainGraph.overallOrder(!1).forEach(e=>{const t=this.mainGraph.getNodeData(e);this.compute(t,e)})}}compute(e,t){const n=this.getModelItem(e);if(n&&t.includes(":")){const e=t.split(":")[1];if(e)if("calculate"===e){const t=ot(n.bind[e],n.node,this);n.value=t,n.readonly=!0}else if("constraint"!==e&&"type"!==e){const t=n.bind[e];if(t){const r=ut(t,n.node,this);n[e]=r}}this.computes+=1}}revalidate(){let e=!0;return this.modelItems.forEach(t=>{const{bind:n}=t;if(n&&"function"==typeof n.hasAttribute&&n.hasAttribute("constraint")){const r=n.getAttribute("constraint");if(r){const a=ut(r,t.node,this);if(t.constraint=a,this.formElement.addToRefresh(t),a||(e=!1),!this.modelConstructed){const e=n.getAlert();e&&t.addAlert(e)}}}}),e}getModelItem(e){return this.modelItems.find(t=>t.node===e)}getDefaultContext(){return this.instances[0].getDefaultContext()}getDefaultInstance(){return this.instances[0]}getDefaultInstanceData(){return this.instances[0].instanceData}getInstance(e){return Array.from(this.instances).find(t=>t.id===e)}evalBinding(e){return this.instances[0].evalXPath(e)}}function yt(e){return e.closest("fx-fore")}function vt(e,t){const n=e.closest("[ref]");if(null!==n)return n.nodeset;const r=function(e){return yt(e).getModel()}(e);if(Qe.isAbsolutePath(t)){const e=Qe.getInstanceId(t);return e?r.getInstance(e).getDefaultContext():r.getDefaultInstance().getDefaultContext()}return null!==r.getDefaultInstance()&&r.inited?r.getDefaultInstance().getDefaultContext():[]}function wt(e,t){const n=function(e){return e&&e.nodeType&&e.nodeType===Node.ATTRIBUTE_NODE?e.ownerElement:e.nodeType===Node.ELEMENT_NODE?e:e.parentNode}(e),r=n.closest("fx-repeatitem");if(r)return"context"===e.nodeName?it(e.nodeValue,r.nodeset,yt(n)):r.nodeset;if(n.hasAttribute("context")){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"context"===e.nodeName){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"ref"===e.nodeName){if(e.ownerElement.hasAttribute("context")){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}return vt(n.parentNode,t)}return vt(n,t)}customElements.define("fx-model",gt);const xt=e=>class extends e{static get properties(){return{context:{type:Object},model:{type:Object},modelItem:{type:Object},nodeset:{type:Object},ref:{type:String},inScopeVariables:{type:Map}}}constructor(){super(),this.context=null,this.model=null,this.modelItem={},this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):"",this.inScopeVariables=null}getModel(){if(this.model)return this.model;return this.getOwnerForm().querySelector("fx-model")}getOwnerForm(){let e=this;for(;e&&e.parentNode;){if("FX-FORE"===e.nodeName.toUpperCase())return e;e=e.parentNode instanceof DocumentFragment?e.parentNode.host:e.parentNode}return e}evalInContext(){let e;if(this.hasAttribute("context")&&(e=wt(this.getAttributeNode("context")||this,this.context)),this.hasAttribute("ref")&&(e=wt(this.getAttributeNode("ref")||this,this.ref)),e||(e=this.getModel().getDefaultInstance().getDefaultContext()),""===this.ref)this.nodeset=e;else if(Array.isArray(e))this.nodeset=it(this.ref,e[0],this);else{const{nodeType:t}=e;this.nodeset=t?it(this.ref,e,this):ot(this.ref,e,this)}}isNotBound(){return!this.hasAttribute("ref")}isBound(){return this.hasAttribute("ref")}getBindingExpr(){if(this.hasAttribute("ref"))return this.getAttribute("ref");const e=this.parentNode.closest("[ref]");return e?e.getAttribute("ref"):"instance()"}getInstance(){if(this.ref.startsWith("instance(")){const e=Qe.getInstanceId(this.ref);return this.getModel().getInstance(e)}return this.getModel().getInstance("default")}_getParentBindingElement(e){if(e.parentNode.host){const{host:t}=e.parentNode;if(t.hasAttribute("ref"))return t}else if(e.parentNode){if(e.parentNode.hasAttribute("ref"))return this.parentNode;this._getParentBindingElement(this.parentNode)}return null}getModelItem(){const e=this.getModel().getModelItem(this.nodeset);e&&(this.modelItem=e);let t;if(this.closest("fx-repeatitem")){const{index:e}=this.closest("fx-repeatitem");t=Array.isArray(this.nodeset)?this.getModel().getModelItem(this.nodeset[e-1]):this.getModel().getModelItem(this.nodeset)}else t=this.getModel().getModelItem(this.nodeset);return t||gt.lazyCreateModelItem(this.getModel(),this.ref,this.nodeset)}getValue(){if(this.hasAttribute("value")){const e=this.getAttribute("value");try{return ct(e,wt(this,e),this.getOwnerForm())}catch(e){this.dispatch("error",{message:e})}}return this.textContent?this.textContent:null}getInScopeContext(){return wt(this.getAttributeNode("ref")||this,this.ref)}setInScopeVariables(e){this.inScopeVariables=e}dispatch(e,t){const n=new CustomEvent(e,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(n)}};class At extends(xt(HTMLElement)){constructor(){super(),this.nodeset=[],this.model={},this.contextNode={},this.inited=!1}connectedCallback(){this.ref=this.getAttribute("ref"),this.readonly=this.getAttribute("readonly"),this.required=this.getAttribute("required"),this.relevant=this.getAttribute("relevant"),this.type=this.hasAttribute("type")?this.getAttribute("type"):At.TYPE_DEFAULT,this.calculate=this.getAttribute("calculate")}init(e){this.model=e,this.instanceId=this._getInstanceId(),this.bindType=this.getModel().getInstance(this.instanceId).type,"xml"===this.bindType&&(this._evalInContext(),this._buildBindGraph(),this._createModelItems()),this._processChildren(e)}_buildBindGraph(){"xml"===this.bindType&&this.nodeset.forEach(e=>{const t=Qe.getPath(e);this.model.mainGraph.addNode(t,e),this.calculate&&(this.model.mainGraph.addNode(t+":calculate",e),this.model.mainGraph.addDependency(t,t+":calculate"));const n=this._getReferencesForProperty(this.calculate,e);if(0!==n.length&&this._addDependencies(n,e,t,"calculate"),!this.calculate){const n=this._getReferencesForProperty(this.readonly,e);0!==n.length?this._addDependencies(n,e,t,"readonly"):this.readonly&&this.model.mainGraph.addNode(t+":readonly",e)}const r=this._getReferencesForProperty(this.required,e);0!==r.length?this._addDependencies(r,e,t,"required"):this.required&&this.model.mainGraph.addNode(t+":required",e);const a=this._getReferencesForProperty(this.relevant,e);0!==a.length?this._addDependencies(a,e,t,"relevant"):this.relevant&&this.model.mainGraph.addNode(t+":relevant",e);const o=this._getReferencesForProperty(this.constraint,e);0!==o.length?this._addDependencies(o,e,t,"constraint"):this.constraint&&this.model.mainGraph.addNode(t+":constraint",e)})}_addDependencies(e,t,n,r){const a=`${n}:${r}`;0!==e.length?(this.model.mainGraph.hasNode(a)||this.model.mainGraph.addNode(a,t),e.forEach(e=>{const t=Qe.getPath(e);t.endsWith("text()[1]")||(this.model.mainGraph.hasNode(t)||this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(a,t))})):this.model.mainGraph.addNode(a,t)}_processChildren(e){const t=this.querySelectorAll(":scope > fx-bind");Array.from(t).forEach(t=>{t.init(e)})}getAlert(){if(this.hasAttribute("alert"))return this.getAttribute("alert");const e=this.querySelector("fx-alert");return e?e.innerHTML:null}_evalInContext(){const e=wt(this.getAttributeNode("ref")||this,this.ref);if(this.nodeset=[],""===this.ref||null===this.ref)this.nodeset=e;else if(Array.isArray(e))e.forEach(t=>{if(Qe.isSelfReference(this.ref))this.nodeset=e;else if(this.ref){st(this.ref,t,this).forEach(e=>{this.nodeset.push(e)})}});else{"xml"===this.getModel().getInstance(this.instanceId).type?this.nodeset=st(this.ref,e,this):this.nodeset=this.ref}}_createModelItems(){Array.isArray(this.nodeset)?Array.from(this.nodeset).forEach(e=>{this._createModelItem(e)}):this._createModelItem(this.nodeset)}static lazyCreateModelitems(e,t,n){Array.isArray(n)?Array.from(n).forEach(n=>{At.lazyCreateModelItem(e,t,n)}):At.lazyCreateModelItem(e,t,n)}_createModelItem(e){if(Qe.isSelfReference(this.ref)){const e=this.parentElement.closest("fx-bind[ref]");return void(e&&(e.required=this.required))}const t=e,n=Qe.getPath(e),r=new mt(n,this.getBindingExpr(),At.READONLY_DEFAULT,At.RELEVANT_DEFAULT,At.REQUIRED_DEFAULT,At.CONSTRAINT_DEFAULT,this.type,t,this);this.getModel().registerModelItem(r)}_getReferencesForProperty(e){if(e){const t=new Set,n=new qe(e=>t.add(e));return this.nodeset.forEach(t=>{ct(e,t,this,n)}),Array.from(t.values())}return[]}_initBooleanModelItemProperty(e,t){return ut(this[e],t,this)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e0&&(this.toastElement.timeOutValue=window.setTimeout(()=>{this._removeElement(this.toastElement)},this.options.duration)),this}hideToast(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this._removeElement(this.toastElement)}_init(e){this.options=Object.assign(this.defaults,e),this.options.backgroundColor,this.toastElement=null,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.style.background=this.options.style.background||e.backgroundColor}_buildToast(){if(!this.options)throw"Toastify is not initialized";let e=document.createElement("div");e.className="toastify on "+this.options.className,e.className+=" toastify-"+this.options.position,e.className+=" "+this.options.gravity;for(const t in this.options.style)e.style[t]=this.options.style[t];if(this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(this.options.escapeMarkup?e.innerText=this.options.text:e.innerHTML=this.options.text,""!==this.options.avatar){let t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position?e.appendChild(t):e.insertAdjacentElement("afterbegin",t)}if(!0===this.options.close){let t=document.createElement("span");t.innerHTML="✖",t.className="toast-close",t.addEventListener("click",e=>{e.stopPropagation(),this._removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)});const n=window.innerWidth>0?window.innerWidth:screen.width;"left"==this.options.position&&n>360?e.insertAdjacentElement("afterbegin",t):e.appendChild(t)}if(this.options.stopOnFocus&&this.options.duration>0&&(e.addEventListener("mouseover",t=>{window.clearTimeout(e.timeOutValue)}),e.addEventListener("mouseleave",()=>{e.timeOutValue=window.setTimeout(()=>{this._removeElement(e)},this.options.duration)})),void 0!==this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),this.options.onClick()}),"object"==typeof this.options.offset){const t=this._getAxisOffsetAValue("x",this.options),n=this._getAxisOffsetAValue("y",this.options),r="left"==this.options.position?t:"-"+t,a="toastify-top"==this.options.gravity?n:"-"+n;e.style.transform=`translate(${r},${a})`}return e}_removeElement(e){e.className=e.className.replace(" on",""),window.setTimeout(()=>{this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),e.parentNode&&e.parentNode.removeChild(e),this.options.callback.call(e),this._reposition()},400)}_reposition(){let e,t={top:15,bottom:15},n={top:15,bottom:15},r={top:15,bottom:15},a=this._rootElement.querySelectorAll(".toastify");for(let o=0;o0?window.innerWidth:screen.width)<=360?(a[o].style[e]=r[e]+"px",r[e]+=i+s):!0===a[o].classList.contains("toastify-left")?(a[o].style[e]=t[e]+"px",t[e]+=i+s):(a[o].style[e]=n[e]+"px",n[e]+=i+s)}}_getAxisOffsetAValue(e,t){return t.offset[e]?isNaN(t.offset[e])?t.offset[e]:t.offset[e]+"px":"0px"}}function Et(e){return new bt(e)}class Nt extends HTMLElement{static get properties(){return{avatar:{type:String},backgroundColor:{type:String},callback:{type:String},classProp:{type:String},close:{type:Boolean},destination:{type:String},duration:{type:Number},escapeMarkup:{type:Boolean},gravity:{type:String},newWindow:{type:Boolean},oldestFirst:{type:Boolean},position:{type:String},selector:{type:String},stopOnFocus:{type:Boolean},text:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"})}_initVar(e,t){return this.hasAttribute(e)?this.getAttribute(e):t}connectedCallback(){this.avatar=this._initVar("avatar",""),this.backgroundColor=this._initVar("backgroundColor",""),this.callback=this._initVar("callback",{}),this.classProp=this._initVar("data-class",""),this.close="true"===this._initVar("close",!1),this.destination=this._initVar("destination",void 0),this.duration=Number(this._initVar("duration",3e3)),this.escapeMarkup="true"===this._initVar("escapeMarkup",!0),this.gravity=this._initVar("gravity","top"),this.newWindow="true"===this._initVar("newWindow",!1),this.offSet=this._initVar("offSet",{}),this.oldestFirst="true"===this._initVar("oldestFirst",!0),this.position=this._initVar("position","right"),this.stopOnFocus=this._initVar("stopOnFocus",!0),this.text=this._initVar("text","");this.shadowRoot.innerHTML=`\n \n ${this.renderHTML}\n `,this.addEventListener("jinn-toast",e=>{this.showToast(e.detail.text)})}showToast(e){new Et({avatar:this.avatar,className:this.classProp,close:this.close,destination:this.destination,duration:this.duration,escapeMarkup:this.escapeMarkup,gravity:this.gravity,newWindow:!1,offset:this.offset,oldestFirst:this.oldestFirst,position:this.position,node:this.shadowRoot,stopOnFocus:this.stopOnFocus,text:e}).showToast()}renderHTML(){return"\n \n "}}window.customElements.define("jinn-toast",Nt);class Bt extends HTMLElement{static get properties(){return{lazyRefresh:{type:Boolean},model:{type:Object},ready:{type:Boolean}}}constructor(){super(),this.model={},this.addEventListener("model-construct-done",this._handleModelConstructDone),this.addEventListener("message",this._displayMessage),this.addEventListener("error",this._displayError),window.addEventListener("compute-exception",e=>{}),this.ready=!1,this.storedTemplateExpressionByNode=new Map;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='\n \n \n \n \n \n \n
\n \n
\n \n ',this.toRefresh=[],this.initialRun=!0,this.someInstanceDataStructureChanged=!1}connectedCallback(){if(this.lazyRefresh=this.hasAttribute("refresh-on-view"),this.lazyRefresh){const e={root:null,rootMargin:"0px",threshold:.3};this.intersectionObserver=new IntersectionObserver(this.handleIntersect,e)}if(this.src=this.hasAttribute("src")?this.getAttribute("src"):null,this.src)return void this._loadFromSrc();this.shadowRoot.querySelector("slot").addEventListener("slotchange",e=>{let t=e.target.assignedElements().find(e=>"FX-MODEL"===e.nodeName.toUpperCase());if(!t){const e=document.createElement("FX-model");this.appendChild(e),t=e}t.inited||(this.src,t.modelConstruct()),this.model=t}),this.addEventListener("path-mutated",e=>{this.someInstanceDataStructureChanged=!0})}addToRefresh(e){this.toRefresh.find(t=>t.path===e.path)||this.toRefresh.push(e)}_loadFromSrc(){fetch(this.src,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then(e=>e.headers.get("content-type").toLowerCase().startsWith("text/html")?e.text().then(e=>(new DOMParser).parseFromString(e,"text/html")):"done").then(e=>{const t=e.querySelector("fx-fore");t||this.dispatchEvent(new CustomEvent("error",{detail:{message:`Fore element not found in '${this.src}'. Maybe wrapped within 'template' element?`}})),t.setAttribute("from-src",this.src),this.replaceWith(t)}).catch(e=>{this.dispatchEvent(new CustomEvent("error",{detail:{message:`'${this.src}' not found or does not contain Fore element.`}}))})}handleIntersect(e,t){e.forEach(e=>{const{target:t}=e;e.isIntersecting&&(t.classList.add("loaded"),"function"==typeof t.refresh?t.refresh(t,!0):ze.refreshChildren(t,!0))}),e[0].target.getOwnerForm().dispatchEvent(new CustomEvent("refresh-done"))}evaluateToNodes(e,t){return st(e,t,this)}disconnectedCallback(){}async refresh(e){this.initialRun||0===this.toRefresh.length?ze.refreshChildren(this,!0):(this.toRefresh.forEach(e=>{const t=e.boundControls;t&&t.forEach(e=>{e.refresh()});const n=this.getModel().mainGraph;if(n&&n.hasNode(e.path)){const t=this.getModel().mainGraph.dependentsOf(e.path,!1);0!==t.length&&t.forEach(e=>{const t=Qe.getBasePath(e);this.getModel().modelItems.find(e=>e.path===t).boundControls.forEach(e=>{e.refresh()})})}}),this.toRefresh=[]),(this.initialRun||this.someInstanceDataStructureChanged)&&(this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1),this._processTemplateExpressions(),this.dispatchEvent(new CustomEvent("refresh-done"))}_updateTemplateExpressions(){const e=st("(descendant-or-self::*/(text(), @*))[matches(.,'\\{.*\\}')] except descendant-or-self::fx-model/descendant-or-self::node()/(., @*)",this,this);this.storedTemplateExpressions||(this.storedTemplateExpressions=[]),Array.from(e).forEach(e=>{if(this.storedTemplateExpressionByNode.has(e))return;const t=this._getTemplateExpression(e);this.storedTemplateExpressionByNode.set(e,t)}),this._processTemplateExpressions()}_processTemplateExpressions(){for(const e of this.storedTemplateExpressionByNode.keys())this._processTemplateExpression({node:e,expr:this.storedTemplateExpressionByNode.get(e)})}_processTemplateExpression(e){const{expr:t}=e,{node:n}=e;this.evaluateTemplateExpression(t,n,this)}evaluateTemplateExpression(e,t){if("{}"===e)return;const n=e.match(/{[^}]*}/g);t.nodeType===t.TEXT_NODE?t.parentNode:t.ownerElement;n&&n.forEach(n=>{let r=n.substring(1,n.length-1);const a=wt(t,r);if(!a){(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE)&&t.parentNode;return}const o=Qe.getInstanceId(r),i=this.getModel().getInstance(o);try{const o=ct(r,a,t,null,i),s=e.replaceAll(n,o);if(t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,s)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=s);s.includes("{")&&(r=s.substring(1,s.length),this.evaluateTemplateExpression(s,t))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}})}_getTemplateExpression(e){return e.nodeType===Node.ATTRIBUTE_NODE?e.value:e.nodeType===Node.TEXT_NODE?e.textContent.trim():null}_handleModelConstructDone(){this._initUI()}async _lazyCreateInstance(){const e=this.querySelector("fx-model");if(0===e.instances.length){const t=document.createElement("fx-instance");e.appendChild(t);const n=document.implementation.createDocument(null,"data",null);this._generateInstance(this,n.firstElementChild),t.instanceData=n,e.instances.push(t)}}_generateInstance(e,t){if(e.hasAttribute("ref")&&!ze.isActionElement(e.nodeName)){const n=e.getAttribute("ref");if(n.includes("/")){n.split("/").forEach(n=>{t=this._generateNode(t,n,e)})}else t=this._generateNode(t,n,e)}if(e.hasChildNodes()){const n=e.children;for(let e=0;e\n "}async submit(){await this.dispatch("submit",{submission:this}),this._submit()}async _submit(){this.evalInContext();const e=this.getModel();if(e.recalculate(),this.validate){if(!e.revalidate())return this.dispatch("submit-error",{}),void this.getModel().parentNode.refresh()}await this._serializeAndSend()}_evaluateAttributeTemplateExpression(e,t){const n=e.match(/{[^}]*}/g);return n&&n.forEach(n=>{const r=n.substring(1,n.length-1),a=ct(r,wt(t,r),this.getOwnerForm()),o=e.replaceAll(n,a);e=o}),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();let n;if("none"===this.serialization)n=void 0;else{const e=this.selectRelevant(t.type);n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),"#echo"===e){let e=null;return n&&"xml"===t.type&&(e=(new DOMParser).parseFromString(n,"application/xml")),n&&"json"===t.type&&(e=JSON.parse(n)),this._handleResponse(e),void this.dispatch("submit-done",{})}const r=this._getHeaders();if("urlencoded-post"===this.method&&(this.method="post"),!this.methods.includes(this.method.toLowerCase()))return void this.dispatch("error",{message:"Unknown method "+this.method});const a=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!a.ok||a.status>400)return void this.dispatch("submit-error",{message:"Error while submitting "+this.id});const o=a.headers.get("content-type").toLowerCase();if(o.startsWith("text/plain")||o.startsWith("text/html")||o.startsWith("text/markdown")){const e=await a.text();this._handleResponse(e)}else if(o.startsWith("application/json")){const e=await a.json();this._handleResponse(e)}else if(o.startsWith("application/xml")){const e=await a.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await a.blob();this._handleResponse(e)}this.dispatch("submit-done",{})}_serialize(e,t){if("urlencoded-post"===this.method){const e=new URLSearchParams;return Array.from(t.children).forEach(t=>{e.append(t.nodeName,t.textContent)}),e}if("xml"===e){return(new XMLSerializer).serializeToString(t)}if("json"===e)return JSON.stringify(t);throw new Error("unknown instance type ",e)}_getHeaders(){const e=new Headers,t=this.getInstance(),n=ze.getContentType(t,this.method);e.append("Content-Type",n),e.has("Accept")&&e.delete("Accept");const r=this.querySelectorAll("fx-header");return Array.from(r).forEach(t=>{const{name:n}=t,r=t.getValue();e.append(n,r)}),e}_getUrlExpr(){return this.storedTemplateExpressions.find(e=>"url"===e.node.nodeName)}_getTargetInstance(){let e;if(e=this.instance?this.model.getInstance(this.instance):this.model.getInstance("default"),!e)throw new Error("target instance not found: "+e);return e}_handleResponse(e){if("instance"===this.replace){const t=this._getTargetInstance();if(!t)throw new Error("target instance not found: "+t);if(this.targetref){const n=ot(this.targetref,t.instanceData.firstElementChild,this),r=e.firstElementChild;n.parentNode.replaceChild(r,n)}else if(this.into){ot(this.into,t.instanceData.firstElementChild,this).innerHTML=e}else{const n=e;t.instanceData=n}this.model.updateModel(),this.getOwnerForm().refresh()}if("all"===this.replace&&(document.getElementsByTagName("html")[0].innerHTML=e),"target"===this.replace){const t=this.getAttribute("target");document.querySelector(t).innerHTML=e}"redirect"===this.replace&&(window.location.href=e)}selectRelevant(e){switch(e){case"xml":return this._relevantXmlNodes();default:return this.nodeset}}_relevantXmlNodes(){if("keep"===this.nonrelevant)return this.nodeset;const e=this.getModel().getModelItem(this.nodeset);if(e&&!e.relevant)return null;const t=(new DOMParser).parseFromString("","application/xml").firstElementChild;return 0===this.nodeset.children.length&&this._isRelevant(this.nodeset)?this.nodeset:this._filterRelevant(this.nodeset,t)}_filterRelevant(e,t){const{childNodes:n}=e;return Array.from(n).forEach(e=>{if(this._isRelevant(e)){const n=e.cloneNode(!1);t.appendChild(n);const{attributes:r}=e;return r&&Array.from(r).forEach(e=>{this._isRelevant(e)?n.setAttribute(e.nodeName,e.value):"empty"===this.nonrelevant?n.setAttribute(e.nodeName,""):n.removeAttribute(e.nodeName)}),this._filterRelevant(e,n)}return null}),t}_isRelevant(e){const t=this.getModel().getModelItem(e);return!(t&&!t.relevant)}_handleError(){this.dispatch("submit-error",{})}}customElements.define("fx-submission",Tt);class It extends(xt(HTMLElement)){constructor(){if(super(),this.style.display="none",this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML="",!this.hasAttribute("name"))throw new Error('required attribute "name" missing');this.name=this.getAttribute("name")}connectedCallback(){this.shadowRoot.innerHTML=""}}customElements.define("fx-header",It);class Ct extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"}),this.name="",this.valueQuery="",this.value=null}connectedCallback(){this.name=this.getAttribute("name"),this.valueQuery=this.getAttribute("value")}refresh(){const e=wt(this,this.valueQuery);this.value=ot(this.valueQuery,e,this,this.precedingVariables)}setInScopeVariables(e){e.has(this.name)?this.dispatch("xforms-binding-error"):(e.set(this.name,this),this.inScopeVariables=new Map(e))}}customElements.define("fx-var",Ct);class St extends(xt(HTMLElement)){constructor(){super(),this.value="",this.display=this.style.display,this.required=!1,this.readonly=!1,this.widget=null}getWidget(){throw new Error("You have to implement the method getWidget!")}async refresh(e){const t=this.value;if(!this.isNotBound()&&(this.evalInContext(),this.isBound())){if(null===this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof mt){if(this.value=this.modelItem.value,this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;t!==this.value&&ze.dispatch(this,"value-changed",{path:this.modelItem.path})}}}async updateWidgetValue(){throw new Error("You have to implement the method updateWidgetValue!")}handleModelItemProperties(){this.handleRequired(),this.handleReadonly(),this.getOwnerForm().ready&&this.handleValid(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}_dispatchEvent(e){this.getOwnerForm().ready&&this.dispatch(e,{})}handleRequired(){this.widget=this.getWidget(),this.isRequired()!==this.modelItem.required&&(this.modelItem.required?(this.widget.setAttribute("required","required"),this.classList.add("required"),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.required=!1,this.classList.toggle("required"),this._dispatchEvent("optional")))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly","readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)this.classList.remove("invalid"),e&&(e.style.display="none"),this._dispatchEvent("valid");else{if(this.classList.add("invalid"),e&&(e.style.display="block"),0!==this.modelItem.alerts.length){const{alerts:e}=this.modelItem;this.querySelector("fx-alert")||e.forEach(e=>{const t=document.createElement("fx-alert");t.innerHTML=e,this.appendChild(t),t.style.display="block"})}this._dispatchEvent("invalid")}}handleRelevant(){this.isEnabled()!==this.modelItem.relevant&&(this.modelItem.relevant?(this._dispatchEvent("relevant"),this.style.display=this.display):(this._dispatchEvent("nonrelevant"),this.style.display="none"))}isRequired(){return!!this.widget.hasAttribute("required")}isValid(){return!this.classList.contains("invalid")}isReadonly(){return!!this.widget.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e,t){e.style.opacity=0,e.style.display=t||"block",function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(e.style.opacity=n,requestAnimationFrame(t))}()}}window.customElements.define("fx-abstract-control",St);customElements.define("fx-alert",class extends St{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n "}async updateWidgetValue(){this.innerHTML=this.value}});class Ot extends St{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.updateEvent=this.hasAttribute("update-event")?this.getAttribute("update-event"):"blur",this.valueProp=this.hasAttribute("value-prop")?this.getAttribute("value-prop"):"value",this.label=this.hasAttribute("label")?this.getAttribute("label"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget(),"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))}),this.updateEvent="blur"),this.widget.addEventListener(this.updateEvent,()=>{this.setValue(this.widget[this.valueProp])});this.shadowRoot.querySelector("slot");this.template=this.querySelector("template")}setValue(e){const t=this.getModelItem(),n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),n.actionPerformed()}renderHTML(e){return`\n ${this.label?""+this.label:""}\n \n \n `}getWidget(){if(this.widget)return this.widget;let e=this.querySelector(".widget");if(e||(e=this.querySelector("input")),!e){const e=document.createElement("input");return e.classList.add("widget"),e.setAttribute("type","text"),this.appendChild(e),e}return e}async updateWidgetValue(){if("checked"===this.valueProp)"true"===this.value?this.widget.checked=!0:this.widget.checked=!1;else{let{widget:e}=this;if(e||(e=this),this.hasAttribute("as")){if("text"===this.getAttribute("as")){const t=new XMLSerializer,n=ze.prettifyXml(t.serializeToString(this.nodeset));e.value=n}}else e.value=this.value}}getTemplate(){return this.querySelector("template")}async refresh(e){super.refresh();const t=this.getWidget();if(t.hasAttribute("ref")){const e=t.getAttribute("ref"),n=ot(e,wt(this,e),this),{children:r}=t;if(Array.from(r).forEach(e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)}),this.template)if(n.length)Array.from(n).forEach(e=>{const t=this.createEntry();this.updateEntry(t,e)});else{const e=this.createEntry();this.updateEntry(e,n)}}ze.refreshChildren(this,e)}updateEntry(e,t){if("SELECT"!==this.widget.nodeName)return;const n=this._getValueAttribute(e),r=n.value,a=ot(r.substring(1,r.length-1),t,e);n.value=a,this.value===a&&e.setAttribute("selected","selected");const o=e.textContent,i=ct(o.substring(1,o.length-1),t,e);e.textContent=i}createEntry(){const e=this.template.content.firstElementChild.cloneNode(!0),t=document.importNode(e,!0);return this.template.parentNode.appendChild(t),t}_getValueAttribute(e){let t;return Array.from(e.attributes).forEach(e=>{-1!==e.value.indexOf("{")&&(t=e)}),t}}window.customElements.define("fx-control",Ot);class Rt extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n ",this.getOwnerForm().registerLazyElement(this)}refresh(e){!e&&this.hasAttribute("refresh-on-view")||(this.isBound()&&(this.evalInContext(),this.modelItem=this.getModelItem(),this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this)),this._getForm().ready&&this.handleModelItemProperties(),ze.refreshChildren(this,e))}handleModelItemProperties(){this.handleReadonly(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.setAttribute("readonly","readonly"),this.dispatchEvent(new CustomEvent("readonly",{}))),this.modelItem.readonly||(this.removeAttribute("readonly"),this.dispatchEvent(new CustomEvent("readwrite",{}))))}handleRelevant(){this.modelItem&&this.isEnabled()!==this.modelItem.enabled&&(this.modelItem.enabled?this.dispatchEvent(new CustomEvent("enabled",{})):this.dispatchEvent(new CustomEvent("disabled",{})))}isReadonly(){return!!this.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}}window.customElements.define("fx-container",Rt); -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const Dt="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,Ut=`{{lit-${String(Math.random()).slice(2)}}}`,Mt=`\x3c!--${Ut}--\x3e`,Gt=e=>-1!==e.index,kt=()=>document.createComment(""),Ft=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,Pt=new WeakMap,Ht=e=>"function"==typeof e&&Pt.has(e),jt={},Xt={}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -class _t{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=Dt?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let a,o=0,i=0,s=r.nextNode();for(;oe}),Vt=` ${Ut} `;class Yt{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r-1||n)&&-1===e.indexOf("--\x3e",a+1);const o=Ft.exec(e);t+=null===o?e+(n?Vt:Mt):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+Ut}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==Lt&&(t=Lt.createHTML(t)),e.innerHTML=t,e}} -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */const qt=e=>null===e||!("object"==typeof e||"function"==typeof e),Qt=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class Jt{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}})(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Wt{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;Ht(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=jt,e(this)}if(this.__pendingValue===jt)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=jt}}class $t extends Jt{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Zt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Zt extends Kt{}let en=!1;(()=>{try{const e={get capture(){return en=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class tn{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Ht(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=jt,e(this)}if(this.__pendingValue===jt)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=nn(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=jt}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const nn=e=>e&&(en?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */;const rn=new class{handleAttributeExpressions(e,t,n,r){const a=t[0];if("."===a){return new $t(e,t.slice(1),n).parts}if("@"===a)return[new tn(e,t.slice(1),r.eventContext)];if("?"===a)return[new Wt(e,t.slice(1),n)];return new Jt(e,t,n).parts}handleTextExpression(e){return new zt(e)}}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const an=(e,...t)=>new Yt(e,t,"html",rn) -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */;void 0===window.ShadyCSS||window.ShadyCSS.prepareTemplateDom -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */,window.JSCompiler_renameProperty=(e,t)=>e -/** -@license -Copyright (c) 2019 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at -http://polymer.github.io/LICENSE.txt The complete set of authors may be found at -http://polymer.github.io/AUTHORS.txt The complete set of contributors may be -found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as -part of the polymer project is also subject to an additional IP rights grant -found at http://polymer.github.io/PATENTS.txt -*/;const on=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,sn=Symbol();class un{constructor(e,t){if(t!==sn)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(on?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const cn=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof un)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new un(n,sn)}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");window.customElements.define("fx-group",class extends Rt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return an``}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){Array.from(e.children).forEach(e=>{if(ze.isUiElement(e.nodeName))e.init(this.model);else if(0!==e.children.length){Array.from(e.children).forEach(e=>{this.initializeChildren(e)})}})}});customElements.define("fx-hint",class extends St{static get styles(){return cn`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return an``}});customElements.define("fx-output",class extends St{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){this.shadowRoot.innerHTML='\n \n \n \n \n \n \n \n ',this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):null,this.addEventListener("slotchange",e=>{})}async refresh(){this.ref&&await super.refresh(),this.valueAttr&&(this.value=this.getValue(),await this.updateWidgetValue())}getValue(){try{const e=wt(this,this.valueAttr);return this.hasAttribute("html")?ot(this.valueAttr,e,this):function(e,t,n,r=null,a=n){const o=nt(e,t,n);return Xe(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}(this.valueAttr,e,this)[0]}catch(e){this.dispatch("error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}async updateWidgetValue(){const e=this.shadowRoot.getElementById("value");if("markdown"===this.mediatype){const e=markdown(this.nodeset);this.innerHtml=e}if("html"!==this.mediatype)e.innerHTML=this.value;else{if(this.modelItem.node){const{node:e}=this.modelItem;return e.nodeType?void this.appendChild(e):void Object.entries(e).map(e=>{this.appendChild(e[1])})}e.innerHTML=this.value.outerHTML}}isReadonly(){return this.readonly=!0,this.readonly}});class ln extends(xt(HTMLElement)){static get properties(){return{inited:{type:Boolean}}}constructor(){super(),this.inited=!1,this.addEventListener("click",this._dispatchIndexChange),this.addEventListener("focusin",this._dispatchIndexChange),this.attachShadow({mode:"open",delegatesFocus:!0})}_handleFocus(){this.parentNode.setIndex(this.index)}_dispatchIndexChange(){this.parentNode&&this.parentNode.dispatchEvent(new CustomEvent("item-changed",{composed:!0,bubbles:!0,detail:{item:this}}))}connectedCallback(){this.display=this.style.display;this.shadowRoot.innerHTML="\n \n \n \n ",this.getOwnerForm().registerLazyElement(this)}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}getModelItem(){return super.getModelItem(),this.getModelItem()[this.index]}refresh(e){this.modelItem=this.getModel().getModelItem(this.nodeset),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,ze.refreshChildren(this,e)}}window.customElements.define("fx-repeatitem",ln);class pn extends(xt(HTMLElement)){static get properties(){return{...super.properties,index:{type:Number},template:{type:Object},focusOnCreate:{type:String},initDone:{type:Boolean},repeatIndex:{type:Number},nodeset:{type:Array}}}constructor(){super(),this.ref="",this.dataTemplate=[],this.focusOnCreate="",this.initDone=!1,this.repeatIndex=1,this.nodeset=[],this.inited=!1,this.index=1,this.repeatSize=0,this.attachShadow({mode:"open",delegatesFocus:!0})}get repeatSize(){return this.querySelectorAll(":scope > fx-repeatitem").length}set repeatSize(e){this.size=e}setIndex(e){this.index=e;const t=this.querySelectorAll(":scope > fx-repeatitem");this.applyIndex(t[this.index-1])}applyIndex(e){this._removeIndexMarker(),e&&e.setAttribute("repeat-index","")}get index(){return this.getAttribute("index")}set index(e){this.setAttribute("index",e)}connectedCallback(){this.ref=this.getAttribute("ref"),this.addEventListener("item-changed",e=>{const{item:t}=e.detail,n=Array.from(this.children).indexOf(t);this.applyIndex(this.children[n]),this.index=n+1}),document.addEventListener("index-changed",e=>{if(e.stopPropagation(),!e.target===this)return;const{index:t}=e.detail;this.index=Number(t),this.applyIndex(this.children[t-1])}),this.mutationObserver=new MutationObserver(e=>{if("childList"===e[0].type){const t=e[0].addedNodes[0];if(t){const e=Qe.getPath(t);this.dispatch("path-mutated",{path:e,index:this.index})}}}),this.getOwnerForm().registerLazyElement(this);this.shadowRoot.innerHTML='\n \n \n \n \n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=wt(this.getAttributeNode("ref")||this,this.ref);this.mutationObserver&&e.nodeName&&this.mutationObserver.observe(e,{childList:!0,subtree:!0});const t=ot(this.ref,e,this);if(null!==t){if("object"==typeof t){if("nodeType"in t)return void(this.nodeset=[t]);if(Array.isArray(t))return void(this.nodeset=t)}throw new Error("Unexpected result of repeat nodeset: "+t)}this.nodeset=[]}async refresh(e){this.inited||this.init(),this._evalNodeset();const t=this.querySelectorAll(":scope > fx-repeatitem"),n=t.length;let r=1;Array.isArray(this.nodeset)&&(r=this.nodeset.length);const a=r;if(aa;e-=1){const n=t[e-1];n.parentNode.removeChild(n),this.getOwnerForm().unRegisterLazyElement(n)}if(a>n)for(let e=n+1;e<=a;e+=1){const t=document.createElement("fx-repeatitem"),n=this._clone();t.appendChild(n),this.appendChild(t),this._initVariables(t),t.nodeset=this.nodeset[e-1],t.index=e,this.getOwnerForm().someInstanceDataStructureChanged=!0}for(let e=0;e1||(e.style.opacity=n,requestAnimationFrame(t))}())}_initTemplate(){this.template=this.querySelector("template"),null===this.template&&this.dispatchEvent(new CustomEvent("no-template-error",{composed:!0,bubbles:!0,detail:{message:"no template found for repeat:"+this.id}})),this.shadowRoot.appendChild(this.template)}_initRepeatItems(){this.nodeset.forEach((e,t)=>{const n=document.createElement("fx-repeatitem");n.nodeset=this.nodeset[t],n.index=t+1;const r=this._clone();n.appendChild(r),this.appendChild(n),1===n.index&&this.applyIndex(n),this._initVariables(n)})}_initVariables(e){const t=new Map(this.inScopeVariables);e.setInScopeVariables(t),function e(n){for(const r of n.children)"setInScopeVariables"in r&&r.setInScopeVariables(t),e(r)}(e)}_clone(){this.template=this.shadowRoot.querySelector("template");const e=this.template.content.cloneNode(!0);return document.importNode(e,!0)}_removeIndexMarker(){Array.from(this.children).forEach(e=>{e.removeAttribute("repeat-index")})}setInScopeVariables(e){this.inScopeVariables=new Map(e)}}window.customElements.define("fx-repeat",pn);window.customElements.define("fx-switch",class extends Rt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){super.refresh();const e=this.querySelectorAll("fx-case");if(this.isBound())Array.from(e).forEach(e=>{e.getAttribute("name")===this.modelItem.value?e.classList.add("selected-case"):e.classList.remove("selected-case")});else{this.querySelector(".selected-case")||e[0].classList.add("selected-case")}ze.refreshChildren(this)}toggle(e){const t=this.querySelectorAll("fx-case");Array.from(t).forEach(t=>{e===t?t.classList.add("selected-case"):t.classList.remove("selected-case")})}});customElements.define("fx-trigger",class extends St{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML()}\n `;const e=this.shadowRoot.querySelector("slot");e.addEventListener("slotchange",()=>{const t=e.assignedElements({flatten:!0});t[0].setAttribute("tabindex","0"),t[0].setAttribute("role","button");const n=t[0];n.addEventListener("click",e=>this.performActions(e)),this.widget=n,"BUTTON"!==n.nodeName&&n.addEventListener("keypress",e=>{"Space"!==e.code&&"Enter"!==e.code||this.performActions(e)})})}renderHTML(){return"\n \n "}getWidget(){return this.widget}async updateWidgetValue(){return null}handleReadonly(){super.handleReadonly(),this.widget.hasAttribute("readonly")?this.widget.setAttribute("disabled","disabled"):this.widget.removeAttribute("disabled")}async performActions(e){const t=this.closest("fx-repeatitem");t&&t.click(),this.querySelectorAll("fx-var").forEach(e=>e.refresh());(async()=>{for(let t=0;t${this.label}`:""}\n \n `;this.shadowRoot.innerHTML=`\n \n ${e}\n `,this.style.display="none"}}window.customElements.define("fx-case",hn);class fn extends HTMLElement{connectedCallback(){const e=Array.from(document.querySelectorAll("fx-instance"));this.innerHTML=`\n \n \n ${e.map((e,t)=>`\n
\n ${e.id}\n
{log('${e.id}')}
\n
\n `).join("")}\n `,this.addEventListener("slotchange",e=>{})}}customElements.define("fx-inspector",fn);class dn extends HTMLElement{static get properties(){return{id:String}}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML=this.render("\n :host {\n display:none;\n height: 100vh;\n width:100vw;\n position:fixed;\n left:0;\n top:0;\n right:0;\n bottom:0;\n transition:opacity 0.4s linear;\n }\n\n "),this.id=this.getAttribute("id");const e=this.querySelector(".close-dialog");e&&e.addEventListener("click",e=>{document.getElementById(this.id).classList.remove("show")}),this.addEventListener("transitionend",()=>{}),this.focus()}render(e){return`\n \n \n `}open(){window.addEventListener("keyup",e=>{"Escape"===e.key&&this.hide()},{once:!0}),this.classList.add("show")}async hide(){await ze.fadeOutElement(this,400),this.classList.remove("show")}}customElements.define("fx-dialog",dn);async function mn(e){return new Promise(t=>setTimeout(()=>t(),e))}customElements.define("fx-items",class extends Ot{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{const t=this.querySelectorAll("[value]");let n;"LABEL"===e.target.nodeName&&(n=document.getElementById(e.target.getAttribute("for")),n.checked=!n.checked);let r="";Array.from(t).forEach(e=>{e.checked&&(r+=" "+e.getAttribute("value"))}),this.setAttribute("value",r.trim());const a=this.parentNode.closest("[ref]");if(!a)return;const o=a.getModelItem(),i=this.shadowRoot.getElementById("setvalue");i.setValue(o,r.trim()),i.actionPerformed()})}getWidget(){return this}async updateWidgetValue(){const e=this.parentNode.closest("[ref]");e&&(this.value=e.value),this.setAttribute("value",this.value)}updateEntry(e,t){const n=e.querySelector("label");n.textContent=t.textContent;const r=ze.createUUID();n.setAttribute("for",r);const a=e.querySelector("[value]"),o=a.value,i=ct(o.substring(1,o.length-1),t,e),s=` ${i} `,u=` ${this.getAttribute("value")} `;a.value=i,a.setAttribute("id",r),-1!==u.indexOf(s)&&(a.checked=!0)}});class gn extends(xt(HTMLElement)){static get properties(){return{...super.properties,detail:{type:Object},needsUpdate:{type:Boolean},event:{type:Object},target:{type:String},ifExpr:{type:String},whileExpr:{type:String},delay:{type:Number}}}constructor(){super(),this.detail={},this.needsUpdate=!1}connectedCallback(){this.style.display="none",this.repeatContext=void 0,this.hasAttribute("event")?this.event=this.getAttribute("event"):this.event="activate",this.target=this.getAttribute("target"),this.target?"#window"===this.target?window.addEventListener(this.event,e=>this.execute(e)):"#document"===this.target?document.addEventListener(this.event,e=>this.execute(e)):(this.targetElement=document.getElementById(this.target),this.targetElement.addEventListener(this.event,e=>this.execute(e))):(this.targetElement=this.parentNode,this.targetElement.addEventListener(this.event,e=>this.execute(e))),this.ifExpr=this.hasAttribute("if")?this.getAttribute("if"):null,this.whileExpr=this.hasAttribute("while")?this.getAttribute("while"):null,this.delay=this.hasAttribute("delay")?Number(this.getAttribute("delay")):0}async execute(e){if(e&&e.detail&&(this.detail=e.detail),this.needsUpdate=!1,this.evalInContext(),this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||ut(this.ifExpr,wt(this),this)){if(this.whileExpr){const e=async()=>{await mn(this.delay||0),this.ownerDocument.contains(this)&&ut(this.whileExpr,wt(this),this)&&(this.perform(),await e())};return await e(),void this.actionPerformed()}!this.delay||(await mn(this.delay),this.ownerDocument.contains(this))?(this.perform(),this.actionPerformed()):this.actionPerformed()}}perform(){(this.isBound()||"FX-ACTION"===this.nodeName)&&this.evalInContext()}actionPerformed(){if(this.needsUpdate){const e=this.getModel();e.recalculate(),e.revalidate(),e.parentNode.refresh(!0),this.dispatchActionPerformed()}}dispatchActionPerformed(){this.dispatchEvent(new CustomEvent("action-performed",{composed:!0,bubbles:!0,detail:{}}))}}window.customElements.define("abstract-action",gn);window.customElements.define("fx-append",class extends gn{static get properties(){return{ref:{type:String},repeat:{type:String},clear:{type:String}}}constructor(){super(),this.repeat=""}connectedCallback(){super.connectedCallback(),this.ref=this.getAttribute("ref"),this.repeat=this.getAttribute("repeat")}perform(){super.perform(),this._dataFromTemplate(),this.needsUpdate=!0}actionPerformed(){super.actionPerformed(),this.dispatch()}_dataFromTemplate(){const e=this.getInScopeContext(),t=this.getOwnerForm().querySelector("#"+this.repeat),n=t.shadowRoot.querySelector("template"),r=e.ownerDocument.createElement(t.ref),a=this._generateInstance(n.content,r);e.appendChild(a)}dispatch(){let e;e=ze.isRepeated(this)?ze.getRepeatTarget(this,this.repeat):document.getElementById(this.repeat),e.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{index:e.nodeset.length}}))}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;ea?n.setIndex(a):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}});window.customElements.define("fx-insert",class extends gn{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n ",this.at=Number(this.hasAttribute("at")?this.getAttribute("at"):0),this.position=this.hasAttribute("position")?this.getAttribute("position"):"after",this.origin=this.hasAttribute("origin")?this.getAttribute("origin"):null,this.keepValues=!!this.hasAttribute("keep-values")}_cloneOriginSequence(e,t){let n;if(this.origin){let t;try{t=it(this.origin,e,this.getOwnerForm()),Array.isArray(t)&&0===t.length&&(n=null),n=t.cloneNode(!0)}catch(e){}}else t&&(n=this._cloneTargetSequence(t),n&&!this.keepValues&&this._clear(n));return n}_getInsertIndex(e,t){return 0===t.length?null:this.hasAttribute("at")?lt(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){let e,t;this.hasAttribute("context")&&(e=wt(this.getAttributeNode("context"),this.getAttribute("context")),t=st(this.getAttribute("context"),e,this.getOwnerForm())),this.hasAttribute("ref")&&(e||(e=wt(this.getAttributeNode("ref"),this.ref)),t=st(this.ref,e,this.getOwnerForm()));const n=this._cloneOriginSequence(e,t);if(!n)return;let r,a;if(0===t.length)r=e,e.appendChild(n),a=1;else{if(this.hasAttribute("at")?(a=lt(this.getAttribute("at"),e,this.getOwnerForm()),r=t[a-1]):(a=t.length,r=t[t.length-1]),!r){a=1,r=t;a=ot("count(preceding::*)",t,this.getOwnerForm())+1}if(this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position)if(a+=1,this.hasAttribute("context")&&this.hasAttribute("ref"))e.append(n);else if(this.hasAttribute("context")){this.getAttribute("context");a=1,r.prepend(n)}else r.insertAdjacentElement("afterend",n)}document.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{insertedNodes:n,index:a}})),this.needsUpdate=!0}_cloneTargetSequence(e){return Array.isArray(e)&&0!==e.length?e[e.length-1].cloneNode(!0):!Array.isArray(e)&&e?e.cloneNode(!0):null}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}_clear(e){const t=e.attributes;for(let e=0;e\n \n :host{\n display:none;\n }\n \n \n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,e=>this.execute(e))}renderHTML(){return"\n \n "}perform(){let e;super.perform(),e=this.hasAttribute("value")?this.getValue():this.textContent,this.dispatchEvent(new CustomEvent("message",{composed:!0,bubbles:!0,detail:{level:this.level,message:e}}))}});window.customElements.define("fx-setvalue",class extends gn{static get properties(){return{...super.properties,ref:{type:String},valueAttr:{type:String}}}constructor(){super(),this.ref="",this.valueAttr=""}connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),!this.hasAttribute("ref"))throw new Error('fx-setvalue must specify a "ref" attribute');this.ref=this.getAttribute("ref"),this.valueAttr=this.getAttribute("value")}perform(){super.perform();let{value:e}=this;e=null!==this.valueAttr?ot(this.valueAttr,this.nodeset,this,this.detail):""!==this.textContent?this.textContent:"";const t=this.getModelItem();this.setValue(t,e)}setValue(e,t){const n=e;n&&n.value!==t&&(n.value=t,this.getModel().changed.push(e),this.needsUpdate=!0)}});window.customElements.define("fx-send",class extends gn{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),this.submission=this.getAttribute("submission")}perform(){super.perform();const e=this.getModel().querySelector("#"+this.submission);if(null===e)throw this.dispatchEvent(new CustomEvent("error",{composed:!0,bubbles:!0,detail:{message:`fx-submission element with id: '${this.submission}' not found`}})),new Error(`submission with id: ${this.submission} not found`);e.submit()}});window.customElements.define("fx-toggle",class extends gn{connectedCallback(){super.connectedCallback(),this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}perform(){if(super.perform(),this.case){const e=this.getOwnerForm().querySelector("#"+this.case);e.parentNode.toggle(e)}}});window.customElements.define("fx-dispatch",class extends gn{constructor(){super(),this.name=null,this.targetid=null,this.details=null,this.attachShadow({mode:"open"})}connectedCallback(){if(super.connectedCallback(),this.name=this.getAttribute("name"),!this.name)throw new Error("no event specified for dispatch",this);this.targetid=this.hasAttribute("targetid")?this.getAttribute("targetid"):null}perform(){const e=this.querySelectorAll("fx-property"),t={};if(Array.from(e).forEach(e=>{const n=e.getAttribute("name"),r=e.getAttribute("value"),a=e.getAttribute("expr");if(a){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const e=ot(a,this.getInScopeContext(),this.getOwnerForm());let o=null;if(e.nodeName){o=(new XMLSerializer).serializeToString(e)}t[n]=o||e}r&&(t[n]=r)}),this.targetid){let e;if(e=Qe.isRepeated(this)?pt(this.targetid,this.parentNode,null):document.getElementById(this.targetid),!e)throw new Error(`targetid ${this.targetid} does not exist in document`);e.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}else document.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}});window.customElements.define("fx-update",class extends gn{perform(){this.getModel().updateModel()}});window.customElements.define("fx-refresh",class extends gn{perform(){this.getOwnerForm().refresh()}});class yn extends gn{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n \n \n "}perform(){const{children:e}=this;if(this.src){this.innerHTML="";const e=document.createElement("script");e.src=this.src,this.appendChild(e)}else Array.from(e).forEach(e=>{if("fx-var"===e.localName)return;const t=e;t.detail=this.detail,t.execute()}),this.dispatchActionPerformed()}}window.customElements.define("fx-action",yn);window.customElements.define("fx-confirm",class extends yn{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}});window.customElements.define("fx-show",class extends yn{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||this.dispatch("error",{message:"dialog does not exist"})}perform(){document.getElementById(this.dialog).open()}});window.customElements.define("fx-hide",class extends gn{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||this.dispatch("error",{message:"dialog does not exist"})}perform(){document.getElementById(this.dialog).hide()}});class vn extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.style.display="none",this.signature=this.hasAttribute("signature")?this.getAttribute("signature"):null,this.signature,this.type=this.hasAttribute("type")?this.getAttribute("type"):null,this.shadowRoot.innerHTML="",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?[^:]*):)?(?[^(]+)\((?(?:\(\)|[^)])*)\)(?: as (?.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:a,returnType:o}=t.groups,i="local"===n?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r}:`${n}:${r}`,s=a?a.split(",").map(e=>{const t=e.match(/(?\$[^\s]+)(?:\sas\s(?.+))/);if(!t)throw new Error(`Param ${e} could not be parsed`);const{variableName:n,varType:r}=t.groups;return{variableName:n,variableType:r||"item()*"}}):[];switch(e){case"text/javascript":{const e=new Function("_domFacade",...s.map(e=>e.variableName),"form",this.functionBody);Ve(i,s.map(e=>e.variableType),o||"item()*",(...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()]));break}case"text/xpath":{const e=(e,...t)=>ot(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce((e,n,r)=>(e[n.variableName.replace("$","")]=t[r],e),{}));Ve(i,s.map(e=>e.variableType),o||"item()*",e);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.define("fx-function",vn); -//# sourceMappingURL=fore-all.js.map diff --git a/src/resources/js/fore-all.js.map b/src/resources/js/fore-all.js.map deleted file mode 100644 index 7bc6186..0000000 --- a/src/resources/js/fore-all.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fore-all.js","sources":["../node_modules/whynot/dist/whynot.esm.js","../node_modules/xspattern/dist/xspattern.esm.js","../node_modules/prsc/dist/prsc.esm.js","../node_modules/fontoxpath/dist/fontoxpath.esm.js","../src/DependencyNotifyingDomFacade.js","../src/xpath-util.js","../src/dep_graph.js","../src/fore.js","../src/xpath-evaluation.js","../src/fx-instance.js","../src/modelitem.js","../src/fx-model.js","../src/getInScopeContext.js","../src/ForeElementMixin.js","../src/fx-bind.js","../node_modules/toastify-js/src/toastify-es.js","../node_modules/@jinntec/jinn-toast/src/JinnToast.js","../src/fx-fore.js","../src/fx-submission.js","../src/fx-header.js","../src/fx-var.js","../src/ui/abstract-control.js","../src/ui/fx-alert.js","../src/ui/fx-control.js","../src/ui/fx-container.js","../node_modules/lit-html/lib/dom.js","../node_modules/lit-html/lib/template.js","../node_modules/lit-html/lib/directive.js","../node_modules/lit-html/lib/part.js","../node_modules/lit-html/lib/template-instance.js","../node_modules/lit-html/lib/template-result.js","../node_modules/lit-html/lib/parts.js","../node_modules/lit-html/lib/default-template-processor.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-html/lib/shady-render.js","../node_modules/lit-element/lib/updating-element.js","../node_modules/lit-element/lib/css-tag.js","../node_modules/lit-element/lit-element.js","../src/ui/fx-group.js","../src/ui/fx-hint.js","../src/ui/fx-output.js","../src/ui/fx-repeatitem.js","../src/ui/fx-repeat.js","../src/ui/fx-switch.js","../src/ui/fx-trigger.js","../src/ui/fx-case.js","../src/ui/fx-inspector.js","../src/ui/fx-dialog.js","../src/actions/abstract-action.js","../src/ui/fx-items.js","../src/actions/fx-append.js","../src/actions/fx-delete.js","../src/actions/fx-insert.js","../src/actions/fx-message.js","../src/actions/fx-setvalue.js","../src/actions/fx-send.js","../src/actions/fx-toggle.js","../src/actions/fx-dispatch.js","../src/actions/fx-update.js","../src/actions/fx-refresh.js","../src/actions/fx-action.js","../src/actions/fx-confirm.js","../src/actions/fx-show.js","../src/actions/fx-hide.js","../src/functions/fx-function.js"],"sourcesContent":["function t(t,s,r,i){const n={op:s,func:r,data:i};return t.push(n),n}function s(t,s){return t}class r{constructor(){this.program=[]}test(s,r){return t(this.program,5,s,void 0===r?null:r)}jump(s){return t(this.program,3,null,s)}record(r,i){return t(this.program,4,void 0===i?s:i,r)}bad(s=1){return t(this.program,1,null,s)}accept(){return t(this.program,0,null,null)}fail(s){return t(this.program,2,s||null,null)}}class i{constructor(t,s,r){this.programLength=t,this.maxFromByPc=s,this.maxSurvivorFromByPc=r}static fromProgram(t){const s=t.length,r=[],n=[];return t.forEach((t=>{r.push(0),n.push(0)})),t.forEach(((t,i)=>{switch(t.op){case 2:if(null===t.func)return;if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 1:case 4:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 3:t.data.forEach((t=>{if(t<0||t>=s)throw new Error(\"Invalid program: program could run past end\");r[t]+=1}));break;case 5:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");n[i+1]+=1;break;case 0:n[i]+=1}})),new i(s,r,n)}static createStub(t){const s=[],r=[];for(let i=0;i0}}class h{constructor(t){this.t=0,this.i=0,this.h=new Uint16Array(t),this.l=new Uint8Array(t)}getBadness(t){return this.l[t]}add(t,s){this.l[t]=s>255?255:s;const r=function(t,s,r,i,n){let h=i,e=n;for(;h>>1;r255?255:s);if(this.l[t]!==r){const s=this.h.indexOf(t,this.i);if(s<0||s>=this.t)return void(this.l[t]=r);this.h.copyWithin(s,s+1,this.t),this.t-=1,this.add(t,r)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class e{constructor(t){this.o=[];let s=t.length;t.forEach((t=>{this.o.push(t>0?s:-1),s+=t})),this.u=new Uint16Array(s)}clear(){this.u.fill(0,0,this.o.length)}add(t,s){const r=this.u[s],i=this.o[s];this.u[s]+=1,this.u[i+r]=t}has(t){return this.u[t]>0}forEach(t,s){const r=this.u[t],i=this.o[t];for(let t=i;t{const r=this.trace(s,i,n,h);var c,o,u;o=r,u=e,t=null===(c=t)?o:null===o?c:Array.isArray(o)?o.reduce(((t,s)=>l(t,s,t===o)),c):l(c,o,u),e=t===r})),t}trace(t,s,r,i){switch(this.p[t]){case 2:return this.v[t];case 1:return null}this.p[t]=1;let n=null;const h=s[t];if(null!==h)n=h;else if(!r.has(t))throw new Error(`Trace without source at pc ${t}`);if(n=this.mergeTraces(n,t,r,s,r,i),null!==n){const s=i[t];null!==s&&(n=o(n,s))}return this.v[t]=n,this.p[t]=2,n}buildSurvivorTraces(t,s,r,i,n){for(let h=0,e=t.length;hl(t,this.k[s])),null);return null===s?[]:Array.isArray(s)?s:[s]}}class f{constructor(t){this.I=[],this.N=new h(t.programLength),this.M=new h(t.programLength),this.P=new a(t)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(t,s,r){const i=this.P.has(s);this.P.add(t,s);const n=this.N.getBadness(t)+r;i?this.N.reschedule(s,n):this.N.add(s,n)}stepToNextGeneration(t,s){const r=this.P.hasSurvivor(s);this.P.addSurvivor(t,s);const i=this.N.getBadness(t);r?this.M.reschedule(s,i):this.M.add(s,i)}accept(t){this.I.push(t),this.P.addSurvivor(t,t)}fail(t){}record(t,s){this.P.record(t,s)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const t=this.N;t.reset(),this.N=this.M,this.M=t}getAcceptingTraces(){return this.P.getTraces(this.I)}}class d{constructor(t){this.U=[],this.G=t,this.V=i.fromProgram(t),this.U.push(new f(this.V))}execute(t,s){const r=this.U.pop()||new f(this.V);r.reset();const i=t.length;let h,e=-1;do{let n=r.getNextThreadPc();if(null===n)break;for(++e,h=e>=i?null:t[e];null!==n;){const t=this.G[n];switch(t.op){case 0:null===h?r.accept(n):r.fail(n);break;case 2:{const i=t.func;if(null===i||i(s)){r.fail(n);break}r.step(n,n+1,0);break}case 1:r.step(n,n+1,t.data);break;case 5:if(null===h){r.fail(n);break}if(!(0,t.func)(h,t.data,s)){r.fail(n);break}r.stepToNextGeneration(n,n+1);break;case 3:{const s=t.data,i=s.length;if(0===i){r.fail(n);break}for(let t=0;tB===A}function a(A,B){if(null===A||null===B)throw new Error(\"unescaped hyphen may not be used as a range endpoint\");if(BA<=a&&a<=B}function n(A){return!0}function e(){return!1}function t(A,B){return a=>A(a)||B(a)}function G(A,B){switch(B.kind){case\"predicate\":return void A.test(B.value);case\"regexp\":return void r(A,B.value,!1)}}function i(A,B){B.forEach((B=>{!function(A,B){const[a,{min:n,max:e}]=B;if(null!==e){for(let B=0;B0){for(let B=0;B!0)),A.jump([n]));const t=[];if(B.forEach((B=>{e.data.push(A.program.length),i(A,B),t.push(A.jump([]))})),t.forEach((B=>{B.data.push(A.program.length)})),a){const B=A.program.length,a=A.jump([]);a.data.push(A.program.length),A.test((()=>!0)),A.jump([B]),a.data.push(A.program.length)}}function o(A,B){return{success:!0,offset:A,value:B}}function l(A){return o(A,void 0)}function H(A,B,a=!1){return{success:!1,offset:A,expected:B,fatal:a}}function u(A){return(B,a)=>{const n=a+A.length;return B.slice(a,n)===A?o(n,A):H(a,[A])}}function C(A,B){return(a,n)=>{const e=A(a,n);return e.success?o(e.offset,B(e.value)):e}}function s(A,B,a){return(n,e)=>{const t=A(n,e);return t.success?B(t.value)?t:H(e,a):t.offset===e?H(e,a):t}}function c(A){return(B,a)=>{let n=null;for(const e of A){const A=e(B,a);if(A.success)return A;if(null===n||A.offset>n.offset?n=A:A.offset===n.offset&&(n.expected=n.expected.concat(A.expected)),A.fatal)break}return n||H(a,[])}}function D(A){return(B,a)=>{const n=A(B,a);return n.success||n.fatal?n:o(a,null)}}function m(A){return(B,a)=>{let n=[],e=a;for(;;){const a=A(B,e);if(!a.success){if(a.fatal)return a;break}n.push(a.value),e=a.offset}return o(e,n)}}function h(A,B,a){return(n,e)=>{const t=A(n,e);if(!t.success)return t;const G=B(n,t.offset);return G.success?o(G.offset,a(t.value,G.value)):G}}function I(A){return h(A,m(A),((A,B)=>[A].concat(B)))}function d(A,B){return A}function T(A,B){return B}function p(A,B){return h(A,B,T)}function E(A,B){return h(A,B,d)}function f(A,B,a,n=!1){return p(A,n?F(E(B,a)):E(B,a))}function g(A,B){return(a,n)=>A(a,n).success?H(n,B):l(n)}function F(A){return(B,a)=>{const n=A(B,a);return n.success?n:H(n.offset,n.expected,!0)}}const P=(A,B)=>A.length===B?l(B):H(B,[\"end of input\"]);const M=[\"Lu\",\"Ll\",\"Lt\",\"Lm\",\"Lo\",\"Mn\",\"Mc\",\"Me\",\"Nd\",\"Nl\",\"No\",\"Pc\",\"Pd\",\"Ps\",\"Pe\",\"Pi\",\"Pf\",\"Po\",\"Zs\",\"Zl\",\"Zp\",\"Sm\",\"Sc\",\"Sk\",\"So\",\"Cc\",\"Cf\",\"Co\",\"Cn\"],J={};function S(A){return A.codePointAt(0)}\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\").forEach(((A,B)=>{J[A]=B}));const K=A=>-1===A||-2===A;function b(A){return B=>!K(B)&&!A(B)}function y(A,B){return null===B?A:a=>A(a)&&!B(a)}const Q=function(A,B){const n=new Map;let e=0;return A.forEach(((A,G)=>{const i=B[G];null!==A&&A.split(\"|\").forEach((A=>{const B=n.get(A),G=a(e,e+i-1);n.set(A,B?t(B,G):G)})),e+=i})),n}([\"BasicLatin\",\"Latin-1Supplement\",\"LatinExtended-A\",\"LatinExtended-B\",\"IPAExtensions\",\"SpacingModifierLetters\",\"CombiningDiacriticalMarks\",\"GreekandCoptic|Greek\",\"Cyrillic\",\"CyrillicSupplement\",\"Armenian\",\"Hebrew\",\"Arabic\",\"Syriac\",\"ArabicSupplement\",\"Thaana\",\"NKo\",\"Samaritan\",\"Mandaic\",\"SyriacSupplement\",null,\"ArabicExtended-A\",\"Devanagari\",\"Bengali\",\"Gurmukhi\",\"Gujarati\",\"Oriya\",\"Tamil\",\"Telugu\",\"Kannada\",\"Malayalam\",\"Sinhala\",\"Thai\",\"Lao\",\"Tibetan\",\"Myanmar\",\"Georgian\",\"HangulJamo\",\"Ethiopic\",\"EthiopicSupplement\",\"Cherokee\",\"UnifiedCanadianAboriginalSyllabics\",\"Ogham\",\"Runic\",\"Tagalog\",\"Hanunoo\",\"Buhid\",\"Tagbanwa\",\"Khmer\",\"Mongolian\",\"UnifiedCanadianAboriginalSyllabicsExtended\",\"Limbu\",\"TaiLe\",\"NewTaiLue\",\"KhmerSymbols\",\"Buginese\",\"TaiTham\",\"CombiningDiacriticalMarksExtended\",\"Balinese\",\"Sundanese\",\"Batak\",\"Lepcha\",\"OlChiki\",\"CyrillicExtended-C\",\"GeorgianExtended\",\"SundaneseSupplement\",\"VedicExtensions\",\"PhoneticExtensions\",\"PhoneticExtensionsSupplement\",\"CombiningDiacriticalMarksSupplement\",\"LatinExtendedAdditional\",\"GreekExtended\",\"GeneralPunctuation\",\"SuperscriptsandSubscripts\",\"CurrencySymbols\",\"CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols\",\"LetterlikeSymbols\",\"NumberForms\",\"Arrows\",\"MathematicalOperators\",\"MiscellaneousTechnical\",\"ControlPictures\",\"OpticalCharacterRecognition\",\"EnclosedAlphanumerics\",\"BoxDrawing\",\"BlockElements\",\"GeometricShapes\",\"MiscellaneousSymbols\",\"Dingbats\",\"MiscellaneousMathematicalSymbols-A\",\"SupplementalArrows-A\",\"BraillePatterns\",\"SupplementalArrows-B\",\"MiscellaneousMathematicalSymbols-B\",\"SupplementalMathematicalOperators\",\"MiscellaneousSymbolsandArrows\",\"Glagolitic\",\"LatinExtended-C\",\"Coptic\",\"GeorgianSupplement\",\"Tifinagh\",\"EthiopicExtended\",\"CyrillicExtended-A\",\"SupplementalPunctuation\",\"CJKRadicalsSupplement\",\"KangxiRadicals\",null,\"IdeographicDescriptionCharacters\",\"CJKSymbolsandPunctuation\",\"Hiragana\",\"Katakana\",\"Bopomofo\",\"HangulCompatibilityJamo\",\"Kanbun\",\"BopomofoExtended\",\"CJKStrokes\",\"KatakanaPhoneticExtensions\",\"EnclosedCJKLettersandMonths\",\"CJKCompatibility\",\"CJKUnifiedIdeographsExtensionA\",\"YijingHexagramSymbols\",\"CJKUnifiedIdeographs\",\"YiSyllables\",\"YiRadicals\",\"Lisu\",\"Vai\",\"CyrillicExtended-B\",\"Bamum\",\"ModifierToneLetters\",\"LatinExtended-D\",\"SylotiNagri\",\"CommonIndicNumberForms\",\"Phags-pa\",\"Saurashtra\",\"DevanagariExtended\",\"KayahLi\",\"Rejang\",\"HangulJamoExtended-A\",\"Javanese\",\"MyanmarExtended-B\",\"Cham\",\"MyanmarExtended-A\",\"TaiViet\",\"MeeteiMayekExtensions\",\"EthiopicExtended-A\",\"LatinExtended-E\",\"CherokeeSupplement\",\"MeeteiMayek\",\"HangulSyllables\",\"HangulJamoExtended-B\",\"HighSurrogates\",\"HighPrivateUseSurrogates\",\"LowSurrogates\",\"PrivateUseArea|PrivateUse\",\"CJKCompatibilityIdeographs\",\"AlphabeticPresentationForms\",\"ArabicPresentationForms-A\",\"VariationSelectors\",\"VerticalForms\",\"CombiningHalfMarks\",\"CJKCompatibilityForms\",\"SmallFormVariants\",\"ArabicPresentationForms-B\",\"HalfwidthandFullwidthForms\",\"Specials\",\"LinearBSyllabary\",\"LinearBIdeograms\",\"AegeanNumbers\",\"AncientGreekNumbers\",\"AncientSymbols\",\"PhaistosDisc\",null,\"Lycian\",\"Carian\",\"CopticEpactNumbers\",\"OldItalic\",\"Gothic\",\"OldPermic\",\"Ugaritic\",\"OldPersian\",null,\"Deseret\",\"Shavian\",\"Osmanya\",\"Osage\",\"Elbasan\",\"CaucasianAlbanian\",null,\"LinearA\",null,\"CypriotSyllabary\",\"ImperialAramaic\",\"Palmyrene\",\"Nabataean\",null,\"Hatran\",\"Phoenician\",\"Lydian\",null,\"MeroiticHieroglyphs\",\"MeroiticCursive\",\"Kharoshthi\",\"OldSouthArabian\",\"OldNorthArabian\",null,\"Manichaean\",\"Avestan\",\"InscriptionalParthian\",\"InscriptionalPahlavi\",\"PsalterPahlavi\",null,\"OldTurkic\",null,\"OldHungarian\",\"HanifiRohingya\",null,\"RumiNumeralSymbols\",null,\"OldSogdian\",\"Sogdian\",null,\"Elymaic\",\"Brahmi\",\"Kaithi\",\"SoraSompeng\",\"Chakma\",\"Mahajani\",\"Sharada\",\"SinhalaArchaicNumbers\",\"Khojki\",null,\"Multani\",\"Khudawadi\",\"Grantha\",null,\"Newa\",\"Tirhuta\",null,\"Siddham\",\"Modi\",\"MongolianSupplement\",\"Takri\",null,\"Ahom\",null,\"Dogra\",null,\"WarangCiti\",null,\"Nandinagari\",\"ZanabazarSquare\",\"Soyombo\",null,\"PauCinHau\",null,\"Bhaiksuki\",\"Marchen\",null,\"MasaramGondi\",\"GunjalaGondi\",null,\"Makasar\",null,\"TamilSupplement\",\"Cuneiform\",\"CuneiformNumbersandPunctuation\",\"EarlyDynasticCuneiform\",null,\"EgyptianHieroglyphs\",\"EgyptianHieroglyphFormatControls\",null,\"AnatolianHieroglyphs\",null,\"BamumSupplement\",\"Mro\",null,\"BassaVah\",\"PahawhHmong\",null,\"Medefaidrin\",null,\"Miao\",null,\"IdeographicSymbolsandPunctuation\",\"Tangut\",\"TangutComponents\",null,\"KanaSupplement\",\"KanaExtended-A\",\"SmallKanaExtension\",\"Nushu\",null,\"Duployan\",\"ShorthandFormatControls\",null,\"ByzantineMusicalSymbols\",\"MusicalSymbols\",\"AncientGreekMusicalNotation\",null,\"MayanNumerals\",\"TaiXuanJingSymbols\",\"CountingRodNumerals\",null,\"MathematicalAlphanumericSymbols\",\"SuttonSignWriting\",null,\"GlagoliticSupplement\",null,\"NyiakengPuachueHmong\",null,\"Wancho\",null,\"MendeKikakui\",null,\"Adlam\",null,\"IndicSiyaqNumbers\",null,\"OttomanSiyaqNumbers\",null,\"ArabicMathematicalAlphabeticSymbols\",null,\"MahjongTiles\",\"DominoTiles\",\"PlayingCards\",\"EnclosedAlphanumericSupplement\",\"EnclosedIdeographicSupplement\",\"MiscellaneousSymbolsandPictographs\",\"Emoticons\",\"OrnamentalDingbats\",\"TransportandMapSymbols\",\"AlchemicalSymbols\",\"GeometricShapesExtended\",\"SupplementalArrows-C\",\"SupplementalSymbolsandPictographs\",\"ChessSymbols\",\"SymbolsandPictographsExtended-A\",null,\"CJKUnifiedIdeographsExtensionB\",null,\"CJKUnifiedIdeographsExtensionC\",\"CJKUnifiedIdeographsExtensionD\",\"CJKUnifiedIdeographsExtensionE\",\"CJKUnifiedIdeographsExtensionF\",null,\"CJKCompatibilityIdeographsSupplement\",null,\"Tags\",null,\"VariationSelectorsSupplement\",null,\"SupplementaryPrivateUseArea-A|PrivateUse\",\"SupplementaryPrivateUseArea-B|PrivateUse\"],[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),x=function(A){const n=new Map,G=A.split(\"\"),i=M.map((()=>[]));let r=0,o=0;for(;o{const a=i[B].reduce(t,e);n.set(A,a);const G=A.charAt(0),r=l.get(G)||[];l.set(G,r),r.push(a)})),l.forEach(((A,B)=>{n.set(B,A.reduce(t,e))})),n}(\"bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA\");function L(A){return 32===A||9===A||10===A||13===A}const Z=[B(S(\":\")),a(S(\"A\"),S(\"Z\")),B(S(\"_\")),a(S(\"a\"),S(\"z\")),a(192,214),a(216,246),a(192,214),a(216,246),a(248,767),a(880,893),a(895,8191),a(8204,8205),a(8304,8591),a(11264,12271),a(12289,55295),a(63744,64975),a(65008,65533),a(65536,983039)].reduce(t),X=[Z,B(S(\"-\")),B(S(\".\")),a(S(\"0\"),S(\"9\")),B(183),a(768,879),a(8255,8256)].reduce(t),k=x.get(\"Nd\"),O=b(k),N=y(a(0,1114111),[x.get(\"P\"),x.get(\"Z\"),x.get(\"C\")].reduce(t)),v=b(N);function w(A){return 10!==A&&13!==A&&!K(A)}const Y={s:L,S:b(L),i:Z,I:b(Z),c:X,C:b(X),d:k,D:O,w:N,W:v},U=u(\"*\"),j=u(\"\\\\\"),R=u(\"{\"),V=u(\"}\"),W=u(\"[\"),q=u(\"]\"),$=u(\"^\"),z=u(\"$\"),_=u(\",\"),AA=u(\"-\"),BA=u(\"(\"),aA=u(\")\"),nA=u(\".\"),eA=u(\"|\"),tA=u(\"+\"),GA=u(\"?\"),iA=u(\"-[\"),rA=S(\"0\");function oA(A){function e(A){return new Set(A.split(\"\").map((A=>S(A))))}function G(A,B){const a=A.codePointAt(B);return void 0===a?H(B,[\"any character\"]):o(B+String.fromCodePoint(a).length,a)}const i=\"xpath\"===A.language?p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,z,BA,aA,W,q]),(A=>S(A)))])):p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,BA,aA,W,q]),(A=>S(A)))]));function r(A,B){const a=e(B);return h(u(A),D(s(G,(A=>a.has(A)),B.split(\"\"))),((A,B)=>function(A){const B=x.get(A);if(null==B)throw new Error(`${A} is not a valid unicode category`);return B}(null===B?A:A+String.fromCodePoint(B))))}const l=c([r(\"L\",\"ultmo\"),r(\"M\",\"nce\"),r(\"N\",\"dlo\"),r(\"P\",\"cdseifo\"),r(\"Z\",\"slp\"),r(\"S\",\"mcko\"),r(\"C\",\"cfon\")]),T=[a(S(\"a\"),S(\"z\")),a(S(\"A\"),S(\"Z\")),a(S(\"0\"),S(\"9\")),B(45)].reduce(t),M=c([l,C(p(u(\"Is\"),function(A){return(B,a)=>{const n=A(B,a);return n.success?o(n.offset,B.slice(a,n.offset)):n}}(I(s(G,T,[\"block identifier\"])))),(B=>function(A,B){const a=Q.get(A);if(void 0===a){if(B)return n;throw new Error(`The unicode block identifier \"${A}\" is not known.`)}return a}(B,\"xpath\"!==A.language)))]),J=f(u(\"\\\\p{\"),M,V,!0),K=C(f(u(\"\\\\P{\"),M,V,!0),b),L=p(j,C(c(\"sSiIcCdDwW\".split(\"\").map((A=>u(A)))),(A=>Y[A]))),Z=C(nA,(()=>w)),X=c([L,J,K]),k=e(\"\\\\[]\"),O=c([i,s(G,(A=>!k.has(A)),[\"unescaped character\"])]),N=c([C(AA,(()=>null)),O]),v=h(N,p(AA,N),a);function oA(A,B){return[A].concat(B||[])}const lA=C(function(A){return(B,a)=>{const n=A(B,a);return n.success?o(a,n.value):n}}(c([q,iA])),(()=>null)),HA=S(\"-\"),uA=c([C(E(E(AA,g(W,[\"not [\"])),lA),(()=>HA)),p(g(AA,[\"not -\"]),O)]),CA=c([h(C(uA,B),c([function(A,B){return CA(A,B)},lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);const sA=c([h(C(O,B),c([CA,lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);function cA(A,B){return sA(A,B)}const DA=C(sA,(A=>A.reduce(t))),mA=C(p($,DA),b),hA=h(c([p(g($,[\"not ^\"]),DA),mA]),D(p(AA,(function(A,B){return IA(A,B)}))),y),IA=f(W,hA,q,!0);const dA=\"xpath\"===A.language?c([C(i,B),X,IA,Z,C($,(()=>A=>-1===A)),C(z,(()=>A=>-2===A))]):c([C(i,B),X,IA,Z]),TA=\"xpath\"===A.language?e(\".\\\\?*+{}()|^$[]\"):e(\".\\\\?*+{}()|[]\"),pA=s(G,(A=>!TA.has(A)),[\"NormalChar\"]),EA=C(p(j,h(C(s(G,a(S(\"1\"),S(\"9\")),[\"digit\"]),(A=>A-rA)),m(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),((A,B)=>{B.reduce(((A,B)=>10*A+B),A)}))),(A=>{throw new Error(\"Backreferences in XPath patterns are not yet implemented.\")})),fA=\"xpath\"===A.language?c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,p(D(u(\"?:\")),SA),aA,!0),(A=>({kind:\"regexp\",value:A}))),EA]):c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,SA,aA,!0),(A=>({kind:\"regexp\",value:A})))]),gA=C(I(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),(A=>A.reduce(((A,B)=>10*A+B)))),FA=c([h(gA,p(_,gA),((A,B)=>{if(B({min:A,max:null}))),C(gA,(A=>({min:A,max:A})))]),PA=\"xpath\"===A.language?h(c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),D(GA),((A,B)=>A)):c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),MA=m(h(fA,C(D(PA),(A=>null===A?{min:1,max:1}:A)),((A,B)=>[A,B]))),JA=h(MA,m(p(eA,F(MA))),((A,B)=>[A].concat(B)));function SA(A,B){return JA(A,B)}const KA=function(A){return h(A,P,d)}(JA);return function(A){let B;try{B=KA(A,0)}catch(B){throw new Error(`Error parsing pattern \"${A}\": ${B.message}`)}return B.success?B.value:function(A,B,a){const n=a.map((A=>`\"${A}\"`));throw new Error(`Error parsing pattern \"${A}\" at offset ${B}: expected ${n.length>1?\"one of \"+n.join(\", \"):n[0]} but found \"${A.slice(B,B+1)}\"`)}(A,B.offset,B.expected)}}function lA(A){return[...A].map((A=>A.codePointAt(0)))}function HA(B,a={language:\"xsd\"}){const n=oA(a)(B),e=A((A=>{r(A,n,\"xpath\"===a.language),A.accept()}));return function(A){const B=\"xpath\"===a.language?[-1,...lA(A),-2]:lA(A);return e.execute(B).success}}export{HA as compile};\n//# sourceMappingURL=xspattern.esm.js.map\n","function t(t,n){return{success:!0,offset:t,value:n}}function n(n){return t(n,void 0)}function e(t,n,e=!1){return{success:!1,offset:t,expected:n,fatal:e}}function u(n){return(u,r)=>{const c=r+n.length;return u.slice(r,c)===n?t(c,n):e(r,[n])}}function r(n,e){return(u,r)=>{const c=n(u,r);return c.success?t(c.offset,e(c.value)):c}}function c(t,n,u){return(r,c)=>{const s=t(r,c);return s.success?n(s.value)?s:e(c,u):s.offset===c?e(c,u):s}}function s(t){return(n,u)=>{let r=null;for(const e of t){const t=e(n,u);if(t.success)return t;if(null===r||t.offset>r.offset?r=t:t.offset===r.offset&&(r.expected=r.expected.concat(t.expected)),t.fatal)break}return r||e(u,[])}}function f(n){return(e,u)=>{const r=n(e,u);return r.success||r.fatal?r:t(u,null)}}function o(n){return(e,u)=>{let r=[],c=u;for(;;){const t=n(e,c);if(!t.success){if(t.fatal)return t;break}r.push(t.value),c=t.offset}return t(c,r)}}function i(n,e,u){return(r,c)=>{const s=n(r,c);if(!s.success)return s;const f=e(r,s.offset);return f.success?t(f.offset,u(s.value,f.value)):f}}function l(t){return i(t,o(t),((t,n)=>[t].concat(n)))}function a(t,n){return t}function p(t,n){return n}function v(t,n){return i(t,n,p)}function d(t,n){return i(t,n,a)}function x(t,n,e,u=!1){return v(t,u?k(d(n,e)):d(n,e))}function h(n){return(e,u)=>{const r=n(e,u);return r.success?t(r.offset,e.slice(u,r.offset)):r}}function b(n){return(e,u)=>{const r=n(e,u);return r.success?t(u,r.value):r}}function g(t,u){return(r,c)=>t(r,c).success?e(c,u):n(c)}function k(t){return(n,u)=>{const r=t(n,u);return r.success?r:e(r.offset,r.expected,!0)}}const j=(t,u)=>0===u?n(u):e(u,[\"start of input\"]),m=(t,u)=>t.length===u?n(u):e(u,[\"end of input\"]);function q(t){return i(t,m,a)}export{q as complete,k as cut,x as delimited,m as end,e as error,c as filter,a as first,d as followed,r as map,g as not,n as ok,t as okWithValue,f as optional,s as or,b as peek,l as plus,v as preceded,h as recognize,p as second,o as star,j as start,i as then,u as token};\n//# sourceMappingURL=prsc.esm.js.map\n","import * as xspattern from 'xspattern';\nimport * as prsc from 'prsc';\nconst fontoxpath = (function (xspattern, prsc) {\nconst VERSION='3.25.1';\nconst fontoxpathGlobal = {};\nvar h;function aa(a){var b=0;return function(){return b>>0)+\"_\",e=0;return b});\np(\"Symbol.iterator\",function(a){if(a)return a;a=Symbol(\"Symbol.iterator\");for(var b=\"Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array\".split(\" \"),c=0;cb||1342177279>>=1)c+=c;return d}});\nfunction Fa(a,b){a=void 0!==a?String(a):\" \";return 0=f}});p(\"Array.prototype.fill\",function(a){return a?a:function(b,c,d){var e=this.length||0;0>c&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);cc&&(c=Math.max(c+e,0));cb?-c:c}});p(\"Number.isFinite\",function(a){return a?a:function(b){return\"number\"!==typeof b?!1:!isNaN(b)&&Infinity!==b&&-Infinity!==b}});p(\"String.prototype.padStart\",function(a){return a?a:function(b,c){var d=Da(this,null,\"padStart\");return Fa(c,b-d.length)+d}});\nfunction Ia(a,b){a instanceof String&&(a+=\"\");var c=0,d=!1,e={next:function(){if(!d&&c=e}});\np(\"String.fromCodePoint\",function(a){return a?a:function(b){for(var c=\"\",d=0;de||1114111=e?c+=String.fromCharCode(e):(e-=65536,c+=String.fromCharCode(e>>>10&1023|55296),c+=String.fromCharCode(e&1023|56320))}return c}});\np(\"String.prototype.codePointAt\",function(a){return a?a:function(b){var c=Da(this,null,\"codePointAt\"),d=c.length;b=Number(b)||0;if(0<=b&&be||56319b||57343c.length)return e?1:-1;if(b.lengthc)return e?1:-1;if(bb?e?1:-1:cJa(a,b)}}function Na(){return function(a,b){return 0>Ja(a,b)}}function Oa(){return function(a,b){return-1=a.length?z:B(a[b])}}}h=hb.prototype;h.ob=function(){return this};h.filter=function(a){var b=this,c=-1;return this.s.create({next:function(){for(c++;c=b.h.length?z:B(b.h[c])}})};h.first=function(){return this.h[0]};h.N=function(){return this.h};h.getEffectiveBooleanValue=function(){if(C(this.h[0].type,53))return!0;throw eb();};h.Na=function(){return this.h.length};h.G=function(){return!1};\nh.ya=function(){return!1};h.map=function(a){var b=this,c=-1;return this.s.create({next:function(){return++c>=b.h.length?z:B(a(b.h[c],c,b))}},this.h.length)};h.L=function(a){return a(this.h)};h.$=function(a){return a.multiple?a.multiple(this):a.default(this)};function ib(){this.value={next:function(){return z}}}h=ib.prototype;h.ob=function(){return this};h.filter=function(){return this};h.first=function(){return null};h.N=function(){return[]};h.getEffectiveBooleanValue=function(){return!1};h.Na=function(){return 0};h.G=function(){return!0};h.ya=function(){return!1};h.map=function(){return this};h.L=function(a){return a([])};h.$=function(a){return a.empty?a.empty(this):a.default(this)};function lb(a){var b=a.value;if(C(a.type,53))return!0;if(C(a.type,0))return b;if(C(a.type,1)||C(a.type,20)||C(a.type,19))return 0!==b.length;if(C(a.type,2))return!isNaN(b)&&0!==b;throw eb();};function mb(a,b){var c=this;this.j=E;this.value={next:function(d){if(null!==c.s&&c.h>=c.s)return z;if(void 0!==c.A[c.h])return B(c.A[c.h++]);d=a.next(d);if(d.done)return c.s=c.h,d;if(c.u||2>c.h)c.A[c.h]=d.value;c.h++;return d}};this.u=!1;this.A=[];this.h=0;this.s=void 0===b?null:b}h=mb.prototype;h.ob=function(){return this.j.create(this.N())};h.filter=function(a){var b=this,c=-1,d=this.value;return this.j.create({next:function(e){c++;for(e=d.next(e);!e.done&&!a(e.value,c,b);)c++,e=d.next(0);return e}})};\nh.first=function(){if(void 0!==this.A[0])return this.A[0];var a=this.value.next(0);nb(this);return a.done?null:a.value};h.N=function(){if(this.h>this.A.length&&this.s!==this.A.length)throw Error(\"Implementation error: Sequence Iterator has progressed.\");var a=this.value;this.u=!0;for(var b=a.next(0);!b.done;)b=a.next(0);return this.A};\nh.getEffectiveBooleanValue=function(){var a=this.value,b=this.h;nb(this);var c=a.next(0);if(c.done)return nb(this,b),!1;c=c.value;if(C(c.type,53))return nb(this,b),!0;if(!a.next(0).done)throw eb();nb(this,b);return lb(c)};h.Na=function(a){if(null!==this.s)return this.s;if(void 0===a?0:a)return-1;a=this.h;var b=this.N().length;nb(this,a);return b};h.G=function(){return 0===this.s?!0:null===this.first()};\nh.ya=function(){if(null!==this.s)return 1===this.s;var a=this.value,b=this.h;nb(this);if(a.next(0).done)return nb(this,b),!1;a=a.next(0);nb(this,b);return a.done};h.map=function(a){var b=this,c=0,d=this.value;return this.j.create({next:function(e){e=d.next(e);return e.done?z:B(a(e.value,c++,b))}},this.s)};h.L=function(a,b){var c=this.value,d,e=[],f=!0;(function(){for(var g=c.next(f?0:b);!g.done;g=c.next(b))f=!1,e.push(g.value);d=a(e).value})();return this.j.create({next:function(){return d.next(0)}})};\nh.$=function(a){function b(e){d=e.value;e=e.Na(!0);-1!==e&&(c.s=e)}var c=this,d=null;return this.j.create({next:function(e){if(d)return d.next(e);if(c.G())return b(a.empty?a.empty(c):a.default(c)),d.next(e);if(c.ya())return b(a.o?a.o(c):a.default(c)),d.next(e);b(a.multiple?a.multiple(c):a.default(c));return d.next(e)}})};function nb(a,b){a.h=void 0===b?0:b};function ob(a){this.A=E;this.h=a;var b=!1;this.value={next:function(){if(b)return z;b=!0;return B(a)}};this.s=null}h=ob.prototype;h.ob=function(){return this};h.filter=function(a){return a(this.h,0,this)?this:this.A.create()};h.first=function(){return this.h};h.N=function(){return[this.h]};h.getEffectiveBooleanValue=function(){null===this.s&&(this.s=lb(this.h));return this.s};h.Na=function(){return 1};h.G=function(){return!1};h.ya=function(){return!0};\nh.map=function(a){return this.A.create(a(this.h,0,this))};h.L=function(a){return a([this.h])};h.$=function(a){return a.o?a.o(this):a.default(this)};var pb=new ib;function qb(a,b){a=void 0===a?null:a;if(null===a)return pb;if(Array.isArray(a))switch(a.length){case 0:return pb;case 1:return new ob(a[0]);default:return new hb(a)}return a.next?new mb(a,void 0===b?null:b):new ob(a)}var E={create:qb,o:function(a){return new ob(a)},empty:function(){return qb()},ca:function(){return qb(cb)},X:function(){return qb(db)}};function rb(a){var b=[],c=a.value;return function(){var d=0;return E.create({next:function(){if(void 0!==b[d])return b[d++];var e=c.next(0);return e.done?e:b[d++]=e}})}};function sb(a,b){this.type=a;this.value=b}\nvar F={},tb=(F[0]=\"xs:boolean\",F[1]=\"xs:string\",F[2]=\"xs:numeric\",F[3]=\"xs:double\",F[4]=\"xs:decimal\",F[5]=\"xs:integer\",F[6]=\"xs:float\",F[7]=\"xs:date\",F[8]=\"xs:time\",F[9]=\"xs:dateTime\",F[10]=\"xs:dateTimeStamp\",F[11]=\"xs:gYearMonth\",F[12]=\"xs:gYear\",F[13]=\"xs:gMonthDay\",F[14]=\"xs:gMonth\",F[15]=\"xs:gDay\",F[16]=\"xs:yearMonthDuration\",F[17]=\"xs:dayTimeDuration\",F[18]=\"xs:duration\",F[19]=\"xs:untypedAtomic\",F[20]=\"xs:anyURI\",F[21]=\"xs:base64Binary\",F[22]=\"xs:hexBinary\",F[23]=\"xs:QName\",F[24]=\"xs:NCName\",\nF[25]=\"xs:Name\",F[26]=\"xs:ENTITY\",F[27]=\"xs:nonPositiveInteger\",F[28]=\"xs:negativeInteger\",F[29]=\"xs:positiveInteger\",F[30]=\"xs:nonNegativeInteger\",F[31]=\"xs:long\",F[32]=\"xs:int\",F[33]=\"xs:short\",F[34]=\"xs:byte\",F[35]=\"xs:unsignedInt\",F[36]=\"xs:unsignedLong\",F[37]=\"xs:unsignedByte\",F[38]=\"xs:unsignedShort\",F[39]=\"xs:error\",F[40]=\"xs:ENTITIES\",F[41]=\"xs:IDREF\",F[42]=\"xs:ID\",F[43]=\"xs:IDREFS\",F[44]=\"xs:NOTATION\",F[45]=\"xs:anySimpleType\",F[46]=\"xs:anyAtomicType\",F[47]=\"attribute()\",F[48]=\"xs:normalizedString\",\nF[49]=\"xs:NMTOKENS\",F[50]=\"xs:NMTOKEN\",F[51]=\"xs:language\",F[52]=\"xs:token\",F[53]=\"node()\",F[54]=\"element()\",F[55]=\"document-node()\",F[56]=\"text()\",F[57]=\"processing-instruction()\",F[58]=\"comment()\",F[59]=\"item()\",F[60]=\"function(*)\",F[61]=\"map(*)\",F[62]=\"array(*)\",F[63]=\"none\",F),ub={\"xs:boolean\":0,\"xs:string\":1,\"xs:numeric\":2,\"xs:double\":3,\"xs:decimal\":4,\"xs:integer\":5,\"xs:float\":6,\"xs:date\":7,\"xs:time\":8,\"xs:dateTime\":9,\"xs:dateTimeStamp\":10,\"xs:gYearMonth\":11,\"xs:gYear\":12,\"xs:gMonthDay\":13,\"xs:gMonth\":14,\n\"xs:gDay\":15,\"xs:yearMonthDuration\":16,\"xs:dayTimeDuration\":17,\"xs:duration\":18,\"xs:untypedAtomic\":19,\"xs:anyURI\":20,\"xs:base64Binary\":21,\"xs:hexBinary\":22,\"xs:QName\":23,\"xs:NCName\":24,\"xs:Name\":25,\"xs:ENTITY\":26,\"xs:nonPositiveInteger\":27,\"xs:negativeInteger\":28,\"xs:positiveInteger\":29,\"xs:nonNegativeInteger\":30,\"xs:long\":31,\"xs:int\":32,\"xs:short\":33,\"xs:byte\":34,\"xs:unsignedInt\":35,\"xs:unsignedLong\":36,\"xs:unsignedByte\":37,\"xs:unsignedShort\":38,\"xs:error\":39,\"xs:ENTITIES\":40,\"xs:IDREF\":41,\"xs:ID\":42,\n\"xs:IDREFS\":43,\"xs:NOTATION\":44,\"xs:anySimpleType\":45,\"xs:anyAtomicType\":46,\"attribute()\":47,\"xs:normalizedString\":48,\"xs:NMTOKENS\":49,\"xs:NMTOKEN\":50,\"xs:language\":51,\"xs:token\":52,\"node()\":53,\"element()\":54,\"document-node()\":55,\"text()\":56,\"processing-instruction()\":57,\"comment()\":58,\"item()\":59,\"function(*)\":60,\"map(*)\":61,\"array(*)\":62};function vb(a){return 2===a.g?tb[a.type]+\"*\":1===a.g?tb[a.type]+\"+\":0===a.g?tb[a.type]+\"?\":tb[a.type]}\nfunction wb(a){if(\"none\"===a)throw Error('XPST0051: The type \"none\" could not be found');if(!a.startsWith(\"xs:\")&&0<=a.indexOf(\":\"))throw Error(\"XPST0081: Invalid prefix for input \"+a);var b=ub[a];if(void 0===b)throw Error('XPST0051: The type \"'+a+'\" could not be found');return b}\nfunction xb(a){switch(a[a.length-1]){case \"*\":return{type:wb(a.substr(0,a.length-1)),g:2};case \"?\":return{type:wb(a.substr(0,a.length-1)),g:0};case \"+\":return{type:wb(a.substr(0,a.length-1)),g:1};default:return{type:wb(a),g:3}}}function yb(a){switch(a){case \"*\":return 2;case \"?\":return 0;case \"+\":return 1;default:return 3}};function Ab(a,b,c){this.namespaceURI=b||null;this.prefix=a||\"\";this.localName=c}Ab.prototype.va=function(){return this.prefix?this.prefix+\":\"+this.localName:this.localName};function Bb(a){var b=a.l,c=a.arity,d=void 0===a.Pa?!1:a.Pa,e=void 0===a.I?!1:a.I,f=a.localName,g=a.namespaceURI,k=a.i;a=a.value;sb.call(this,60,null);this.value=a;this.I=e;e=-1;for(a=0;a=l||l>k.R.length)throw Error(\"FOAY0001: array position out of bounds.\");return k.R[l-1]()})})};function Xb(a){Bb.call(this,{value:function(c,d,e,f){return Wb(c,d,e,E.o(b),f)},localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",l:[{type:5,g:3}],arity:1,i:{type:59,g:2}});var b=this;this.type=62;this.R=a}x(Xb,Bb);function Yb(a){switch(a.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function Zb(a){return{type:Yb(a),value:a}};function $b(a,b){a=a.map(function(c){return c.first()});return b(a)};function ac(a,b){var c=C(a.type,1)||C(a.type,20)||C(a.type,19),d=C(b.type,1)||C(b.type,20)||C(b.type,19);if(c&&d)return a.value===b.value;c=C(a.type,4)||C(a.type,3)||C(a.type,6);d=C(b.type,4)||C(b.type,3)||C(b.type,6);if(c&&d)return isNaN(a.value)&&isNaN(b.value)?!0:a.value===b.value;c=C(a.type,0)||C(a.type,22)||C(a.type,18)||C(a.type,23)||C(a.type,44);d=C(b.type,0)||C(b.type,22)||C(b.type,18)||C(b.type,23)||C(b.type,44);return c&&d?a.value===b.value:!1};function bc(a,b,c,d,e){return $b([d,e],function(f){f=t(f);var g=f.next().value,k=f.next().value;return(f=g.h.find(function(l){return ac(l.key,k)}))?f.value():E.empty()})};function cc(a){Bb.call(this,{l:[{type:59,g:3}],arity:1,localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",value:function(c,d,e,f){return bc(c,d,e,E.o(b),f)},i:{type:59,g:2}});var b=this;this.type=61;this.h=a}x(cc,Bb);function dc(){}function ec(a,b){return a.ab()===b.ab()&&a.bb()===b.bb()}h=dc.prototype;h.Za=function(){return 0};h.getHours=function(){return 0};h.getMinutes=function(){return 0};h.$a=function(){return 0};h.ab=function(){return 0};h.bb=function(){return 0};h.getSeconds=function(){return 0};h.cb=function(){return 0};h.oa=function(){return!0};function fc(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while multiplying xs:dayTimeDuration\");return new fc(aa||273860b.pa?1:-1:d>c?1:-1}function vc(a,b,c){return 0===uc(a,b,c)}function xc(a,b,c){a=(sc(a,c).getTime()-sc(b,c).getTime())/1E3;return new fc(a)}\nfunction yc(a){throw Error(\"Not implemented: adding durations to \"+tb[a.type]);}function zc(a){throw Error(\"Not implemented: subtracting durations from \"+tb[a.type]);};function Ac(a,b){if(null===a)return null;switch(typeof a){case \"boolean\":return a?cb:db;case \"number\":return y(a,3);case \"string\":return y(a,1);case \"object\":return\"nodeType\"in a?Zb({node:a,F:null}):Array.isArray(a)?new Xb(a.map(function(c){if(void 0===c)return function(){return E.empty()};c=Ac(c,b);c=null===c?E.empty():E.o(c);return rb(c)})):new cc(Object.keys(a).filter(function(c){return void 0!==a[c]}).map(function(c){var d=Ac(a[c],b);d=null===d?E.empty():E.o(d);return{key:y(c,1),value:rb(d)}}))}throw Error(\"Value \"+\nString(a)+' of type \"'+typeof a+'\" is not adaptable to an XPath value.');}function Bc(a,b){if(\"number\"!==typeof a&&(\"string\"!==typeof a||!$a.get(b)(a)))throw Error(\"Cannot convert JavaScript value '\"+a+\"' to the XPath type \"+tb[b]+\" since it is not valid.\");}\nfunction Cc(a,b,c){if(null===b)return null;switch(a){case 0:return b?cb:db;case 1:return y(b+\"\",1);case 3:case 2:return Bc(b,3),y(+b,3);case 4:return Bc(b,a),y(+b,4);case 5:return Bc(b,a),y(b|0,5);case 6:return Bc(b,a),y(+b,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(b instanceof Date))throw Error(\"The JavaScript value \"+b+\" with type \"+typeof b+\" is not a valid type to be converted to an XPath \"+tb[a]+\".\");return y(rc(tc(b.toISOString()),a),a);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if(\"object\"!==\ntypeof b||!(\"nodeType\"in b))throw Error(\"The JavaScript value \"+b+\" with type \"+typeof b+\" is not a valid type to be converted to an XPath \"+tb[a]+\".\");return Zb({node:b,F:null});case 59:return Ac(b,c);default:throw Error('Values of the type \"'+a+'\" can not be adapted to equivalent XPath values.');}}\nfunction Dc(a,b,c){if(0===c.g)return b=Cc(c.type,b,a),null===b?[]:[b];if(2===c.g||1===c.g){if(!Array.isArray(b))throw Error(\"The JavaScript value \"+b+\" should be an array if it is to be converted to \"+vb(c)+\".\");return b.map(function(e){return Cc(c.type,e,a)}).filter(function(e){return null!==e})}var d=Cc(c.type,b,a);if(null===d)throw Error(\"The JavaScript value \"+b+\" should be a single entry if it is to be converted to \"+vb(c)+\".\");return[d]}\nfunction Ec(a,b,c){c=void 0===c?{type:59,g:0}:c;return E.create(Dc(a,b,c))};function Fc(a,b){this.h=b=void 0===b?{vb:null,Ab:null,pb:!1}:b;this.Ja=a.Ja;this.Ga=a.Ga;this.M=a.M;this.Ea=a.Ea||Object.create(null)}function Gc(a,b){var c=0,d=b.value;return{next:function(e){e=d.next(e);return e.done?z:B(Hc(a,c++,e.value,b))}}}function Ic(a){a.h.pb||(a.h.pb=!0,a.h.vb=tc((new Date).toISOString()),a.h.Ab=ic(\"PT0S\"));return a.h.vb}function Jc(a){a.h.pb||(a.h.pb=!0,a.h.vb=tc((new Date).toISOString()),a.h.Ab=ic(\"PT0S\"));return a.h.Ab}\nfunction Hc(a,b,c,d){return new Fc({M:c,Ja:b,Ga:d||a.Ga,Ea:a.Ea},a.h)}function Kc(a,b){return new Fc({M:a.M,Ja:a.Ja,Ga:a.Ga,Ea:Object.assign(Object.create(null),a.Ea,b)},a.h)};function Lc(a,b,c,d,e,f,g,k){var l=new Map;this.debug=a;this.Ha=b;this.h=c;this.s=d;this.A=e;this.u=f;this.ha=l;this.O=g;this.j=k};function Mc(a){var b=0,c=null,d=!0;return E.create({next:function(e){for(;bNumber.MAX_VALUE?{v:!1,error:Error(\"FOAR0002: Can not cast \"+b+\" to xs:decimal, it is out of bounds for JavaScript numbers\")}:{v:!0,value:y(b,4)}}:a(0)?function(b){return{v:!0,value:y(b?1:0,4)}}:a(1)||a(19)?function(b){var c=parseFloat(b);return!isNaN(c)||isFinite(c)?{v:!0,value:y(c,4)}:{v:!1,error:Error(\"FORG0001: Can not cast \"+\nb+\" to xs:decimal\")}}:function(){return{v:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.\")}}};function hd(a,b){return a(2)?function(c){return{v:!0,value:c}}:a(0)?function(c){return{v:!0,value:c?1:0}}:a(1)||a(19)?function(c){switch(c){case \"NaN\":return{v:!0,value:NaN};case \"INF\":case \"+INF\":return{v:!0,value:Infinity};case \"-INF\":return{v:!0,value:-Infinity};case \"0\":case \"+0\":return{v:!0,value:0};case \"-0\":return{v:!0,value:-0}}var d=parseFloat(c);return isNaN(d)?{v:!1,error:Nc(c,b)}:{v:!0,value:d}}:function(){return{v:!1,error:Error(\"XPTY0004: Casting not supported from given type to \"+b+\n\" or any of its derived types.\")}}};function id(a){var b=hd(a,3);return function(c){c=b(c);return c.v?{v:!0,value:y(c.value,3)}:c}};function jd(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(b))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");a=new jd(a||0===b?b:-b)}else a=null;return a}\nfunction md(a,b){if(isNaN(b))throw Error(\"FOCA0005: Cannot multiply xs:yearMonthDuration by NaN\");a=Math.round(a.ga*b);if(a>Number.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");return new jd(ab?\"-\":\"\")+\"INF\"}}}return a(9)||a(7)||a(8)||a(15)||a(14)||a(13)||a(12)||a(11)?function(b){return{v:!0,value:b.toString()}}:a(16)?function(b){return{v:!0,value:b.toString()}}:a(17)?function(b){return{v:!0,value:b.toString()}}:a(18)?function(b){return{v:!0,value:b.toString()}}:a(22)?function(b){return{v:!0,value:b.toUpperCase()}}:function(b){return{v:!0,value:b+\"\"}}};function Cd(a){var b=Bd(a);return function(c){c=b(c);return c.v?{v:!0,value:y(c.value,1)}:c}};function Dd(a){return a(9)?function(b){return{v:!0,value:y(rc(b,8),8)}}:a(19)||a(1)?function(b){return{v:!0,value:y(tc(b),8)}}:function(){return{v:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:time or any of its derived types.\")}}};function Ed(a){var b=Bd(a);return function(c){c=b(c);return c.v?{v:!0,value:y(c.value,19)}:c}};function Fd(a){return a(18)&&!a(17)?function(b){return{v:!0,value:y(b.Sa,16)}}:a(17)?function(){return{v:!0,value:y(ld(\"P0M\"),16)}}:a(19)||a(1)?function(b){var c=ld(b);return c?{v:!0,value:y(c,16)}:{v:!1,error:Nc(b,16)}}:function(){return{v:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.\")}}};var Gd=[2,5,17,16];\nfunction Ad(a,b){function c(d){return C(a,d)}if(39===b)return function(){return{v:!1,error:Error(\"FORG0001: Casting to xs:error is always invalid.\")}};switch(b){case 19:return Ed(c);case 1:return Cd(c);case 6:return pd(c);case 3:return id(c);case 4:return gd(c);case 5:return xd(c);case 2:return zd(a);case 18:return od(c);case 16:return Fd(c);case 17:return fd(c);case 9:return ed(c);case 8:return Dd(c);case 7:return dd(c);case 11:return vd(c);case 12:return ud(c);case 13:return td(c);case 15:return qd(c);\ncase 14:return rd(c);case 0:return cd(c);case 21:return bd(c);case 22:return wd(c);case 20:return ad(c);case 23:throw Error(\"Casting to xs:QName is not implemented.\");}return function(){return{v:!1,error:Error(\"XPTY0004: Casting not supported from \"+a+\" to \"+b+\".\")}}}var Hd=Object.create(null);\nfunction Id(a,b){if(19===a&&1===b)return function(f){return{v:!0,value:y(f,1)}};if(44===b)return function(){return{v:!1,error:Error(\"XPST0080: Casting to xs:NOTATION is not permitted.\")}};if(39===b)return function(){return{v:!1,error:Error(\"FORG0001: Casting to xs:error is not permitted.\")}};if(45===a||45===b)return function(){return{v:!1,error:Error(\"XPST0080: Casting from or to xs:anySimpleType is not permitted.\")}};if(46===a||46===b)return function(){return{v:!1,error:Error(\"XPST0080: Casting from or to xs:anyAtomicType is not permitted.\")}};\nif(C(a,60)&&1===b)return function(){return{v:!1,error:Error(\"FOTY0014: Casting from function item to xs:string is not permitted.\")}};if(a===b)return function(f){return{v:!0,value:{type:b,value:f}}};var c=Gd.includes(a)?a:Wc(a),d=Gd.includes(b)?b:Wc(b);if(null===d||null===c)return function(){return{v:!1,error:Error(\"XPST0081: Can not cast: type \"+(d?tb[a]:tb[b])+\" is unknown.\")}};var e=[];1!==c&&19!==c||e.push(function(f){var g=Xc(f,b);return Yc(g,b)?{v:!0,value:g}:{v:!1,error:Nc(f,b,\"pattern validation failed.\")}});\nc!==d&&(e.push(Ad(c,d)),e.push(function(f){return{v:!0,value:f.value}}));19!==d&&1!==d||e.push(function(f){return Yc(f,b)?{v:!0,value:f}:{v:!1,error:Nc(f,b,\"pattern validation failed.\")}});e.push(function(f){return $c(f,b)?{v:!0,value:f}:{v:!1,error:Nc(f,b,\"pattern validation failed.\")}});e.push(function(f){return{v:!0,value:{type:b,value:f}}});return function(f){f={v:!0,value:f};for(var g=0,k=e.length;gd.value.node.localName?1:-1;c=Ub(b,c.value);d=Ub(b,d.value)}else c=c.value,d=d.value;return Rd(a,b,c,d)}function Td(a,b,c){return Sd(a.s,a,b,c)}\nfunction Ud(a,b){return Vd(b,function(c,d){return Sd(a.s,a,c,d)}).filter(function(c,d,e){return 0===d?!0:!Nd(c.value,e[d-1].value)})}function Wd(a,b){return a=a.length)return a;var c=Math.floor(a.length/2),d=Vd(a.slice(0,c),b);a=Vd(a.slice(c),b);for(c=[];d.length&&a.length;)0>b(d[0],a[0])?c.push(d.shift()):c.push(a.shift());return c.concat(d.concat(a))};var Xd=xspattern;function Yd(a,b){if(C(a.type,2)){if(C(a.type,6))return 3===b?y(a.value,3):null;if(C(a.type,4)){if(6===b)return y(a.value,6);if(3===b)return y(a.value,3)}return null}return C(a.type,20)&&1===b?y(a.value,1):null};function Zd(a,b,c,d,e){if(C(a.type,b.type))return a;C(b.type,46)&&C(a.type,53)&&(a=Uc(a,c).first());if(C(a.type,b.type)||46===b.type)return a;if(C(a.type,19)){c=Kd(a,b.type);if(!c)throw Error(\"XPTY0004 Unable to convert \"+(e?\"return\":\"argument\")+\" of type \"+tb[a.type]+\" to type \"+vb(b)+\" while calling \"+d);return c}c=Yd(a,b.type);if(!c)throw Error(\"XPTY0004 Unable to cast \"+(e?\"return\":\"argument\")+\" of type \"+tb[a.type]+\" to type \"+vb(b)+\" while calling \"+d);return c}\nfunction $d(a){switch(a){case 2:return\"*\";case 1:return\"+\";case 0:return\"?\";case 3:return\"\"}}\nfunction ae(a,b,c,d,e){return 0===a.g?b.$({default:function(){return b.map(function(f){return Zd(f,a,c,d,e)})},multiple:function(){throw Error(\"XPTY0004: Multiplicity of \"+(e?\"function return value\":\"function argument\")+\" of type \"+tb[a.type]+$d(a.g)+\" for \"+d+' is incorrect. Expected \"?\", but got \"+\".');}}):1===a.g?b.$({empty:function(){throw Error(\"XPTY0004: Multiplicity of \"+(e?\"function return value\":\"function argument\")+\" of type \"+tb[a.type]+$d(a.g)+\" for \"+d+' is incorrect. Expected \"+\", but got \"empty-sequence()\"');\n},default:function(){return b.map(function(f){return Zd(f,a,c,d,e)})}}):2===a.g?b.map(function(f){return Zd(f,a,c,d,e)}):b.$({o:function(){return b.map(function(f){return Zd(f,a,c,d,e)})},default:function(){throw Error(\"XPTY0004: Multiplicity of \"+(e?\"function return value\":\"function argument\")+\" of type \"+tb[a.type]+$d(a.g)+\" for \"+d+\" is incorrect. Expected exactly one\");}})};function be(a,b){return C(a,5)?y(b,5):C(a,6)?y(b,6):C(a,3)?y(b,3):y(b,4)}function ce(a){if(Math.floor(a)===a||isNaN(a))return 0;a=/\\d+(?:\\.(\\d*))?(?:[Ee](-)?(\\d+))*/.exec(a+\"\");var b=a[1]?a[1].length:0;if(a[3]){if(a[2])return b+parseInt(a[3],10);a=b-parseInt(a[3],10);return 0>a?0:a}return b}function de(a,b,c){return b&&0===a*c%1%.5?0===Math.floor(a*c)%2?Math.floor(a*c)/c:Math.ceil(a*c)/c:Math.round(a*c)/c}\nfunction ee(a,b,c,d,e,f){var g=!1;return E.create({next:function(){if(g)return z;var k=e.first();if(!k)return g=!0,z;if((C(k.type,6)||C(k.type,3))&&(0===k.value||isNaN(k.value)||Infinity===k.value||-Infinity===k.value))return g=!0,B(k);var l;f?l=f.first().value:l=0;g=!0;if(ce(k.value)e?E.o(y(1,5)):a=f||57344<=f&&65533>=f||65536<=\nf&&1114111>=f)return String.fromCodePoint(f);throw Error(\"FOCH0001\");}).join(\"\");return E.o(y(e,1))})},localName:\"codepoints-to-string\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,b,c,d){return $b([d],function(e){e=(e=t(e).next().value)?e.value.split(\"\"):[];return 0===e.length?E.empty():E.create(e.map(function(f){return y(f.codePointAt(0),5)}))})},localName:\"string-to-codepoints\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:5,\ng:2}},{l:[{type:1,g:0}],m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;return null===e||0===e.value.length?E.create(y(\"\",1)):E.create(y(encodeURIComponent(e.value).replace(/[!'()*]/g,function(f){return\"%\"+f.charCodeAt(0).toString(16).toUpperCase()}),1))})},localName:\"encode-for-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;return null===e||0===e.value.length?E.create(y(\"\",\n1)):E.create(y(e.value.replace(/([\\u00A0-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFEF \"<>{}|\\\\^`/\\n\\u007f\\u0080-\\u009f]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g,function(f){return encodeURI(f)}),1))})},localName:\"iri-to-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(a,b,c,d,e){return $b([d,e],function(f){var g=t(f);f=g.next().value;g=g.next().value;if(null===f||null===g)return E.empty();f=f.value;g=g.value;if(f.length!==g.length)return E.X();f=f.split(\"\");\ng=g.split(\"\");for(var k=0;kq.node.nodeName?1:-1}).map(function(n){return Zb(n)});e=Nb(b.h,e.value).filter(function(n){return\"http://www.w3.org/2000/xmlns/\"!==n.node.namespaceURI}).sort(function(n,q){return n.node.nodeName>q.node.nodeName?1:-1}).map(function(n){return Zb(n)});var k=Le(a,b,c,E.create(d),\nE.create(e)),l=!1;return{next:function(){if(l)return z;var n=f.next(0);if(!n.done&&!1===n.value)return l=!0,n;n=k.next(0);if(!n.done&&!1===n.value)return l=!0,n;n=g.next(0);l=!0;return n}}}function Se(a,b,c,d,e){var f=Le(a,b,c,we(a,b,c,E.o(d)),we(a,b,c,E.o(e))),g=!1;return{next:function(){if(g)return z;var k=f.next(0);return k.done||!1!==k.value?B(Ie(Uc(d,b).first(),Uc(e,b).first())):(g=!0,k)}}}\nfunction Me(a,b,c,d,e){if(C(d.type,46)&&C(e.type,46))return Ld(Ie(d,e));if(C(d.type,61)&&C(e.type,61))return Ne(a,b,c,d,e);if(C(d.type,62)&&C(e.type,62))return Pe(a,b,c,d,e);if(C(d.type,53)&&C(e.type,53)){if(C(d.type,55)&&C(e.type,55))return Qe(a,b,c,d,e);if(C(d.type,54)&&C(e.type,54))return Re(a,b,c,d,e);if(C(d.type,47)&&C(e.type,47)||C(d.type,57)&&C(e.type,57)||C(d.type,58)&&C(e.type,58))return Se(a,b,c,d,e)}return Ld(!1)};function Te(a){return Error(\"XUST0001: \"+(void 0===a?\"Can not execute an updating expression in a non-updating context.\":a))}function Ue(a){return Error(\"XUTY0004: The attribute \"+a.name+'=\"'+a.value+'\" follows a node that is not an attribute node.')}function Ve(){return Error(\"XUTY0005: The target of a insert expression with into must be a single element or document node.\")}\nfunction We(){return Error(\"XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.\")}function Xe(){return Error(\"XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.\")}function Ye(){return Error(\"XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.\")}\nfunction Ze(a){return Error(\"XUDY0017: The target \"+a.outerHTML+\" is used in more than one replace value of expression.\")}function $e(a){return Error(\"XUDY0021: Applying the updates will result in the XDM instance violating constraint: '\"+a+\"'\")}function af(a){return Error(\"XUDY0023: The namespace binding \"+a+\" is conflicting.\")}function bf(a){return Error(\"XUDY0024: The namespace binding \"+a+\" is conflicting.\")}\nfunction cf(){return Error(\"XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.\")};function I(a,b,c,d,e){c=void 0===c?{C:!1,Y:!1,S:\"unsorted\",subtree:!1}:c;this.s=a;this.O=c.S||\"unsorted\";this.subtree=!!c.subtree;this.Y=!!c.Y;this.C=!!c.C;this.ha=b;this.I=!1;this.Ya=null;this.bc=void 0===d?!1:d;this.type=e}function J(a,b,c){b&&null!==b.M?a.C?(null===a.Ya&&(a.Ya=rb(a.h(null,c).ob())),a=a.Ya()):a=a.h(b,c):a=a.h(b,c);return a}I.prototype.A=function(){return null};\nI.prototype.P=function(a){this.ha.forEach(function(b){return b.P(a)});if(!this.bc&&this.ha.some(function(b){return b.I}))throw Te();};function df(a,b){this.H=a;this.fa=b};function ef(a){a&&\"object\"===typeof a&&\"nodeType\"in a&&(a=a.ownerDocument||a,\"function\"===typeof a.createElementNS&&\"function\"===typeof a.createProcessingInstruction&&\"function\"===typeof a.createTextNode&&\"function\"===typeof a.createComment&&(this.h=a));this.h||(this.h=null)}h=ef.prototype;h.createAttributeNS=function(a,b){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createAttributeNS(a,b)};\nh.createCDATASection=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createCDATASection(a)};h.createComment=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createComment(a)};h.createDocument=function(){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.implementation.createDocument(null,null,null)};\nh.createElementNS=function(a,b){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createElementNS(a,b)};h.createProcessingInstruction=function(a,b){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createProcessingInstruction(a,b)};h.createTextNode=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createTextNode(a)};function ff(a,b,c,d){var e=Ub(c,a).node,f=(a=Tb(c,a))?a.node:null;b.forEach(function(g){d.insertBefore(e,g.node,f)})}function gf(a,b,c,d){var e=Ub(c,a).node;b.forEach(function(f){d.insertBefore(e,f.node,a.node)})}function hf(a,b,c,d){var e=(c=Rb(c,a))?c.node:null;b.forEach(function(f){d.insertBefore(a.node,f.node,e)})}function jf(a,b,c){b.forEach(function(d){c.insertBefore(a.node,d.node,null)})}\nfunction kf(a,b,c,d){b.forEach(function(e){var f=e.node.nodeName;if(Ob(c,a,f))throw $e(\"An attribute \"+f+\" already exists.\");d.setAttributeNS(a.node,e.node.namespaceURI,f,Qb(c,e))})}\nfunction lf(a,b,c,d,e){d||(d=new ef(a?a.node:null));switch(a.node.nodeType){case 1:var f=c.getAllAttributes(a.node),g=c.getChildNodes(a.node),k=d.createElementNS(b.namespaceURI,b.va());var l={node:k,F:null};f.forEach(function(n){e.setAttributeNS(k,n.namespaceURI,n.nodeName,n.value)});g.forEach(function(n){e.insertBefore(k,n,null)});break;case 2:b=d.createAttributeNS(b.namespaceURI,b.va());b.value=Qb(c,a);l={node:b,F:null};break;case 7:l={node:d.createProcessingInstruction(b.va(),Qb(c,a)),F:null}}if(!Ub(c,\na))throw Error(\"Not supported: renaming detached nodes.\");mf(a,[l],c,e)}function nf(a,b,c,d){c.getChildNodes(a.node).forEach(function(e){return d.removeChild(a.node,e)});b&&d.insertBefore(a.node,b.node,null)}\nfunction mf(a,b,c,d){var e=Ub(c,a),f=a.node.nodeType;if(2===f){if(b.some(function(l){return 2!==l.node.nodeType}))throw Error('Constraint \"If $target is an attribute node, $replacement must consist of zero or more attribute nodes.\" failed.');var g=e?e.node:null;d.removeAttributeNS(g,a.node.namespaceURI,a.node.nodeName);b.forEach(function(l){var n=l.node.nodeName;if(Ob(c,e,n))throw $e(\"An attribute \"+n+\" already exists.\");d.setAttributeNS(g,l.node.namespaceURI,n,Qb(c,l))})}if(1===f||3===f||8===f||\n7===f){var k=(f=Tb(c,a))?f.node:null;d.removeChild(e.node,a.node);b.forEach(function(l){d.insertBefore(e.node,l.node,k)})}};function of(a,b,c,d){pf(a,b);a.filter(function(e){return-1!==[\"insertInto\",\"insertAttributes\",\"replaceValue\",\"rename\"].indexOf(e.type)}).forEach(function(e){switch(e.type){case \"insertInto\":jf(e.target,e.content,d);break;case \"insertAttributes\":kf(e.target,e.content,b,d);break;case \"rename\":lf(e.target,e.s,b,c,d);break;case \"replaceValue\":var f=e.target;e=e.s;if(2===f.node.nodeType){var g=Ub(b,f);g?d.setAttributeNS(g.node,f.node.namespaceURI,f.node.nodeName,e):f.node.value=e}else d.setData(f.node,\ne)}});a.filter(function(e){return-1!==[\"insertBefore\",\"insertAfter\",\"insertIntoAsFirst\",\"insertIntoAsLast\"].indexOf(e.type)}).forEach(function(e){switch(e.type){case \"insertAfter\":ff(e.target,e.content,b,d);break;case \"insertBefore\":gf(e.target,e.content,b,d);break;case \"insertIntoAsFirst\":hf(e.target,e.content,b,d);break;case \"insertIntoAsLast\":jf(e.target,e.content,d)}});a.filter(function(e){return\"replaceNode\"===e.type}).forEach(function(e){mf(e.target,e.s,b,d)});a.filter(function(e){return\"replaceElementContent\"===\ne.type}).forEach(function(e){nf(e.target,e.text,b,d)});a.filter(function(e){return\"delete\"===e.type}).forEach(function(e){e=e.target;var f=Ub(b,e);(f=f?f.node:null)&&(2===e.node.nodeType?d.removeAttributeNS(f,e.node.namespaceURI,e.node.nodeName):d.removeChild(f,e.node))});if(a.some(function(e){return\"put\"===e.type}))throw Error('Not implemented: the execution for pendingUpdate \"put\" is not yet implemented.');}\nfunction pf(a,b){function c(f){return new Ab(f.node.prefix,f.node.namespaceURI,f.node.localName)}function d(f,g){var k=new Set;a.filter(function(l){return l.type===f}).map(function(l){return l.target}).forEach(function(l){l=l?l.node:null;k.has(l)&&g(l);k.add(l)})}d(\"rename\",function(f){throw Error(\"XUDY0015: The target \"+f.outerHTML+\" is used in more than one rename expression.\");});d(\"replaceNode\",function(f){throw Error(\"XUDY0016: The target \"+f.outerHTML+\" is used in more than one replace expression.\");\n});d(\"replaceValue\",function(f){throw Ze(f);});d(\"replaceElementContent\",function(f){throw Ze(f);});var e=new Map;a.filter(function(f){return\"replaceNode\"===f.type&&2===f.target.node.nodeType}).forEach(function(f){var g=Ub(b,f.target);g=g?g.node:null;var k=e.get(g);k?k.push.apply(k,w(f.s.map(c))):e.set(g,f.s.map(c))});a.filter(function(f){return\"rename\"===f.type&&2===f.target.node.nodeType}).forEach(function(f){var g=Ub(b,f.target);if(g){g=g.node;var k=e.get(g);k?k.push(f.s):e.set(g,[f.s])}});e.forEach(function(f){var g=\n{};f.forEach(function(k){g[k.prefix]||(g[k.prefix]=k.namespaceURI);if(g[k.prefix]!==k.namespaceURI)throw bf(k.namespaceURI);})})}function qf(a,b){for(var c=[],d=1;da.h[c])return-1}return 0};function Af(){return Oc(\"Expected base expression of a function call to evaluate to a sequence of single function item\")}function Bf(a,b,c,d){for(var e=[],f=0;fg.R.length||0>=l)throw Error(\"FOAY0001: subarray start out of bounds.\");if(0>k)throw Error(\"FOAY0002: subarray length out of bounds.\");if(l+k>g.R.length+1)throw Error(\"FOAY0001: subarray start + length out of bounds.\");return E.o(new Xb(g.R.slice(l-1,k+l-1)))})}\nfunction Hf(a,b,c,d,e){return $b([d],function(f){var g=t(f).next().value;return e.L(function(k){k=k.map(function(v){return v.value}).sort(function(v,A){return A-v}).filter(function(v,A,G){return G[A-1]!==v});for(var l=g.R.concat(),n=0,q=k.length;ng.R.length||0>=u)throw Error(\"FOAY0001: subarray position out of bounds.\");l.splice(u-1,1)}return E.o(new Xb(l))})})}function If(a){return C(a,1)||C(a,20)||C(a,19)}\nfunction Jf(a,b,c,d,e){return 0===d.length?0!==e.length:0!==e.length&&Me(a,b,c,d[0],e[0]).next(0).value?Jf(a,b,c,d.slice(1),e.slice(1)):d[0].value!==d[0].value?!0:If(d[0].type)&&0!==e.length&&If(e[0].type)?d[0].value=g||g>k.R.length)throw Error(\"FOAY0001: array position out of bounds.\");k=k.R.concat();k.splice(g-1,1,rb(f));return E.o(new Xb(k))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"append\",l:[{type:62,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(a,b,c,d,e){return $b([d],function(f){f=t(f).next().value.R.concat([rb(e)]);return E.o(new Xb(f))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"subarray\",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],i:{type:62,g:3},m:Gf},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"subarray\",l:[{type:62,g:3},{type:5,g:3}],i:{type:62,g:3},m:function(a,b,c,d,e){var f=E.o(y(d.first().value.length-e.first().value+1,5));return Gf(a,b,c,d,e,f)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"remove\",l:[{type:62,g:3},{type:5,g:2}],i:{type:62,g:3},m:Hf},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"insert-before\",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(a,b,c,d,e,f){return $b([d,e],function(g){var k=t(g);g=k.next().value;k=k.next().value.value;if(k>g.R.length+1||0>=k)throw Error(\"FOAY0001: subarray position out of bounds.\");g=g.R.concat();g.splice(k-1,0,rb(f));return E.o(new Xb(g))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"head\",l:[{type:62,g:3}],i:{type:59,g:2},m:function(a,b,c,d){return Wb(a,b,c,d,E.o(y(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"tail\",l:[{type:62,g:3}],i:{type:59,g:2},m:function(a,b,c,d){return Hf(a,b,c,d,E.o(y(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"reverse\",l:[{type:62,g:3}],i:{type:62,g:3},m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;return E.o(new Xb(e.R.concat().reverse()))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"join\",l:[{type:62,g:2}],i:{type:62,g:3},m:function(a,b,c,d){return d.L(function(e){e=e.reduce(function(f,\ng){return f.concat(g.R)},[]);return E.o(new Xb(e))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"for-each\",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(a,b,c,d,e){return $b([d,e],function(f){f=t(f);var g=f.next().value,k=f.next().value;if(1!==k.A)throw Oc(\"The callback passed into array:for-each has a wrong arity.\");f=g.R.map(function(l){return rb(k.value.call(void 0,a,b,c,Bf(k.s,[l()],b,\"array:for-each\")[0]))});return E.o(new Xb(f))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"filter\",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(a,b,c,d,e){return $b([d,e],function(f){f=t(f);var g=f.next().value,k=f.next().value;if(1!==k.A)throw Oc(\"The callback passed into array:filter has a wrong arity.\");var l=g.R.map(function(u){u=Bf(k.s,[u()],b,\"array:filter\")[0];var v=k.value;return v(a,b,c,u)}),n=[],q=!1;return E.create({next:function(){if(q)return z;for(var u=0,v=g.R.length;u=c.start.line&&k<=c.end.line){var l=kc.start.line?g.length:c.start.la-1+g.length;e.push(Array(g.length+\nf.length).fill(\" \",0,k).fill(\"^\",k,l).join(\"\"))}return e},[]);b=dg(b).join(\"\\n\");throw new ag(a.join(\"\\n\")+\"\\n\\n\"+b,c);};var eg=Object.create(null);function fg(a,b){for(var c=[],d=0;da.length?\"\":\"object\"===typeof a[1]?a[2]||\"\":a[1]||\"\"}function O(a,b){if(!Array.isArray(a))return null;a=a[1];return\"object\"!==typeof a||Array.isArray(a)?null:b in a?a[b]:null}function P(a,b){return b.reduce(M,a)}\nfunction Q(a,b){for(var c=[],d=1;dNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:yearMonthDuration\");return new jd(aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:dayTimeDuration\");return new fc(ae;e++)if(g=kh(d[e],b,c[f]))return 59!==g.type&&R(a,\"type\",g),g;default:return{type:59,g:2}}}59!==d.type&&R(a,\"type\",d);return d}\nfunction kh(a,b,c){var d=Q(a,\"*\"),e=M(a,\"atomicType\");if(!e)return{type:59,g:2};if(wb(O(e,\"prefix\")+\":\"+e[2])===b.type)if(1===d.length){if(3===b.g)return c}else if(a=M(a,\"occurrenceIndicator\")[1],b.g===yb(a))return c};function lh(a,b){T(a,b)}function T(a,b){var c=mh.get(a[0]);if(c)return c(a,b);for(c=1;c:\"+a.location.start.line+\":\"+a.location.start.la+\" - \"+a.location.end.line+\":\"+a.location.end.la);return b};function Uh(a,b,c){uf.call(this,c.s,[c],{C:c.C,Y:c.Y,S:c.O,subtree:c.subtree});this.j=b;this.J={end:{la:a.end.la,line:a.end.line,offset:a.end.offset},start:{la:a.start.la,line:a.start.line,offset:a.start.offset}}}x(Uh,uf);Uh.prototype.B=function(a,b,c){var d=this;b=t(c).next().value;try{var e=b(a)}catch(f){throw new Th(this.J,this.j,f);}return E.create({next:function(f){try{return e.value.next(f)}catch(g){throw new Th(d.J,d.j,g);}}})};\nUh.prototype.P=function(a){try{uf.prototype.P.call(this,a)}catch(b){throw new Th(this.J,this.j,b);}};function Vh(a,b,c,d){I.call(this,a,b,c,!0);this.j=d;this.I=this.j.I}x(Vh,I);function Wh(a,b,c,d){var e=[],f=a.J(b,c,d,function(k){if(a.j instanceof Vh){var l=Wh(a.j,b,k,d);return tf(l,function(q){return e=q})}var n=null;return E.create({next:function(){for(;;){if(!n){var q=k.next(0);if(q.done)return z;q=a.j.u(q.value,d);n=tf(q,function(u){return e=qf(e,u)}).value}q=n.next(0);if(q.done)n=null;else return q}}})}),g=!1;return{next:function(){if(g)return z;var k=f.N();g=!0;return B(new df(k,e))}}}\nVh.prototype.h=function(a,b){var c=this;return this.J(a,Ld(a),b,function(d){if(c.j instanceof Vh)return Xh(c.j,a,d,b);var e=null;return E.create({next:function(f){for(;;){if(!e){var g=d.next(0);if(g.done)return z;e=J(c.j,g.value,b).value}g=e.next(f);if(g.done)e=null;else return g}}})})};Vh.prototype.u=function(a,b){return Wh(this,a,Ld(a),b)};\nVh.prototype.P=function(a){I.prototype.P.call(this,a);this.I=this.j.I;a=t(this.ha);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b!==this.j&&b.I)throw Te();};function Xh(a,b,c,d){return a.J(b,c,d,function(e){if(a.j instanceof Vh)return Xh(a.j,b,e,d);var f=null;return E.create({next:function(){for(;;){if(!f){var g=e.next(0);if(g.done)return z;f=J(a.j,g.value,d).value}g=f.next(0);if(g.done)f=null;else return g}}})})};function Yh(a,b,c,d){Vh.call(this,b.s.add(d.s),[b,d],{C:!1},d);this.T=a.prefix;this.ka=a.namespaceURI;this.$b=a.localName;this.mb=null;this.B=c;this.ua=null;this.na=b}x(Yh,Vh);\nYh.prototype.J=function(a,b,c,d){var e=this,f=null,g=null,k=0;return d({next:function(){for(var l={};;){if(!f){var n=b.next(0);if(n.done)return z;g=n.value;k=0;f=J(e.na,g,c).value}l.hb=f.next(0);if(l.hb.done)f=null;else return k++,n={},l=(n[e.mb]=function(q){return function(){return E.o(q.hb.value)}}(l),n),e.ua&&(l[e.ua]=function(){return E.o(new sb(5,k))}),B(Kc(g,l));l={hb:l.hb}}}})};\nYh.prototype.P=function(a){if(this.T&&(this.ka=a.ba(this.T),!this.ka&&this.T))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.T+\" in a for expression\");this.na.P(a);yg(a);this.mb=Cg(a,this.ka,this.$b);if(this.B){if(this.B.prefix&&(this.B.namespaceURI=a.ba(this.B.prefix),!this.B.namespaceURI&&this.B.prefix))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.T+\" in the positionalVariableBinding in a for expression\");this.ua=Cg(a,this.B.namespaceURI,this.B.localName)}this.j.P(a);\nEg(a);if(this.na.I)throw Te();this.j.I&&(this.I=!0)};function Zh(a,b,c){var d={};I.call(this,new yf((d.external=1,d)),[c],{C:!1,S:\"unsorted\"});this.T=a.map(function(e){return e.name});this.B=a.map(function(e){return e.type});this.u=null;this.J=b;this.j=c}x(Zh,I);\nZh.prototype.h=function(a,b){var c=this,d=new Bb({l:this.B,arity:this.B.length,Pa:!0,I:this.j.I,localName:\"dynamic-function\",namespaceURI:\"\",i:this.J,value:function(e,f,g,k){for(var l=[],n=3;nc.W.value};case \"geOp\":return function(c,d){c=b(c,d);return c.V.value>=c.W.value}}}\nfunction li(a,b){switch(a){case \"ltOp\":return function(c,d){c=b(c,d);return c.V.value.gac.W.value.ga};case \"geOp\":return function(c,d){d=b(c,d);c=d.V;d=d.W;return ec(c.value,d.value)||c.value.ga>d.value.ga}}}\nfunction mi(a,b){switch(a){case \"eqOp\":return function(c,d){c=b(c,d);return ec(c.V.value,c.W.value)};case \"ltOp\":return function(c,d){c=b(c,d);return c.V.value.eac.W.value.ea};case \"geOp\":return function(c,d){d=b(c,d);c=d.V;d=d.W;return ec(c.value,d.value)||c.value.ea>d.value.ea}}}\nfunction ni(a,b){switch(a){case \"eqOp\":return function(c,d){c=b(c,d);return ec(c.V.value,c.W.value)};case \"neOp\":return function(c,d){c=b(c,d);return!ec(c.V.value,c.W.value)}}}\nfunction oi(a,b){switch(a){case \"eqOp\":return function(c,d,e){c=b(c,d);return vc(c.V.value,c.W.value,Jc(e))};case \"neOp\":return function(c,d,e){c=b(c,d);return!vc(c.V.value,c.W.value,Jc(e))};case \"ltOp\":return function(c,d,e){c=b(c,d);e=Jc(e);return 0>uc(c.V.value,c.W.value,e)};case \"leOp\":return function(c,d,e){d=b(c,d);c=d.V;d=d.W;var f;(f=vc(c.value,d.value,Jc(e)))||(e=Jc(e),f=0>uc(c.value,d.value,e));return f};case \"gtOp\":return function(c,d,e){c=b(c,d);e=Jc(e);return 0Td(b,e.first(),f.first())}:void 0;case \"nodeAfterOp\":return b?function(e,f){return 0Td(b.h,g,k)){if(q=B(g),g=null,\"exceptOp\"===c.j)return q}else k=null}if(\"exceptOp\"===c.j)return null!==\ng?(q=B(g),g=null,q):e.next(0);l=!0;return z}})};function Di(a,b){uf.call(this,a.reduce(function(c,d){return c.add(d.s)},new yf({})),a,{S:\"unsorted\",C:a.every(function(c){return c.C})},b)}x(Di,uf);Di.prototype.B=function(a,b,c){return c.length?Mc(c.map(function(d){return d(a)})):E.empty()};function Ei(a,b,c){I.call(this,(new yf({})).add(a.s),[a,b],{C:a.C&&b.C},!1,c);this.j=a;this.u=b}x(Ei,I);Ei.prototype.h=function(a,b){var c=this,d=J(this.j,a,b),e=Gc(a,d),f=null,g=null,k=!1;return E.create({next:function(l){for(;!k;){if(!f&&(f=e.next(l),f.done))return k=!0,z;g||(g=J(c.u,f.value,b));var n=g.value.next(l);if(n.done)f=g=null;else return n}}})};function Fi(a,b,c){I.call(this,a.s,[a],{C:!1});this.j=wb(b.prefix?b.prefix+\":\"+b.localName:b.localName);if(46===this.j||45===this.j||44===this.j)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(b.namespaceURI)throw Error(\"Not implemented: castable as expressions with a namespace URI.\");this.B=a;this.u=c}x(Fi,I);\nFi.prototype.h=function(a,b){var c=this,d=Vc(J(this.B,a,b),b);return d.$({empty:function(){return c.u?E.ca():E.X()},o:function(){return d.map(function(e){return Jd(e,c.j).v?cb:db})},multiple:function(){return E.X()}})};function Gi(a,b,c){I.call(this,a.s,[a],{C:!1});this.j=wb(b.prefix?b.prefix+\":\"+b.localName:b.localName);if(46===this.j||45===this.j||44===this.j)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(b.namespaceURI)throw Error(\"Not implemented: casting expressions with a namespace URI.\");this.B=a;this.u=c}x(Gi,I);\nGi.prototype.h=function(a,b){var c=this,d=Vc(J(this.B,a,b),b);return d.$({empty:function(){if(!c.u)throw Error(\"XPTY0004: Sequence to cast is empty while target type is singleton.\");return E.empty()},o:function(){return d.map(function(e){return Kd(e,c.j)})},multiple:function(){throw Error(\"XPTY0004: Sequence to cast is not singleton or empty.\");}})};function Hi(a,b){var c=a.value,d=null,e=!1;return E.create({next:function(){for(;!e;){if(!d){var f=c.next(0);if(f.done)return e=!0,B(cb);d=b(f.value)}f=d.getEffectiveBooleanValue();d=null;if(!1===f)return e=!0,B(db)}return z}})};function Ii(a,b,c,d){I.call(this,a.s,[a],{C:!1},!1,d);this.B=a;this.u=b;this.j=c}x(Ii,I);Ii.prototype.h=function(a,b){var c=this,d=J(this.B,a,b);return d.$({empty:function(){return\"?\"===c.j||\"*\"===c.j?E.ca():E.X()},multiple:function(){return\"+\"===c.j||\"*\"===c.j?Hi(d,function(e){var f=E.o(e);e=Hc(a,0,e,f);return J(c.u,e,b)}):E.X()},o:function(){return Hi(d,function(e){var f=E.o(e);e=Hc(a,0,e,f);return J(c.u,e,b)})}})};function Ji(a,b){return null!==a&&null!==b&&C(a.type,53)&&C(b.type,53)?Nd(a.value,b.value):!1}function Ki(a){var b=a.next(0);if(b.done)return E.empty();var c=null,d=null;return E.create({next:function(e){if(b.done)return z;c||(c=b.value.value);do{var f=c.next(e);if(f.done){b=a.next(0);if(b.done)return f;c=b.value.value}}while(f.done||Ji(f.value,d));d=f.value;return f}})}\nfunction Li(a,b){var c=[];(function(){for(var g=b.next(0),k={};!g.done;)k.jb=g.value.value,g={current:k.jb.next(0),next:function(l){return function(n){return l.jb.next(n)}}(k)},g.current.done||c.push(g),g=b.next(0),k={jb:k.jb}})();var d=null,e=!1,f={};return E.create((f[Symbol.iterator]=function(){return this},f.next=function(){e||(e=!0,c.every(function(v){return C(v.current.value.type,53)})&&c.sort(function(v,A){return Td(a,v.current.value,A.current.value)}));do{if(!c.length)return z;var g=c.shift();\nvar k=g.current;g.current=g.next(0);if(!C(k.value.type,53))return k;if(!g.current.done){for(var l=0,n=c.length-1,q=0;l<=n;){q=Math.floor((l+n)/2);var u=Td(a,g.current.value,c[q].current.value);if(0===u){l=q;break}0=c.j.length?z:B(J(c.j[d++],a,b))}}).map(function(e){if(!C(e.type,53))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");return e})}return Mc(this.j.map(function(e){return J(e,a,b)})).L(function(e){if(e.some(function(f){return!C(f.type,53)}))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");e=Ud(b.h,e);return E.create(e)})};function Ni(a){return a.every(function(b){return null===b||C(b.type,5)||C(b.type,4)})||null!==a.map(function(b){return b?Wc(b.type):null}).reduce(function(b,c){return null===c?b:c===b?b:null})?a:a.every(function(b){return null===b||C(b.type,1)||C(b.type,20)})?a.map(function(b){return b?Kd(b,1):null}):a.every(function(b){return null===b||C(b.type,4)||C(b.type,6)})?a.map(function(b){return b?Kd(b,6):b}):a.every(function(b){return null===b||C(b.type,4)||C(b.type,6)||C(b.type,3)})?a.map(function(b){return b?\nKd(b,3):b}):null};function Oi(a){return(a=a.find(function(b){return!!b}))?Wc(a.type):null}function Pi(a,b){var c=new yf({});Vh.call(this,c,[b].concat(w(a.map(function(d){return d.da}))),{C:!1,Y:!1,S:\"unsorted\",subtree:!1},b);this.B=a}x(Pi,Vh);\nPi.prototype.J=function(a,b,c,d){if(this.B[1])throw Error(\"More than one order spec is not supported for the order by clause.\");var e=[],f=!1,g,k,l=null,n=this.B[0];return E.create({next:function(){if(!f){for(var q=b.next(0);!q.done;)e.push(q.value),q=b.next(0);q=e.map(function(ea){return n.da.h(ea,c)}).map(function(ea){return Vc(ea,c)});if(q.find(function(ea){return!ea.G()&&!ea.ya()}))throw mg(\"Order by only accepts empty or singleton sequences\");g=q.map(function(ea){return ea.first()});g=g.map(function(ea){return null===\nea?ea:C(19,ea.type)?Kd(ea,1):ea});if(Oi(g)&&(g=Ni(g),!g))throw mg(\"Could not cast values\");q=g.length;k=g.map(function(ea,Ea){return Ea});for(var u=0;u=g.length?z:B(e[k[fa++]]):0>fa?z:B(e[k[fa--]])}}).value;f=!0}return l.next(0)}})};function Qi(a){I.call(this,a?a.s:new yf({}),a?[a]:[],{S:\"sorted\",subtree:!1,Y:!1,C:!1});this.j=a}x(Qi,I);Qi.prototype.h=function(a,b){if(null===a.M)throw Error(\"XPDY0002: context is absent, it needs to be present to use paths.\");for(var c=b.h,d=a.M.value;9!==d.node.nodeType;)if(d=Ub(c,d),null===d)throw Error(\"XPDY0050: the root node of the context node is not a document node.\");c=E.o(Zb(d));return this.j?J(this.j,Hc(a,0,c.first(),c),b):c};function Ri(a){I.call(this,new yf({}),[],{S:\"sorted\"},!1,a)}x(Ri,I);Ri.prototype.h=function(a){if(null===a.M)throw Error('XPDY0002: context is absent, it needs to be present to use the \".\" operator');return E.o(a.M)};function Si(a,b){var c=!1,d=!1;b.forEach(function(e){C(e.type,53)?c=!0:d=!0});if(d&&c)throw Error(\"XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.\");return c?Ud(a,b):b}function Ti(a,b){var c=a.every(function(e){return e.Y}),d=a.every(function(e){return e.subtree});I.call(this,a.reduce(function(e,f){return e.add(f.s)},new yf({})),a,{C:!1,Y:c,S:b?\"sorted\":\"unsorted\",subtree:d});this.j=a;this.u=b}x(Ti,I);\nTi.prototype.h=function(a,b){var c=this,d=!0;return this.j.reduce(function(e,f,g){var k=null===e?Ld(a):Gc(a,e);e={next:function(q){q=k.next(q);if(q.done)return z;if(null!==q.value.M&&!C(q.value.M.type,53)&&0=d)throw Error(\"FOAY0001: Array index out of bounds\");c.push(a.R[d-1]())}else throw mg(\"The key specifier is not an integer.\");else if(C(a.type,61))\"*\"===b?c.push.apply(c,w(a.h.map(function(e){return e.value()}))):(a=a.h.find(function(e){return ac(e.key,b)}))&&c.push(a.value());else throw mg(\"The provided context item is not a map or an array.\");\nreturn Mc(c)}function Wi(a,b,c,d,e){if(\"*\"===b)return Vi(a,b,c);b=J(b,d,e);b=rb(b)().L(function(f){return f.reduce(function(g,k){return Vi(a,k,g)},new ib)});return Mc([c,b])};function Xi(a,b){I.call(this,a.s,[a].concat(\"*\"===b?[]:[b]),{C:a.C,S:a.O,subtree:a.subtree});this.j=a;this.u=b}x(Xi,I);Xi.prototype.h=function(a,b){var c=this;return J(this.j,a,b).L(function(d){return d.reduce(function(e,f){return Wi(f,c.u,e,a,b)},new ib)})};Xi.prototype.A=function(){return this.j.A()};function Yi(a,b){var c={};I.call(this,new yf((c.external=1,c)),\"*\"===a?[]:[a],{C:!1},!1,b);this.j=a}x(Yi,I);Yi.prototype.h=function(a,b){return Wi(a.M,this.j,new ib,a,b)};function Zi(a,b,c,d){var e=b.map(function(g){return g.eb});b=b.map(function(g){return g.name});var f=e.reduce(function(g,k){return g.add(k.s)},c.s);I.call(this,f,e.concat(c),{C:!1},!1,d);this.u=a;this.B=b;this.J=e;this.T=c;this.j=null}x(Zi,I);\nZi.prototype.h=function(a,b){var c=this,d=a,e=this.j.map(function(q,u){var v=J(c.J[u],d,b).N();u={};d=Kc(a,(u[q]=function(){return E.create(v)},u));return v});if(e.some(function(q){return 0===q.length}))return\"every\"===this.u?E.ca():E.X();var f=Array(e.length).fill(0);f[0]=-1;for(var g=!0;g;){g=!1;for(var k=0,l=f.length;kn.length-1)f[k]=0;else{g=Object.create(null);k={};for(l=0;l\"))throw Error('XQDY0026: The content \"'+l+'\" for a processing instruction node contains \"?>\".');k=!0;return B({H:[],fa:qf([new xj(d.value,\nl)],g,e)})}}}}function Nj(a,b,c){rf.call(this,new yf({}),[b,c],{C:!1,S:\"unsorted\"});this.J=a;this.j=b;this.B=c}x(Nj,rf);Nj.prototype.u=function(a,b){var c=sf(this.j)(a,b);a=sf(this.B)(a,b);return this.J?Mj(b,c,a):Lj(b,c,a)};function Oj(a){switch(a.type){case \"delete\":return new mj({node:a.target,F:null});case \"insertAfter\":return new oj({node:a.target,F:null},a.content.map(function(b){return{node:b,F:null}}));case \"insertBefore\":return new qj({node:a.target,F:null},a.content.map(function(b){return{node:b,F:null}}));case \"insertInto\":return new tj({node:a.target,F:null},a.content.map(function(b){return{node:b,F:null}}));case \"insertIntoAsFirst\":return new rj({node:a.target,F:null},a.content.map(function(b){return{node:b,\nF:null}}));case \"insertIntoAsLast\":return new sj({node:a.target,F:null},a.content.map(function(b){return{node:b,F:null}}));case \"insertAttributes\":return new pj({node:a.target,F:null},a.content.map(function(b){return{node:b,F:null}}));case \"rename\":return new uj({node:a.target,F:null},a.newName);case \"replaceNode\":return new wj({node:a.target,F:null},a.replacement.map(function(b){return{node:b,F:null}}));case \"replaceValue\":return new xj({node:a.target,F:null},a[\"string-value\"]);case \"replaceElementContent\":return new vj({node:a.target,\nF:null},a.text?{node:a.text,F:null}:null);default:throw Error('Unexpected type \"'+a.type+'\" when parsing a transferable pending update.');}};function Pj(a,b,c){if(b.find(function(e){return Nd(e,a)}))return!0;var d=Ub(c,a);return d?Pj(d,b,c):!1}function Qj(a,b,c){rf.call(this,new yf({}),a.reduce(function(d,e){d.push(e.eb);return d},[b,c]),{C:!1,S:\"unsorted\"});this.j=a;this.J=b;this.B=c;this.I=null}x(Qj,rf);Qj.prototype.h=function(a,b){a=this.u(a,b);return tf(a,function(){})};\nQj.prototype.u=function(a,b){var c=this,d=b.h,e=b.s,f=b.A,g=[],k,l,n,q=[],u=[];return{next:function(){if(q.length!==c.j.length)for(var v={},A=q.length;A\"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include \"?>\"');if(null!==c.j.Jb)return e=c.j.Jb,Vj(e),E.o(Zb(Wj(e,f)));e=J(c.j.Cb,a,b);var g=Ij(b,e);return E.create({next:function(){var k=g.next(0);if(k.done)return k;k=k.value.value;Vj(k);return B(Zb(Wj(k,f)))}})})};function Yj(a){I.call(this,a?a.s:new yf({}),a?[a]:[],{C:!1,S:\"unsorted\"});this.j=a}x(Yj,I);Yj.prototype.h=function(a,b){if(!this.j)return E.empty();a=J(this.j,a,b);return Vc(a,b).L(function(c){if(0===c.length)return E.empty();c={node:{data:c.map(function(d){return Kd(d,1).value}).join(\" \"),Qa:!0,nodeType:3},F:null};return E.o(Zb(c))})};function Zj(a,b,c,d){var e=new yf({}),f;uf.call(this,e,(f=[a].concat(w(b.map(function(g){return g.xc})),[c])).concat.apply(f,w(b.map(function(g){return g.Lb.map(function(k){return k.Kb})}))),{C:!1,Y:!1,S:\"unsorted\",subtree:!1},d);this.J=a;this.j=b.length;this.T=b.map(function(g){return g.Lb})}x(Zj,uf);\nZj.prototype.B=function(a,b,c){var d=this;return c[0](a).L(function(e){for(var f=0;fe.length)return!1;break;default:if(1!==e.length)return!1}var k=E.create(e);return e.every(function(l,n){l=Hc(a,n,l,k);return J(g.Kb,l,b).getEffectiveBooleanValue()})}))return c[f+1](a);return c[d.j+1](a)})};Zj.prototype.P=function(a){uf.prototype.P.call(this,a);if(this.J.I)throw Te();};var ak={aa:!1,qa:!1},bk={aa:!0,qa:!1},ck={aa:!0,qa:!0};function dk(a){return a.aa?a.qa?ck:bk:ak}\nfunction U(a,b){switch(a[0]){case \"andOp\":var c=O(a,\"type\");return new gi(ek(\"andOp\",a,dk(b)),c);case \"orOp\":return c=O(a,\"type\"),new hi(ek(\"orOp\",a,dk(b)),c);case \"unaryPlusOp\":return c=M(M(a,\"operand\"),\"*\"),a=O(a,\"type\"),new fi(\"+\",U(c,b),a);case \"unaryMinusOp\":return c=M(M(a,\"operand\"),\"*\"),a=O(a,\"type\"),new fi(\"-\",U(c,b),a);case \"addOp\":case \"subtractOp\":case \"multiplyOp\":case \"divOp\":case \"idivOp\":case \"modOp\":var d=a[0],e=U(P(a,[\"firstOperand\",\"*\"]),dk(b));b=U(P(a,[\"secondOperand\",\"*\"]),dk(b));\nvar f=O(a,\"type\"),g=O(P(a,[\"firstOperand\",\"*\"]),\"type\"),k=O(P(a,[\"secondOperand\",\"*\"]),\"type\");g&&k&&O(a,\"type\")&&(c=Pg(d,g.type,k.type));return new Yg(d,e,b,f,c);case \"sequenceExpr\":return fk(a,b);case \"unionOp\":return c=O(a,\"type\"),new Mi([U(P(a,[\"firstOperand\",\"*\"]),dk(b)),U(P(a,[\"secondOperand\",\"*\"]),dk(b))],c);case \"exceptOp\":case \"intersectOp\":return c=O(a,\"type\"),new Ci(a[0],U(P(a,[\"firstOperand\",\"*\"]),dk(b)),U(P(a,[\"secondOperand\",\"*\"]),dk(b)),c);case \"stringConcatenateOp\":return gk(a,b);\ncase \"rangeSequenceExpr\":return hk(a,b);case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":return ik(\"generalCompare\",a,b);case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":return ik(\"valueCompare\",a,b);case \"isOp\":case \"nodeBeforeOp\":case \"nodeAfterOp\":return ik(\"nodeCompare\",a,b);case \"pathExpr\":return jk(a,b);case \"contextItemExpr\":return new Ri(O(a,\"type\"));case \"functionCallExpr\":return kk(a,b);case \"inlineFunctionExpr\":return lk(a,\nb);case \"arrowExpr\":return mk(a,b);case \"dynamicFunctionInvocationExpr\":return nk(a,b);case \"namedFunctionRef\":return b=M(a,\"functionName\"),c=O(a,\"type\"),a=N(P(a,[\"integerConstantExpr\",\"value\"])),new ci(Fg(b),parseInt(a,10),c);case \"integerConstantExpr\":return new ai(N(M(a,\"value\")),{type:5,g:3});case \"stringConstantExpr\":return new ai(N(M(a,\"value\")),{type:1,g:3});case \"decimalConstantExpr\":return new ai(N(M(a,\"value\")),{type:4,g:3});case \"doubleConstantExpr\":return new ai(N(M(a,\"value\")),{type:3,\ng:3});case \"varRef\":return a=Fg(M(a,\"name\")),new ej(a.prefix,a.namespaceURI,a.localName);case \"flworExpr\":return ok(a,b);case \"quantifiedExpr\":return pk(a,b);case \"ifThenElseExpr\":return c=O(a,\"type\"),new Sh(U(M(M(a,\"ifClause\"),\"*\"),dk(b)),U(M(M(a,\"thenClause\"),\"*\"),b),U(M(M(a,\"elseClause\"),\"*\"),b),c);case \"instanceOfExpr\":return c=U(P(a,[\"argExpr\",\"*\"]),b),d=P(a,[\"sequenceType\",\"*\"]),e=P(a,[\"sequenceType\",\"occurrenceIndicator\"]),a=O(a,\"type\"),new Ii(c,U(d,dk(b)),e?N(e):\"\",a);case \"castExpr\":return b=\nU(M(M(a,\"argExpr\"),\"*\"),dk(b)),c=M(a,\"singleType\"),a=Fg(M(c,\"atomicType\")),c=null!==M(c,\"optional\"),new Gi(b,a,c);case \"castableExpr\":return b=U(M(M(a,\"argExpr\"),\"*\"),dk(b)),c=M(a,\"singleType\"),a=Fg(M(c,\"atomicType\")),c=null!==M(c,\"optional\"),new Fi(b,a,c);case \"simpleMapExpr\":return qk(a,b);case \"mapConstructor\":return rk(a,b);case \"arrayConstructor\":return sk(a,b);case \"unaryLookup\":return c=O(a,\"type\"),new Yi(tk(a,b),c);case \"typeswitchExpr\":return uk(a,b);case \"elementConstructor\":return vk(a,\nb);case \"attributeConstructor\":return wk(a,b);case \"computedAttributeConstructor\":return(c=M(a,\"tagName\"))?c=Fg(c):(c=M(a,\"tagNameExpr\"),c={Ka:U(M(c,\"*\"),dk(b))}),a=U(M(M(a,\"valueExpr\"),\"*\"),dk(b)),new Sj(c,{tb:[a]});case \"computedCommentConstructor\":if(!b.aa)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");a=(a=M(a,\"argExpr\"))?U(M(a,\"*\"),dk(b)):null;return new Tj(a);case \"computedTextConstructor\":if(!b.aa)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");\na=(a=M(a,\"argExpr\"))?U(M(a,\"*\"),dk(b)):null;return new Yj(a);case \"computedElementConstructor\":return xk(a,b);case \"computedPIConstructor\":if(!b.aa)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");c=M(a,\"piTargetExpr\");d=M(a,\"piTarget\");e=M(a,\"piValueExpr\");a=O(a,\"type\");return new Xj({Cb:c?U(M(c,\"*\"),dk(b)):null,Jb:d?N(d):null},e?U(M(e,\"*\"),dk(b)):new Di([],a));case \"CDataSection\":return new ai(N(a),{type:1,g:3});case \"deleteExpr\":return a=U(P(a,[\"targetExpr\",\n\"*\"]),b),new zj(a);case \"insertExpr\":c=U(P(a,[\"sourceExpr\",\"*\"]),b);e=Q(a,\"*\")[1];switch(e[0]){case \"insertAfter\":d=1;break;case \"insertBefore\":d=2;break;case \"insertInto\":d=(d=M(e,\"*\"))?\"insertAsFirst\"===d[0]?4:5:3}a=U(P(a,[\"targetExpr\",\"*\"]),b);return new Dj(c,d,a);case \"renameExpr\":return c=U(P(a,[\"targetExpr\",\"*\"]),b),a=U(P(a,[\"newNameExpr\",\"*\"]),b),new Kj(c,a);case \"replaceExpr\":return c=!!M(a,\"replaceValue\"),d=U(P(a,[\"targetExpr\",\"*\"]),b),a=U(P(a,[\"replacementExpr\",\"*\"]),b),new Nj(c,d,a);case \"transformExpr\":return yk(a,\nb);case \"x:stackTrace\":c=a[1];for(a=a[2];\"x:stackTrace\"===a[0];)a=a[2];return new Uh(c,a[0],U(a,b));default:return zk(a)}}\nfunction zk(a){switch(a[0]){case \"nameTest\":return new bj(Fg(a));case \"piTest\":return(a=M(a,\"piTarget\"))?new cj(N(a)):new aj(7);case \"commentTest\":return new aj(8);case \"textTest\":return new aj(3);case \"documentTest\":return new aj(9);case \"attributeTest\":var b=(a=M(a,\"attributeName\"))&&M(a,\"star\");return!a||b?new aj(2):new bj(Fg(M(a,\"QName\")),{kind:2});case \"elementTest\":return b=(a=M(a,\"elementName\"))&&M(a,\"star\"),!a||b?new aj(1):new bj(Fg(M(a,\"QName\")),{kind:1});case \"anyKindTest\":return new dj({prefix:\"\",\nnamespaceURI:null,localName:\"node()\"});case \"anyMapTest\":return new dj({prefix:\"\",namespaceURI:null,localName:\"map(*)\"});case \"anyArrayTest\":return new dj({prefix:\"\",namespaceURI:null,localName:\"array(*)\"});case \"Wildcard\":return M(a,\"star\")?(b=M(a,\"uri\"))?a=new bj({localName:\"*\",namespaceURI:N(b),prefix:\"\"}):(b=M(a,\"NCName\"),a=\"star\"===M(a,\"*\")[0]?new bj({localName:N(b),namespaceURI:null,prefix:\"*\"}):new bj({localName:\"*\",namespaceURI:null,prefix:N(b)})):a=new bj({localName:\"*\",namespaceURI:null,\nprefix:\"*\"}),a;case \"atomicType\":return new dj(Fg(a));case \"anyItemType\":return new dj({prefix:\"\",namespaceURI:null,localName:\"item()\"});default:throw Error(\"No selector counterpart for: \"+a[0]+\".\");}}function sk(a,b){var c=O(a,\"type\");a=M(a,\"*\");var d=Q(a,\"arrayElem\").map(function(e){return U(M(e,\"*\"),dk(b))});switch(a[0]){case \"curlyArray\":return new uh(d,c);case \"squareArray\":return new vh(d,c);default:throw Error(\"Unrecognized arrayType: \"+a[0]);}}\nfunction rk(a,b){var c=O(a,\"type\");return new bi(Q(a,\"mapConstructorEntry\").map(function(d){return{key:U(P(d,[\"mapKeyExpr\",\"*\"]),dk(b)),value:U(P(d,[\"mapValueExpr\",\"*\"]),dk(b))}}),c)}function ek(a,b,c){function d(f){var g=M(M(f,\"firstOperand\"),\"*\");f=M(M(f,\"secondOperand\"),\"*\");g[0]===a?d(g):e.push(U(g,c));f[0]===a?d(f):e.push(U(f,c))}var e=[];d(b);return e}function tk(a,b){a=M(a,\"*\");switch(a[0]){case \"NCName\":return new ai(N(a),{type:1,g:3});case \"star\":return\"*\";default:return U(a,dk(b))}}\nfunction ik(a,b,c){var d=P(b,[\"firstOperand\",\"*\"]),e=P(b,[\"secondOperand\",\"*\"]);d=U(d,dk(c));c=U(e,dk(c));switch(a){case \"valueCompare\":return new ti(b[0],d,c);case \"nodeCompare\":return new Ai(b[0],d,c);case \"generalCompare\":return new xi(b[0],d,c)}}\nfunction Ak(a,b,c){a=Q(a,\"*\");return new Pi(a.filter(function(d){return\"stable\"!==d[0]}).map(function(d){var e=M(d,\"orderModifier\"),f=e?M(e,\"orderingKind\"):null;e=e?M(e,\"emptyOrderingMode\"):null;f=f?\"ascending\"===N(f):!0;e=e?\"empty least\"===N(e):!0;return{da:U(P(d,[\"orderByExpr\",\"*\"]),b),Gb:f,zc:e}}),c)}\nfunction ok(a,b){var c=Q(a,\"*\");a=M(c[c.length-1],\"*\");c=c.slice(0,-1);if(1\"),xl=V.token(\"\"),Cl=V.token(\"&#x\"),\nDl=V.token(\"&#\"),El=V.token(\":*\"),Fl=V.token(\"*:\"),Gl=V.token(\":=\"),Hl=V.token(\"&\"),Il=V.token(\":\"),Jl=V.token(\";\"),Kl=V.token(\"*\"),Ll=V.token(\"@\"),Ml=V.token(\"$\"),Nl=V.token(\"#\"),Ol=V.token(\"%\"),Pl=V.token(\"?\"),Ql=V.token(\"!\"),Rl=V.token(\"|\"),Sl=V.token(\"||\"),Tl=V.token(\"=\"),Ul=V.token(\"!=\"),Vl=V.token(\"<\"),Wl=V.token(\"<<\"),Xl=V.token(\"<=\"),Yl=V.token(\">\"),Zl=V.token(\">>\"),$l=V.token(\">=\"),am=V.token(\",\"),bm=V.token(\".\"),cm=V.token(\"..\"),dm=V.token(\"+\"),em=V.token(\"-\"),fm=V.token(\"/\"),gm=V.token(\"//\"),\nhm=V.token(\"=>\"),im=V.token(\"e\"),jm=V.token(\"E\"),km=V.token(\"l\"),lm=V.token(\"L\"),mm=V.token(\"m\"),nm=V.token(\"M\"),om=V.token(\"Q\"),pm=V.token(\"x\"),qm=V.token(\"X\"),rm=V.token(\"as\"),sm=V.token(\"cast\"),tm=V.token(\"castable\"),um=V.token(\"treat\"),vm=V.token(\"instance\"),wm=V.token(\"of\"),xm=V.token(\"node\"),ym=V.token(\"nodes\"),zm=V.token(\"delete\"),Am=V.token(\"value\"),Bm=V.token(\"function\"),Cm=V.token(\"map\"),Dm=V.token(\"element\"),Em=V.token(\"attribute\"),Fm=V.token(\"schema-element\"),Gm=V.token(\"intersect\"),Hm=\nV.token(\"except\"),Im=V.token(\"union\"),Jm=V.token(\"to\"),Km=V.token(\"is\"),Lm=V.token(\"or\"),Mm=V.token(\"and\"),Nm=V.token(\"div\"),Om=V.token(\"idiv\"),Pm=V.token(\"mod\"),Qm=V.token(\"eq\"),Rm=V.token(\"ne\"),Sm=V.token(\"lt\"),Tm=V.token(\"le\"),Um=V.token(\"gt\"),Vm=V.token(\"ge\"),Wm=V.token(\"amp\"),Xm=V.token(\"quot\"),Ym=V.token(\"apos\"),Zm=V.token(\"if\"),$m=V.token(\"then\"),an=V.token(\"else\"),bn=V.token(\"allowing\"),cn=V.token(\"empty\"),dn=V.token(\"at\"),en=V.token(\"in\"),fn=V.token(\"for\"),gn=V.token(\"let\"),hn=V.token(\"where\"),\njn=V.token(\"collation\"),kn=V.token(\"group\"),ln=V.token(\"by\"),mn=V.token(\"order\"),nn=V.token(\"stable\"),on=V.token(\"return\"),pn=V.token(\"array\"),qn=V.token(\"document\"),rn=V.token(\"namespace\"),sn=V.token(\"text\"),tn=V.token(\"comment\"),un=V.token(\"processing-instruction\"),vn=V.token(\"lax\"),wn=V.token(\"strict\"),xn=V.token(\"validate\"),yn=V.token(\"type\"),zn=V.token(\"declare\"),An=V.token(\"default\"),Bn=V.token(\"boundary-space\"),Cn=V.token(\"strip\"),Dn=V.token(\"preserve\"),En=V.token(\"no-preserve\"),Fn=V.token(\"inherit\"),\nGn=V.token(\"no-inherit\"),Hn=V.token(\"greatest\"),In=V.token(\"least\"),Jn=V.token(\"copy-namespaces\"),Kn=V.token(\"decimal-format\"),Ln=V.token(\"case\"),Mn=V.token(\"typeswitch\"),Nn=V.token(\"some\"),On=V.token(\"every\"),Pn=V.token(\"satisfies\"),Qn=V.token(\"replace\"),Rn=V.token(\"with\"),Sn=V.token(\"copy\"),Tn=V.token(\"modify\"),Un=V.token(\"first\"),Vn=V.token(\"last\"),Wn=V.token(\"before\"),Xn=V.token(\"after\"),Yn=V.token(\"into\"),Zn=V.token(\"insert\"),$n=V.token(\"rename\"),ao=V.token(\"switch\"),bo=V.token(\"variable\"),co=\nV.token(\"external\"),eo=V.token(\"updating\"),fo=V.token(\"import\"),go=V.token(\"schema\"),ho=V.token(\"module\"),io=V.token(\"base-uri\"),jo=V.token(\"construction\"),ko=V.token(\"ordering\"),lo=V.token(\"ordered\"),mo=V.token(\"unordered\"),no=V.token(\"option\"),oo=V.token(\"context\"),po=V.token(\"item\"),qo=V.token(\"xquery\"),ro=V.token(\"version\"),so=V.token(\"encoding\"),to=V.token(\"document-node\"),uo=V.token(\"namespace-node\"),vo=V.token(\"schema-attribute\"),wo=V.token(\"ascending\"),xo=V.token(\"descending\"),yo=V.token(\"empty-sequence\"),\nzo=V.token(\"child::\"),Ao=V.token(\"descendant::\"),Bo=V.token(\"attribute::\"),Co=V.token(\"self::\"),Do=V.token(\"descendant-or-self::\"),Eo=V.token(\"following-sibling::\"),Fo=V.token(\"following::\"),Go=V.token(\"parent::\"),Ho=V.token(\"ancestor::\"),Io=V.token(\"preceding-sibling::\"),Jo=V.token(\"preceding::\"),Ko=V.token(\"ancestor-or-self::\"),Lo=V.token(\"decimal-separator\"),Mo=V.token(\"grouping-separator\"),No=V.token(\"infinity\"),Oo=V.token(\"minus-sign\"),Po=V.token(\"NaN\"),Qo=V.token(\"per-mille\"),Ro=V.token(\"zero-digit\"),\nSo=V.token(\"digit\"),To=V.token(\"pattern-separator\"),Uo=V.token(\"exponent-separator\"),Vo=V.token(\"schema-attribute(\"),Wo=V.token(\"document-node(\"),Xo=V.token(\"processing-instruction(\"),Yo=V.token(\"processing-instruction()\"),Zo=V.token(\"comment()\"),$o=V.token(\"text()\"),ap=V.token(\"namespace-node()\"),bp=V.token(\"node()\"),cp=V.token(\"item()\"),dp=V.token(\"empty-sequence()\");var ep=new Map,fp=new Map,gp=V.or([cl(/[\\t\\n\\r -\\uD7FF\\uE000\\uFFFD]/),cl(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/)]),hp=V.preceded(V.peek(V.not(V.or([el,fl]),['comment contents cannot contain \"(:\" or \":)\"'])),gp),ip=V.map(V.delimited(el,V.star(V.or([hp,function(a,b){return ip(a,b)}])),fl),function(a){return a.join(\"\")}),jp=V.or([dl,ip]),kp=V.map(V.plus(dl),function(a){return a.join(\"\")}),Y=Xk(V.map(V.star(jp),function(a){return a.join(\"\")}),ep),Z=Xk(V.map(V.plus(jp),function(a){return a.join(\"\")}),fp);var lp=V.or([cl(/[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/),V.then(cl(/[\\uD800-\\uDB7F]/),cl(/[\\uDC00-\\uDFFF]/),function(a,b){return a+b})]),mp=V.or([lp,cl(/[\\-\\.0-9\\xB7\\u0300-\\u036F\\u203F\\u2040]/)]),np=V.then(lp,V.star(mp),function(a,b){return a+b.join(\"\")}),op=V.map(np,function(a){return[\"prefix\",a]}),pp=V.or([lp,Il]),qp=V.or([mp,Il]),rp=V.then(pp,V.star(qp),function(a,b){return a+b.join(\"\")}),sp=\nV.map(np,function(a){var b={};return[(b.prefix=\"\",b.URI=null,b),a]}),tp=V.then(np,V.preceded(Il,np),function(a,b){var c={};return[(c.prefix=a,c.URI=null,c),b]}),up=V.or([tp,sp]),vp=V.followed(X([om,Y,ml],V.map(V.star(cl(/[^{}]/)),function(a){return a.join(\"\").replace(/\\s+/g,\" \").trim()})),nl),wp=V.then(vp,np,function(a,b){return[a,b]}),xp=V.or([V.map(wp,function(a){var b={};return[(b.prefix=null,b.URI=a[0],b),a[1]]}),up]),yp=V.or([V.map(xp,function(a){return[\"QName\"].concat(w(a))}),V.map(Kl,function(){return[\"star\"]})]),\nzp=V.map(V.preceded(Ml,xp),function(a){return[\"varRef\",[\"name\"].concat(w(a))]});var Ap=V.peek(V.or([il,sl,ql,jp])),Bp=V.map(V.or([zo,Ao,Bo,Co,Do,Eo,Fo]),function(a){return a.substring(0,a.length-2)}),Cp=V.map(V.or([Go,Ho,Io,Jo,Ko]),function(a){return a.substring(0,a.length-2)}),Dp=Yk(Hl,V.or([Sm,Um,Wm,Xm,Ym]),Jl,function(a,b,c){return a+b+c}),Ep=V.or([Yk(Cl,cl(/[0-9a-fA-F]+/),Jl,function(a,b,c){return a+b+c}),Yk(Dl,cl(/[0-9]+/),Jl,function(a,b,c){return a+b+c})]),Fp=bl([tl],'\"'),Gp=bl([rl],\"'\"),Hp=al(bl([Zo],\"commentTest\")),Ip=al(bl([$o],\"textTest\")),Jp=al(bl([ap],\"namespaceTest\")),\nKp=al(bl([bp],\"anyKindTest\")),Lp=cl(/[0-9]+/),Mp=V.then(V.or([V.then(bm,Lp,function(a,b){return a+b}),V.then(Lp,V.optional(V.preceded(bm,cl(/[0-9]*/))),function(a,b){return a+(null!==b?\".\"+b:\"\")})]),Yk(V.or([im,jm]),V.optional(V.or([dm,em])),Lp,function(a,b,c){return a+(b?b:\"\")+c}),function(a,b){return[\"doubleConstantExpr\",[\"value\",a+b]]}),Np=V.or([V.map(V.preceded(bm,Lp),function(a){return[\"decimalConstantExpr\",[\"value\",\".\"+a]]}),V.then(V.followed(Lp,bm),V.optional(Lp),function(a,b){return[\"decimalConstantExpr\",\n[\"value\",a+\".\"+(null!==b?b:\"\")]]})]),Op=V.map(Lp,function(a){return[\"integerConstantExpr\",[\"value\",a]]}),Pp=V.followed(V.or([Mp,Np,Op]),V.peek(V.not(cl(/[a-zA-Z]/),[\"no alphabetical characters after numeric literal\"]))),Qp=V.map(V.followed(bm,V.peek(V.not(bm,[\"context item should not be followed by another .\"]))),function(){return[\"contextItemExpr\"]}),Rp=V.or([pn,Em,tn,to,Dm,yo,Bm,Zm,po,Cm,uo,xm,un,vo,Fm,ao,sn,Mn]),Sp=al(bl([Pl],\"argumentPlaceholder\")),Tp=V.or([Pl,Kl,dm]),Up=V.preceded(V.peek(V.not(cl(/[{}<&]/),\n[\"elementContentChar cannot be {, }, <, or &\"])),gp),Vp=V.map(V.delimited(ul,V.star(V.preceded(V.peek(V.not(vl,['CDataSection content may not contain \"]]\\x3e\"'])),gp)),vl),function(a){return[\"CDataSection\",a.join(\"\")]}),Wp=V.preceded(V.peek(V.not(cl(/[\"{}<&]/),['quotAttrValueContentChar cannot be \", {, }, <, or &'])),gp),Xp=V.preceded(V.peek(V.not(cl(/['{}<&]/),[\"aposAttrValueContentChar cannot be ', {, }, <, or &\"])),gp),Yp=V.map(V.star(V.or([V.preceded(V.peek(V.not(em,[])),gp),V.map(X([em,V.peek(V.not(em,\n[]))],gp),function(a){return\"-\"+a})])),function(a){return a.join(\"\")}),Zp=V.map(V.delimited(yl,Yp,zl),function(a){return[\"computedCommentConstructor\",[\"argExpr\",[\"stringConstantExpr\",[\"value\",a]]]]}),$p=V.preceded(V.peek(V.not(Yk(V.or([qm,pm]),V.or([nm,mm]),V.or([lm,km]),function(){return[]}),[])),rp),aq=V.map(V.star(V.preceded(V.peek(V.not(Bl,[])),gp)),function(a){return a.join(\"\")}),bq=V.then(V.preceded(Al,$p),V.followed(V.optional(V.preceded(kp,aq)),Bl),function(a,b){return[\"computedPIConstructor\",\n[\"piTarget\",a],[\"piValueExpr\",[\"stringConstantExpr\",[\"value\",b]]]]}),cq=V.map(gm,function(){return[\"stepExpr\",[\"xpathAxis\",\"descendant-or-self\"],[\"anyKindTest\"]]}),dq=V.or([vn,wn]),eq=V.map(V.star(V.followed(gp,V.peek(V.not(hl,[\"Pragma contents should not contain '#)'\"])))),function(a){return a.join(\"\")}),fq=V.map(V.followed(V.or([Qm,Rm,Sm,Tm,Um,Vm]),Ap),function(a){return a+\"Op\"}),gq=V.or([V.followed(bl([Km],\"isOp\"),Ap),bl([Wl],\"nodeBeforeOp\"),bl([Zl],\"nodeAfterOp\")]),hq=V.or([bl([Tl],\"equalOp\"),\nbl([Ul],\"notEqualOp\"),bl([Xl],\"lessThanOrEqualOp\"),bl([Vl],\"lessThanOp\"),bl([$l],\"greaterThanOrEqualOp\"),bl([Yl],\"greaterThanOp\")]),iq=V.map(eo,function(){return[\"annotation\",[\"annotationName\",\"updating\"]]}),jq=V.or([Dn,En]),kq=V.or([Fn,Gn]),lq=V.or([Lo,Mo,No,Oo,Po,Ol,Qo,Ro,So,To,Uo]),mq=V.map(X([zn,Z,Bn,Z],V.or([Dn,Cn])),function(a){return[\"boundarySpaceDecl\",a]}),nq=V.map(X([zn,Z,jo,Z],V.or([Dn,Cn])),function(a){return[\"constructionDecl\",a]}),oq=V.map(X([zn,Z,ko,Z],V.or([lo,mo])),function(a){return[\"orderingModeDecl\",\na]}),pq=V.map(X([zn,Z,An,Z,mn,Z,cn,Z],V.or([Hn,In])),function(a){return[\"emptyOrderDecl\",a]}),qq=V.then(X([zn,Z,Jn,Z],jq),X([Y,am,Y],kq),function(a,b){return[\"copyNamespacesDecl\",[\"preserveMode\",a],[\"inheritMode\",b]]});function rq(a){switch(a[0]){case \"constantExpr\":case \"varRef\":case \"contextItemExpr\":case \"functionCallExpr\":case \"sequenceExpr\":case \"elementConstructor\":case \"computedElementConstructor\":case \"computedAttributeConstructor\":case \"computedDocumentConstructor\":case \"computedTextConstructor\":case \"computedCommentConstructor\":case \"computedNamespaceConstructor\":case \"computedPIConstructor\":case \"orderedExpr\":case \"unorderedExpr\":case \"namedFunctionRef\":case \"inlineFunctionExpr\":case \"dynamicFunctionInvocationExpr\":case \"mapConstructor\":case \"arrayConstructor\":case \"stringConstructor\":case \"unaryLookup\":return a}return[\"sequenceExpr\",\na]}function sq(a){if(!(1<=a&&55295>=a||57344<=a&&65533>=a||65536<=a&&1114111>=a))throw Error(\"XQST0090: The character reference \"+a+\" (\"+a.toString(16)+\") does not reference a valid codePoint.\");}\nfunction tq(a){return a.replace(/(&[^;]+);/g,function(b){if(/^&#x/.test(b))return b=parseInt(b.slice(3,-1),16),sq(b),String.fromCodePoint(b);if(/^&#/.test(b))return b=parseInt(b.slice(2,-1),10),sq(b),String.fromCodePoint(b);switch(b){case \"<\":return\"<\";case \">\":return\">\";case \"&\":return\"&\";case \""\":return String.fromCharCode(34);case \"'\":return String.fromCharCode(39)}throw Error('XPST0003: Unknown character reference: \"'+b+'\"');})}\nfunction uq(a,b,c){if(!a.length)return[];for(var d=[a[0]],e=1;e=b+c)return z;k=e.next(k);d++;return k}},f)}function Sq(a){return a.map(function(b){return C(b.type,19)?Kd(b,3):b})}\nfunction Tq(a){a=Sq(a);if(a.some(function(b){return Number.isNaN(b.value)}))return[y(NaN,3)];a=Ni(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");return a}\nfunction Uq(a,b,c,d,e,f){return $b([e,f],function(g){var k=t(g);g=k.next().value;k=k.next().value;if(Infinity===g.value)return E.empty();if(-Infinity===g.value)return k&&Infinity===k.value?E.empty():d;if(k){if(isNaN(k.value))return E.empty();Infinity===k.value&&(k=null)}return isNaN(g.value)?E.empty():Rq(d,Math.round(g.value),k?Math.round(k.value):null)})}\nfunction Vq(a,b,c,d,e){if(d.G())return e;a=Sq(d.N());a=Ni(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(f){return C(f.type,2)}))throw Error(\"FORG0006: items passed to fn:sum are not all numeric.\");b=a.reduce(function(f,g){return f+g.value},0);return a.every(function(f){return C(f.type,5)})?E.o(y(b,5)):a.every(function(f){return C(f.type,3)})?E.o(y(b,3)):a.every(function(f){return C(f.type,4)})?E.o(y(b,4)):E.o(y(b,6))};var Wq=[].concat(Mf,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"boolean\",l:[{type:59,g:2}],i:{type:0,g:3},m:function(a,b,c,d){return d.getEffectiveBooleanValue()?E.ca():E.X()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"true\",l:[],i:{type:0,g:3},m:function(){return E.ca()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"not\",l:[{type:59,g:2}],i:{type:0,g:3},m:function(a,b,c,d){return!1===d.getEffectiveBooleanValue()?E.ca():E.X()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"false\",l:[],i:{type:0,g:3},m:function(){return E.X()}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"last\",l:[],i:{type:5,g:3},m:function(a){if(null===a.M)throw Error(\"XPDY0002: The fn:last() function depends on dynamic context, which is absent.\");var b=!1;return E.create({next:function(){if(b)return z;var c=a.Ga.Na();b=!0;return B(y(c,5))}},1)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"position\",l:[],i:{type:5,g:3},m:function(a){if(null===\na.M)throw Error(\"XPDY0002: The fn:position() function depends on dynamic context, which is absent.\");return E.o(y(a.Ja+1,5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-dateTime\",l:[],i:{type:10,g:3},m:function(a){return E.o(y(Ic(a),10))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-date\",l:[],i:{type:7,g:3},m:function(a){return E.o(y(rc(Ic(a),7),7))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-time\",l:[],\ni:{type:8,g:3},m:function(a){return E.o(y(rc(Ic(a),8),8))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"implicit-timezone\",l:[],i:{type:17,g:3},m:function(a){return E.o(y(Jc(a),17))}}],Nf,Vf,Xf,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"years-from-duration\",l:[{type:18,g:0}],i:{type:5,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.cb(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"months-from-duration\",l:[{type:18,\ng:0}],i:{type:5,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.$a(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"days-from-duration\",l:[{type:18,g:0}],i:{type:5,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.Za(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"hours-from-duration\",l:[{type:18,g:0}],i:{type:5,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.getHours(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"minutes-from-duration\",l:[{type:18,g:0}],i:{type:5,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.getMinutes(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"seconds-from-duration\",l:[{type:18,g:0}],i:{type:4,g:0},m:function(a,b,c,d){return d.G()?d:E.o(y(d.first().value.getSeconds(),4))}}],Zf,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"id\",l:[{type:1,g:2},{type:53,g:3}],i:{type:54,g:2},m:Nq},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"id\",l:[{type:1,g:2}],i:{type:54,g:2},m:function(a,b,c,d){return Nq(a,b,c,d,E.o(a.M))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2},{type:53,g:3}],i:{type:53,g:2},m:Oq},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2}],i:{type:53,g:2},m:function(a,b,c,d){return Oq(a,b,c,d,E.o(a.M))}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"parse-json\",l:[{type:1,g:3}],i:{type:59,g:0},m:function(a,\nb,c,d){try{var e=JSON.parse(d.first().value)}catch(f){throw Error(\"FOJS0001: parsed JSON string contains illegal JSON.\");}return Pq(e)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"contains\",l:[{type:61,g:3},{type:46,g:3}],i:{type:0,g:3},m:function(a,b,c,d,e){return $b([d,e],function(f){f=t(f);var g=f.next().value,k=f.next().value;return g.h.some(function(l){return ac(l.key,k)})?E.ca():E.X()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"entry\",\nl:[{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(a,b,c,d,e){return d.map(function(f){return new cc([{key:f,value:rb(e)}])})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"for-each\",l:[{type:61,g:3},{type:59,g:2}],i:{type:59,g:2},m:function(a,b,c,d,e){return $b([d,e],function(f){f=t(f);var g=f.next().value,k=f.next().value;return Mc(g.h.map(function(l){return k.value.call(void 0,a,b,c,E.o(l.key),l.value())}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",\nlocalName:\"get\",l:[{type:61,g:3},{type:46,g:3}],i:{type:59,g:2},m:bc},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"keys\",l:[{type:61,g:3}],i:{type:46,g:2},m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;return E.create(e.h.map(function(f){return f.key}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",l:[{type:61,g:2},{type:61,g:3}],i:{type:61,g:3},m:Qq},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",\nl:[{type:61,g:2}],i:{type:61,g:3},m:function(a,b,c,d){return Qq(a,b,c,d,E.o(new cc([{key:y(\"duplicates\",1),value:function(){return E.o(y(\"use-first\",1))}}])))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"put\",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(a,b,c,d,e,f){return $b([d,e],function(g){g=t(g);var k=g.next().value,l=g.next().value;g=k.h.concat();k=g.findIndex(function(n){return ac(n.key,l)});0<=k?g.splice(k,1,{key:l,value:rb(f)}):g.push({key:l,\nvalue:rb(f)});return E.o(new cc(g))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"remove\",l:[{type:61,g:3},{type:46,g:2}],i:{type:61,g:3},m:function(a,b,c,d,e){return $b([d],function(f){var g=t(f).next().value.h.concat();return e.L(function(k){k.forEach(function(l){var n=g.findIndex(function(q){return ac(q.key,l)});0<=n&&g.splice(n,1)});return E.o(new cc(g))})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"size\",l:[{type:61,g:3}],i:{type:5,g:3},\nm:function(a,b,c,d){return d.map(function(e){return y(e.h.length,5)})}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"pi\",l:[],i:{type:3,g:3},m:function(){return E.o(y(Math.PI,3))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.pow(Math.E,e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp10\",l:[{type:3,g:0}],i:{type:3,\ng:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.pow(10,e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.log(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log10\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.log10(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"pow\",l:[{type:3,g:0},{type:2,g:3}],i:{type:3,g:0},m:function(a,b,c,d,e){return e.L(function(f){var g=t(f).next().value;return d.map(function(k){return 1!==Math.abs(k.value)||Number.isFinite(g.value)?y(Math.pow(k.value,g.value),3):y(1,3)})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"sqrt\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.sqrt(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"sin\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.sin(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"cos\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.cos(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"tan\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.tan(e.value),3)})}},\n{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"asin\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.asin(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"acos\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,c,d){return d.map(function(e){return y(Math.acos(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan\",l:[{type:3,g:0}],i:{type:3,g:0},m:function(a,b,\nc,d){return d.map(function(e){return y(Math.atan(e.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan2\",l:[{type:3,g:0},{type:3,g:3}],i:{type:3,g:0},m:function(a,b,c,d,e){return e.L(function(f){var g=t(f).next().value;return d.map(function(k){return y(Math.atan2(k.value,g.value),3)})})}}],Fe,ie,[{namespaceURI:\"http://fontoxpath/operators\",localName:\"to\",l:[{type:5,g:0},{type:5,g:0}],i:{type:5,g:2},m:function(a,b,c,d,e){a=d.first();e=e.first();if(null===a||null===\ne)return E.empty();var f=a.value;e=e.value;return f>e?E.empty():E.create({next:function(){return B(y(f++,5))}},e-f+1)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"QName\",l:[{type:1,g:0},{type:1,g:3}],i:{type:23,g:3},m:function(a,b,c,d,e){return $b([d,e],function(f){var g=t(f);f=g.next().value;g=g.next().value.value;if(!Yc(g,23))throw Error(\"FOCA0002: The provided QName is invalid.\");f=f?f.value||null:null;if(null===f&&g.includes(\":\"))throw Error(\"FOCA0002: The URI of a QName may not be empty if a prefix is provided.\");\nif(d.G())return E.o(y(new Ab(\"\",null,g),23));if(!g.includes(\":\"))return E.o(y(new Ab(\"\",f,g),23));var k=t(g.split(\":\"));g=k.next().value;k=k.next().value;return E.o(y(new Ab(g,f,k),23))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"prefix-from-QName\",l:[{type:23,g:0}],i:{type:24,g:0},m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;if(null===e)return E.empty();e=e.value;return e.prefix?E.o(y(e.prefix,24)):E.empty()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"local-name-from-QName\",l:[{type:23,g:0}],i:{type:24,g:0},m:function(a,b,c,d){return d.map(function(e){return y(e.value.localName,24)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"namespace-uri-from-QName\",l:[{type:23,g:0}],i:{type:20,g:0},m:function(a,b,c,d){return d.map(function(e){return y(e.value.namespaceURI||\"\",20)})}}],[{l:[{type:59,g:2}],m:function(a,b,c,d){return d.$({empty:function(){return E.ca()},multiple:function(){return E.X()},o:function(){return E.X()}})},\nlocalName:\"empty\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,b,c,d){return d.$({empty:function(){return E.X()},multiple:function(){return E.ca()},o:function(){return E.ca()}})},localName:\"exists\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,b,c,d){return Rq(d,1,1)},localName:\"head\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,\nb,c,d){return Rq(d,2,null)},localName:\"tail\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(a,b,c,d,e,f){if(d.G())return f;if(f.G())return d;a=d.N();e=e.first().value-1;0>e?e=0:e>a.length&&(e=a.length);b=a.slice(e);return E.create(a.slice(0,e).concat(f.N(),b))},localName:\"insert-before\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(a,b,c,d,e){a=e.first().value;\nd=d.N();if(!d.length||1>a||a>d.length)return E.create(d);d.splice(a-1,1);return E.create(d)},localName:\"remove\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,b,c,d){return d.L(function(e){return E.create(e.reverse())})},localName:\"reverse\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(a,b,c,d,e){return Uq(a,b,c,d,e,E.empty())},localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\ni:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:Uq,localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,b,c,d){return d},localName:\"unordered\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:46,g:2}],m:function(a,b,c,d){var e=Vc(d,b).N();return E.create(e).filter(function(f,g){return e.slice(0,g).every(function(k){return!Ie(f,k)})})},localName:\"distinct-values\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\ni:{type:46,g:2}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"distinct-values\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(a,b,c,d,e){return e.L(function(f){var g=t(f).next().value;return Vc(d,b).map(function(k,l){return si(\"eqOp\",k.type,g.type)(k,g,a)?y(l+1,5):y(-1,5)}).filter(function(k){return-1!==k.value})})},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\ni:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(a,b,c,d,e){var f=!1,g=Le(a,b,c,d,e);return E.create({next:function(){if(f)return z;var k=g.next(0);if(k.done)return k;f=!0;return B(y(k.value,0))}})},localName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:0,\ng:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,b,c,d){var e=!1;return E.create({next:function(){if(e)return z;var f=d.Na();e=!0;return B(y(f,5))}})},localName:\"count\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:5,g:3}},{l:[{type:46,g:2}],m:function(a,b,c,d){if(d.G())return d;a=Sq(d.N());\na=Ni(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(e){return C(e.type,2)}))throw Error(\"FORG0006: items passed to fn:avg are not all numeric.\");b=a.reduce(function(e,f){return e+f.value},0)/a.length;return a.every(function(e){return C(e.type,5)||C(e.type,3)})?E.o(y(b,3)):a.every(function(e){return C(e.type,4)})?E.o(y(b,4)):E.o(y(b,6))},localName:\"avg\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:0}},{l:[{type:46,g:2}],\nm:function(a,b,c,d){if(d.G())return d;a=Tq(d.N());return E.o(a.reduce(function(e,f){return e.value\nf.value?f:e}))},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:0}},{l:[{type:46,g:2}],m:function(a,b,c,d){return Vq(a,b,c,d,E.o(y(0,5)))},localName:\"sum\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:Vq,localName:\"sum\",\nnamespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:46,g:0}},{l:[{type:59,g:2}],m:function(a,b,c,d){if(!d.G()&&!d.ya())throw Error(\"FORG0003: The argument passed to fn:zero-or-one contained more than one item.\");return d},localName:\"zero-or-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,b,c,d){if(d.G())throw Error(\"FORG0004: The argument passed to fn:one-or-more was empty.\");return d},localName:\"one-or-more\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\ni:{type:59,g:1}},{l:[{type:59,g:2}],m:function(a,b,c,d){if(!d.ya())throw Error(\"FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.\");return d},localName:\"exactly-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,b,c,d,e){if(d.G())return d;var f=e.first(),g=f.s;if(1!==g.length)throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return d.filter(function(k){k=\nae(g[0],E.o(k),b,\"fn:filter\",!1);k=f.value.call(void 0,a,b,c,k);if(!k.ya()||!C(k.first().type,0))throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return k.first().value})},localName:\"filter\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,b,c,d,e){if(d.G())return d;var f=e.first(),g=f.s;if(1!==g.length)throw Error(\"XPTY0004: signature of function passed to fn:for-each is incompatible.\");var k=d.value,\nl;return E.create({next:function(n){for(;;){if(!l){var q=k.next(0);if(q.done)return q;q=ae(g[0],E.o(q.value),b,\"fn:for-each\",!1);l=f.value.call(void 0,a,b,c,q).value}q=l.next(n);if(!q.done)return q;l=null}}})},localName:\"for-each\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,b,c,d,e,f){if(d.G())return d;var g=f.first(),k=g.s;if(2!==k.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-left is incompatible.\");\nreturn d.L(function(l){return l.reduce(function(n,q){n=ae(k[0],n,b,\"fn:fold-left\",!1);q=ae(k[1],E.o(q),b,\"fn:fold-left\",!1);return g.value.call(void 0,a,b,c,n,q)},e)})},localName:\"fold-left\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,b,c,d,e,f){if(d.G())return d;var g=f.first(),k=g.s;if(2!==k.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-right is incompatible.\");return d.L(function(l){return l.reduceRight(function(n,\nq){n=ae(k[0],n,b,\"fn:fold-right\",!1);q=ae(k[1],E.o(q),b,\"fn:fold-right\",!1);return g.value.call(void 0,a,b,c,q,n)},e)})},localName:\"fold-right\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,b,c,d){if(!b.j)throw Error(\"serialize() called but no xmlSerializer set in execution parameters.\");a=d.N();if(!a.every(function(e){return C(e.type,53)}))throw Error(\"Expected argument to fn:serialize to resolve to a sequence of Nodes.\");return E.o(y(a.map(function(e){return b.j.serializeToString(kj(e.value,\nb,!1))}),1))},localName:\"serialize\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:1,g:3}}],ue,[{l:[{type:59,g:3},{type:61,g:3}],m:function(a,b,c,d,e){var f,g;return E.create({next:function(){if(!f){var k=Lq(d,e,c,b);f=k.Gc;g=k.Dc}try{return f.next(0)}catch(l){bg(g.value,l)}}})},localName:\"evaluate\",namespaceURI:\"http://fontoxml.com/fontoxpath\",i:{type:59,g:2}},{l:[],m:function(){return E.o(y(\"undefined\"===typeof VERSION?\"devbuild\":VERSION,1))},localName:\"version\",namespaceURI:\"http://fontoxml.com/fontoxpath\",\ni:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(a,b,c,d,e){return $b([d,e],function(f){var g=t(f);f=g.next().value;g=g.next().value;var k=c.za(f.value.namespaceURI,f.value.localName,g.value);if(null===k)return E.empty();f=new Bb({l:k.l,arity:g.value,localName:f.value.localName,namespaceURI:f.value.namespaceURI,i:k.i,value:k.m});return E.o(f)})},localName:\"function-lookup\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{g:0,type:60}},{l:[{type:60,g:3}],m:function(a,b,c,d){return $b([d],\nfunction(e){e=t(e).next().value;return e.Pa()?E.empty():E.o(y(new Ab(\"\",e.u,e.j),23))})},localName:\"function-name\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:23,g:0}},{l:[{type:60,g:3}],m:function(a,b,c,d){return $b([d],function(e){e=t(e).next().value;return E.o(y(e.A,5))})},localName:\"function-arity\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",i:{type:5,g:3}}]);function Xq(a){this.h=a}h=Xq.prototype;h.createAttributeNS=function(a,b){return this.h.createAttributeNS(a,b)};h.createCDATASection=function(a){return this.h.createCDATASection(a)};h.createComment=function(a){return this.h.createComment(a)};h.createDocument=function(){return this.h.createDocument()};h.createElementNS=function(a,b){return this.h.createElementNS(a,b)};h.createProcessingInstruction=function(a,b){return this.h.createProcessingInstruction(a,b)};h.createTextNode=function(a){return this.h.createTextNode(a)};var Yq=Symbol(\"IS_XPATH_VALUE_SYMBOL\");function Zq(a){return function(b,c){b=Dc(new Mb(null===c?new Gb:c),b,xb(a));c={};return c[Yq]=!0,c.Db=b,c}};Wq.forEach(function(a){ig(a.namespaceURI,a.localName,a.l,a.i,a.m)});function $q(a){return a&&\"object\"===typeof a&&\"lookupNamespaceURI\"in a?function(b){return a.lookupNamespaceURI(b||null)}:function(){return null}}function ar(a){return function(b){var c=b.localName;return b.prefix?null:{namespaceURI:a,localName:c}}}\nfunction br(a,b,c,d,e,f){var g,k,l,n,q,u,v;if(null===d||void 0===d)d=d||{};e?(g=e.logger||{trace:console.log.bind(console)},k=e.documentWriter,l=e.moduleImports,n=e.namespaceResolver,q=e.functionNameResolver,u=e.nodesFactory,v=e.xmlSerializer):(g={trace:console.log.bind(console)},l={},n=null,u=null,k=null,v=null,q=void 0);var A=new Mb(null===c?new Gb:c);c=l||Object.create(null);l=void 0===e.defaultFunctionNamespaceURI?\"http://www.w3.org/2005/xpath-functions\":e.defaultFunctionNamespaceURI;var G=Kq(a,\nf,n||$q(b),d,c,l,q||ar(l));a=b?Ec(A,b):E.empty();b=!u&&f.aa?new ef(b):new Xq(u);k=k?new Jb(k):Ib;u=Object.keys(d).reduce(function(fa,ea){var Ea=d[ea];fa[\"Q{}\"+ea+\"[0]\"]=Ea&&\"object\"===typeof Ea&&Yq in Ea?function(){return E.create(Ea.Db)}:function(){return Ec(A,d[ea])};return fa},Object.create(null));n={};q=t(Object.keys(G.ia.Da));for(c=q.next();!c.done;n={Wa:n.Wa},c=q.next())n.Wa=c.value,u[n.Wa]||(u[n.Wa]=function(fa){return function(){return(0,G.ia.Da[fa.Wa])(H,L)}}(n));var H=new Fc({M:a.first(),\nJa:0,Ga:a,Ea:u});var L=new Lc(f.debug,f.Ha,A,b,k,e.currentContext,g,v);return{xb:H,zb:L,da:G.da}};function cr(a,b){var c={},d=0,e=!1,f=null;return{next:function(){if(e)return z;for(var g={};d {\\n\\t\\t\\t\\t\\tconst result = \"+a+\".next();\\n\\t\\t\\t\\t\\treturn result.done ? false : !!result.value;\\n\\t\\t\\t\\t})()\",{type:0});case 5:throw Error(\"Trying to get value of generated code with type None\");default:throw Error(\"Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.\");\n}}var cu={DONE_TOKEN:z,getEffectiveBooleanValue:lb,isSubtypeOf:C,ready:B};var du={qc:\"pathExpr\",Ob:\"andOp\",pc:\"orOp\",sc:\"stringConstantExpr\",Sb:\"equalOp\",nc:\"notEqualOp\",dc:\"lessThanOrEqualOp\",cc:\"lessThanOp\",Yb:\"greaterThanOrEqualOp\",Xb:\"greaterThanOp\",Tb:\"eqOp\",jc:\"neOp\",fc:\"ltOp\",ec:\"leOp\",Zb:\"gtOp\",Wb:\"geOp\",ac:\"isOp\",mc:\"nodeBeforeOp\",lc:\"nodeAfterOp\",Vb:\"functionCallExpr\"},eu=Object.values(du);\nfunction fu(a,b,c,d,e){a=M(a,c);a=M(a,eu);if(!a)return[au(\"Unsupported: a base expression used with an operand.\"),null];b+=c;c=t(d.yb(a,b,d));d=c.next().value;c=c.next().value;return d.isAstAccepted?0===e?[bu(b,d.code,d.xa),null]:[Dr(b,d.xa,[d.code]),c]:[d,null]};function gu(a,b,c){4===b&&(a+=\".next().value\");47===c&&(a=\"(function () { const attr = \"+a+\"; return attr ? domFacade.getData(attr) : null})()\");return a}\nfunction hu(a,b,c,d,e){var f=O(M(a,\"firstOperand\")[1],\"type\");a=O(M(a,\"secondOperand\")[1],\"type\");if(!f||!a)return au(\"Left or right type of compare are not found, annotation failed.\");var g=[47,1];if(!g.includes(f.type)||!g.includes(a.type))return au(\"Unsupported types in compare: [\"+tb[f.type]+\", \"+tb[a.type]+\"]\");if(!c.isAstAccepted)return c;if(!d.isAstAccepted)return d;if(!f||!a)return au(\"Operands in compare weren't annotated\");g=new Map([[\"eqOp\",\"===\"],[\"neOp\",\"!==\"]]);if(!g.has(b))return au(b+\n\" not yet implemented\");b=g.get(b);g=Cr(c.code,c.xa);var k=Cr(d.code,d.xa);return Dr(\"function \"+e+\"(contextItem) {\\n\\t\\t\\t\\t\"+c.ta.join(\"\\n\")+\"\\n\\t\\t\\t \\t\"+d.ta.join(\"\\n\")+\"\\n\\t \\t \\treturn \"+gu(g[0],g[1].type,f.type)+\" \"+b+\" \"+gu(k[0],k[1].type,a.type)+\";\\n\\t\\t}\",{type:3,i:{type:0}})}var iu={},ju=(iu.equalOp=\"eqOp\",iu.notEqualOp=\"neOp\",iu.lessThanOrEqualOp=\"leOp\",iu.lessThanOp=\"ltOp\",iu.greaterThanOrEqualOp=\"geOp\",iu.greaterThanOp=\"gtOp\",iu);var mu={\"local-name\":ku,name:lu};function nu(a){return\"(\"+a+\".localName || \"+a+\".target || '')\"}function ou(a){return\"(((\"+a+\".prefix || '').length !== 0 ? \"+a+\".prefix + ':' : '')\\n\\t\\t+ (\"+a+\".localName || \"+a+\".target || ''))\"}\nfunction pu(a,b,c,d,e){a=M(a,\"arguments\");if(1===a.length)b=\"function \"+b+\"(contextItem) {\\n\\t\\t\\tif (contextItem === undefined || contextItem === null) {\\n\\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\\n}\\n\\t\\t\\treturn \"+d(\"contextItem\")+\";\\n\\t\\t}\";else if(2===a.length)if(e=a[1],c=t(c.yb(e,\"arg\",c)),a=c.next().value,c.next(),c=a.isAstAccepted?Dr(\"arg\",a.xa,[a.code]):a,\"contextItemExpr\"===e[0])b=\"function \"+b+\"(contextItem) {\\n\\t\\t\\t\\tif (contextItem === undefined || contextItem === null) {\\n\\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\\n}\\n\\t\\t\\t\\treturn \"+\nd(\"contextItem\")+\";\\n\\t\\t\\t}\";else{if(!c.isAstAccepted)return c;b=\"function \"+b+\"(contextItem) {\\n\\t\\t\\t\\t\"+c.ta+\"\\n\\t\\t\\t\\tconst value = \"+Cr(c.code,c.xa)[0]+';\\n\\t\\t\\t\\tconst childElement = value.next().value;\\n\\t\\t\\t\\treturn (value.done ? \"\" : '+d(\"childElement\")+\");\\n\\t\\t\\t}\"}else return au(\"Incorrect arg count for \"+e+\" function\");return Dr(b,{type:3,i:{type:0}})}function lu(a,b,c){return pu(a,b,c,ou,\"name()\")}function ku(a,b,c){return pu(a,b,c,nu,\"local-name()\")};function qu(a){return JSON.stringify(a).replace(/\\u2028/g,\"\\\\u2028\").replace(/\\u2029/g,\"\\\\u2029\")};function ru(a,b,c,d){var e=t(fu(a,b,\"firstOperand\",c,0)),f=e.next().value;e=e.next().value;if(!f.isAstAccepted)return[f,null];c=t(fu(a,b,\"secondOperand\",c,0));a=c.next().value;c=c.next().value;return a.isAstAccepted?[Dr(\"\\n\\tfunction \"+b+\"(contextItem) {\\n\\t\\t\"+f.ta.join(\"\\n\")+\"\\n\\t\\t\"+a.ta.join(\"\\n\")+\"\\n\\t\\treturn \"+f.code+\" \"+d+\" \"+a.code+\";\\n\\t}\\n\\t\",{type:3,i:{type:0}}),\"&&\"===d?Ah(e,c):e||c]:[a,null]};function su(a){for(var b=[],c=0;c {\\n\\t\\t\\t\"+a.code+\"\\n\\t\\t\\treturn DONE_TOKEN;\\n\\t\\t};\\n\\t\\treturn {\\n\\t\\t\\tnext,\\n\\t\\t\\t[Symbol.iterator]() { return this; }\\n\\t\\t};\\n\\t}\\n\\t\",{type:3,i:{type:4}}),e]:[a,null];case du.Ob:return ru(a,b,c,\"&&\");case du.pc:return ru(a,b,c,\"||\");case du.sc:return a=M(a,\"value\")[1]||\"\",a=qu(a),[Dr(\"const \"+b+\" = \"+a+\";\",{type:1}),null];case du.Sb:case du.nc:case du.dc:case du.cc:case du.Yb:case du.Xb:case du.Tb:case du.jc:case du.fc:case du.ec:case du.Zb:case du.Wb:case du.ac:case du.mc:case du.lc:a:{var f=\nt(fu(a,b,\"firstOperand\",c));e=f.next().value;f.next();if(e.isAstAccepted)if(f=t(fu(a,b,\"secondOperand\",c)),c=f.next().value,f.next(),c.isAstAccepted)switch(d){case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":b=hu(a,d,e,c,b);break a;case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":f=O(a,\"type\");var g=O(a,\"type\");b=f&&g?3===f.g&&3===g.g?hu(a,ju[d],e,c,b):au(\"generalCompare with sequences is still in development\"):\nau(\"types of compare are not known\");break a;default:b=au(\"Unsupported compare type\")}else b=c;else b=e}return[b,null];case du.Vb:return d=N(M(a,\"functionName\")),[void 0!==mu[d]?mu[d](a,b,c):au(\"Unsupported function: \"+d),null];default:return[au(\"Unsupported: the base expression '\"+d+\"'.\"),null]}};function Bu(a,b,c){switch(a){case 9:c=t(Cr(\"compiledXPathExpression\",b));a=c.next().value;if(4!==c.next().value.type)throw Error(\"Trying access generated code as an iterator while this is not the case.\");return Dr(\"\\n\\tconst firstResult = \"+a+\".next();\\n\\tif (!firstResult.done) {\\n\\t\\treturn firstResult.value\\n\\t}\\n\\treturn null;\\n\\t\",{type:2});case 7:return c=t(Cr(\"compiledXPathExpression\",b)),a=c.next().value,4!==c.next().value.type?au(\"Return type was not an iterator\"):Dr(\"\\n\\tconst nodes = [];\\n\\tfor (const node of \"+\na+\") {\\n\\t\\tnodes.push(node);\\n\\t}\\n\\treturn nodes;\\n\\t\",{type:2});case 3:return c=bu(\"compiledXPathExpression\",\"\",b),c.isAstAccepted?Dr(\"return \"+c.code+\";\",{type:2}):c;case 2:return void 0===c?c=au(\"Full AST wasn't annotated so we cannot correctly emit a string return\"):C(c,1)||C(c,47)?(b=t(Cr(\"compiledXPathExpression\",b)),a=b.next().value,b=b.next().value,c=Dr(\"return \"+gu(a,b.type,c)+\" || '';\",{type:2})):c=au(\"Not implemented: returning anything but strings and attributes from codegen\"),c;default:return au(\"Unsupported: the return type '\"+\na+\"'.\")}}\nfunction Cu(a,b,c){var d=M(a,\"mainModule\");if(!d)return au(\"Unsupported: Can not execute a library module.\");if(M(d,\"prolog\"))return au(\"Unsupported: XQuery.\");d=P(d,[\"queryBody\",\"*\"]);c.yb=Au;var e=t(Au(d,\"compiledXPathExpression\",c));c=e.next().value;e.next();if(!1===c.isAstAccepted)return c;e=c.ta?c.ta.join(\"\\n\"):\"\";d=O(d,\"type\");b=Bu(b,c.xa,d?d.type:void 0);if(!1===b.isAstAccepted)return b;b=e+c.code+b.code;c=\"\\n\\treturn (contextItem, domFacade, runtimeLib) => {\\n\\t\\tconst {\\n\\t\\t\\tDONE_TOKEN,\\n\\t\\t\\tValueType,\\n\\t\\t\\tXPDY0002,\\n\\t\\t\\tdeterminePredicateTruthValue,\\n\\t\\t\\tisSubtypeOf,\\n\\t\\t\\tready,\\n\\t\\t\\tatomize,\\n\\t\\t} = runtimeLib;\";Du(a)&&\n(c+='\\n\\t\\tif (!contextItem) {\\n\\t\\t\\tthrow XPDY0002(\"Context is needed to evaluate the given path expression.\");\\n\\t\\t}\\n\\n\\t\\tif (!contextItem.nodeType) {\\n\\t\\t\\tthrow new Error(\"Context item must be subtype of node().\");\\n\\t\\t}\\n\\t\\t');return{code:c+(b+\"}\\n//# sourceURL=generated.js\"),isAstAccepted:!0}}function Du(a){var b=Q(a,\"*\");if(\"pathExpr\"===a[0])return!0;a=t(b);for(b=a.next();!b.done;b=a.next())if(Du(b.value))return!0;return!1};function Eu(a,b,c){c=c||{};b=b||0;\"string\"===typeof a?(a=Wk(a),a=Eq(a,{aa:\"XQuery3.1\"===c.language||\"XQueryUpdate3.1\"===c.language,debug:!1})):a=Sk(a);var d=M(a,\"mainModule\");if(!d)return au(\"Unsupported: XQuery Library modules are not supported.\");if(M(d,\"prolog\"))return au(\"Unsupported: XQuery Prologs are not supported.\");d={ba:c.namespaceResolver||$q(null)};c=new th(new xg(new lg(d.ba,{},void 0===c.defaultFunctionNamespaceURI?\"http://www.w3.org/2005/xpath-functions\":c.defaultFunctionNamespaceURI,\nc.functionNameResolver||ar(\"http://www.w3.org/2005/xpath-functions\"))));T(a,c);return Cu(a,b,d)};function Fu(a,b,c){c=c?c:new Gb;return a()(b,c,cu)};var Gu={},Hu=(Gu[\"http://www.w3.org/2005/XQueryX\"]=\"xqx\",Gu[\"http://www.w3.org/2007/xquery-update-10\"]=\"xquf\",Gu[\"http://fontoxml.com/fontoxpath\"]=\"x\",Gu);\nfunction Iu(a,b){switch(a){case \"copySource\":case \"insertAfter\":case \"insertAsFirst\":case \"insertAsLast\":case \"insertBefore\":case \"insertInto\":case \"modifyExpr\":case \"newNameExpr\":case \"replacementExpr\":case \"replaceValue\":case \"returnExpr\":case \"sourceExpr\":case \"targetExpr\":case \"transformCopies\":case \"transformCopy\":return{localName:a,rb:b||\"http://www.w3.org/2005/XQueryX\"};case \"deleteExpr\":case \"insertExpr\":case \"renameExpr\":case \"replaceExpr\":case \"transformExpr\":return{localName:a,rb:\"http://www.w3.org/2007/xquery-update-10\"};\ncase \"x:stackTrace\":return{localName:\"stackTrace\",rb:\"http://fontoxml.com/fontoxpath\"};default:return{localName:a,rb:\"http://www.w3.org/2005/XQueryX\"}}}\nfunction Ju(a,b,c,d,e){if(\"string\"===typeof c)return 0===c.length?null:b.createTextNode(c);if(!Array.isArray(c))throw new TypeError(\"JsonML element should be an array or string\");var f=Iu(c[0],d);d=f.rb;f=b.createElementNS(d,Hu[d]+\":\"+f.localName);var g=c[1],k=1;if(\"object\"===typeof g&&!Array.isArray(g)){if(null!==g){k=t(Object.keys(g));for(var l=k.next();!l.done;l=k.next()){l=l.value;var n=g[l];null!==n&&(\"type\"===l?void 0!==n&&a.setAttributeNS(f,d,\"fontoxpath:\"+l,vb(n)):e&&\"prefix\"===l&&\"\"===n||\na.setAttributeNS(f,d,Hu[d]+\":\"+l,n))}}k=2}g=k;for(k=c.length;g !bucket || getBucketsForNode(childNode).includes(bucket),\n );\n return matchingNodes;\n }\n*/\n\n getChildNodes(node, bucket) {\n const matchingNodes = Array.from(node.childNodes).filter(\n childNode => !bucket || getBucketsForNode(childNode).includes(bucket),\n );\n matchingNodes.forEach(matchingNode => this._onNodeTouched(matchingNode));\n return matchingNodes;\n }\n\n /**\n * Get the data of this node.\n *\n * @param node -\n */\n getData(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n this._onNodeTouched(node);\n return node.value;\n }\n // Text node\n this._onNodeTouched(node.parentNode);\n return node.data;\n }\n\n /**\n * Get the first child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n getFirstChild(node, bucket) {\n for (const child of node.childNodes) {\n if (!bucket || getBucketsForNode(child).includes(bucket)) {\n this._onNodeTouched(node);\n return child;\n }\n }\n return null;\n }\n\n /**\n * Get the last child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getLastChild(node, bucket) {\n const matchingNodes = node\n .getChildNodes()\n .filter(childNode => !bucket || getBucketsForNode(childNode).includes(bucket));\n const matchNode = matchingNodes[matchingNodes.length - 1];\n if (matchNode) {\n return matchNode;\n }\n return null;\n }\n\n /**\n * Get the next sibling of this node\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the nextSibling that is requested.\n */\n // eslint-disable-next-line class-methods-use-this\n getNextSibling(node, bucket) {\n for (let { nextSibling } = node; nextSibling; nextSibling = nextSibling.nextSibling) {\n if (!getBucketsForNode(nextSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n return nextSibling;\n }\n return null;\n }\n\n /**\n * Get the parent of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getParentNode(node) {\n return node.parentNode;\n }\n\n /**\n * Get the previous sibling of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getPreviousSibling(node, bucket) {\n for (\n let { previousSibling } = node;\n previousSibling;\n previousSibling = previousSibling.previousSibling\n ) {\n if (!getBucketsForNode(previousSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n return previousSibling;\n }\n return null;\n }\n}\n","import * as fx from 'fontoxpath';\n\n/**\n * Checks wether the specified path expression is an absolute path.\n *\n * @param path the path expression.\n * @return true if specified path expression is an absolute\n * path, otherwise false.\n */\n\nexport class XPathUtil {\n static getParentBindingElement(start) {\n /* if (start.parentNode.host) {\n const { host } = start.parentNode;\n if (host.hasAttribute('ref')) {\n return host;\n }\n } else */\n if (start.parentNode && start.parentNode.nodeType !== Node.DOCUMENT_NODE) {\n if (start.parentNode.hasAttribute('ref')) {\n return start.parentNode;\n }\n XPathUtil.getParentBindingElement(start.parentNode);\n }\n return null;\n }\n\n static isAbsolutePath(path) {\n return path != null && (path.startsWith('/') || path.startsWith('instance('));\n }\n\n static isRepeated(element) {\n return element.parentElement.closest('fx-repeatitem');\n }\n\n static isSelfReference(ref) {\n return ref === '.' || ref === './text()' || ref === 'text()' || ref === '' || ref === null;\n }\n\n static getDefaultInstance(boundElement) {\n // const fore = boundElement.closest('fx-fore');\n const fore = XPathUtil.getForeElement(boundElement);\n const defaultInstance = fore.querySelector('fx-instance');\n if (!defaultInstance) {\n throw new Error('no default instance present');\n }\n return defaultInstance;\n }\n\n static getForeElement(start) {\n if (start.nodeName === 'FX-FORE') {\n return start;\n }\n if (start.parentNode) {\n return XPathUtil.getForeElement(start.parentNode);\n }\n throw new Error('no Fore element present');\n }\n\n /**\n * returns the instance id from a complete XPath using `instance()` function.\n *\n * Will return 'default' in case no ref is given at all or the `instance()` function is called without arg.\n *\n * Otherwise instance id is extracted from function and returned. If all fails null is returned.\n * @param ref\n * @returns {string}\n */\n static getInstanceId(ref) {\n if (!ref) {\n return 'default';\n }\n if (ref.startsWith('instance()')) {\n return 'default';\n }\n if (ref.startsWith('instance(')) {\n const result = ref.substring(ref.indexOf('(') + 1);\n return result.substring(1, result.indexOf(')') - 1);\n }\n return null;\n }\n\n // todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node) {\n const path = fx.evaluateXPath('path()', node);\n /*\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if (instanceId !== null && instanceId !== 'default') {\n return `#${instanceId}${XPathUtil.shortenPath(path)}`;\n }\n*/\n return XPathUtil.shortenPath(path);\n }\n\n static shortenPath(path) {\n const tmp = path.replaceAll(/(Q{(.*?)\\})/g, '');\n // cut off leading slash\n const tmp1 = tmp.substring(1, tmp.length);\n // ### cut-off root node ref\n return tmp1.substring(tmp1.indexOf('/'), tmp.length);\n }\n\n static getBasePath(dep) {\n const split = dep.split(':');\n return split[0];\n }\n}\n","/**\n * A simple dependency graph\n *\n * based on the work of https://github.com/jriecken/dependency-graph but working on ES6.\n *\n * Furthermore instead of the DepGraphCycleError a compute-exception event is dispatched.\n *\n *\n */\n\n/**\n * Cycle error, including the path of the cycle.\n */\n// const DepGraphCycleError = (exports.DepGraphCycleError = function (cyclePath) {\n\n/*\nexport function DepGraphCycleError(cyclePath) {\n const message = \"Dependency Cycle Found: \" + cyclePath.join(\" -> \");\n const instance = new Error(message);\n instance.cyclePath = cyclePath;\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n if (Error.captureStackTrace) {\n Error.captureStackTrace(instance, DepGraphCycleError);\n }\n return instance;\n};\n\nDepGraphCycleError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: Error,\n enumerable: false,\n writable: true,\n configurable: true\n }\n});\nObject.setPrototypeOf(DepGraphCycleError, Error);\n*/\n\n/**\n * Helper for creating a Topological Sort using Depth-First-Search on a set of edges.\n *\n * Detects cycles and throws an Error if one is detected (unless the \"circular\"\n * parameter is \"true\" in which case it ignores them).\n *\n * @param edges The set of edges to DFS through\n * @param leavesOnly Whether to only return \"leaf\" nodes (ones who have no edges)\n * @param result An array in which the results will be populated\n * @param circular A boolean to allow circular dependencies\n */\nfunction createDFS(edges, leavesOnly, result, circular) {\n const visited = {};\n // eslint-disable-next-line func-names\n return function(start) {\n // console.log('start ', start);\n if (visited[start]) {\n return;\n }\n const inCurrentPath = {};\n const currentPath = [];\n const todo = []; // used as a stack\n todo.push({ node: start, processed: false });\n while (todo.length > 0) {\n const current = todo[todo.length - 1]; // peek at the todo stack\n const { processed } = current;\n const { node } = current;\n if (!processed) {\n // Haven't visited edges yet (visiting phase)\n if (visited[node]) {\n todo.pop();\n // eslint-disable-next-line no-continue\n continue;\n } else if (inCurrentPath[node]) {\n // It's not a DAG\n if (circular) {\n todo.pop();\n // If we're tolerating cycles, don't revisit the node\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPath.push(node);\n window.dispatchEvent(\n new CustomEvent('compute-exception', {\n composed: true,\n bubbles: true,\n detail: {\n path: currentPath,\n message: 'cyclic graph',\n },\n }),\n );\n // return;\n // console.log('‘circular path: ' + currentPath);\n // throw new DepGraphCycleError(currentPath);\n\n // Stop all processing. This form is broken and we should not break the browser\n throw new Error(`Cyclic at ${currentPath}`);\n }\n\n inCurrentPath[node] = true;\n currentPath.push(node);\n const nodeEdges = edges[node];\n // (push edges onto the todo stack in reverse order to be order-compatible with the old DFS implementation)\n for (let i = nodeEdges.length - 1; i >= 0; i -= 1) {\n todo.push({ node: nodeEdges[i], processed: false });\n }\n current.processed = true;\n } else {\n // Have visited edges (stack unrolling phase)\n todo.pop();\n currentPath.pop();\n inCurrentPath[node] = false;\n visited[node] = true;\n if (!leavesOnly || edges[node].length === 0) {\n result.push(node);\n }\n }\n }\n };\n}\n\n/**\n * Simple Dependency Graph\n */\n\n/*\nvar DepGraph = (exports.DepGraph = function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n});\n*/\n\nexport function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n}\n\nDepGraph.prototype = {\n /**\n * The number of nodes in the graph.\n */\n size() {\n return Object.keys(this.nodes).length;\n },\n /**\n * Add a node to the dependency graph. If a node already exists, this method will do nothing.\n */\n addNode(node, data) {\n if (!this.hasNode(node)) {\n // Checking the arguments length allows the user to add a node with undefined data\n if (arguments.length === 2) {\n this.nodes[node] = data;\n } else {\n this.nodes[node] = node;\n }\n this.outgoingEdges[node] = [];\n this.incomingEdges[node] = [];\n }\n },\n /**\n * Remove a node from the dependency graph. If a node does not exist, this method will do nothing.\n */\n removeNode(node) {\n if (this.hasNode(node)) {\n delete this.nodes[node];\n delete this.outgoingEdges[node];\n delete this.incomingEdges[node];\n // [this.incomingEdges, this.outgoingEdges].forEach(function (edgeList) {\n [this.incomingEdges, this.outgoingEdges].forEach(edgeList => {\n Object.keys(edgeList).forEach(key => {\n const idx = edgeList[key].indexOf(node);\n if (idx >= 0) {\n edgeList[key].splice(idx, 1);\n }\n }, this);\n });\n }\n },\n /**\n * Check if a node exists in the graph\n */\n hasNode(node) {\n // return this.nodes.hasOwnProperty(node);\n\n return Object.prototype.hasOwnProperty.call(this.nodes, node);\n },\n /**\n * Get the data associated with a node name\n */\n getNodeData(node) {\n if (this.hasNode(node)) {\n return this.nodes[node];\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Set the associated data for a given node name. If the node does not exist, this method will throw an error\n */\n setNodeData(node, data) {\n if (this.hasNode(node)) {\n this.nodes[node] = data;\n } else {\n throw new Error(`Node does not exist: ${node}`);\n }\n },\n /**\n * Add a dependency between two nodes. If either of the nodes does not exist,\n * an Error will be thrown.\n */\n addDependency(from, to) {\n if (!this.hasNode(from)) {\n throw new Error(`Node does not exist: ${from}`);\n }\n if (!this.hasNode(to)) {\n throw new Error(`Node does not exist: ${to}`);\n }\n if (this.outgoingEdges[from].indexOf(to) === -1) {\n this.outgoingEdges[from].push(to);\n }\n if (this.incomingEdges[to].indexOf(from) === -1) {\n this.incomingEdges[to].push(from);\n }\n return true;\n },\n /**\n * Remove a dependency between two nodes.\n */\n removeDependency(from, to) {\n let idx;\n if (this.hasNode(from)) {\n idx = this.outgoingEdges[from].indexOf(to);\n if (idx >= 0) {\n this.outgoingEdges[from].splice(idx, 1);\n }\n }\n\n if (this.hasNode(to)) {\n idx = this.incomingEdges[to].indexOf(from);\n if (idx >= 0) {\n this.incomingEdges[to].splice(idx, 1);\n }\n }\n },\n /**\n * Return a clone of the dependency graph. If any custom data is attached\n * to the nodes, it will only be shallow copied.\n */\n clone() {\n const source = this;\n const result = new DepGraph();\n const keys = Object.keys(source.nodes);\n keys.forEach(n => {\n result.nodes[n] = source.nodes[n];\n result.outgoingEdges[n] = source.outgoingEdges[n].slice(0);\n result.incomingEdges[n] = source.incomingEdges[n].slice(0);\n });\n return result;\n },\n /**\n * Get an array containing the direct dependencies of the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependenciesOf(node) {\n if (this.hasNode(node)) {\n return this.outgoingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that directly depend on the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependantsOf(node) {\n if (this.hasNode(node)) {\n return this.incomingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that the specified node depends on (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned\n * in the array.\n */\n dependenciesOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * get an array containing the nodes that depend on the specified node (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.\n */\n dependantsOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.incomingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n\n /**\n * Get an array of nodes that have no dependants (i.e. nothing depends on them).\n */\n entryNodes() {\n const self = this;\n return Object.keys(this.nodes).filter(node => self.incomingEdges[node].length === 0);\n },\n\n /**\n * Construct the overall processing order for the dependency graph.\n *\n * Throws an Error if the graph has a cycle.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.\n */\n overallOrder(leavesOnly) {\n const self = this;\n const result = [];\n const keys = Object.keys(this.nodes);\n if (keys.length === 0) {\n return result; // Empty graph\n }\n if (!this.circular) {\n // Look for cycles - we run the DFS starting at all the nodes in case there\n // are several disconnected subgraphs inside this dependency graph.\n const CycleDFS = createDFS(this.outgoingEdges, false, [], this.circular);\n keys.forEach(n => {\n CycleDFS(n);\n });\n }\n\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n // Find all potential starting points (nodes with nothing depending on them) an\n // run a DFS starting at these points to get the order\n keys\n .filter(node => self.incomingEdges[node].length === 0)\n .forEach(n => {\n DFS(n);\n });\n\n // If we're allowing cycles - we need to run the DFS against any remaining\n // nodes that did not end up in the initial result (as they are part of a\n // subgraph that does not have a clear starting point)\n if (this.circular) {\n keys.filter(node => result.indexOf(node) === -1).forEach(n => DFS(n));\n }\n\n return result;\n },\n};\n\n// Create some aliases\nDepGraph.prototype.directDependentsOf = DepGraph.prototype.directDependantsOf;\nDepGraph.prototype.dependentsOf = DepGraph.prototype.dependantsOf;\n","export class Fore {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n static get ACTION_ELEMENTS() {\n return [\n 'FX-DELETE',\n 'FX-DISPATCH',\n 'FX-HIDE',\n 'FX-INSERT',\n 'FX-LOAD',\n 'FX-MESSAGE',\n 'FX-REBUILD',\n 'FX-RECALCULATE',\n 'FX-REFRESH',\n 'FX-RENEW',\n 'FX-REPLACE',\n 'FX-RESET',\n 'FX-RETAIN',\n 'FX-RETURN',\n 'FX-REVALIDATE',\n 'FX-SEND',\n 'FX-SETFOCUS',\n 'FX-SETINDEX',\n 'FX-SETVALUE',\n 'FX-SHOW',\n 'FX-TOGGLE',\n 'FX-UPDATE',\n ];\n }\n\n static createUUID() {\n // http://www.ietf.org/rfc/rfc4122.txt\n const s = [];\n const hexDigits = '0123456789abcdef';\n for (let i = 0; i < 36; i += 1) {\n s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n }\n s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010\n s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01\n s[8] = s[13] = s[18] = s[23] = '-';\n\n const uuid = s.join('');\n return uuid;\n }\n\n static get XFORMS_NAMESPACE_URI() {\n // todo: should be centralized somewhere as constant. Exists in several? places\n return 'http://www.w3.org/2002/xforms';\n }\n\n static isActionElement(elementName) {\n return Fore.ACTION_ELEMENTS.includes(elementName);\n }\n\n static get UI_ELEMENTS() {\n return [\n 'FX-ALERT',\n 'FX-CONTROL',\n 'FX-BUTTON',\n 'FX-CONTROL',\n 'FX-DIALOG',\n 'FX-FILENAME',\n 'FX-MEDIATYPE',\n 'FX-GROUP',\n 'FX-HINT',\n 'FX-INPUT',\n 'FX-ITEMS',\n 'FX-LABEL',\n 'FX-OUTPUT',\n 'FX-RANGE',\n 'FX-REPEAT',\n 'FX-REPEATITEM',\n 'FX-SWITCH',\n 'FX-SECRET',\n 'FX-SELECT',\n 'FX-SUBMIT',\n 'FX-TEXTAREA',\n 'FX-TRIGGER',\n 'FX-UPLOAD',\n 'FX-VAR',\n ];\n }\n\n static isUiElement(elementName) {\n const found = Fore.UI_ELEMENTS.includes(elementName);\n if (found) {\n // console.log('_isUiElement ', found);\n }\n return Fore.UI_ELEMENTS.includes(elementName);\n }\n\n /**\n * recursively refreshes all UI Elements.\n *\n * todo: this could probably made more efficient with significant impact on rendering perf\n *\n * @param startElement\n * @param force\n * @returns {Promise}\n */\n static async refreshChildren(startElement, force) {\n const refreshed = new Promise(resolve => {\n /*\n if there's an 'refresh-on-view' attribute the element wants to be handled by\n handleIntersect function that calls the refresh of the respective element and\n not the global one.\n */\n // if(!force && startElement.hasAttribute('refresh-on-view')) return;\n\n /* ### attempt with querySelectorAll is even slower than iterating recursively\n\n const children = startElement.querySelectorAll('[ref]');\n Array.from(children).forEach(uiElement => {\n if (Fore.isUiElement(uiElement.nodeName) && typeof uiElement.refresh === 'function') {\n uiElement.refresh();\n }\n });\n*/\n const { children } = startElement;\n if (children) {\n Array.from(children).forEach(element => {\n if (Fore.isUiElement(element.nodeName) && typeof element.refresh === 'function') {\n element.refresh();\n } else if (element.nodeName.toUpperCase() !== 'FX-MODEL') {\n Fore.refreshChildren(element, force);\n }\n });\n }\n resolve('done');\n });\n\n return refreshed;\n }\n\n static isRepeated(element) {\n return element.closest('fx-repeatitem') !== null;\n }\n\n static getRepeatTarget(element, id) {\n const repeatContextItem = element.closest('fx-repeatitem');\n const target = repeatContextItem.querySelector(`#${id}`);\n return target;\n }\n\n /**\n * returns the proper content-type for instance.\n *\n * @param instance an fx-instance element\n * @returns {string|null}\n */\n static getContentType(instance, method) {\n if (method === 'urlencoded-post') {\n return 'application/x-www-form-urlencoded; charset=UTF-8';\n }\n if (instance.type === 'xml') {\n return 'application/xml; charset=UTF-8';\n }\n if (instance.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', instance.type);\n return null;\n }\n\n static fadeInElement(element) {\n const duration = 600;\n let fadeIn = () => {\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n // Play the animation with the newly specified duration\n fadeIn = element.animate(\n {\n opacity: [0, 1],\n },\n duration,\n );\n return fadeIn.finished;\n };\n return fadeIn();\n }\n\n static fadeOutElement(element, duration) {\n // const duration = duration;\n let fadeOut = () => {\n\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n\n // Play the animation with the newly specified duration\n fadeOut = element.animate(\n {\n opacity: [1, 0],\n },\n duration,\n );\n return fadeOut.finished;\n };\n return fadeOut();\n }\n\n static dispatch(target, eventName, detail) {\n const event = new CustomEvent(eventName, {\n composed: true,\n bubbles: true,\n detail,\n });\n console.log('firing', event);\n target.dispatchEvent(event);\n }\n\n static prettifyXml(source) {\n const xmlDoc = new DOMParser().parseFromString(source, 'application/xml');\n const xsltDoc = new DOMParser().parseFromString(\n [\n // describes how we want to modify the XML - indent everything\n '',\n ' ',\n ' ', // change to just text() to strip space in text nodes\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n '',\n ].join('\\n'),\n 'application/xml',\n );\n\n const xsltProcessor = new XSLTProcessor();\n xsltProcessor.importStylesheet(xsltDoc);\n const resultDoc = xsltProcessor.transformToDocument(xmlDoc);\n const resultXml = new XMLSerializer().serializeToString(resultDoc);\n return resultXml;\n }\n\n\n /**\n * clear all text nodes and attribute values to get a 'clean' template.\n * @param n\n * @private\n */\n /*\n static clear(n) {\n n.textContent = '';\n if (n.hasAttributes()) {\n const attrs = n.attributes;\n for (let i = 0; i < attrs.length; i+= 1) {\n attrs[i].value = '';\n }\n }\n const { children } = n;\n for (let i = 0; i < children.length; i+= 1) {\n Fore.clear(children[i]);\n }\n }\n */\n}\n","import {\n evaluateXPath as fxEvaluateXPath,\n evaluateXPathToBoolean as fxEvaluateXPathToBoolean,\n evaluateXPathToFirstNode as fxEvaluateXPathToFirstNode,\n evaluateXPathToNodes as fxEvaluateXPathToNodes,\n evaluateXPathToNumber as fxEvaluateXPathToNumber,\n evaluateXPathToString as fxEvaluateXPathToString,\n evaluateXPathToStrings as fxEvaluateXPathToStrings,\n parseScript,\n registerCustomXPathFunction,\n registerXQueryModule,\n} from 'fontoxpath';\nimport { Fore } from './fore.js';\n\nimport { XPathUtil } from './xpath-util.js';\n\nconst XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';\n\nconst createdNamespaceResolversByXPathQueryAndNode = new Map();\n\nfunction getCachedNamespaceResolver(xpath, node) {\n if (!createdNamespaceResolversByXPathQueryAndNode.has(xpath)) {\n return null;\n }\n return createdNamespaceResolversByXPathQueryAndNode.get(xpath).get(node) || null;\n}\nfunction setCachedNamespaceResolver(xpath, node, resolver) {\n if (!createdNamespaceResolversByXPathQueryAndNode.has(xpath)) {\n return createdNamespaceResolversByXPathQueryAndNode.set(xpath, new Map());\n }\n return createdNamespaceResolversByXPathQueryAndNode.get(xpath).set(node, resolver);\n}\n\nconst xhtmlNamespaceResolver = prefix => {\n if (!prefix) {\n return 'http://www.w3.org/1999/xhtml';\n }\n return undefined;\n};\n\n/**\n * Resolve a namespace. Needs a namespace prefix and the element that is most closely related to the\n * XPath in which the namespace is being resolved. The prefix will be resolved by using the\n * ancestry of said element.\n *\n * It has two ways of doing so:\n *\n * - If the prefix is defined in an `xmlns:XXX=\"YYY\"` namespace declaration, it will return 'YYY'.\n * - If the prefix is the empty prefix and there is an `xpath-default-namespace=\"YYY\"` attribute in the\n * - ancestry, that attribute will be used and 'YYY' will be returned\n *\n * @param {Node} contextElement The element that is most closely related with the XPath in which this prefix is resolved.\n * @param {string} prefix The prefix to resolve\n */\nfunction createNamespaceResolver(xpathQuery, formElement) {\n const cachedResolver = getCachedNamespaceResolver(xpathQuery, formElement);\n if (cachedResolver) {\n return cachedResolver;\n }\n\n // Make namespace resolving use the `instance` element that is related to here\n const xmlDocument = new DOMParser().parseFromString('', 'text/xml');\n\n const xpathAST = parseScript(xpathQuery, {}, xmlDocument);\n let instanceReferences = fxEvaluateXPathToStrings(\n `descendant::xqx:functionCallExpr\n\t\t\t\t[xqx:functionName = \"instance\"]\n\t\t\t\t/xqx:arguments\n\t\t\t\t/xqx:stringConstantExpr\n\t\t\t\t/xqx:value`,\n xpathAST,\n null,\n {},\n {\n namespaceResolver: prefix =>\n prefix === 'xqx' ? 'http://www.w3.org/2005/XQueryX' : undefined,\n },\n );\n if (instanceReferences.length === 0) {\n // No instance functions. Look up further in the hierarchy to see if we can deduce the intended context from there\n const ancestorComponent = fxEvaluateXPathToFirstNode('ancestor::*[@ref][1]', formElement);\n if (ancestorComponent) {\n const resolver = createNamespaceResolver(\n ancestorComponent.getAttribute('ref'),\n ancestorComponent,\n );\n setCachedNamespaceResolver(xpathQuery, formElement, resolver);\n return resolver;\n }\n // Nothing found: let's just assume we're supposed to use the `default` instance\n instanceReferences = ['default'];\n }\n\n if (instanceReferences.length === 1) {\n // console.log(`resolving ${xpathQuery} with ${instanceReferences[0]}`);\n let instance;\n if (instanceReferences[0] === 'default') {\n const actualForeElement = fxEvaluateXPathToFirstNode(\n 'ancestor-or-self::fx-fore',\n formElement,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n instance = actualForeElement && actualForeElement.querySelector('fx-instance');\n } else {\n instance = resolveId(instanceReferences[0], formElement, 'fx-instance');\n }\n if (instance && instance.hasAttribute('xpath-default-namespace')) {\n const xpathDefaultNamespace = instance.getAttribute('xpath-default-namespace');\n /*\n console.log(\n `Resolving the xpath ${xpathQuery} with the default namespace set to ${xpathDefaultNamespace}`,\n );\n*/\n const resolveNamespacePrefix = prefix => {\n if (!prefix) {\n return xpathDefaultNamespace;\n }\n return undefined;\n };\n setCachedNamespaceResolver(xpathQuery, formElement, resolveNamespacePrefix);\n return resolveNamespacePrefix;\n }\n }\n if (instanceReferences.length > 1) {\n console.warn(\n `More than one instance is used in the query \"${xpathQuery}\". The default namespace resolving will be used`,\n );\n }\n\n const xpathDefaultNamespace =\n fxEvaluateXPathToString('ancestor-or-self::*/@xpath-default-namespace[last()]', formElement) ||\n '';\n\n const resolveNamespacePrefix = function resolveNamespacePrefix(prefix) {\n if (prefix === '') {\n return xpathDefaultNamespace;\n }\n\n // Note: ideally we should use Node#lookupNamespaceURI. However, the nodes we are passed are\n // XML. The best we can do is emulate the `xmlns:xxx` namespace declarations by regarding them as\n // attributes. Which they technically ARE NOT!\n\n return fxEvaluateXPathToString(\n 'ancestor-or-self::*/@*[name() = \"xmlns:\" || $prefix][last()]',\n formElement,\n null,\n { prefix },\n );\n };\n\n setCachedNamespaceResolver(xpathQuery, formElement, resolveNamespacePrefix);\n return resolveNamespacePrefix;\n}\n\nfunction createNamespaceResolverForNode(query, contextNode, formElement) {\n if (((contextNode && contextNode.ownerDocument) || contextNode) === window.document) {\n // Running a query on the HTML DOM. Don't bother resolving namespaces in any other way\n return xhtmlNamespaceResolver;\n }\n return createNamespaceResolver(query, formElement);\n}\n\n/**\n * Implementation of the functionNameResolver passed to FontoXPath to\n * redirect function resolving for unprefixed functions to either the fn or the xf namespace\n */\n// eslint-disable-next-line no-unused-vars\nfunction functionNameResolver({ prefix, localName }, _arity) {\n switch (localName) {\n // TODO: put the full XForms library functions set here\n case 'context':\n case 'base64encode':\n case 'boolean-from-string':\n case 'current':\n case 'depends':\n case 'event':\n case 'index':\n case 'instance':\n case 'log':\n case 'logtree':\n return { namespaceURI: XFORMS_NAMESPACE_URI, localName };\n default:\n if (prefix === '' || prefix === 'fn') {\n return { namespaceURI: 'http://www.w3.org/2005/xpath-functions', localName };\n }\n if (prefix === 'local') {\n return { namespaceURI: 'http://www.w3.org/2005/xquery-local-functions', localName };\n }\n return null;\n }\n}\n\n/**\n * Get the variables in scope of the form element. These are the values of the variables that\n * logically precede the formElement that declares the XPath\n *\n * @param {Node} formElement The element that declares the XPath\n *\n * @return {Object} A key-value mapping of the variables\n */\nfunction getVariablesInScope(formElement) {\n let closestActualFormElement = formElement;\n while (closestActualFormElement && !('inScopeVariables' in closestActualFormElement)) {\n closestActualFormElement = closestActualFormElement.parentNode;\n }\n\n if (!closestActualFormElement) {\n return {};\n }\n\n const variables = {};\n if(closestActualFormElement.inScopeVariables){\n for (const key of closestActualFormElement.inScopeVariables.keys()) {\n const varElement = closestActualFormElement.inScopeVariables.get(key);\n variables[key] = varElement.value;\n }\n }\n return variables;\n}\n\n/**\n * Evaluate an XPath to _any_ type. When possible, prefer to use any other function to ensure the\n * type of the output is more predictable.\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {{parentNode}|ForeElementMixin} formElement The form element associated to the XPath\n */\nexport function evaluateXPath(xpath, contextNode, formElement, variables = {}) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n\n return fxEvaluateXPath(\n xpath,\n contextNode,\n null,\n { ...variablesInScope, ...variables },\n 'xs:anyType',\n {\n currentContext: { formElement, variables },\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n functionNameResolver,\n namespaceResolver,\n },\n );\n}\n\n/**\n * Evaluate an XPath to the first Node\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node} The first node found by the XPath\n */\nexport function evaluateXPathToFirstNode(xpath, contextNode, formElement) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n return fxEvaluateXPathToFirstNode(xpath, contextNode, null, variablesInScope, {\n defaultFunctionNamespaceURI: XFORMS_NAMESPACE_URI,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n currentContext: { formElement },\n namespaceResolver,\n });\n}\n\n/**\n * Evaluate an XPath to all nodes\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node[]} All nodes\n */\nexport function evaluateXPathToNodes(xpath, contextNode, formElement) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n\n return fxEvaluateXPathToNodes(xpath, contextNode, null, variablesInScope, {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver,\n });\n}\n\n/**\n * Evaluate an XPath to a boolean\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {boolean}\n */\nexport function evaluateXPathToBoolean(xpath, contextNode, formElement) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n\n return fxEvaluateXPathToBoolean(xpath, contextNode, null, variablesInScope, {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver,\n });\n}\n\n/**\n * Evaluate an XPath to a string\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * access. This is used to determine dependencies between bind elements.\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * @return {string}\n */\nexport function evaluateXPathToString(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n\n return fxEvaluateXPathToString(xpath, contextNode, domFacade, variablesInScope, {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver,\n });\n}\n\n/**\n * Evaluate an XPath to a set of strings\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * access. This is used to determine dependencies between bind elements.\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * @return {string}\n */\nexport function evaluateXPathToStrings(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n return fxEvaluateXPathToStrings(\n xpath,\n contextNode,\n domFacade,\n {},\n\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver,\n },\n );\n}\n\n/**\n * Evaluate an XPath to a number\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * access. This is used to determine dependencies between bind elements.\n * @return {Number}\n */\nexport function evaluateXPathToNumber(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n const namespaceResolver = createNamespaceResolverForNode(xpath, contextNode, formElement);\n const variablesInScope = getVariablesInScope(formElement);\n\n return fxEvaluateXPathToNumber(xpath, contextNode, domFacade, variablesInScope, {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver,\n });\n}\n\n/**\n * Resolve an id in scope. Behaves like the algorithm defined on https://www.w3.org/community/xformsusers/wiki/XForms_2.0#idref-resolve\n */\nexport function resolveId(id, sourceObject, nodeName = null) {\n const allMatchingTargetObjects = fxEvaluateXPathToNodes(\n 'outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]',\n sourceObject,\n null,\n { id },\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n if (allMatchingTargetObjects.length === 0) {\n return null;\n }\n\n if (\n allMatchingTargetObjects.length === 1 &&\n fxEvaluateXPathToBoolean(\n '(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore',\n allMatchingTargetObjects[0],\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )\n ) {\n // If the target element is not repeated, then the search for the target object is trivial since\n // there is only one associated with the target element that bears the matching ID. This is true\n // regardless of whether or not the source object is repeated. However, if the target element is\n // repeated, then additional information must be used to help select a target object from among\n // those associated with the identified target element.\n const targetObject = allMatchingTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n\n // SPEC:\n\n // 12.2.1 References to Elements within a repeat Element\n\n // When the target element that is identified by the IDREF of a source object has one or more\n // repeat elements as ancestors, then the set of ancestor repeats are partitioned into two\n // subsets, those in common with the source element and those that are not in common. Any ancestor\n // repeat elements of the target element not in common with the source element are descendants of\n // the repeat elements that the source and target element have in common, if any.\n\n // For the repeat elements that are in common, the desired target object exists in the same set of\n // run-time objects that contains the source object. Then, for each ancestor repeat of the target\n // element that is not in common with the source element, the current index of the repeat\n // determines the set of run-time objects that contains the desired target object.\n for (const ancestorRepeatItem of fxEvaluateXPathToNodes(\n 'ancestor::fx-repeatitem => reverse()',\n sourceObject,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )) {\n const foundTargetObjects = allMatchingTargetObjects.filter(to =>\n ancestorRepeatItem.contains(to),\n );\n switch (foundTargetObjects.length) {\n case 0:\n // Nothing found: ignore\n break;\n case 1: {\n // A single one is found: the target object is directly in a common repeat\n const targetObject = foundTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n default: {\n // Multiple target objects are found: they are in a repeat that is not common with the source object\n // We found a target object in a common repeat! We now need to find the one that is in the repeatitem identified at the current index\n const targetObject = foundTargetObjects.find(to =>\n fxEvaluateXPathToNodes(\n 'every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]',\n to,\n null,\n {},\n ),\n );\n if (!targetObject) {\n // Nothing valid found for whatever reason. This might be something dynamic?\n return null;\n }\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n }\n }\n // We found no target objects in common repeats. The id is unresolvable\n return null;\n}\n\nconst contextFunction = (dynamicContext, string) => {\n const caller = dynamicContext.currentContext.formElement;\n if (string) {\n const instance = resolveId(string, caller);\n if (instance) {\n if (instance.nodeName === 'FX-REPEAT') {\n const { nodeset } = instance;\n for (let parent = caller; parent; parent = parent.parentNode) {\n if (parent.parentNode === instance) {\n const offset = Array.from(parent.parentNode.children).indexOf(parent);\n return nodeset[offset];\n }\n }\n }\n return instance.nodeset;\n }\n }\n const parent = XPathUtil.getParentBindingElement(caller);\n const p = caller.nodeName;\n // const p = dynamicContext.domFacade.getParentElement();\n\n if (parent) return parent;\n return caller.getInScopeContext();\n};\n\n/**\n * @param id as string\n * @return instance data for given id serialized to string.\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'context' },\n [],\n 'item()?',\n contextFunction,\n);\n\n/**\n * @param id as string\n * @return instance data for given id serialized to string.\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'context' },\n ['xs:string'],\n 'item()?',\n contextFunction,\n);\n\n/**\n * @param id as string\n * @return instance data for given id serialized to string.\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'log' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n if (instance) {\n if (instance.getAttribute('type') === 'json') {\n console.warn('log() does not work for JSON yet');\n // return JSON.stringify(instance.getDefaultContext());\n } else {\n const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n return Fore.prettifyXml(def);\n }\n }\n return null;\n },\n);\n\nfunction buildTree(tree, data) {\n if (!data) return;\n if (data.nodeType === Node.ELEMENT_NODE) {\n if (data.children) {\n const details = document.createElement('details');\n details.setAttribute('data-path', data.nodeName);\n const summary = document.createElement('summary');\n\n let display = ` <${data.nodeName}`;\n Array.from(data.attributes).forEach(attr => {\n display += ` ${attr.nodeName}=\"${attr.nodeValue}\"`;\n });\n\n let contents;\n if (\n data.firstChild &&\n data.firstChild.nodeType === Node.TEXT_NODE &&\n data.firstChild.data.trim() !== ''\n ) {\n // console.log('whoooooooooopp');\n contents = data.firstChild.nodeValue;\n display += `>${contents}`;\n } else {\n display += '>';\n }\n summary.textContent = display;\n\n details.appendChild(summary);\n if (data.childElementCount !== 0) {\n details.setAttribute('open', 'open');\n } else {\n summary.setAttribute('style', 'list-style:none;');\n }\n tree.appendChild(details);\n\n Array.from(data.children).forEach(child => {\n // if(child.nodeType === Node.ELEMENT_NODE){\n // child.parentNode.appendChild(buildTree(child));\n buildTree(details, child);\n // }\n });\n }\n } /* else if(data.nodeType === Node.ATTRIBUTE_NODE){\n //create span for now\n // const span = document.createElement('span');\n // span.style.background = 'grey';\n // span.textContent = data.value;\n // tree.appendChild(span);\n tree.setAttribute(data.nodeName,data.value);\n }else {\n tree.textContent = data;\n } */\n\n // return tree;\n}\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'logtree' },\n ['xs:string?'],\n 'element()?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n\n if (instance) {\n // const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n // const def = JSON.stringify(instance.getDefaultContext());\n\n const treeDiv = document.createElement('div');\n treeDiv.setAttribute('class', 'logtree');\n // const datatree = buildTree(tree,instance.getDefaultContext());\n // return tree.appendChild(datatree);\n // return buildTree(root,instance.getDefaultContext());;\n const form = dynamicContext.currentContext.formElement;\n const logtree = form.querySelector('.logtree');\n if (logtree) {\n logtree.parentNode.removeChild(logtree);\n }\n const tree = buildTree(treeDiv, instance.getDefaultContext());\n if (tree) {\n form.appendChild(tree);\n }\n }\n return null;\n },\n);\n\nconst instance = (dynamicContext, string) => {\n // Spec: https://www.w3.org/TR/xforms-xpath/#The_XForms_Function_Library#The_instance.28.29_Function\n // TODO: handle no string passed (null will be passed instead)\n\n const formElement = fxEvaluateXPathToFirstNode(\n 'ancestor-or-self::fx-fore',\n dynamicContext.currentContext.formElement,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n // console.log('fnInstance dynamicContext: ', dynamicContext);\n // console.log('fnInstance string: ', string);\n\n const inst = string\n ? resolveId(string, formElement, 'fx-instance')\n : formElement.querySelector(`fx-instance`);\n\n // const def = instance.getInstanceData();\n if (inst) {\n const def = inst.getDefaultContext();\n // console.log('target instance root node: ', def);\n\n return def;\n }\n return null;\n};\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'index' },\n ['xs:string?'],\n 'xs:integer?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n if (string === null) {\n return 1;\n }\n const repeat = resolveId(string, formElement, 'fx-repeat');\n\n // const def = instance.getInstanceData();\n if (repeat) {\n return repeat.getAttribute('index');\n }\n return Number(1);\n },\n);\n\n// Note that this is not to spec. The spec enforces elements to be returned from the\n// instance. However, we allow instances to actually be JSON!\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n [],\n 'item()?',\n domFacade => instance(domFacade, null),\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n ['xs:string?'],\n 'item()?',\n instance,\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'depends' },\n ['node()*'],\n 'item()?',\n (dynamicContext, nodes) =>\n // console.log('depends on : ', nodes[0]);\n nodes[0],\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'event' },\n ['xs:string?'],\n 'item()?',\n (dynamicContext, arg) => {\n const payload = dynamicContext.currentContext.variables[arg];\n if (payload.nodeType) {\n console.log('got some node as js object');\n }\n\n return dynamicContext.currentContext.variables[arg];\n },\n);\n\n// Implement the XForms standard functions here.\nregisterXQueryModule(`\n module namespace xf=\"${XFORMS_NAMESPACE_URI}\";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = \"true\" or $str = \"1\"\n };\n`);\n\n// How to run XQUERY:\n/**\nregisterXQueryModule(`\nmodule namespace my-custom-namespace = \"my-custom-uri\";\n(:~\n\tInsert attribute somewhere\n\t~:)\ndeclare %public %updating function my-custom-namespace:do-something ($ele as element()) as xs:boolean {\n\tif ($ele/@done) then false() else\n\t(insert node\n\tattribute done {\"true\"}\n\tinto $ele, true())\n};\n`)\n// At some point:\nconst contextNode = null;\nconst pendingUpdatesAndXdmValue = evaluateUpdatingExpressionSync('ns:do-something(.)', contextNode, null, null, {moduleImports: {'ns': 'my-custom-uri'}})\n\nconsole.log(pendingUpdatesAndXdmValue.xdmValue); // this is true or false, see function\n\nexecutePendingUpdateList(pendingUpdatesAndXdmValue.pendingUpdateList, null, null, null);\n*/\n\n/**\n * @param input as string\n * @return {string}\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'base64encode' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => btoa(string),\n);\n","import { Fore } from './fore.js';\nimport { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\n/**\n * Container for data instances.\n *\n * Offers several ways of loading data from either inline content or via 'src' attribute which will use the fetch\n * API to resolve data.\n */\nexport class FxInstance extends HTMLElement {\n constructor() {\n super();\n this.model = this.parentNode;\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n if (this.hasAttribute('src')) {\n this.src = this.getAttribute('src');\n }\n\n if (this.hasAttribute('id')) {\n this.id = this.getAttribute('id');\n } else {\n this.id = 'default';\n }\n\n if (this.hasAttribute('type')) {\n this.type = this.getAttribute('type');\n } else {\n this.type = 'xml';\n }\n const style = `\n :host {\n display: none;\n }\n :host * {\n display:none;\n }\n ::slotted(*){\n display:none;\n }\n `;\n\n const html = `\n `;\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n /**\n * Is called by fx-model during initialization phase (model-construct)\n * @returns {Promise}\n */\n async init() {\n // console.log('fx-instance init');\n await this._initInstance().then(() => {\n this.dispatchEvent(\n new CustomEvent('instance-loaded', {\n composed: true,\n bubbles: true,\n detail: { instance: this },\n }),\n );\n return this;\n });\n }\n\n evalXPath(xpath) {\n const formElement = this.parentElement.parentElement;\n const result = evaluateXPathToFirstNode(xpath, this.getDefaultContext(), formElement);\n return result;\n }\n\n /**\n * returns the current instance data\n *\n * @returns {Document | T | any}\n */\n getInstanceData() {\n if (!this.instanceData) {\n this._createInstanceData();\n }\n return this.instanceData;\n }\n\n setInstanceData(data) {\n if (!data) {\n this._createInstanceData();\n return;\n }\n this.instanceData = data;\n }\n\n /**\n * return the default context (root node of respective instance) for XPath evalution.\n *\n * @returns {Document|T|any|Element}\n */\n getDefaultContext() {\n // console.log('getDefaultContext ', this.instanceData.firstElementChild);\n if (this.type === 'xml') {\n return this.instanceData.firstElementChild;\n }\n return this.instanceData;\n }\n\n /**\n * does the actual loading of data. Handles inline data, data loaded via fetch() or data constructed from\n * querystring.\n *\n * @returns {Promise}\n * @private\n */\n async _initInstance() {\n if (this.src === '#querystring') {\n /*\n * generate XML data from URL querystring\n * todo: there's no variant to generate JSON yet\n */\n // eslint-disable-next-line no-restricted-globals\n const query = new URLSearchParams(location.search);\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n for (const p of query) {\n const newNode = doc.createElement(p[0]);\n newNode.appendChild(doc.createTextNode(p[1]));\n root.appendChild(newNode);\n }\n this.instanceData = doc;\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // resolve('done');\n } else if (this.src) {\n await this._loadData();\n } else if (this.childNodes.length !== 0) {\n this._useInlineData();\n }\n }\n\n _createInstanceData() {\n if (this.type === 'xml') {\n // const doc = new DOMParser().parseFromString('', 'application/xml');\n const doc = new DOMParser().parseFromString('', 'application/xml');\n this.instanceData = doc;\n }\n if (this.type === 'json') {\n this.instanceData = {};\n }\n }\n\n async _loadData() {\n const url = `${this.src}`;\n const contentType = Fore.getContentType(this, 'get');\n\n await fetch(url, {\n method: 'GET',\n mode: 'cors',\n credentials: 'include',\n headers: {\n 'Content-Type': contentType,\n },\n })\n .then(response => {\n const status = response.status;\n if(status >= 400){\n console.log('response status', status);\n alert(`response status: ${status} - failed to load data for '${this.src}' - stopping.`);\n throw new Error(`failed to load data - status: ${status}`);\n }\n const responseContentType = response.headers.get('content-type').toLowerCase();\n console.log('********** responseContentType *********', responseContentType);\n if (responseContentType.startsWith('text/html')) {\n // const htmlResponse = response.text();\n // return new DOMParser().parseFromString(htmlResponse, 'text/html');\n // return response.text();\n return response.text().then(result =>\n // console.log('xml ********', result);\n new DOMParser().parseFromString(result, 'text/html'),\n );\n }\n if (\n responseContentType.startsWith('text/plain') ||\n responseContentType.startsWith('text/markdown')\n ) {\n // console.log(\"********** inside res plain *********\");\n return response.text();\n }\n if (responseContentType.startsWith('application/json')) {\n // console.log(\"********** inside res json *********\");\n return response.json();\n }\n if (responseContentType.startsWith('application/xml')) {\n return response.text().then(result =>\n // console.log('xml ********', result);\n new DOMParser().parseFromString(result, 'application/xml'),\n );\n }\n return 'done';\n })\n .then(data => {\n if (data.nodeType) {\n this.instanceData = data;\n console.log('instanceData loaded: ', this.instanceData);\n return;\n }\n this.instanceData = data;\n })\n .catch(error => {\n throw new Error(`failed loading data ${error}`);\n });\n }\n\n _getContentType() {\n if (this.type === 'xml') {\n return 'application/xml';\n }\n if (this.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', this.type);\n return null;\n }\n\n _useInlineData() {\n if (this.type === 'xml') {\n // console.log('innerHTML ', this.innerHTML);\n const instanceData = new DOMParser().parseFromString(this.innerHTML, 'application/xml');\n\n console.log('fx-instance init id:', this.id);\n this.instanceData = instanceData;\n // console.log('instanceData ', this.instanceData);\n // console.log('instanceData ', this.instanceData.firstElementChild);\n\n console.log('fx-instance data: ', this.instanceData);\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // todo: move innerHTML out to shadowDOM (for later reset)\n } else if (this.type === 'json') {\n this.instanceData = JSON.parse(this.textContent);\n } else if (this.type === 'html') {\n this.instanceData = this.firstElementChild.children;\n } else if (this.type === 'text') {\n this.instanceData = this.textContent;\n } else {\n console.warn('unknow type for data ', this.type);\n }\n }\n\n _handleResponse() {\n console.log('_handleResponse ');\n const ajax = this.shadowRoot.getElementById('loader');\n const instanceData = new DOMParser().parseFromString(ajax.lastResponse, 'application/xml');\n this.instanceData = instanceData;\n console.log('data: ', this.instanceData);\n }\n\n _handleError() {\n const loader = this.shadowRoot.getElementById('loader');\n console.log('_handleResponse ', loader.lastError);\n }\n}\ncustomElements.define('fx-instance', FxInstance);\n","/**\n * Class for holding ModelItem facets.\n *\n * A ModelItem annotates nodes that are referred by a fx-bind element with facets for calculation and validation.\n *\n * Each bound node in an instance has exactly one ModelItem associated with it.\n */\nexport class ModelItem {\n /**\n *\n * @param {path} calculated normalized path expression linking to data\n * @param {ref} ref relative binding expression\n * @param {*} isReadonly - boolean to signal readonly/readwrite state\n * @param {*} relevant - boolean to signal relevant/non-relevant state\n * @param {*} required - boolean to signal required/optional state\n * @param {*} required - boolean boolean to signal valid/invalid state\n * @param {*} type - string expression to set a datatype\n * @param {*} node - the node the 'ref' expression is referring to\n * @param {*} bind - the fx-bind element having created this modelItem\n */\n constructor(path, ref, readonly, relevant, required, constraint, type, node, bind) {\n this.path = path;\n this.ref = ref;\n this.constraint = constraint;\n this.readonly = readonly;\n this.relevant = relevant;\n this.required = required;\n this.type = type;\n this.node = node;\n this.bind = bind;\n this.changed = false;\n this.alerts = [];\n this.boundControls = [];\n // this.value = this._getValue();\n }\n\n /*\n get ref(){\n return this.bind.ref;\n }\n*/\n\n get value() {\n if (!this.node.nodeType) return this.node;\n\n if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n return this.node.nodeValue;\n }\n return this.node.textContent;\n }\n\n set value(newVal) {\n console.log('modelitem.setvalue oldVal', this.value);\n console.log('modelitem.setvalue newVal', newVal);\n\n if (newVal.nodeType === Node.DOCUMENT_NODE) {\n // this.node.replaceWith(newVal.firstElementChild);\n this.node.appendChild(newVal.firstElementChild);\n } else if (newVal.nodeType === Node.ELEMENT_NODE) {\n // this.node.replaceWith(newVal);\n this.node.appendChild(newVal);\n } else if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n this.node.nodeValue = newVal;\n } else {\n this.node.textContent = newVal;\n }\n }\n\n addAlert(alert) {\n this.alerts.push(alert);\n }\n\n cleanAlerts() {\n this.alerts = [];\n }\n}\n","import { DepGraph } from './dep_graph.js';\nimport { Fore } from './fore.js';\nimport './fx-instance.js';\nimport { ModelItem } from './modelitem.js';\nimport { evaluateXPath, evaluateXPathToBoolean } from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * @ts-check\n */\nexport class FxModel extends HTMLElement {\n constructor() {\n super();\n // this.id = '';\n\n this.instances = [];\n this.modelItems = [];\n this.defaultContext = {};\n this.changed = [];\n\n // this.mainGraph = new DepGraph(false);\n this.inited = false;\n this.modelConstructed = false;\n this.attachShadow({ mode: 'open' });\n this.computes = 0;\n }\n\n get formElement() {\n return this.parentElement;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n this.shadowRoot.innerHTML = `\n \n `;\n\n this.addEventListener('model-construct-done', e => {\n this.modelConstructed = true;\n // console.log('model-construct-done fired ', this.modelConstructed);\n console.log('model-construct-done fired ', e.detail.model.instances);\n });\n\n this.skipUpdate = false;\n }\n\n static lazyCreateModelItem(model, ref, node) {\n // console.log('lazyCreateModelItem ', node);\n\n let targetNode = {};\n if (node === null || node === undefined) return null;\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n let path;\n if (node.nodeType) {\n path = XPathUtil.getPath(node);\n } else {\n path = null;\n targetNode = node;\n }\n // const path = XPathUtil.getPath(node);\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(\n path,\n ref,\n Fore.READONLY_DEFAULT,\n Fore.RELEVANT_DEFAULT,\n Fore.REQUIRED_DEFAULT,\n Fore.CONSTRAINT_DEFAULT,\n Fore.TYPE_DEFAULT,\n targetNode,\n this,\n );\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n\n /**\n * modelConstruct starts actual processing of the model by\n *\n * 1. loading instances if present or constructing one\n * 2. calling updateModel to run the model update cycle of rebuild, recalculate and revalidate\n *\n * @event model-construct-done is fired once all instances have be loaded or after generating instance\n *\n */\n modelConstruct() {\n console.log('### <<<<< dispatching model-construct >>>>>');\n this.dispatchEvent(new CustomEvent('model-construct', { detail: this }));\n\n console.time('instance-loading');\n const instances = this.querySelectorAll('fx-instance');\n if (instances.length > 0) {\n console.group('init instances');\n const promises = [];\n instances.forEach(instance => {\n promises.push(instance.init());\n });\n\n Promise.all(promises).then(() => {\n this.instances = Array.from(instances);\n console.log('_modelConstruct this.instances ', this.instances);\n this.updateModel();\n this.inited = true;\n\n console.log('### <<<<< dispatching model-construct-done >>>>>');\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n });\n console.groupEnd();\n } else {\n // ### if there's no instance one will created\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n }\n console.timeEnd('instance-loading');\n this.inited = true;\n }\n\n registerModelItem(modelItem) {\n // console.log('ModelItem registered ', modelItem);\n this.modelItems.push(modelItem);\n }\n\n /**\n * update action triggering the update cycle\n */\n updateModel() {\n console.time('updateModel');\n this.rebuild();\n if(this.skipUpdate) return;\n this.recalculate();\n this.revalidate();\n console.timeEnd('updateModel');\n }\n\n rebuild() {\n console.group('### rebuild');\n console.time('rebuild');\n this.mainGraph = new DepGraph(false); //do: should be moved down below binds.length check but causes errors in tests.\n this.modelItems = [];\n\n // trigger recursive initialization of the fx-bind elements\n const binds = this.querySelectorAll('fx-model > fx-bind');\n if(binds.length === 0 ) {\n console.log('skipped model update');\n this.skipUpdate = true;\n return ;\n }\n\n binds.forEach(bind => {\n bind.init(this);\n });\n console.timeEnd('rebuild');\n\n // console.log(`dependencies of a `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}a[1]:required\"));\n // console.log(`dependencies of b `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}b[1]:required\"));\n console.log(`rebuild mainGraph`, this.mainGraph);\n console.log(`rebuild mainGraph calc order`, this.mainGraph.overallOrder());\n\n this.dispatchEvent(new CustomEvent('rebuild-done', { detail: { maingraph: this.mainGraph } }));\n\n /*\n console.log(\n `rebuild finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n */\n console.groupEnd();\n }\n\n /**\n * recalculation of all modelItems. Uses dependency graph to determine order of computation.\n *\n * todo: use 'changed' flag on modelItems to determine subgraph for recalculation. Flag already exists but is not used.\n */\n recalculate() {\n console.group('### recalculate');\n console.log('changed nodes ', this.changed);\n\n console.time('recalculate');\n this.computes = 0;\n\n this.subgraph = new DepGraph(false);\n if (this.changed.length !== 0) {\n // ### build the subgraph\n this.changed.forEach(modelItem => {\n this.subgraph.addNode(modelItem.path, modelItem.node);\n // const dependents = this.mainGraph.dependantsOf(modelItem.path, false);\n // this._addSubgraphDependencies(modelItem.path);\n if (this.mainGraph.hasNode(modelItem.path)) {\n // const dependents = this.mainGraph.directDependantsOf(modelItem.path)\n\n const all = this.mainGraph.dependantsOf(modelItem.path, false);\n const dependents = all.reverse();\n if (dependents.length !== 0) {\n dependents.forEach(dep => {\n // const subdep = this.mainGraph.dependentsOf(dep,false);\n // subgraph.addDependency(dep, modelItem.path);\n const val = this.mainGraph.getNodeData(dep);\n this.subgraph.addNode(dep, val);\n if (dep.includes(':')) {\n const path = dep.substring(0, dep.indexOf(':'));\n this.subgraph.addNode(path, val);\n\n const deps = this.mainGraph.dependentsOf(modelItem.path, false);\n // if we find the dep to be first in list of dependents we are dependent on ourselves not adding edge to modelItem.path\n if (deps.indexOf(dep) !== 0) {\n this.subgraph.addDependency(dep, modelItem.path);\n }\n }\n // subgraph.addDependency(dep,modelItem.path);\n });\n }\n }\n });\n\n // ### compute the subgraph\n const ordered = this.subgraph.overallOrder(false);\n ordered.forEach(path => {\n if (this.mainGraph.hasNode(path)) {\n const node = this.mainGraph.getNodeData(path);\n this.compute(node, path);\n }\n });\n const toRefresh = [...this.changed];\n this.formElement.toRefresh = toRefresh;\n this.changed = [];\n console.log('subgraph', this.subgraph);\n this.dispatchEvent(\n new CustomEvent('recalculate-done', { detail: { subgraph: this.subgraph } }),\n );\n } else {\n const v = this.mainGraph.overallOrder(false);\n v.forEach(path => {\n const node = this.mainGraph.getNodeData(path);\n this.compute(node, path);\n });\n }\n console.log(`recalculated ${this.computes} modelItems`);\n\n console.timeEnd('recalculate');\n console.log(\n `recalculate finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n console.groupEnd();\n }\n\n /*\n _addSubgraphDependencies(path){\n const dependents = this.mainGraph.directDependantsOf(path)\n\n const alreadyInGraph = this.subgraph.incomingEdges[path];\n // const alreadyInGraph = path in this.subgraph;\n if(dependents.length !== 0 && alreadyInGraph.length === 0){\n\n dependents.forEach(dep => {\n // const val= this.mainGraph.getNodeData(dep);\n // this.subgraph.addNode(dep,val);\n if(dep.includes(':')){\n const subpath = dep.substring(0, dep.indexOf(':'));\n // this.subgraph.addNode(subpath,val);\n this.subgraph.addDependency(subpath,dep);\n this.subgraph.addDependency(dep,path);\n /!*\n const subdeps = this.mainGraph.directDependantsOf(path);\n console.log('subdeps',path, subdeps);\n subdeps.forEach(sdep => {\n const sval= this.mainGraph.getNodeData(sdep);\n this.subgraph.addNode(sdep,sval);\n console.log('subdep',sdep);\n });\n *!/\n if(this.subgraph.incomingEdges[dep] === 0){\n this._addSubgraphDependencies(subpath)\n }\n\n }\n });\n\n }\n\n }\n*/\n\n /**\n * (re-) computes a modelItem.\n * @param node - the node the modelItem is attached to\n * @param path - the canonical XPath of the node\n */\n compute(node, path) {\n const modelItem = this.getModelItem(node);\n if (modelItem && path.includes(':')) {\n const property = path.split(':')[1];\n if (property) {\n /*\n if (property === 'readonly') {\n // make sure that calculated items are always readonly\n if(modelItem.bind['calculate']){\n modelItem.readonly = true;\n }else {\n const expr = modelItem.bind[property];\n const compute = evaluateXPathToBoolean(expr, modelItem.node, this);\n modelItem.readonly = compute;\n }\n }\n*/\n if (property === 'calculate') {\n const expr = modelItem.bind[property];\n const compute = evaluateXPath(expr, modelItem.node, this);\n modelItem.value = compute;\n modelItem.readonly = true; // calculated nodes are always readonly\n } else if (property !== 'constraint' && property !== 'type') {\n const expr = modelItem.bind[property];\n if (expr) {\n const compute = evaluateXPathToBoolean(expr, modelItem.node, this);\n modelItem[property] = compute;\n console.log(\n `recalculating path ${path} - Expr:'${expr}' computed`,\n modelItem[property],\n );\n }\n }\n }\n this.computes += 1;\n }\n }\n\n /**\n * Iterates all modelItems to calculate the validation status.\n *\n * Model alerts are given on 'fx-bind' elements as either attribute `alert` or as `fx-alert` child elements.\n *\n * During model-construct all model alerts are added to the modelItem if any\n *\n * to revalidate:\n * Gets the `constraint` attribute declaration from modelItem.bind\n * Computes the XPath to a Boolean\n * Updates the modelItem.constraint property\n *\n * todo: type checking\n * todo: run browser validation API\n *\n */\n revalidate() {\n console.group('### revalidate');\n\n console.time('revalidate');\n let valid = true;\n this.modelItems.forEach(modelItem => {\n // console.log('validating node ', modelItem.node);\n\n const { bind } = modelItem;\n if (bind) {\n /*\n todo: investigate why bind is an element when created in fx-bind.init() and an fx-bind object when\n created lazily.\n */\n if (typeof bind.hasAttribute === 'function' && bind.hasAttribute('constraint')) {\n const constraint = bind.getAttribute('constraint');\n if (constraint) {\n const compute = evaluateXPathToBoolean(constraint, modelItem.node, this);\n console.log('modelItem validity computed: ', compute);\n modelItem.constraint = compute;\n this.formElement.addToRefresh(modelItem); // let fore know that modelItem needs refresh\n if (!compute) valid = false;\n // ### alerts are added only once during model-construct. Otherwise they would add up in each run of revalidate()\n if (!this.modelConstructed) {\n // todo: get alert from attribute or child element\n const alert = bind.getAlert();\n if (alert) {\n modelItem.addAlert(alert);\n }\n }\n }\n }\n }\n });\n console.timeEnd('revalidate');\n console.log('modelItems after revalidate: ', this.modelItems);\n console.groupEnd();\n return valid;\n }\n\n /**\n *\n * @param node\n * @returns {ModelItem}\n */\n getModelItem(node) {\n return this.modelItems.find(m => m.node === node);\n }\n\n /**\n * get the default evaluation context for this model.\n * @returns {Element} the\n */\n getDefaultContext() {\n return this.instances[0].getDefaultContext();\n }\n\n getDefaultInstance() {\n return this.instances[0];\n }\n\n getDefaultInstanceData() {\n console.log('default instance data ', this.instances[0].instanceData);\n return this.instances[0].instanceData;\n }\n\n getInstance(id) {\n // console.log('getInstance ', id);\n // console.log('instances ', this.instances);\n // console.log('instances array ',Array.from(this.instances));\n\n const instArray = Array.from(this.instances);\n return instArray.find(inst => inst.id === id);\n }\n\n evalBinding(bindingExpr) {\n // console.log('MODEL.evalBinding ', bindingExpr);\n // default context of evaluation is always the default instance\n const result = this.instances[0].evalXPath(bindingExpr);\n return result;\n }\n}\n\ncustomElements.define('fx-model', FxModel);\n","import { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\nimport { XPathUtil } from './xpath-util.js';\n\n\nfunction _getElement(node) {\n if (node && node.nodeType && node.nodeType === Node.ATTRIBUTE_NODE) {\n // The context of an attribute is the ref of the element it's defined on\n return node.ownerElement;\n }\n\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n // The context of a query should be the element having a ref\n return node;\n }\n\n // For text nodes, just start looking from the parent element\n return node.parentNode;\n}\n\nfunction _getForeContext(node) {\n return node.closest('fx-fore');\n}\n\nfunction _getModelInContext(node) {\n // const ownerForm = node.closest('fx-fore');\n const ownerForm = _getForeContext(node);\n return ownerForm.getModel();\n}\n\nfunction _getInitialContext(node, ref) {\n const parentBind = node.closest('[ref]');\n\n if (parentBind !== null) {\n return parentBind.nodeset;\n }\n\n const model = _getModelInContext(node);\n if (XPathUtil.isAbsolutePath(ref)) {\n const instanceId = XPathUtil.getInstanceId(ref);\n if(instanceId){\n return model.getInstance(instanceId).getDefaultContext();\n }\n return model.getDefaultInstance().getDefaultContext();\n }\n if (model.getDefaultInstance() !== null && model.inited) {\n return model.getDefaultInstance().getDefaultContext();\n }\n return [];\n}\n\nexport default function getInScopeContext(node, ref) {\n const parentElement = _getElement(node);\n /*\n if(parentElement.nodeName.toUpperCase() === 'FX-REPEATITEM'){\n return parentElement.nodeset;\n }\n*/\n\n const repeatItem = parentElement.closest('fx-repeatitem');\n if (repeatItem) {\n if(node.nodeName === 'context'){\n return evaluateXPathToFirstNode(node.nodeValue, repeatItem.nodeset, _getForeContext(parentElement));\n }\n return repeatItem.nodeset;\n }\n\n if (parentElement.hasAttribute('context')) {\n const initialContext = _getInitialContext(node.ownerElement.parentNode, ref);\n const contextAttr = node.ownerElement.getAttribute('context');\n return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n }\n\n if (node.nodeType === Node.ATTRIBUTE_NODE && node.nodeName === 'context') {\n const initialContext = _getInitialContext(node.ownerElement.parentNode, ref);\n const contextAttr = node.ownerElement.getAttribute('context');\n return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n }\n if (node.nodeType === Node.ATTRIBUTE_NODE && node.nodeName === 'ref') {\n // Note: do not consider the ref of the owner element since it should not be used to define the\n // context\n if (node.ownerElement.hasAttribute('context')) {\n const initialContext = _getInitialContext(node.ownerElement.parentNode, ref);\n const contextAttr = node.ownerElement.getAttribute('context');\n return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n }\n\n // Never resolve the context from a ref itself!\n return _getInitialContext(parentElement.parentNode, ref);\n }\n\n // if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute('context')) {\n // const initialContext = _getInitialContext(node.parentNode, ref);\n // const contextAttr = node.getAttribute('context');\n // return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n // }\n return _getInitialContext(parentElement, ref);\n}\n","import { XPathUtil } from './xpath-util.js';\nimport { FxModel } from './fx-model.js';\nimport {\n evaluateXPath,\n evaluateXPathToFirstNode,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * Mixin containing all general functions that are shared by all Fore element classes.\n * @param superclass\n * @returns {{readonly properties: {ref: {type: StringConstructor}, context: {type: ObjectConstructor}, nodeset: {type: ObjectConstructor}, model: {type: ObjectConstructor}, inScopeVariables: {type: MapConstructor}, modelItem: {type: ObjectConstructor}}, new(): ForeElementMixin, context: null, model: null, modelItem: {}, ref: *|string, inScopeVariables: null, nodeset: *, prototype: ForeElementMixin}}\n */\nexport const foreElementMixin = superclass =>\n class ForeElementMixin extends superclass {\n static get properties() {\n return {\n /**\n * context object for evaluation\n */\n context: {\n type: Object,\n },\n /**\n * the model of this element\n */\n model: {\n type: Object,\n },\n /**\n * The modelitem object associated to the bound node holding the evaluated state.\n */\n modelItem: {\n type: Object,\n },\n /**\n * the node(s) bound by this element\n */\n nodeset: {\n type: Object,\n },\n /**\n * XPath binding expression pointing to bound node\n */\n ref: {\n type: String,\n },\n inScopeVariables: {\n type: Map,\n },\n };\n }\n\n constructor() {\n super();\n this.context = null;\n this.model = null;\n this.modelItem = {};\n this.ref = this.hasAttribute('ref') ? this.getAttribute('ref') : '';\n this.inScopeVariables = null;\n }\n\n getModel() {\n // console.log('getModel this ', this);\n if (this.model) {\n return this.model;\n }\n // const ownerForm = this.closest('fx-fore');\n // const ownerForm = this.getOwnerForm(this);\n const ownerForm = this.getOwnerForm();\n return ownerForm.querySelector('fx-model');\n }\n\n /**\n *\n * @returns {{parentNode}|ForeElementMixin}\n */\n getOwnerForm() {\n let currentElement = this;\n while (currentElement && currentElement.parentNode) {\n // console.log('current ', currentElement);\n\n if (currentElement.nodeName.toUpperCase() === 'FX-FORE') {\n return currentElement;\n }\n\n if (currentElement.parentNode instanceof DocumentFragment) {\n currentElement = currentElement.parentNode.host;\n } else {\n currentElement = currentElement.parentNode;\n }\n }\n return currentElement;\n }\n\n /**\n * evaluation of fx-bind and UiElements differ in details so that each class needs it's own implementation.\n */\n evalInContext() {\n // const inscopeContext = this.getInScopeContext();\n let inscopeContext;\n if(this.hasAttribute('context')){\n inscopeContext = getInScopeContext(this.getAttributeNode('context') || this, this.context);\n }\n if(this.hasAttribute('ref')){\n inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);\n }\n if (!inscopeContext) {\n // ### always fall back to default context with there's neither a 'context' or 'ref' present\n inscopeContext = this.getModel().getDefaultInstance().getDefaultContext();\n console.warn('no in scopeContext for ', this);\n console.warn('using default context ', this);\n // return;\n }\n if (this.ref === '') {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n /*\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n const localResult = evaluateXPathToFirstNode(this.ref, n, this);\n // console.log('local result: ', localResult);\n this.nodeset.push(localResult);\n }\n });\n*/\n this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext[0], this);\n } else {\n // this.nodeset = fx.evaluateXPathToFirstNode(this.ref, inscopeContext, null, {namespaceResolver: this.namespaceResolver});\n const { nodeType } = inscopeContext;\n if (nodeType) {\n this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext, this);\n } else {\n this.nodeset = evaluateXPath(this.ref, inscopeContext, this);\n }\n }\n // console.log('UiElement evaluated to nodeset: ', this.nodeset);\n }\n\n isNotBound() {\n return !this.hasAttribute('ref');\n }\n\n isBound() {\n return this.hasAttribute('ref');\n }\n\n getBindingExpr() {\n if (this.hasAttribute('ref')) {\n return this.getAttribute('ref');\n }\n // try to get closest parent bind\n const parent = this.parentNode.closest('[ref]');\n if (!parent) {\n return 'instance()'; // the default instance\n }\n return parent.getAttribute('ref');\n }\n\n getInstance() {\n if (this.ref.startsWith('instance(')) {\n const instId = XPathUtil.getInstanceId(this.ref);\n return this.getModel().getInstance(instId);\n }\n return this.getModel().getInstance('default');\n }\n\n _getParentBindingElement(start) {\n if (start.parentNode.host) {\n const { host } = start.parentNode;\n if (host.hasAttribute('ref')) {\n return host;\n }\n } else if (start.parentNode) {\n if (start.parentNode.hasAttribute('ref')) {\n return this.parentNode;\n }\n this._getParentBindingElement(this.parentNode);\n }\n return null;\n }\n\n getModelItem() {\n // return this.model.bindingMap.find(m => m.refnode === this.nodeset);\n // return this.getModel().bindingMap.find(m => m.refnode === this.nodeset);\n\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi) {\n this.modelItem = mi;\n }\n\n const repeated = this.closest('fx-repeatitem');\n let existed;\n if (repeated) {\n const { index } = this.closest('fx-repeatitem');\n if (Array.isArray(this.nodeset)) {\n existed = this.getModel().getModelItem(this.nodeset[index - 1]);\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n\n if (!existed) {\n return FxModel.lazyCreateModelItem(this.getModel(), this.ref, this.nodeset);\n }\n return existed;\n }\n\n /**\n * Returns the effective value for the element.\n * a: look for 'value' attribute and if present evaluate it and return the resulting value\n * b: look for textContent and return the value if present\n * c: return null\n */\n getValue() {\n if (this.hasAttribute('value')) {\n const valAttr = this.getAttribute('value');\n try {\n const inscopeContext = getInScopeContext(this, valAttr);\n return evaluateXPathToString(valAttr, inscopeContext, this.getOwnerForm());\n } catch (error) {\n console.error(error);\n this.dispatch('error', { message: error });\n }\n }\n if (this.textContent) {\n return this.textContent;\n }\n return null;\n }\n\n getInScopeContext() {\n return getInScopeContext(this.getAttributeNode('ref') || this, this.ref);\n }\n\n setInScopeVariables(inScopeVariables) {\n this.inScopeVariables = inScopeVariables;\n }\n\n dispatch(eventName, detail) {\n const event = new CustomEvent(eventName, {\n composed: true,\n bubbles: true,\n detail,\n });\n // console.log('firing', event);\n this.dispatchEvent(event);\n }\n };\n","import { DependencyNotifyingDomFacade } from './DependencyNotifyingDomFacade.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { ModelItem } from './modelitem.js';\nimport {\n evaluateXPathToBoolean,\n evaluateXPathToNodes,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * FxBind declaratively attaches constraints to nodes in the data (instances).\n *\n * It's major task is to create ModelItem Objects for each Node in the data their ref is pointing to.\n *\n * References and constraint attributes use XPath statements to point to the nodes they are attributing.\n *\n * Note: why is fx-bind not extending BoundElement? Though fx-bind has a 'ref' attr it is not bound in the sense of\n * getting updates about changes of the bound nodes. Instead it acts as a factory for modelItems that are used by\n * BoundElements to track their state.\n */\n// export class FxBind extends HTMLElement {\nexport class FxBind extends foreElementMixin(HTMLElement) {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n /*\n static get styles() {\n return css`\n :host {\n display: none;\n }\n `;\n }\n*/\n\n /*\n static get properties() {\n return {\n ...super.properties,\n\n /!**\n * allows to calculate a value. This value will become readonly.\n *!/\n calculate: {\n type: String\n },\n contextNode:{\n type:Object\n },\n /!**\n * arbitrary XPath resolving to xs:boolean - defaults to 'true()'\n *!/\n constraint: {\n type: String\n },\n /!**\n * id of this bind\n *!/\n id:{\n type:String\n },\n /!**\n * the nodeset the bind is referring to by it's binding expression (ref attribute)\n *!/\n nodeset: {\n type: Array\n },\n /!**\n * the owning model of this bind\n *!/\n model:{\n type:Object\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between readonly and readwrite mode - defaults to 'false()'\n *!/\n readonly: {\n type: String\n },\n /!**\n * the XPath binding expression of this bind\n *!/\n ref: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between relevant and non-relevant mode - defaults to 'true()'\n *!/\n relevant: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between required and optional - defaults to 'false'.\n *!/\n required: {\n type: String\n },\n /!**\n * XPath statement\n *!/\n type: {\n type: String\n }\n };\n }\n*/\n\n constructor() {\n super();\n // this.id='';\n // this.ref = '';\n // this.readonly = 'false()';\n // this.required = 'false()';\n // this.relevant = 'true()';\n // this.constraint = 'true()';\n // this.type = 'xs:string';\n // this.calculate = '';\n this.nodeset = [];\n this.model = {};\n this.contextNode = {};\n this.inited = false;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n // this.id = this.hasAttribute('id')?this.getAttribute('id'):;\n this.ref = this.getAttribute('ref');\n this.readonly = this.getAttribute('readonly');\n this.required = this.getAttribute('required');\n this.relevant = this.getAttribute('relevant');\n this.type = this.hasAttribute('type') ? this.getAttribute('type') : FxBind.TYPE_DEFAULT;\n this.calculate = this.getAttribute('calculate');\n }\n\n /**\n * initializes the bind element by evaluating the binding expression.\n *\n * For each node referred to by the binding expr a ModelItem object is created.\n *\n * @param model\n */\n init(model) {\n this.model = model;\n console.log('init binding ', this);\n this.instanceId = this._getInstanceId();\n this.bindType = this.getModel().getInstance(this.instanceId).type;\n // console.log('binding type ', this.bindType);\n\n if (this.bindType === 'xml') {\n this._evalInContext();\n this._buildBindGraph();\n this._createModelItems();\n }\n\n // ### process child bindings\n this._processChildren(model);\n }\n\n /*\n //todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node){\n let path = fx.evaluateXPath('path()',node);\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if(instanceId !== 'default'){\n return '#' + instanceId + FxBind.shortenPath(path);\n }else {\n return FxBind.shortenPath(path);\n }\n\n }\n*/\n\n _buildBindGraph() {\n if (this.bindType === 'xml') {\n this.nodeset.forEach(node => {\n const path = XPathUtil.getPath(node);\n this.model.mainGraph.addNode(path, node);\n\n if (this.calculate) {\n this.model.mainGraph.addNode(`${path}:calculate`, node);\n // Calculated values are a dependency of the model item.\n this.model.mainGraph.addDependency(path, `${path}:calculate`);\n }\n\n const calculateRefs = this._getReferencesForProperty(this.calculate, node);\n if (calculateRefs.length !== 0) {\n this._addDependencies(calculateRefs, node, path, 'calculate');\n }\n\n if (!this.calculate) {\n const readonlyRefs = this._getReferencesForProperty(this.readonly, node);\n if (readonlyRefs.length !== 0) {\n this._addDependencies(readonlyRefs, node, path, 'readonly');\n } else if (this.readonly) {\n this.model.mainGraph.addNode(`${path}:readonly`, node);\n }\n }\n\n // const requiredRefs = this.requiredReferences;\n const requiredRefs = this._getReferencesForProperty(this.required, node);\n if (requiredRefs.length !== 0) {\n this._addDependencies(requiredRefs, node, path, 'required');\n } else if (this.required) {\n this.model.mainGraph.addNode(`${path}:required`, node);\n }\n\n const relevantRefs = this._getReferencesForProperty(this.relevant, node);\n if (relevantRefs.length !== 0) {\n this._addDependencies(relevantRefs, node, path, 'relevant');\n } else if (this.relevant) {\n this.model.mainGraph.addNode(`${path}:relevant`, node);\n }\n\n const constraintRefs = this._getReferencesForProperty(this.constraint, node);\n if (constraintRefs.length !== 0) {\n this._addDependencies(constraintRefs, node, path, 'constraint');\n } else if (this.constraint) {\n this.model.mainGraph.addNode(`${path}:constraint`, node);\n }\n });\n }\n }\n\n /**\n * Add the dependencies of this bind\n *\n * @param {Node[]} refs The nodes that are referenced by this bind. these need to be resolved before\n * this bind can be resolved.\n * @param {Node} node The start of the reference\n * @param {string} path The path to the start of the reference\n * @param {string} property The property with this dependency\n */\n _addDependencies(refs, node, path, property) {\n // console.log('_addDependencies',path);\n const nodeHash = `${path}:${property}`;\n if (refs.length !== 0) {\n if (!this.model.mainGraph.hasNode(nodeHash)) {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n refs.forEach(ref => {\n const otherPath = XPathUtil.getPath(ref);\n // console.log('otherPath', otherPath)\n\n // todo: nasty hack to prevent duplicate pathes like 'a[1]' and 'a[1]/text()[1]' to end up as separate nodes in the graph\n if (!otherPath.endsWith('text()[1]')) {\n if (!this.model.mainGraph.hasNode(otherPath)) {\n this.model.mainGraph.addNode(otherPath, ref);\n }\n this.model.mainGraph.addDependency(nodeHash, otherPath);\n }\n });\n } else {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n }\n\n _processChildren(model) {\n const childbinds = this.querySelectorAll(':scope > fx-bind');\n Array.from(childbinds).forEach(bind => {\n // console.log('init child bind ', bind);\n bind.init(model);\n });\n }\n\n /*\n render() {\n return html`\n \n `;\n }\n*/\n\n getAlert() {\n if (this.hasAttribute('alert')) {\n return this.getAttribute('alert');\n }\n const alertChild = this.querySelector('fx-alert');\n if (alertChild) {\n return alertChild.innerHTML;\n }\n return null;\n }\n\n /*\n firstUpdated(_changedProperties) {\n super.firstUpdated(_changedProperties);\n }\n */\n\n /*\n namespaceResolver(prefix) {\n // TODO: Do proper namespace resolving. Look at the ancestry / namespacesInScope of the declaration\n\n /!**\n * for (let ancestor = this; ancestor; ancestor = ancestor.parentNode) {\n * \tif (ancestor.getAttribute(`xmlns:${prefix}`)) {\n * // Return value\n * }\n * }\n *!/\n\n // console.log('namespaceResolver prefix', prefix);\n const ns = {\n xhtml: 'http://www.w3.org/1999/xhtml',\n // '' : Fore.XFORMS_NAMESPACE_URI\n };\n return ns[prefix] || null;\n }\n*/\n\n /**\n * overwrites\n */\n _evalInContext() {\n const inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);\n\n // reset nodeset\n this.nodeset = [];\n\n if (this.ref === '' || this.ref === null) {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n // eslint-disable-next-line no-lonely-if\n if (this.ref) {\n const localResult = evaluateXPathToNodes(this.ref, n, this);\n localResult.forEach(item => {\n this.nodeset.push(item);\n });\n /*\n const localResult = fx.evaluateXPathToFirstNode(this.ref, n, null, {namespaceResolver: this.namespaceResolver});\n this.nodeset.push(localResult);\n */\n }\n // console.log('local result: ', localResult);\n // this.nodeset.push(localResult);\n }\n });\n } else {\n const inst = this.getModel().getInstance(this.instanceId);\n if (inst.type === 'xml') {\n this.nodeset = evaluateXPathToNodes(this.ref, inscopeContext, this);\n } else {\n this.nodeset = this.ref;\n }\n }\n }\n\n _createModelItems() {\n // console.log('#### ', thi+s.nodeset);\n\n /*\n if(XPathUtil.isSelfReference(this.ref)){\n return;\n }\n */\n if (Array.isArray(this.nodeset)) {\n // todo - iterate and create\n // console.log('################################################ ', this.nodeset);\n // Array.from(this.nodeset).forEach((n, index) => {\n Array.from(this.nodeset).forEach(n => {\n // console.log('node ',n);\n // this._createModelItem(n, index);\n this._createModelItem(n);\n });\n } else {\n this._createModelItem(this.nodeset);\n }\n }\n\n static lazyCreateModelitems(model, ref, nodeset) {\n if (Array.isArray(nodeset)) {\n Array.from(nodeset).forEach(n => {\n FxBind.lazyCreateModelItem(model, ref, n);\n });\n } else {\n FxBind.lazyCreateModelItem(model, ref, nodeset);\n }\n }\n\n /*\n static lazyCreateModelItem(model,ref,node){\n console.log('lazyCreateModelItem ', node);\n\n let mItem = {};\n let targetNode = {};\n if(node === null) return null;\n if(node.nodeType === node.TEXT_NODE){\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n }else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n const path = FxBind.getPath(node);\n\n // const path = Fore.evaluateXPath ('path()', node, this, Fore.namespaceResolver) ;\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(path,\n ref,\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n FxBind.TYPE_DEFAULT,\n targetNode,\n this);\n\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n*/\n\n /**\n * creates a ModelItem for given instance node.\n *\n * Please note that for textnode no ModelItem is created but instead the one of its parent is used which either\n * must exist and be initialized already when we hit the textnode.\n * @param node\n * @private\n */\n // _createModelItem(node, index) {\n _createModelItem(node) {\n // console.log('_createModelItem node', node, index);\n\n /*\n this.calculateReferences = this._getReferencesForProperty(this.calculate,node);\n this.readOnlyReferences = this._getReferencesForProperty(this.readonly,node);\n this.requiredReferences = this._getReferencesForProperty(this.required,node);\n this.relevantReferences = this._getReferencesForProperty(this.relevant,node);\n this.constraintReferences = this._getReferencesForProperty(this.constraint,node);\n */\n\n /*\n if bind is the dot expression we use the modelitem of the parent\n */\n if (XPathUtil.isSelfReference(this.ref)) {\n const parentBoundElement = this.parentElement.closest('fx-bind[ref]');\n console.log('parent bound element ', parentBoundElement);\n\n if (parentBoundElement) {\n // todo: Could be fancier by combining them\n parentBoundElement.required = this.required; // overwrite parent property!\n } else {\n console.error('no parent bound element');\n }\n\n return;\n }\n\n // let value = null;\n // const mItem = {};\n /*\n let targetNode = {};\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n*/\n const targetNode = node;\n\n // const path = fx.evaluateXPath('path()',node);\n // const path = this.getPath(node);\n const path = XPathUtil.getPath(node);\n // const shortPath = this.shortenPath(path);\n\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // const newItem = new ModelItem(shortPath,\n const newItem = new ModelItem(\n path,\n this.getBindingExpr(),\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n this.type,\n targetNode,\n this,\n );\n\n this.getModel().registerModelItem(newItem);\n }\n\n /**\n * Get the nodes that are referred by the given XPath expression\n *\n * @param {string} propertyExpr The XPath to get the referenced nodes from\n *\n * @return {Node[]} The nodes that are referenced by the XPath\n *\n * todo: DependencyNotifyingDomFacade reports back too much in some cases like 'a[1]' and 'a[1]/text[1]'\n */\n _getReferencesForProperty(propertyExpr) {\n if (propertyExpr) {\n const touchedNodes = new Set();\n const domFacade = new DependencyNotifyingDomFacade(otherNode => touchedNodes.add(otherNode));\n this.nodeset.forEach(node => {\n evaluateXPathToString(propertyExpr, node, this, domFacade);\n });\n\n return Array.from(touchedNodes.values());\n }\n return [];\n }\n\n _initBooleanModelItemProperty(property, node) {\n // evaluate expression to boolean\n const propertyExpr = this[property];\n // console.log('####### ', propertyExpr);\n const result = evaluateXPathToBoolean(propertyExpr, node, this);\n return result;\n }\n\n static shortenPath(path) {\n const steps = path.split('/');\n let result = '';\n for (let i = 2; i < steps.length; i += 1) {\n const step = steps[i];\n if (step.indexOf('{}') !== -1) {\n const q = step.split('{}');\n result += `/${q[1]}`;\n } else {\n result += `/${step}`;\n }\n }\n return result;\n }\n\n // todo: more elaborated implementation ;)\n _getInstanceId() {\n const bindExpr = this.getBindingExpr();\n // console.log('_getInstanceId bindExpr ', bindExpr);\n if (bindExpr.startsWith('instance(')) {\n this.instanceId = XPathUtil.getInstanceId(bindExpr);\n return this.instanceId;\n }\n if (this.instanceId) {\n return this.instanceId;\n }\n return 'default';\n }\n}\ncustomElements.define('fx-bind', FxBind);\n","/*!\n * Toastify js 1.11.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n/**\n * Options used for Toastify\n * @typedef {Object} ToastifyConfigurationObject\n * @property {string} text - Message to be displayed in the toast\n * @property {Element} node - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @property {number} duration - Duration for which the toast should be displayed. -1 for permanent toast\n * @property {string|Element} selector - CSS ID Selector on which the toast should be added\n * @property {url} destination - URL to which the browser should be navigated on click of the toast\n * @property {boolean} newWindow - Decides whether the destination should be opened in a new window or not\n * @property {boolean} close - To show the close icon or not\n * @property {string} gravity - To show the toast from top or bottom\n * @property {string} position - To show the toast on left or right\n * @property {string} backgroundColor - Deprecated: Sets the background color of the toast\n * @property {url} avatar - Image/icon to be shown before text\n * @property {string} className - Ability to provide custom class name for further customization\n * @property {boolean} stopOnFocus - To stop timer when hovered over the toast (Only if duration is set)\n * @property {Function} callback - Invoked when the toast is dismissed\n * @property {Function} onClick - Invoked when the toast is clicked\n * @property {Object} offset - Ability to add some offset to axis\n * @property {boolean} escapeMarkup - Toggle the default behavior of escaping HTML markup\n * @property {Object} style - Use the HTML DOM style property to add styles to toast\n */\n\n\nclass Toastify {\n\n defaults = {\n oldestFirst: true,\n text: \"Toastify is awesome!\",\n node: undefined,\n duration: 3000,\n selector: undefined,\n callback: function() {},\n destination: undefined,\n newWindow: false,\n close: false,\n gravity: \"toastify-top\",\n positionLeft: false,\n position: \"\",\n backgroundColor: \"\",\n avatar: \"\",\n className: \"\",\n stopOnFocus: true,\n onClick: function() {},\n offset: { x: 0, y: 0 },\n escapeMarkup: true,\n style: { background: \"\" },\n };\n\n constructor(options) {\n /**\n * The version of Toastify\n * @type {string}\n * @public\n */\n this.version = \"1.11.0\";\n\n /**\n * The configuration object to configure Toastify\n * @type {ToastifyConfigurationObject}\n * @public\n */\n this.options = {};\n\n /**\n * The element that is the Toast\n * @type {Element}\n * @public\n */\n this.toastElement = null;\n\n /**\n * The root element that contains all the toasts\n * @type {Element}\n * @private\n */\n this._rootElement = document.body;\n\n this._init(options);\n }\n\n /**\n * Display the toast\n * @public\n */\n showToast() {\n // Creating the DOM object for the toast\n this.toastElement = this._buildToast();\n\n // Getting the root element to with the toast needs to be added\n if (typeof this.options.selector === \"string\") {\n this._rootElement = document.getElementById(this.options.selector);\n } else if (this.options.selector instanceof HTMLElement || this.options.selector instanceof ShadowRoot) {\n this._rootElement = this.options.selector;\n } else {\n this._rootElement = document.body;\n }\n\n // Validating if root element is present in DOM\n if (!this._rootElement) {\n throw \"Root element is not defined\";\n }\n\n // Adding the DOM element\n this._rootElement.insertBefore(this.toastElement, this._rootElement.firstChild);\n\n // Repositioning the toasts in case multiple toasts are present\n this._reposition();\n\n if (this.options.duration > 0) {\n this.toastElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(this.toastElement);\n },\n this.options.duration\n ); // Binding `this` for function invocation\n }\n\n // Supporting function chaining\n return this;\n }\n\n /**\n * Hide the toast\n * @public\n */\n hideToast() {\n if (this.toastElement.timeOutValue) {\n clearTimeout(this.toastElement.timeOutValue);\n }\n this._removeElement(this.toastElement);\n }\n\n /**\n * Init the Toastify class\n * @param {ToastifyConfigurationObject} options - The configuration object to configure Toastify\n * @param {string} [options.text=Hi there!] - Message to be displayed in the toast\n * @param {Element} [options.node] - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @param {number} [options.duration=3000] - Duration for which the toast should be displayed. -1 for permanent toast\n * @param {string} [options.selector] - CSS Selector on which the toast should be added\n * @param {url} [options.destination] - URL to which the browser should be navigated on click of the toast\n * @param {boolean} [options.newWindow=false] - Decides whether the destination should be opened in a new window or not\n * @param {boolean} [options.close=false] - To show the close icon or not\n * @param {string} [options.gravity=toastify-top] - To show the toast from top or bottom\n * @param {string} [options.position=right] - To show the toast on left or right\n * @param {string} [options.backgroundColor] - Sets the background color of the toast (To be deprecated)\n * @param {url} [options.avatar] - Image/icon to be shown before text\n * @param {string} [options.className] - Ability to provide custom class name for further customization\n * @param {boolean} [options.stopOnFocus] - To stop timer when hovered over the toast (Only if duration is set)\n * @param {Function} [options.callback] - Invoked when the toast is dismissed\n * @param {Function} [options.onClick] - Invoked when the toast is clicked\n * @param {Object} [options.offset] - Ability to add some offset to axis\n * @param {boolean} [options.escapeMarkup=true] - Toggle the default behavior of escaping HTML markup\n * @param {Object} [options.style] - Use the HTML DOM style property to add styles to toast\n * @private\n */\n _init(options) {\n\n // Setting defaults\n this.options = Object.assign(this.defaults, options);\n\n if (this.options.backgroundColor) {\n // This is being deprecated in favor of using the style HTML DOM property\n console.warn('DEPRECATION NOTICE: \"backgroundColor\" is being deprecated. Please use the \"style.background\" property.');\n }\n\n this.toastElement = null;\n\n this.options.gravity = options.gravity === \"bottom\" ? \"toastify-bottom\" : \"toastify-top\"; // toast position - top or bottom\n this.options.stopOnFocus = options.stopOnFocus === undefined ? true : options.stopOnFocus; // stop timeout on focus\n\n this.options.style.background = this.options.style.background || options.backgroundColor;\n }\n\n /**\n * Build the Toastify element\n * @returns {Element}\n * @private\n */\n _buildToast() {\n // Validating if the options are defined\n if (!this.options) {\n throw \"Toastify is not initialized\";\n }\n\n // Creating the DOM object\n let divElement = document.createElement(\"div\");\n divElement.className = `toastify on ${this.options.className}`;\n\n // Positioning toast to left or right or center (default right)\n divElement.className += ` toastify-${this.options.position}`;\n\n // Assigning gravity of element\n divElement.className += ` ${this.options.gravity}`;\n\n // Loop through our style object and apply styles to divElement\n for (const property in this.options.style) {\n divElement.style[property] = this.options.style[property];\n }\n\n // Adding the toast message/node\n if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {\n // If we have a valid node, we insert it\n divElement.appendChild(this.options.node)\n } else {\n if (this.options.escapeMarkup) {\n divElement.innerText = this.options.text;\n } else {\n divElement.innerHTML = this.options.text;\n }\n\n if (this.options.avatar !== \"\") {\n let avatarElement = document.createElement(\"img\");\n avatarElement.src = this.options.avatar;\n\n avatarElement.className = \"toastify-avatar\";\n\n if (this.options.position == \"left\") {\n // Adding close icon on the left of content\n divElement.appendChild(avatarElement);\n } else {\n // Adding close icon on the right of content\n divElement.insertAdjacentElement(\"afterbegin\", avatarElement);\n }\n }\n }\n\n // Adding a close icon to the toast\n if (this.options.close === true) {\n // Create a span for close element\n let closeElement = document.createElement(\"span\");\n closeElement.innerHTML = \"✖\";\n\n closeElement.className = \"toast-close\";\n\n // Triggering the removal of toast from DOM on close click\n closeElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this._removeElement(this.toastElement);\n window.clearTimeout(this.toastElement.timeOutValue);\n }\n );\n\n //Calculating screen width\n const width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Adding the close icon to the toast element\n // Display on the right if screen width is less than or equal to 360px\n if ((this.options.position == \"left\") && width > 360) {\n // Adding close icon on the left of content\n divElement.insertAdjacentElement(\"afterbegin\", closeElement);\n } else {\n // Adding close icon on the right of content\n divElement.appendChild(closeElement);\n }\n }\n\n // Clear timeout while toast is focused\n if (this.options.stopOnFocus && this.options.duration > 0) {\n // stop countdown\n divElement.addEventListener(\n \"mouseover\",\n (event) => {\n window.clearTimeout(divElement.timeOutValue);\n }\n )\n // add back the timeout\n divElement.addEventListener(\n \"mouseleave\",\n () => {\n divElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(divElement);\n },\n this.options.duration\n )\n }\n )\n }\n\n // Adding an on-click destination path\n if (typeof this.options.destination !== \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n if (this.options.newWindow === true) {\n window.open(this.options.destination, \"_blank\");\n } else {\n window.location = this.options.destination;\n }\n }\n );\n }\n\n if (typeof this.options.onClick === \"function\" && typeof this.options.destination === \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this.options.onClick();\n }\n );\n }\n\n // Adding offset\n if (typeof this.options.offset === \"object\") {\n\n const x = this._getAxisOffsetAValue(\"x\", this.options);\n const y = this._getAxisOffsetAValue(\"y\", this.options);\n\n const xOffset = this.options.position == \"left\" ? x : `-${x}`;\n const yOffset = this.options.gravity == \"toastify-top\" ? y : `-${y}`;\n\n divElement.style.transform = `translate(${xOffset},${yOffset})`;\n\n }\n\n // Returning the generated element\n return divElement;\n }\n\n /**\n * Remove the toast from the DOM\n * @param {Element} toastElement\n */\n _removeElement(toastElement) {\n // Hiding the element\n toastElement.className = toastElement.className.replace(\" on\", \"\");\n\n // Removing the element from DOM after transition end\n window.setTimeout(\n () => {\n // remove options node if any\n if (this.options.node && this.options.node.parentNode) {\n this.options.node.parentNode.removeChild(this.options.node);\n }\n\n // Remove the element from the DOM, only when the parent node was not removed before.\n if (toastElement.parentNode) {\n toastElement.parentNode.removeChild(toastElement);\n }\n\n // Calling the callback function\n this.options.callback.call(toastElement);\n\n // Repositioning the toasts again\n this._reposition();\n },\n 400\n ); // Binding `this` for function invocation\n }\n\n /**\n * Position the toast on the DOM\n * @private\n */\n _reposition() {\n\n // Top margins with gravity\n let topLeftOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let topRightOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let offsetSize = {\n top: 15,\n bottom: 15,\n };\n\n // Get all toast messages that have been added to the container (selector)\n let allToasts = this._rootElement.querySelectorAll(\".toastify\");\n\n let classUsed;\n\n // Modifying the position of each toast element\n for (let i = 0; i < allToasts.length; i++) {\n // Getting the applied gravity\n if (allToasts[i].classList.contains(\"toastify-top\") === true) {\n classUsed = \"toastify-top\";\n } else {\n classUsed = \"toastify-bottom\";\n }\n\n let height = allToasts[i].offsetHeight;\n classUsed = classUsed.substr(9, classUsed.length - 1)\n // Spacing between toasts\n let offset = 15;\n\n let width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Show toast in center if screen with less than or equal to 360px\n if (width <= 360) {\n // Setting the position\n allToasts[i].style[classUsed] = `${offsetSize[classUsed]}px`;\n\n offsetSize[classUsed] += height + offset;\n } else {\n if (allToasts[i].classList.contains(\"toastify-left\") === true) {\n // Setting the position\n allToasts[i].style[classUsed] = `${topLeftOffsetSize[classUsed]}px`;\n\n topLeftOffsetSize[classUsed] += height + offset;\n } else {\n // Setting the position\n allToasts[i].style[classUsed] = `${topRightOffsetSize[classUsed]}px`;\n\n topRightOffsetSize[classUsed] += height + offset;\n }\n }\n }\n }\n\n /**\n * Helper function to get offset\n * @param {string} axis - 'x' or 'y'\n * @param {ToastifyConfigurationObject} options - The options object containing the offset object\n */\n _getAxisOffsetAValue(axis, options) {\n\n if (options.offset[axis]) {\n if (isNaN(options.offset[axis])) {\n return options.offset[axis];\n } else {\n return `${options.offset[axis]}px`;\n }\n }\n\n return '0px';\n\n }\n\n }\n\n\n // Returning the Toastify function to be assigned to the window object/module\n function StartToastifyInstance(options) {\n return new Toastify(options);\n }\n\n export default StartToastifyInstance;\n","import Toastify from 'toastify-js/src/toastify-es';\n\n/**\n *\n * Wrapper component for toastify-js - https://github.com/apvarun/toastify-js\n *\n * @event jinn-toast - will show the toast with text passed in event\n */\nexport class JinnToast extends HTMLElement {\n\n static get properties() {\n return {\n avatar: {type: String},\n backgroundColor: {type: String},\n callback: {type: String},\n classProp: {type: String},\n close: {type: Boolean},\n destination: {type: String},\n duration: {type: Number},\n escapeMarkup: {type: Boolean},\n gravity: {type: String},\n newWindow: {type: Boolean},\n oldestFirst: {type: Boolean},\n position: {type: String},\n selector: {type: String},\n stopOnFocus: {type: Boolean},\n text: {type: String}\n };\n }\n\n constructor() {\n super();\n this.attachShadow({mode: 'open'});\n }\n\n _initVar(name, defaultVal) {\n return this.hasAttribute(name) ? this.getAttribute(name) : defaultVal;\n }\n\n connectedCallback() {\n this.avatar = this._initVar('avatar', '');\n this.backgroundColor = this._initVar('backgroundColor', '');\n this.callback = this._initVar('callback', {});\n this.classProp = this._initVar('data-class', '');\n this.close = (this._initVar('close', false)) === 'true';\n this.destination = this._initVar('destination', undefined);\n this.duration = Number(this._initVar('duration', 3000));\n this.escapeMarkup = (this._initVar('escapeMarkup', true)) === 'true';\n this.gravity = this._initVar('gravity', 'top');\n this.newWindow = (this._initVar('newWindow', false)) === 'true';\n this.offSet = this._initVar('offSet', {});\n this.oldestFirst = (this._initVar('oldestFirst', true)) === 'true';\n this.position = this._initVar('position', 'right');\n // this.selector = this._initVar('selector','');\n this.stopOnFocus = this._initVar('stopOnFocus', true);\n this.text = this._initVar('text', '');\n\n const style = `\n :host{\n display:none;\n }\n `;\n this.shadowRoot.innerHTML = `\n \n ${this.renderHTML}\n `;\n\n /**\n * trigger toast via @jinn-toast events\n */\n this.addEventListener('jinn-toast', (ev) =>{\n this.showToast(ev.detail.text);\n });\n\n }\n\n showToast(text){\n new Toastify({\n avatar: this.avatar,\n // backgroundColor:this.backgroundColor,\n // callback: this.callback,\n className:this.classProp,\n close: this.close,\n destination: this.destination,\n duration: this.duration,\n escapeMarkup: this.escapeMarkup,\n gravity: this.gravity,\n newWindow: false,\n offset:this.offset,\n oldestFirst: this.oldestFirst,\n position: this.position,\n node: this.shadowRoot,\n stopOnFocus: this.stopOnFocus,\n text,\n }).showToast();\n\n }\n\n renderHTML() {\n return `\n \n `;\n }\n\n}\nwindow.customElements.define('jinn-toast', JinnToast);\n","import { Fore } from './fore.js';\nimport './fx-instance.js';\nimport './fx-model.js';\nimport '@jinntec/jinn-toast';\nimport { evaluateXPathToNodes, evaluateXPathToString } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * Main class for Fore.Outermost container element for each Fore application.\n *\n * Root element for Fore. Kicks off initialization and displays messages.\n *\n * fx-fore is the outermost container for each form. A form can have exactly one model\n * with arbitrary number of instances.\n *\n * Main responsiblities are initialization and updating of model and instances, update of UI (refresh) and global messaging.\n *\n *\n *\n * @ts-check\n */\nexport class FxFore extends HTMLElement {\n static get properties() {\n return {\n /**\n * Setting this marker attribute will refresh the UI in a lazy fashion just updating elements being\n * in viewport.\n *\n * this feature is still experimental and should be used with caution and extra testing\n */\n lazyRefresh: {\n type: Boolean,\n },\n model: {\n type: Object,\n },\n ready: {\n type: Boolean,\n },\n };\n }\n\n /**\n * attaches handlers for\n *\n * - `model-construct-done` to trigger the processing of the UI\n * - `message` - to display a message triggered by an fx-message action\n * - `error` - to display an error message\n * - 'compute-exception` - warn about circular dependencies in graph\n */\n constructor() {\n super();\n this.model = {};\n this.addEventListener('model-construct-done', this._handleModelConstructDone);\n this.addEventListener('message', this._displayMessage);\n this.addEventListener('error', this._displayError);\n window.addEventListener('compute-exception', e => {\n console.error('circular dependency: ', e);\n });\n\n this.ready = false;\n this.storedTemplateExpressionByNode = new Map();\n\n const style = `\n :host {\n // display: none;\n height:auto;\n padding:var(--model-element-padding);\n font-family:Roboto, sans-serif;\n color:var(--paper-grey-900);\n }\n :host ::slotted(fx-model){\n display:none;\n }\n :host(.fx-ready){\n animation: fadein .4s forwards;\n display:block;\n }\n\n #modalMessage .dialogActions{\n text-align:center;\n }\n .overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n transition: all 500ms;\n visibility: hidden;\n opacity: 0;\n z-index:10;\n }\n .overlay.show {\n visibility: visible;\n opacity: 1;\n }\n\n .popup {\n margin: 70px auto;\n background: #fff;\n border-radius: 5px;\n width: 30%;\n position: relative;\n transition: all 5s ease-in-out;\n padding: 20px;\n\n }\n .popup h2 {\n margin-top: 0;\n width:100%;\n background:#eee;\n position:absolute;\n top:0;\n right:0;\n left:0;\n height:40px;\n border-radius: 5px;\n\n }\n .popup .close {\n position: absolute;\n top: 3px;\n right: 10px;\n transition: all 200ms;\n font-size: 30px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n }\n .popup .close:focus{\n outline:none;\n }\n\n .popup .close:hover {\n color: #06D85F;\n }\n #messageContent{\n margin-top:40px;\n }\n @keyframes fadein {\n 0% {\n opacity:0;\n }\n 100% {\n opacity:1;\n }\n }\n `;\n\n const html = `\n \n \n \n \n
\n
\n

\n ×\n
\n
\n
\n `;\n\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n\n this.toRefresh = [];\n this.initialRun = true;\n this.someInstanceDataStructureChanged = false;\n }\n\n connectedCallback() {\n this.lazyRefresh = this.hasAttribute('refresh-on-view');\n if (this.lazyRefresh) {\n const options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.3,\n };\n this.intersectionObserver = new IntersectionObserver(this.handleIntersect, options);\n }\n\n this.src = this.hasAttribute('src')? this.getAttribute('src'):null;\n if(this.src){\n this._loadFromSrc();\n return ;\n }\n\n const slot = this.shadowRoot.querySelector('slot');\n slot.addEventListener('slotchange', event => {\n const children = event.target.assignedElements();\n let modelElement = children.find(\n modelElem => modelElem.nodeName.toUpperCase() === 'FX-MODEL',\n );\n if (!modelElement) {\n const generatedModel = document.createElement('FX-model');\n this.appendChild(generatedModel);\n modelElement = generatedModel;\n }\n if (!modelElement.inited) {\n console.log(\n `########## FORE: kick off processing for ... ${window.location.href} ##########`,\n );\n if(this.src){\n console.log('########## FORE: loaded from ... ', this.src, '##########');\n }\n modelElement.modelConstruct();\n }\n this.model = modelElement;\n });\n this.addEventListener('path-mutated', (e) =>{\n console.log('path-mutated event received', e.detail.path, e.detail.index);\n this.someInstanceDataStructureChanged = true;\n });\n }\n\n\n addToRefresh(modelItem){\n const found = this.toRefresh.find(mi => mi.path === modelItem.path );\n if(!found){\n this.toRefresh.push(modelItem);\n }\n }\n\n /**\n * loads a Fore from an URL given by `src`.\n *\n * Will extract the `fx-fore` element from that target file and use and replace current `fx-fore` element with the loaded one.\n * @private\n */\n _loadFromSrc() {\n console.log('########## loading Fore from ',this.src ,'##########');\n fetch(this.src, {\n method: 'GET',\n mode: 'cors',\n credentials: 'include',\n headers: {\n 'Content-Type': 'text/html',\n },\n })\n .then(response => {\n const responseContentType = response.headers.get('content-type').toLowerCase();\n console.log('********** responseContentType *********', responseContentType);\n if (responseContentType.startsWith('text/html')) {\n // const htmlResponse = response.text();\n // return new DOMParser().parseFromString(htmlResponse, 'text/html');\n // return response.text();\n return response.text().then(result =>\n // console.log('xml ********', result);\n new DOMParser().parseFromString(result, 'text/html'),\n );\n }\n return 'done';\n })\n .then(data => {\n // const theFore = fxEvaluateXPathToFirstNode('//fx-fore', data.firstElementChild);\n const theFore = data.querySelector('fx-fore');\n\n // console.log('thefore', theFore)\n if(!theFore){\n this.dispatchEvent(new CustomEvent('error',{detail:{message: `Fore element not found in '${this.src}'. Maybe wrapped within 'template' element?`}}));\n }\n theFore.setAttribute('from-src', this.src);\n this.replaceWith(theFore);\n })\n .catch(error => {\n this.dispatchEvent(new CustomEvent('error',{detail:{message: `'${this.src}' not found or does not contain Fore element.`}}));\n });\n }\n\n /**\n * refreshes the UI by using IntersectionObserver API. This is the handler being called\n * by the observer whenever elements come into / move out of viewport.\n * @param entries\n * @param observer\n */\n handleIntersect(entries, observer) {\n console.time('refreshLazy');\n entries.forEach(entry => {\n const { target } = entry;\n\n if (entry.isIntersecting) {\n console.log('in view', entry);\n // console.log('repeat in view entry', entry.target);\n // const target = entry.target;\n // if(target.hasAttribute('refresh-on-view')){\n target.classList.add('loaded');\n // }\n\n // todo: too restrictive here? what if target is a usual html element? shouldn't it refresh downwards?\n if (typeof target.refresh === 'function') {\n console.log('refreshing target', target);\n target.refresh(target, true);\n } else {\n console.log('refreshing children', target);\n Fore.refreshChildren(target, true);\n }\n }\n });\n entries[0].target.getOwnerForm().dispatchEvent(new CustomEvent('refresh-done'));\n\n console.timeEnd('refreshLazy');\n }\n\n evaluateToNodes(xpath, context) {\n return evaluateXPathToNodes(xpath, context, this);\n }\n\n disconnectedCallback() {\n /*\n this.removeEventListener('model-construct-done', this._handleModelConstructDone);\n this.removeEventListener('message', this._displayMessage);\n this.removeEventListener('error', this._displayError);\n this.storedTemplateExpressionByNode=null;\n this.shadowRoot = undefined;\n*/\n }\n\n /**\n * refreshes the whole UI by visiting each bound element (having a 'ref' attribute) and applying the state of\n * the bound modelItem to the bound element.\n *\n *\n * AVT:\n *\n */\n async refresh(force) {\n // refresh () {\n console.group('### refresh');\n\n console.time('refresh');\n\n // ### refresh Fore UI elements\n console.time('refreshChildren');\n console.log('toRefresh',this.toRefresh);\n\n if(!this.initialRun && this.toRefresh.length !== 0){\n let needsRefresh = false;\n\n // ### after recalculation the changed modelItems are copied to 'toRefresh' array for processing\n this.toRefresh.forEach(modelItem => {\n // check if modelItem has boundControls - if so, call refresh() for each of them\n const controlsToRefresh = modelItem.boundControls;\n if(controlsToRefresh){\n controlsToRefresh.forEach(ctrl => {\n ctrl.refresh();\n });\n }\n\n // ### check if other controls depend on current modelItem\n const mainGraph = this.getModel().mainGraph;\n if(mainGraph && mainGraph.hasNode(modelItem.path)){\n const deps = this.getModel().mainGraph.dependentsOf(modelItem.path, false);\n // ### iterate dependant modelItems and refresh all their boundControls\n if(deps.length !== 0){\n deps.forEach(dep => {\n // ### if changed modelItem has a 'facet' path we use the basePath that is the locationPath without facet name\n const basePath = XPathUtil.getBasePath(dep);\n const modelItemOfDep = this.getModel().modelItems.find(mip => mip.path === basePath);\n // ### refresh all boundControls\n modelItemOfDep.boundControls.forEach(control =>{control.refresh()});\n });\n needsRefresh = true;\n }\n }\n });\n this.toRefresh = [];\n if(!needsRefresh){\n console.log('skipping refresh - no dependants');\n }\n }else{\n Fore.refreshChildren(this, true);\n console.timeEnd('refreshChildren');\n }\n\n // ### refresh template expressions\n if(this.initialRun || this.someInstanceDataStructureChanged){\n this._updateTemplateExpressions();\n this.someInstanceDataStructureChanged = false; //reset\n }\n this._processTemplateExpressions();\n\n console.timeEnd('refresh');\n\n console.groupEnd();\n console.log('### <<<<< dispatching refresh-done - end of UI update cycle >>>>>');\n this.dispatchEvent(new CustomEvent('refresh-done'));\n }\n\n /**\n * entry point for processing of template expression enclosed in '{}' brackets.\n *\n * Expressions are found with an XPath search. For each node an entry is added to the storedTemplateExpressionByNode map.\n *\n *\n * @private\n */\n _updateTemplateExpressions() {\n // Note the fact we're going over HTML here: therefore the `html` prefix.\n const search =\n \"(descendant-or-self::*/(text(), @*))[matches(.,'\\\\{.*\\\\}')] except descendant-or-self::fx-model/descendant-or-self::node()/(., @*)\";\n\n const tmplExpressions = evaluateXPathToNodes(search, this, this);\n console.log('template expressions found ', tmplExpressions);\n\n if (!this.storedTemplateExpressions) {\n this.storedTemplateExpressions = [];\n }\n\n console.log('######### storedTemplateExpressions', this.storedTemplateExpressions.length);\n\n /*\n storing expressions and their nodes for re-evaluation\n */\n Array.from(tmplExpressions).forEach(node => {\n if (this.storedTemplateExpressionByNode.has(node)) {\n // If the node is already known, do not process it twice\n return;\n }\n const expr = this._getTemplateExpression(node);\n\n // console.log('storedTemplateExpressionByNode', this.storedTemplateExpressionByNode);\n this.storedTemplateExpressionByNode.set(node, expr);\n });\n console.log('stored template expressions ', this.storedTemplateExpressionByNode);\n\n // TODO: Should we clean up nodes that existed but are now gone?\n this._processTemplateExpressions();\n\n }\n\n _processTemplateExpressions() {\n for (const node of this.storedTemplateExpressionByNode.keys()) {\n this._processTemplateExpression({\n node,\n expr: this.storedTemplateExpressionByNode.get(node),\n });\n }\n }\n\n// eslint-disable-next-line class-methods-use-this\n _processTemplateExpression(exprObj) {\n // console.log('processing template expression ', exprObj);\n\n const { expr } = exprObj;\n const { node } = exprObj;\n // console.log('expr ', expr);\n this.evaluateTemplateExpression(expr, node, this);\n }\n\n /**\n * evaluate a template expression (some expression in {} brackets) on a node (either text- or attribute node.\n * @param expr the XPath to evaluate\n * @param node the node which will get updated with evaluation result\n * @param form the form element\n */\n evaluateTemplateExpression(expr, node) {\n if (expr === '{}') return;\n const matches = expr.match(/{[^}]*}/g);\n const namespaceContextNode =\n node.nodeType === node.TEXT_NODE ? node.parentNode : node.ownerElement;\n if (matches) {\n matches.forEach(match => {\n // console.log('match ', match);\n let naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n if (!inscope) {\n const errNode =\n node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ATTRIBUTE_NODE\n ? node.parentNode\n : node;\n console.warn('no inscope context for ', errNode);\n return;\n }\n // Templates are special: they use the namespace configuration from the place where they are\n // being defined\n const instanceId = XPathUtil.getInstanceId(naked);\n // console.log('target instance ', instanceId);\n const inst = this.getModel().getInstance(instanceId);\n try {\n const result = evaluateXPathToString(naked, inscope, node, null, inst);\n\n // console.log('result of eval ', result);\n const replaced = expr.replaceAll(match, result);\n // console.log('result of replacing ', replaced);\n\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n const parent = node.ownerElement;\n\n // parent.setAttribute(name, replaced);\n parent.setAttribute(node.nodeName, replaced);\n } else if (node.nodeType === Node.TEXT_NODE) {\n node.textContent = replaced;\n }\n\n if (replaced.includes('{')) {\n // console.log('need to go next round');\n\n // todo: duplicated code here - see above\n naked = replaced.substring(1, replaced.length);\n this.evaluateTemplateExpression(replaced, node);\n }\n } catch (error) {\n this.dispatchEvent(new CustomEvent('error', { detail: error }));\n }\n });\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n _getTemplateExpression(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n return node.value;\n }\n if (node.nodeType === Node.TEXT_NODE) {\n return node.textContent.trim();\n }\n return null;\n }\n\n /**\n * called when `model-construct-done` event is received to\n * start initing of the UI.\n *\n * @private\n */\n _handleModelConstructDone() {\n this._initUI();\n }\n\n /**\n * If there's no instance element found in a fx-model during init it will construct\n * an instance from UI bindings.\n *\n * @returns {Promise}\n * @private\n */\n async _lazyCreateInstance() {\n const model = this.querySelector('fx-model');\n if (model.instances.length === 0) {\n console.log('### lazy creation of instance');\n const generatedInstance = document.createElement('fx-instance');\n model.appendChild(generatedInstance);\n\n const generated = document.implementation.createDocument(null, 'data', null);\n // const newData = this._generateInstance(this, generated.firstElementChild);\n this._generateInstance(this, generated.firstElementChild);\n generatedInstance.instanceData = generated;\n model.instances.push(generatedInstance);\n console.log('generatedInstance ', this.getModel().getDefaultInstanceData());\n }\n }\n\n /**\n * @param {Element} start\n * @param {Element} parent\n */\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref') && !Fore.isActionElement(start.nodeName)) {\n const ref = start.getAttribute('ref');\n\n if (ref.includes('/')) {\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n // const generated = document.createElement(ref);\n parent = this._generateNode(parent, step, start);\n });\n } else {\n parent = this._generateNode(parent, ref, start);\n }\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n\n // eslint-disable-next-line class-methods-use-this\n _generateNode(parent, step, start) {\n const generated = parent.ownerDocument.createElement(step);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n return parent;\n }\n\n /*\n _createStep(){\n\n }\n */\n\n /*\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref')) {\n const ref = start.getAttribute('ref');\n\n if(ref.includes('/')){\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n\n });\n }\n\n // const generated = document.createElement(ref);\n const generated = parent.ownerDocument.createElement(ref);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n */\n\n /**\n * Start the initialization of the UI by\n *\n * 1. checking if a instance needs to be generated\n * 2. attaching lazy loading intersection observers if `refresh-on-view` attributes are found\n * 3. doing a full refresh of the UI\n *\n * @returns {Promise}\n * @private\n */\n async _initUI() {\n console.log('### _initUI()');\n\n await this._lazyCreateInstance();\n\n console.log('registering variables!');\n const variables = new Map();\n (function registerVariables(node) {\n for (const child of node.children) {\n if ('setInScopeVariables' in child) {\n child.setInScopeVariables(variables);\n }\n registerVariables(child);\n }\n })(this);\n console.log('Found variables:', variables);\n\n const options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.3,\n };\n\n await this.refresh();\n // this.style.display='block'\n this.classList.add('fx-ready');\n document.body.classList.add('fx-ready');\n\n this.ready = true;\n this.initialRun = false;\n console.log('### <<<<< dispatching ready >>>>>');\n console.log('########## modelItems: ', this.getModel().modelItems);\n console.log('########## FORE: form fully initialized... ##########');\n this.dispatchEvent(new CustomEvent('ready', {}));\n }\n\n registerLazyElement(element) {\n if (this.intersectionObserver) {\n // console.log('registerLazyElement',element);\n this.intersectionObserver.observe(element);\n }\n }\n\n unRegisterLazyElement(element) {\n if (this.intersectionObserver) {\n this.intersectionObserver.unobserve(element);\n }\n }\n\n /**\n *\n * @returns {FxModel}\n */\n getModel() {\n return this.querySelector('fx-model');\n }\n\n _displayMessage(e) {\n const { level } = e.detail;\n const msg = e.detail.message;\n this._showMessage(level, msg);\n }\n\n _displayError(e) {\n // const { error } = e.detail;\n const msg = e.detail.message;\n // this._showMessage('modal', msg);\n const toast = this.shadowRoot.querySelector('#error');\n toast.showToast(msg);\n }\n\n _showMessage(level, msg) {\n if (level === 'modal') {\n // this.$.messageContent.innerText = msg;\n // this.$.modalMessage.open();\n\n this.shadowRoot.getElementById('messageContent').innerText = msg;\n // this.shadowRoot.getElementById('modalMessage').open();\n this.shadowRoot.getElementById('modalMessage').classList.add('show');\n } else if (level === 'sticky') {\n // const notification = this.$.modeless;\n this.shadowRoot.querySelector('#sticky').showToast(msg);\n } else {\n const toast = this.shadowRoot.querySelector('#message');\n toast.showToast(msg);\n }\n }\n}\n\ncustomElements.define('fx-fore', FxFore);\n","import { Fore } from './fore.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { evaluateXPathToString, evaluateXPath } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * todo: validate='false'\n */\nexport class FxSubmission extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // this.style.display = 'none';\n this.methods = ['get', 'put', 'post', 'delete', 'head', 'urlencoded-post'];\n\n this.model = this.parentNode;\n\n // ### initialize properties with defaults\n // if (!this.hasAttribute('id')) throw new Error('id is required');\n if (!this.hasAttribute('id')) console.warn('id is required');\n this.id = this.getAttribute('id');\n\n /** if present should be a existing instance id */\n this.instance = this.hasAttribute('instance') ? this.getAttribute('instance') : null;\n\n /** if present will determine XPath where to insert a response into when mode is 'replace' */\n this.into = this.hasAttribute('into') ? this.getAttribute('into') : null;\n\n /** http method */\n this.method = this.hasAttribute('method') ? this.getAttribute('method') : 'get';\n\n /** relevance processing - one of 'remove, keep or empty' */\n this.nonrelevant = this.hasAttribute('nonrelevant')\n ? this.getAttribute('nonrelevant')\n : 'remove';\n\n /** replace might be 'all', 'instance' or 'none' */\n this.replace = this.hasAttribute('replace') ? this.getAttribute('replace') : 'all';\n\n this.serialization = this.hasAttribute('serialization')\n ? this.getAttribute('serialization')\n : 'xml';\n\n // if (!this.hasAttribute('url')) throw new Error(`url is required for submission: ${this.id}`);\n if (!this.hasAttribute('url')) console.warn(`url is required for submission: ${this.id}`);\n this.url = this.getAttribute('url');\n\n this.targetref = this.hasAttribute('targetref') ? this.getAttribute('targetref') : null;\n\n this.mediatype = this.hasAttribute('mediatype')\n ? this.getAttribute('mediatype')\n : 'application/xml';\n\n this.validate = this.getAttribute('validate') ? this.getAttribute('validate') : 'true';\n this.shadowRoot.innerHTML = this.renderHTML();\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderHTML() {\n return `\n \n `;\n }\n\n async submit() {\n await this.dispatch('submit', { submission: this });\n this._submit();\n }\n\n async _submit() {\n console.log('submitting....');\n this.evalInContext();\n const model = this.getModel();\n\n model.recalculate();\n\n if (this.validate) {\n const valid = model.revalidate();\n if (!valid) {\n console.log('validation failed. Bubmission stopped');\n // ### allow alerts to pop up\n this.dispatch('submit-error', {});\n this.getModel().parentNode.refresh();\n return;\n }\n }\n console.log('model updated....');\n await this._serializeAndSend();\n }\n\n /**\n * resolves template expressions for a single attribute\n * @param expr the attribute value to evaluate\n * @param node the attribute node used for scoped resolution\n * @returns {*}\n * @private\n */\n _evaluateAttributeTemplateExpression(expr, node) {\n const matches = expr.match(/{[^}]*}/g);\n if (matches) {\n matches.forEach(match => {\n console.log('match ', match);\n const naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n const result = evaluateXPathToString(naked, inscope, this.getOwnerForm());\n const replaced = expr.replaceAll(match, result);\n console.log('replacing ', expr, ' with ', replaced);\n expr = replaced;\n });\n }\n return expr;\n }\n\n /**\n * sends the data after evaluating\n *\n * @private\n */\n async _serializeAndSend() {\n const resolvedUrl = this._evaluateAttributeTemplateExpression(this.url, this);\n\n const instance = this.getInstance();\n console.log('instance type', instance.type);\n\n let serialized;\n if (this.serialization === 'none') {\n serialized = undefined;\n } else {\n const relevant = this.selectRelevant(instance.type);\n serialized = this._serialize(instance.type, relevant);\n }\n\n // let serialized = serializer.serializeToString(relevant);\n if (this.method.toLowerCase() === 'get') {\n serialized = undefined;\n }\n // console.log('data being send', serialized);\n // console.log('submitting data',serialized);\n\n if (resolvedUrl === '#echo') {\n let data = null;\n if (serialized && instance.type === 'xml') {\n data = new DOMParser().parseFromString(serialized, 'application/xml');\n }\n if (serialized && instance.type === 'json') {\n data = JSON.parse(serialized);\n }\n this._handleResponse(data);\n this.dispatch('submit-done', {});\n return;\n }\n // ### setting headers\n const headers = this._getHeaders();\n console.log('headers', headers);\n\n // ### map urlencoded-post to post for fetch\n if (this.method === 'urlencoded-post') {\n this.method = 'post';\n }\n\n if (!this.methods.includes(this.method.toLowerCase())) {\n this.dispatch('error', { message: `Unknown method ${this.method}` });\n return;\n }\n const response = await fetch(resolvedUrl, {\n method: this.method,\n mode: 'cors',\n credentials: 'include',\n headers,\n body: serialized,\n });\n\n if (!response.ok || response.status > 400) {\n this.dispatch('submit-error', { message: `Error while submitting ${this.id}` });\n return;\n }\n\n const contentType = response.headers.get('content-type').toLowerCase();\n if (\n contentType.startsWith('text/plain') ||\n contentType.startsWith('text/html') ||\n contentType.startsWith('text/markdown')\n ) {\n const text = await response.text();\n this._handleResponse(text);\n } else if (contentType.startsWith('application/json')) {\n const json = await response.json();\n this._handleResponse(json);\n } else if (contentType.startsWith('application/xml')) {\n const text = await response.text();\n const xml = new DOMParser().parseFromString(text, 'application/xml');\n this._handleResponse(xml);\n } else {\n const blob = await response.blob();\n this._handleResponse(blob);\n }\n\n this.dispatch('submit-done', {});\n }\n\n _serialize(instanceType, relevantNodes) {\n if (this.method === 'urlencoded-post') {\n // this.method = 'post';\n const params = new URLSearchParams();\n // console.log('nodes to serialize', relevantNodes);\n Array.from(relevantNodes.children).forEach(child => {\n params.append(child.nodeName, child.textContent);\n });\n return params;\n }\n if (instanceType === 'xml') {\n const serializer = new XMLSerializer();\n return serializer.serializeToString(relevantNodes);\n }\n if(instanceType === 'json'){\n // console.warn('JSON serialization is not yet supported')\n return JSON.stringify(relevantNodes);\n }\n throw new Error('unknown instance type ', instanceType);\n }\n\n _getHeaders() {\n const headers = new Headers();\n\n // ### set content-type header according to type of instance\n const instance = this.getInstance();\n const contentType = Fore.getContentType(instance, this.method);\n headers.append('Content-Type', contentType);\n // ### needed to overwrite browsers' setting of 'Accept' header\n if (headers.has('Accept')) {\n headers.delete('Accept');\n }\n // headers.append('Accept', 'application/xml');\n\n // ### add header defined by fx-header elements\n const headerElems = this.querySelectorAll('fx-header');\n Array.from(headerElems).forEach(header => {\n const { name } = header;\n const val = header.getValue();\n headers.append(name, val);\n });\n return headers;\n }\n\n _getUrlExpr() {\n return this.storedTemplateExpressions.find(stored => stored.node.nodeName === 'url');\n }\n\n _getTargetInstance() {\n let targetInstance;\n if (this.instance) {\n targetInstance = this.model.getInstance(this.instance);\n } else {\n targetInstance = this.model.getInstance('default');\n }\n if (!targetInstance) {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n return targetInstance;\n }\n\n /**\n * handles replacement of instance data from response data.\n *\n * Please note that data might be\n * @param data\n * @private\n */\n _handleResponse(data) {\n console.log('_handleResponse ', data);\n\n\n/*\n // ### responses need to be handled depending on their type.\n if(this.type === 'json'){\n\n }\n*/\n\n if (this.replace === 'instance') {\n const targetInstance = this._getTargetInstance();\n if (targetInstance) {\n if (this.targetref) {\n const theTarget = evaluateXPath(\n this.targetref,\n targetInstance.instanceData.firstElementChild,\n this,\n );\n console.log('theTarget', theTarget);\n const clone = data.firstElementChild;\n const parent = theTarget.parentNode;\n parent.replaceChild(clone, theTarget);\n console.log('finally ', parent);\n } else if (this.into) {\n const theTarget = evaluateXPath(\n this.into,\n targetInstance.instanceData.firstElementChild,\n this,\n );\n console.log('theTarget', theTarget);\n theTarget.innerHTML = data;\n } else {\n const instanceData = data;\n targetInstance.instanceData = instanceData;\n console.log('### replaced instance ', this.getModel().instances);\n console.log('### replaced instance ', targetInstance.instanceData);\n }\n\n this.model.updateModel(); // force update\n // this.model.formElement.refresh();\n this.getOwnerForm().refresh();\n } else {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n }\n\n if (this.replace === 'all') {\n document.getElementsByTagName('html')[0].innerHTML = data;\n }\n if (this.replace === 'target') {\n const target = this.getAttribute('target');\n const targetNode = document.querySelector(target);\n targetNode.innerHTML = data;\n }\n if (this.replace === 'redirect') {\n window.location.href = data;\n }\n }\n\n /**\n * select relevant nodes\n *\n * @returns {*}\n */\n selectRelevant(type) {\n console.log('selectRelevant' ,type)\n switch (type){\n case 'xml':\n return this._relevantXmlNodes();\n default:\n console.warn(`relevance selection not supported for type:${this.type}`);\n return this.nodeset;\n }\n }\n\n // todo: support for 'empty'\n _relevantXmlNodes() {\n // ### no relevance selection - current nodeset is used 'as-is'\n if (this.nonrelevant === 'keep') {\n return this.nodeset;\n }\n\n // first check if nodeset of submission is relevant - otherwise bail out\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi && !mi.relevant) return null;\n\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n\n if (this.nodeset.children.length === 0 && this._isRelevant(this.nodeset)) {\n return this.nodeset;\n }\n return this._filterRelevant(this.nodeset, root);\n }\n\n _filterRelevant(node, result) {\n const { childNodes } = node;\n Array.from(childNodes).forEach(n => {\n if (this._isRelevant(n)) {\n const clone = n.cloneNode(false);\n result.appendChild(clone);\n const { attributes } = n;\n if (attributes) {\n Array.from(attributes).forEach(attr => {\n if (this._isRelevant(attr)) {\n clone.setAttribute(attr.nodeName, attr.value);\n } else if (this.nonrelevant === 'empty') {\n clone.setAttribute(attr.nodeName, '');\n } else {\n clone.removeAttribute(attr.nodeName);\n }\n });\n }\n return this._filterRelevant(n, clone);\n }\n return null;\n });\n return result;\n }\n\n _isRelevant(node) {\n const mi = this.getModel().getModelItem(node);\n if (!mi || mi.relevant) {\n return true;\n }\n return false;\n }\n\n _handleError() {\n this.dispatch('submit-error', {});\n /*\n console.log('ERRRORRRRR');\n this.dispatchEvent(\n new CustomEvent('submit-error', {\n composed: true,\n bubbles: true,\n detail: {},\n }),\n );\n */\n }\n}\n\ncustomElements.define('fx-submission', FxSubmission);\n","import { foreElementMixin } from './ForeElementMixin.js';\n\nexport class FxHeader extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.style.display = 'none';\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = ``;\n\n if (!this.hasAttribute('name')) {\n throw new Error('required attribute \"name\" missing');\n }\n this.name = this.getAttribute('name');\n }\n\n connectedCallback() {\n this.shadowRoot.innerHTML = ``;\n }\n}\ncustomElements.define('fx-header', FxHeader);\n","import './fx-instance.js';\nimport { evaluateXPath } from './xpath-evaluation.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * @ts-check\n */\nexport class FxVariable extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' });\n this.name = '';\n this.valueQuery = '';\n this.value = null;\n }\n\n connectedCallback() {\n this.name = this.getAttribute('name');\n this.valueQuery = this.getAttribute('value');\n }\n\n refresh() {\n const inscope = getInScopeContext(this, this.valueQuery);\n\n this.value = evaluateXPath(this.valueQuery, inscope, this, this.precedingVariables);\n }\n\n setInScopeVariables(inScopeVariables) {\n if (inScopeVariables.has(this.name)) {\n console.error(`The variable ${this.name} is declared more than once`);\n this.dispatch('xforms-binding-error');\n return;\n }\n inScopeVariables.set(this.name, this);\n // Clone the preceding variables to make sure we are not going to get access to variables we\n // should not get access to\n this.inScopeVariables = new Map(inScopeVariables);\n }\n}\n\ncustomElements.define('fx-var', FxVariable);\n","import '../fx-model.js';\nimport { foreElementMixin } from '../ForeElementMixin.js';\nimport { ModelItem } from '../modelitem.js';\nimport { Fore } from '../fore.js';\n\n/**\n * `AbstractControl` -\n * is a general base class for control elements.\n *\n */\nexport default class AbstractControl extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.value = '';\n this.display = this.style.display;\n this.required = false;\n this.readonly = false;\n this.widget = null;\n // this.attachShadow({ mode: 'open' });\n }\n\n // eslint-disable-next-line class-methods-use-this\n getWidget() {\n throw new Error('You have to implement the method getWidget!');\n }\n\n /**\n * (re)apply all modelItem state properties to this control. model -> UI\n */\n async refresh(force) {\n // console.log('### AbstractControl.refresh on : ', this);\n\n const currentVal = this.value;\n\n // if(this.repeated) return\n if (this.isNotBound()) return;\n\n // await this.updateComplete;\n // await this.getWidget();\n this.evalInContext();\n\n if (this.isBound()) {\n // this.control = this.querySelector('#control');\n\n if (this.nodeset === null) {\n this.style.display = 'none';\n return;\n }\n\n this.modelItem = this.getModelItem();\n\n if (this.modelItem instanceof ModelItem) {\n // console.log('### XfAbstractControl.refresh modelItem : ', this.modelItem);\n\n this.value = this.modelItem.value;\n\n /*\n this is another case that highlights the fact that an init() function might make sense in general.\n */\n if(!this.modelItem.boundControls.includes(this)){\n this.modelItem.boundControls.push(this);\n }\n\n // console.log('>>>>>>>> abstract refresh ', this.control);\n // this.control[this.valueProp] = this.value;\n await this.updateWidgetValue();\n this.handleModelItemProperties();\n\n // if(!this.closest('fx-fore').ready) return; // state change event do not fire during init phase (initial refresh)\n if (!this.getOwnerForm().ready) return; // state change event do not fire during init phase (initial refresh)\n if (currentVal !== this.value) {\n Fore.dispatch(this,'value-changed', { path: this.modelItem.path });\n }\n }\n }\n }\n\n /**\n *\n * @returns {Promise}\n */\n // eslint-disable-next-line class-methods-use-this\n async updateWidgetValue() {\n throw new Error('You have to implement the method updateWidgetValue!');\n }\n\n handleModelItemProperties() {\n // console.log('form ready', this.getOwnerForm().ready);\n this.handleRequired();\n this.handleReadonly();\n if (this.getOwnerForm().ready) {\n this.handleValid();\n }\n this.handleRelevant();\n }\n\n _getForm() {\n return this.getModel().parentNode;\n }\n\n _dispatchEvent(event) {\n if (this.getOwnerForm().ready) {\n this.dispatch(event, {});\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n handleRequired() {\n // console.log('mip required', this.modelItem.required);\n // const control = this.querySelector('#control');\n this.widget = this.getWidget();\n if (this.isRequired() !== this.modelItem.required) {\n if (this.modelItem.required) {\n this.widget.setAttribute('required', 'required');\n this.classList.add('required');\n this._dispatchEvent('required');\n } else {\n this.widget.removeAttribute('required');\n this.required = false;\n // this.removeAttribute('required');\n this.classList.toggle('required');\n this._dispatchEvent('optional');\n }\n }\n }\n\n handleReadonly() {\n // console.log('mip readonly', this.modelItem.isReadonly);\n if (this.isReadonly() !== this.modelItem.readonly) {\n if (this.modelItem.readonly) {\n this.widget.setAttribute('readonly', 'readonly');\n // this.setAttribute('readonly','readonly');\n this.classList.toggle('readonly');\n this._dispatchEvent('readonly');\n }\n if (!this.modelItem.readonly) {\n this.widget.removeAttribute('readonly');\n // this.removeAttribute('readonly');\n this.classList.toggle('readonly');\n this._dispatchEvent('readwrite');\n }\n }\n }\n\n // todo - review alert handling altogether. There could be potentially multiple ones in model\n handleValid() {\n // console.log('mip valid', this.modelItem.required);\n const alert = this.querySelector('fx-alert');\n\n if (this.isValid() !== this.modelItem.constraint) {\n if (this.modelItem.constraint) {\n this.classList.remove('invalid');\n if (alert) alert.style.display = 'none';\n this._dispatchEvent('valid');\n } else {\n // ### constraint is invalid - handle alerts\n this.classList.add('invalid');\n if (alert) {\n alert.style.display = 'block';\n }\n if (this.modelItem.alerts.length !== 0) {\n const { alerts } = this.modelItem;\n console.log('alerts from bind: ', alerts);\n\n const controlAlert = this.querySelector('fx-alert');\n if (!controlAlert) {\n alerts.forEach(modelAlert => {\n const newAlert = document.createElement('fx-alert');\n newAlert.innerHTML = modelAlert;\n this.appendChild(newAlert);\n newAlert.style.display = 'block';\n });\n }\n }\n\n // this.dispatchEvent(new CustomEvent('invalid', {}));\n this._dispatchEvent('invalid');\n }\n }\n }\n\n handleRelevant() {\n // console.log('mip valid', this.modelItem.enabled);\n if (this.isEnabled() !== this.modelItem.relevant) {\n if (this.modelItem.relevant) {\n this._dispatchEvent('relevant');\n // this._fadeIn(this, this.display);\n this.style.display = this.display;\n } else {\n this._dispatchEvent('nonrelevant');\n // this._fadeOut(this);\n this.style.display = 'none';\n }\n }\n }\n\n isRequired() {\n if (this.widget.hasAttribute('required')) {\n return true;\n }\n return false;\n }\n\n isValid() {\n if (this.classList.contains('invalid')) {\n return false;\n }\n return true;\n }\n\n isReadonly() {\n // const widget = this.querySelector('#widget');\n if (this.widget.hasAttribute('readonly')) {\n return true;\n }\n return false;\n }\n\n isEnabled() {\n // if(this.style.display === 'none' || this.classList.contains('non-relevant')){\n if (this.style.display === 'none') {\n return false;\n }\n return true;\n }\n\n // eslint-disable-next-line class-methods-use-this\n _fadeOut(el) {\n el.style.opacity = 1;\n\n (function fade() {\n // eslint-disable-next-line no-cond-assign\n if ((el.style.opacity -= 0.1) < 0) {\n el.style.display = 'none';\n } else {\n requestAnimationFrame(fade);\n }\n })();\n }\n\n // eslint-disable-next-line class-methods-use-this\n _fadeIn(el, display) {\n el.style.opacity = 0;\n el.style.display = display || 'block';\n\n (function fade() {\n let val = parseFloat(el.style.opacity);\n // eslint-disable-next-line no-cond-assign\n if (!((val += 0.1) > 1)) {\n el.style.opacity = val;\n requestAnimationFrame(fade);\n }\n })();\n }\n}\n\nwindow.customElements.define('fx-abstract-control', AbstractControl);\n","import AbstractControl from './abstract-control.js';\n\nexport class FxAlert extends AbstractControl {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n const style = `\n :host {\n height: auto;\n font-size: 0.8em;\n font-weight: 400;\n color: red;\n display: none;\n }\n `;\n\n const html = `\n \n `;\n\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n async updateWidgetValue() {\n console.log('alert update', this);\n this.innerHTML = this.value;\n }\n}\ncustomElements.define('fx-alert', FxAlert);\n","import XfAbstractControl from './abstract-control.js';\nimport { evaluateXPath, evaluateXPathToString, evaluateXPathToNodes } from '../xpath-evaluation.js';\nimport getInScopeContext from '../getInScopeContext.js';\nimport { Fore } from '../fore.js';\n\nconst WIDGETCLASS = 'widget';\n\n/**\n * `fx-control`\n * a generic wrapper for controls\n *\n *\n *\n * @customElement\n * @demo demo/index.html\n */\nexport default class FxControl extends XfAbstractControl {\n constructor() {\n super();\n this.inited = false;\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n this.updateEvent = this.hasAttribute('update-event')\n ? this.getAttribute('update-event')\n : 'blur';\n this.valueProp = this.hasAttribute('value-prop') ? this.getAttribute('value-prop') : 'value';\n this.label = this.hasAttribute('label') ? this.getAttribute('label') : null;\n const style = `\n :host{\n display:inline-block;\n }\n `;\n\n /*\n const controlHtml = `\n \n \n `;\n*/\n\n /*\n this.shadowRoot.innerHTML = `\n \n ${controlHtml}\n `\n*/\n this.shadowRoot.innerHTML = `\n \n ${this.renderHTML(this.ref)}\n `;\n\n this.widget = this.getWidget();\n // console.log('widget ', this.widget);\n\n // ### convenience marker event\n if (this.updateEvent === 'enter') {\n this.widget.addEventListener('keyup', event => {\n if (event.keyCode === 13) {\n // Cancel the default action, if needed\n event.preventDefault();\n this.setValue(this.widget[this.valueProp]);\n }\n });\n this.updateEvent = 'blur'; // needs to be registered too\n }\n this.widget.addEventListener(this.updateEvent, () => {\n // console.log('eventlistener ', this.updateEvent);\n this.setValue(this.widget[this.valueProp]);\n });\n\n const slot = this.shadowRoot.querySelector('slot');\n this.template = this.querySelector('template');\n // console.log('template',this.template);\n }\n\n setValue(val) {\n const modelitem = this.getModelItem();\n const setval = this.shadowRoot.getElementById('setvalue');\n setval.setValue(modelitem, val);\n setval.actionPerformed();\n }\n\n renderHTML(ref) {\n return `\n ${this.label ? `${this.label}` : ''}\n \n \n `;\n }\n\n /**\n *\n * @returns {HTMLElement|*}\n */\n getWidget() {\n if (this.widget) return this.widget;\n let widget = this.querySelector(`.${WIDGETCLASS}`);\n if (!widget) {\n widget = this.querySelector('input');\n }\n if (!widget) {\n const input = document.createElement('input');\n input.classList.add(WIDGETCLASS);\n input.setAttribute('type', 'text');\n this.appendChild(input);\n return input;\n }\n return widget;\n }\n\n // todo: check again\n async updateWidgetValue() {\n // this.widget[this.valueProp] = this.value;\n if (this.valueProp === 'checked') {\n if (this.value === 'true') {\n this.widget.checked = true;\n } else {\n this.widget.checked = false;\n }\n } else {\n let { widget } = this;\n if (!widget) {\n widget = this;\n }\n if(this.hasAttribute('as')){\n const as = this.getAttribute('as');\n if(as === 'text'){\n const serializer = new XMLSerializer();\n const pretty = Fore.prettifyXml(serializer.serializeToString(this.nodeset))\n widget.value = pretty;\n }\n }else{\n widget.value = this.value;\n }\n }\n }\n\n getTemplate() {\n return this.querySelector('template');\n }\n\n async refresh(force) {\n console.log('fx-control refresh', this);\n super.refresh();\n // console.log('refresh template', this.template);\n // const {widget} = this;\n\n // ### if we find a ref on control we have a 'select' control of some kind\n const widget = this.getWidget();\n if (widget.hasAttribute('ref')) {\n // ### eval nodeset for list control\n const ref = widget.getAttribute('ref');\n /*\n actually a ref on a select or similar component should point to a different instance\n with an absolute expr e.g. 'instance('theId')/...'\n\n todo: even bail out if ref is not absolute?\n */\n\n const inscope = getInScopeContext(this, ref);\n // const nodeset = evaluateXPathToNodes(ref, inscope, this);\n const nodeset = evaluateXPath(ref, inscope, this);\n\n // ### clear items\n const { children } = widget;\n Array.from(children).forEach(child => {\n if (child.nodeName.toLowerCase() !== 'template') {\n child.parentNode.removeChild(child);\n }\n });\n\n // ### build the items\n if (this.template) {\n if (nodeset.length) {\n // console.log('nodeset', nodeset);\n Array.from(nodeset).forEach(node => {\n // console.log('#### node', node);\n const newEntry = this.createEntry();\n\n // ### initialize new entry\n // ### set value\n this.updateEntry(newEntry, node);\n });\n } else {\n const newEntry = this.createEntry();\n this.updateEntry(newEntry, nodeset);\n }\n }\n }\n Fore.refreshChildren(this, force);\n }\n\n updateEntry(newEntry, node) {\n // ### >>> todo: needs rework this code is heavily assuming a select control with 'value' attribute - not generic at all yet.\n\n if (this.widget.nodeName !== 'SELECT') return;\n const valueAttribute = this._getValueAttribute(newEntry);\n const valueExpr = valueAttribute.value;\n const cutted = valueExpr.substring(1, valueExpr.length - 1);\n const evaluated = evaluateXPath(cutted, node, newEntry);\n valueAttribute.value = evaluated;\n\n if (this.value === evaluated) {\n newEntry.setAttribute('selected', 'selected');\n }\n\n // ### set label\n const optionLabel = newEntry.textContent;\n const labelExpr = optionLabel.substring(1, optionLabel.length - 1);\n\n const label = evaluateXPathToString(labelExpr, node, newEntry);\n newEntry.textContent = label;\n // ### <<< needs rework\n }\n\n createEntry() {\n const content = this.template.content.firstElementChild.cloneNode(true);\n const newEntry = document.importNode(content, true);\n this.template.parentNode.appendChild(newEntry);\n return newEntry;\n }\n\n // eslint-disable-next-line class-methods-use-this\n _getValueAttribute(element) {\n let result;\n Array.from(element.attributes).forEach(attribute => {\n const attrVal = attribute.value;\n if (attrVal.indexOf('{') !== -1) {\n // console.log('avt found ', attribute);\n result = attribute;\n }\n });\n return result;\n }\n}\n\nwindow.customElements.define('fx-control', FxControl);\n","import '../fx-model.js';\nimport { Fore } from '../fore.js';\nimport { foreElementMixin } from '../ForeElementMixin.js';\n\n/**\n * `fx-container` -\n * is a general class for container elements.\n *\n */\nexport class FxContainer extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n const style = `\n :host {\n display: block;\n }\n `;\n\n const html = `\n \n `;\n\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n\n this.getOwnerForm().registerLazyElement(this);\n }\n\n /**\n * (re)apply all state properties to this control.\n */\n refresh(force) {\n if (!force && this.hasAttribute('refresh-on-view')) return;\n // console.log('### FxContainer.refresh on : ', this);\n\n if (this.isBound()) {\n this.evalInContext();\n this.modelItem = this.getModelItem();\n if(!this.modelItem.boundControls.includes(this)){\n this.modelItem.boundControls.push(this);\n }\n\n // this.value = this.modelItem.value;\n }\n\n // await this.updateComplete;\n\n // state change event do not fire during init phase (initial refresh)\n if (this._getForm().ready) {\n this.handleModelItemProperties();\n }\n Fore.refreshChildren(this, force);\n }\n\n handleModelItemProperties() {\n this.handleReadonly();\n this.handleRelevant();\n }\n\n _getForm() {\n return this.getModel().parentNode;\n }\n\n handleReadonly() {\n // console.log('mip readonly', this.modelItem.isReadonly);\n if (this.isReadonly() !== this.modelItem.readonly) {\n if (this.modelItem.readonly) {\n this.setAttribute('readonly', 'readonly');\n this.dispatchEvent(new CustomEvent('readonly', {}));\n }\n if (!this.modelItem.readonly) {\n this.removeAttribute('readonly');\n this.dispatchEvent(new CustomEvent('readwrite', {}));\n }\n }\n }\n\n handleRelevant() {\n // console.log('mip valid', this.modelItem.enabled);\n if (!this.modelItem) return;\n\n if (this.isEnabled() !== this.modelItem.enabled) {\n if (this.modelItem.enabled) {\n this.dispatchEvent(new CustomEvent('enabled', {}));\n } else {\n this.dispatchEvent(new CustomEvent('disabled', {}));\n }\n }\n }\n\n isReadonly() {\n if (this.hasAttribute('readonly')) {\n return true;\n }\n return false;\n }\n\n isEnabled() {\n if (this.style.display === 'none') {\n return false;\n }\n return true;\n }\n}\n\nwindow.customElements.define('fx-container', FxContainer);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `