diff --git a/.pnp.cjs b/.pnp.cjs index 673ce16a..e3469d5c 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -56,7 +56,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jest", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:29.7.0"],\ ["jest-environment-jsdom", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:29.7.0"],\ ["lodash", "npm:4.17.21"],\ - ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:1.3.2"],\ + ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:2.0.4"],\ ["next", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:12.3.2"],\ ["postcss", "npm:8.4.31"],\ ["prettier", "npm:3.0.3"],\ @@ -3127,6 +3127,36 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@bundled-es-modules/cookie", [\ + ["npm:2.0.0", {\ + "packageLocation": "./.yarn/cache/@bundled-es-modules-cookie-npm-2.0.0-936890fd62-53114eabbe.zip/node_modules/@bundled-es-modules/cookie/",\ + "packageDependencies": [\ + ["@bundled-es-modules/cookie", "npm:2.0.0"],\ + ["cookie", "npm:0.5.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@bundled-es-modules/js-levenshtein", [\ + ["npm:2.0.1", {\ + "packageLocation": "./.yarn/cache/@bundled-es-modules-js-levenshtein-npm-2.0.1-926d2f52c4-13d0cbd2b0.zip/node_modules/@bundled-es-modules/js-levenshtein/",\ + "packageDependencies": [\ + ["@bundled-es-modules/js-levenshtein", "npm:2.0.1"],\ + ["js-levenshtein", "npm:1.1.6"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@bundled-es-modules/statuses", [\ + ["npm:1.0.1", {\ + "packageLocation": "./.yarn/cache/@bundled-es-modules-statuses-npm-1.0.1-c6f8822c93-bcaa7de192.zip/node_modules/@bundled-es-modules/statuses/",\ + "packageDependencies": [\ + ["@bundled-es-modules/statuses", "npm:1.0.1"],\ + ["statuses", "npm:2.0.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@colors/colors", [\ ["npm:1.5.0", {\ "packageLocation": "./.yarn/cache/@colors-colors-npm-1.5.0-875af3a8b4-d64d5260be.zip/node_modules/@colors/colors/",\ @@ -3940,29 +3970,25 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@mswjs/cookies", [\ - ["npm:0.2.2", {\ - "packageLocation": "./.yarn/cache/@mswjs-cookies-npm-0.2.2-fdd3f4ab67-23b1ef56d5.zip/node_modules/@mswjs/cookies/",\ + ["npm:1.1.0", {\ + "packageLocation": "./.yarn/cache/@mswjs-cookies-npm-1.1.0-a9e9053518-1d9be44548.zip/node_modules/@mswjs/cookies/",\ "packageDependencies": [\ - ["@mswjs/cookies", "npm:0.2.2"],\ - ["@types/set-cookie-parser", "npm:2.4.4"],\ - ["set-cookie-parser", "npm:2.6.0"]\ + ["@mswjs/cookies", "npm:1.1.0"]\ ],\ "linkType": "HARD"\ }]\ ]],\ ["@mswjs/interceptors", [\ - ["npm:0.17.10", {\ - "packageLocation": "./.yarn/cache/@mswjs-interceptors-npm-0.17.10-c1199a9424-0e6d32f399.zip/node_modules/@mswjs/interceptors/",\ + ["npm:0.25.10", {\ + "packageLocation": "./.yarn/cache/@mswjs-interceptors-npm-0.25.10-430aa16639-02e8b2c973.zip/node_modules/@mswjs/interceptors/",\ "packageDependencies": [\ - ["@mswjs/interceptors", "npm:0.17.10"],\ - ["@open-draft/until", "npm:1.0.3"],\ - ["@types/debug", "npm:4.1.9"],\ - ["@xmldom/xmldom", "npm:0.8.10"],\ - ["debug", "virtual:feb0771c9f8eadaf509cfed41e14a8bebbea5442233275c1c87085111077a08ef71eb773b899665b154d8203a55a489610a54117ae059fce5f5b8b844493b1b1#npm:4.3.4"],\ - ["headers-polyfill", "npm:3.2.5"],\ + ["@mswjs/interceptors", "npm:0.25.10"],\ + ["@open-draft/deferred-promise", "npm:2.2.0"],\ + ["@open-draft/logger", "npm:0.3.0"],\ + ["@open-draft/until", "npm:2.1.0"],\ + ["is-node-process", "npm:1.2.0"],\ ["outvariant", "npm:1.4.0"],\ - ["strict-event-emitter", "npm:0.2.8"],\ - ["web-encoding", "npm:1.1.5"]\ + ["strict-event-emitter", "npm:0.5.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -4156,11 +4182,31 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@open-draft/deferred-promise", [\ + ["npm:2.2.0", {\ + "packageLocation": "./.yarn/cache/@open-draft-deferred-promise-npm-2.2.0-adf396dc9f-7f29d39725.zip/node_modules/@open-draft/deferred-promise/",\ + "packageDependencies": [\ + ["@open-draft/deferred-promise", "npm:2.2.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@open-draft/logger", [\ + ["npm:0.3.0", {\ + "packageLocation": "./.yarn/cache/@open-draft-logger-npm-0.3.0-12b03e55aa-7adfe3d0ed.zip/node_modules/@open-draft/logger/",\ + "packageDependencies": [\ + ["@open-draft/logger", "npm:0.3.0"],\ + ["is-node-process", "npm:1.2.0"],\ + ["outvariant", "npm:1.4.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@open-draft/until", [\ - ["npm:1.0.3", {\ - "packageLocation": "./.yarn/cache/@open-draft-until-npm-1.0.3-c0d6a46a29-323e92ebef.zip/node_modules/@open-draft/until/",\ + ["npm:2.1.0", {\ + "packageLocation": "./.yarn/cache/@open-draft-until-npm-2.1.0-e27da33c52-140ea3b16f.zip/node_modules/@open-draft/until/",\ "packageDependencies": [\ - ["@open-draft/until", "npm:1.0.3"]\ + ["@open-draft/until", "npm:2.1.0"]\ ],\ "linkType": "HARD"\ }]\ @@ -6906,16 +6952,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@types/debug", [\ - ["npm:4.1.9", {\ - "packageLocation": "./.yarn/cache/@types-debug-npm-4.1.9-8e7cf27fbd-e88ee8b19d.zip/node_modules/@types/debug/",\ - "packageDependencies": [\ - ["@types/debug", "npm:4.1.9"],\ - ["@types/ms", "npm:0.7.32"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@types/detect-port", [\ ["npm:1.3.3", {\ "packageLocation": "./.yarn/cache/@types-detect-port-npm-1.3.3-6e7844725c-0dadb52028.zip/node_modules/@types/detect-port/",\ @@ -7187,15 +7223,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@types/ms", [\ - ["npm:0.7.32", {\ - "packageLocation": "./.yarn/cache/@types-ms-npm-0.7.32-38dadca018-610744605c.zip/node_modules/@types/ms/",\ - "packageDependencies": [\ - ["@types/ms", "npm:0.7.32"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@types/node", [\ ["npm:16.18.57", {\ "packageLocation": "./.yarn/cache/@types-node-npm-16.18.57-ca9a02d7be-db21a14416.zip/node_modules/@types/node/",\ @@ -7347,21 +7374,20 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@types/set-cookie-parser", [\ - ["npm:2.4.4", {\ - "packageLocation": "./.yarn/cache/@types-set-cookie-parser-npm-2.4.4-988879b8bf-db6f16639f.zip/node_modules/@types/set-cookie-parser/",\ + ["@types/stack-utils", [\ + ["npm:2.0.1", {\ + "packageLocation": "./.yarn/cache/@types-stack-utils-npm-2.0.1-867718ab70-205fdbe332.zip/node_modules/@types/stack-utils/",\ "packageDependencies": [\ - ["@types/set-cookie-parser", "npm:2.4.4"],\ - ["@types/node", "npm:20.8.2"]\ + ["@types/stack-utils", "npm:2.0.1"]\ ],\ "linkType": "HARD"\ }]\ ]],\ - ["@types/stack-utils", [\ - ["npm:2.0.1", {\ - "packageLocation": "./.yarn/cache/@types-stack-utils-npm-2.0.1-867718ab70-205fdbe332.zip/node_modules/@types/stack-utils/",\ + ["@types/statuses", [\ + ["npm:2.0.4", {\ + "packageLocation": "./.yarn/cache/@types-statuses-npm-2.0.4-c9c508f332-3a806c3b96.zip/node_modules/@types/statuses/",\ "packageDependencies": [\ - ["@types/stack-utils", "npm:2.0.1"]\ + ["@types/statuses", "npm:2.0.4"]\ ],\ "linkType": "HARD"\ }]\ @@ -7963,15 +7989,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@xmldom/xmldom", [\ - ["npm:0.8.10", {\ - "packageLocation": "./.yarn/cache/@xmldom-xmldom-npm-0.8.10-c1bd991e61-4c136aec31.zip/node_modules/@xmldom/xmldom/",\ - "packageDependencies": [\ - ["@xmldom/xmldom", "npm:0.8.10"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@xtuc/ieee754", [\ ["npm:1.2.0", {\ "packageLocation": "./.yarn/cache/@xtuc-ieee754-npm-1.2.0-ec0ce4e025-ac56d4ca6e.zip/node_modules/@xtuc/ieee754/",\ @@ -8035,15 +8052,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@zxing/text-encoding", [\ - ["npm:0.9.0", {\ - "packageLocation": "./.yarn/cache/@zxing-text-encoding-npm-0.9.0-8426ff59e9-c23b12aee7.zip/node_modules/@zxing/text-encoding/",\ - "packageDependencies": [\ - ["@zxing/text-encoding", "npm:0.9.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["abab", [\ ["npm:2.0.6", {\ "packageLocation": "./.yarn/cache/abab-npm-2.0.6-2662fba7f0-6ffc1af4ff.zip/node_modules/abab/",\ @@ -9597,7 +9605,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jest", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:29.7.0"],\ ["jest-environment-jsdom", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:29.7.0"],\ ["lodash", "npm:4.17.21"],\ - ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:1.3.2"],\ + ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:2.0.4"],\ ["next", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:12.3.2"],\ ["postcss", "npm:8.4.31"],\ ["prettier", "npm:3.0.3"],\ @@ -10083,13 +10091,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["cookie", [\ - ["npm:0.4.2", {\ - "packageLocation": "./.yarn/cache/cookie-npm-0.4.2-7761894d5f-a00833c998.zip/node_modules/cookie/",\ - "packageDependencies": [\ - ["cookie", "npm:0.4.2"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:0.5.0", {\ "packageLocation": "./.yarn/cache/cookie-npm-0.5.0-e2d58a161a-1f4bd2ca57.zip/node_modules/cookie/",\ "packageDependencies": [\ @@ -13093,10 +13094,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["headers-polyfill", [\ - ["npm:3.2.5", {\ - "packageLocation": "./.yarn/cache/headers-polyfill-npm-3.2.5-5873ac13a0-a3c4bdd661.zip/node_modules/headers-polyfill/",\ + ["npm:4.0.2", {\ + "packageLocation": "./.yarn/cache/headers-polyfill-npm-4.0.2-0cef9f97de-a95280ed58.zip/node_modules/headers-polyfill/",\ "packageDependencies": [\ - ["headers-polyfill", "npm:3.2.5"]\ + ["headers-polyfill", "npm:4.0.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -15684,35 +15685,38 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["msw", [\ - ["npm:1.3.2", {\ - "packageLocation": "./.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/",\ + ["npm:2.0.4", {\ + "packageLocation": "./.yarn/unplugged/msw-virtual-ec266fa3e2/node_modules/msw/",\ "packageDependencies": [\ - ["msw", "npm:1.3.2"]\ + ["msw", "npm:2.0.4"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:1.3.2", {\ - "packageLocation": "./.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/",\ + ["virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:2.0.4", {\ + "packageLocation": "./.yarn/unplugged/msw-virtual-ec266fa3e2/node_modules/msw/",\ "packageDependencies": [\ - ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:1.3.2"],\ - ["@mswjs/cookies", "npm:0.2.2"],\ - ["@mswjs/interceptors", "npm:0.17.10"],\ - ["@open-draft/until", "npm:1.0.3"],\ + ["msw", "virtual:5c27e03dae35d0976fad331e8fffa55eb62b5bc849583336ab59ba9f7c56861263fd0502a76a9335956f901566959f012bae9b45f34a60bde556a5b21d514601#npm:2.0.4"],\ + ["@bundled-es-modules/cookie", "npm:2.0.0"],\ + ["@bundled-es-modules/js-levenshtein", "npm:2.0.1"],\ + ["@bundled-es-modules/statuses", "npm:1.0.1"],\ + ["@mswjs/cookies", "npm:1.1.0"],\ + ["@mswjs/interceptors", "npm:0.25.10"],\ + ["@open-draft/until", "npm:2.1.0"],\ ["@types/cookie", "npm:0.4.1"],\ ["@types/js-levenshtein", "npm:1.1.1"],\ + ["@types/statuses", "npm:2.0.4"],\ ["@types/typescript", null],\ ["chalk", "npm:4.1.2"],\ ["chokidar", "npm:3.5.3"],\ - ["cookie", "npm:0.4.2"],\ ["graphql", "npm:16.8.1"],\ - ["headers-polyfill", "npm:3.2.5"],\ + ["headers-polyfill", "npm:4.0.2"],\ ["inquirer", "npm:8.2.6"],\ ["is-node-process", "npm:1.2.0"],\ ["js-levenshtein", "npm:1.1.6"],\ ["node-fetch", "virtual:513bf8bc0cdd59c4bb5f46d8baeefcaaf0c4da35f3a1bb75f7ca013a93bb8034fbb319a605352bd0996fa9998448a8de332a0013f22991774908a6c5da95bb8e#npm:2.7.0"],\ ["outvariant", "npm:1.4.0"],\ ["path-to-regexp", "npm:6.2.1"],\ - ["strict-event-emitter", "npm:0.4.6"],\ + ["strict-event-emitter", "npm:0.5.1"],\ ["type-fest", "npm:2.19.0"],\ ["typescript", "patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=f3b441"],\ ["yargs", "npm:17.7.2"]\ @@ -18542,15 +18546,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["set-cookie-parser", [\ - ["npm:2.6.0", {\ - "packageLocation": "./.yarn/cache/set-cookie-parser-npm-2.6.0-a7dd154236-bf11ebc594.zip/node_modules/set-cookie-parser/",\ - "packageDependencies": [\ - ["set-cookie-parser", "npm:2.6.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["set-function-name", [\ ["npm:2.0.1", {\ "packageLocation": "./.yarn/cache/set-function-name-npm-2.0.1-a9f970eea0-4975d17d90.zip/node_modules/set-function-name/",\ @@ -18920,18 +18915,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["strict-event-emitter", [\ - ["npm:0.2.8", {\ - "packageLocation": "./.yarn/cache/strict-event-emitter-npm-0.2.8-e8b9131760-6ac06fe72a.zip/node_modules/strict-event-emitter/",\ + ["npm:0.5.1", {\ + "packageLocation": "./.yarn/cache/strict-event-emitter-npm-0.5.1-8414bf36b3-350480431b.zip/node_modules/strict-event-emitter/",\ "packageDependencies": [\ - ["strict-event-emitter", "npm:0.2.8"],\ - ["events", "npm:3.3.0"]\ - ],\ - "linkType": "HARD"\ - }],\ - ["npm:0.4.6", {\ - "packageLocation": "./.yarn/cache/strict-event-emitter-npm-0.4.6-b845d23c7d-4f4f290961.zip/node_modules/strict-event-emitter/",\ - "packageDependencies": [\ - ["strict-event-emitter", "npm:0.4.6"]\ + ["strict-event-emitter", "npm:0.5.1"]\ ],\ "linkType": "HARD"\ }]\ @@ -20518,17 +20505,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["web-encoding", [\ - ["npm:1.1.5", {\ - "packageLocation": "./.yarn/cache/web-encoding-npm-1.1.5-d5a3c7dc3d-2234a2b122.zip/node_modules/web-encoding/",\ - "packageDependencies": [\ - ["web-encoding", "npm:1.1.5"],\ - ["@zxing/text-encoding", "npm:0.9.0"],\ - ["util", "npm:0.12.5"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["webidl-conversions", [\ ["npm:3.0.1", {\ "packageLocation": "./.yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-c92a0a6ab9.zip/node_modules/webidl-conversions/",\ diff --git a/.yarn/cache/@bundled-es-modules-cookie-npm-2.0.0-936890fd62-53114eabbe.zip b/.yarn/cache/@bundled-es-modules-cookie-npm-2.0.0-936890fd62-53114eabbe.zip new file mode 100644 index 00000000..d80c144d Binary files /dev/null and b/.yarn/cache/@bundled-es-modules-cookie-npm-2.0.0-936890fd62-53114eabbe.zip differ diff --git a/.yarn/cache/@bundled-es-modules-js-levenshtein-npm-2.0.1-926d2f52c4-13d0cbd2b0.zip b/.yarn/cache/@bundled-es-modules-js-levenshtein-npm-2.0.1-926d2f52c4-13d0cbd2b0.zip new file mode 100644 index 00000000..68691f23 Binary files /dev/null and b/.yarn/cache/@bundled-es-modules-js-levenshtein-npm-2.0.1-926d2f52c4-13d0cbd2b0.zip differ diff --git a/.yarn/cache/@bundled-es-modules-statuses-npm-1.0.1-c6f8822c93-bcaa7de192.zip b/.yarn/cache/@bundled-es-modules-statuses-npm-1.0.1-c6f8822c93-bcaa7de192.zip new file mode 100644 index 00000000..6d4c0c8e Binary files /dev/null and b/.yarn/cache/@bundled-es-modules-statuses-npm-1.0.1-c6f8822c93-bcaa7de192.zip differ diff --git a/.yarn/cache/@mswjs-cookies-npm-0.2.2-fdd3f4ab67-23b1ef56d5.zip b/.yarn/cache/@mswjs-cookies-npm-0.2.2-fdd3f4ab67-23b1ef56d5.zip deleted file mode 100644 index d20ef6a8..00000000 Binary files a/.yarn/cache/@mswjs-cookies-npm-0.2.2-fdd3f4ab67-23b1ef56d5.zip and /dev/null differ diff --git a/.yarn/cache/@mswjs-cookies-npm-1.1.0-a9e9053518-1d9be44548.zip b/.yarn/cache/@mswjs-cookies-npm-1.1.0-a9e9053518-1d9be44548.zip new file mode 100644 index 00000000..ab36ab77 Binary files /dev/null and b/.yarn/cache/@mswjs-cookies-npm-1.1.0-a9e9053518-1d9be44548.zip differ diff --git a/.yarn/cache/@mswjs-interceptors-npm-0.17.10-c1199a9424-0e6d32f399.zip b/.yarn/cache/@mswjs-interceptors-npm-0.17.10-c1199a9424-0e6d32f399.zip deleted file mode 100644 index 91a45882..00000000 Binary files a/.yarn/cache/@mswjs-interceptors-npm-0.17.10-c1199a9424-0e6d32f399.zip and /dev/null differ diff --git a/.yarn/cache/@mswjs-interceptors-npm-0.25.10-430aa16639-02e8b2c973.zip b/.yarn/cache/@mswjs-interceptors-npm-0.25.10-430aa16639-02e8b2c973.zip new file mode 100644 index 00000000..78d0cd25 Binary files /dev/null and b/.yarn/cache/@mswjs-interceptors-npm-0.25.10-430aa16639-02e8b2c973.zip differ diff --git a/.yarn/cache/@open-draft-deferred-promise-npm-2.2.0-adf396dc9f-7f29d39725.zip b/.yarn/cache/@open-draft-deferred-promise-npm-2.2.0-adf396dc9f-7f29d39725.zip new file mode 100644 index 00000000..33b2d2a8 Binary files /dev/null and b/.yarn/cache/@open-draft-deferred-promise-npm-2.2.0-adf396dc9f-7f29d39725.zip differ diff --git a/.yarn/cache/@open-draft-logger-npm-0.3.0-12b03e55aa-7adfe3d0ed.zip b/.yarn/cache/@open-draft-logger-npm-0.3.0-12b03e55aa-7adfe3d0ed.zip new file mode 100644 index 00000000..9de979b8 Binary files /dev/null and b/.yarn/cache/@open-draft-logger-npm-0.3.0-12b03e55aa-7adfe3d0ed.zip differ diff --git a/.yarn/cache/@open-draft-until-npm-1.0.3-c0d6a46a29-323e92ebef.zip b/.yarn/cache/@open-draft-until-npm-1.0.3-c0d6a46a29-323e92ebef.zip deleted file mode 100644 index 821769c4..00000000 Binary files a/.yarn/cache/@open-draft-until-npm-1.0.3-c0d6a46a29-323e92ebef.zip and /dev/null differ diff --git a/.yarn/cache/@open-draft-until-npm-2.1.0-e27da33c52-140ea3b16f.zip b/.yarn/cache/@open-draft-until-npm-2.1.0-e27da33c52-140ea3b16f.zip new file mode 100644 index 00000000..17f96da7 Binary files /dev/null and b/.yarn/cache/@open-draft-until-npm-2.1.0-e27da33c52-140ea3b16f.zip differ diff --git a/.yarn/cache/@types-debug-npm-4.1.9-8e7cf27fbd-e88ee8b19d.zip b/.yarn/cache/@types-debug-npm-4.1.9-8e7cf27fbd-e88ee8b19d.zip deleted file mode 100644 index ec56ef71..00000000 Binary files a/.yarn/cache/@types-debug-npm-4.1.9-8e7cf27fbd-e88ee8b19d.zip and /dev/null differ diff --git a/.yarn/cache/@types-ms-npm-0.7.32-38dadca018-610744605c.zip b/.yarn/cache/@types-ms-npm-0.7.32-38dadca018-610744605c.zip deleted file mode 100644 index ca614493..00000000 Binary files a/.yarn/cache/@types-ms-npm-0.7.32-38dadca018-610744605c.zip and /dev/null differ diff --git a/.yarn/cache/@types-set-cookie-parser-npm-2.4.4-988879b8bf-db6f16639f.zip b/.yarn/cache/@types-set-cookie-parser-npm-2.4.4-988879b8bf-db6f16639f.zip deleted file mode 100644 index de8da54b..00000000 Binary files a/.yarn/cache/@types-set-cookie-parser-npm-2.4.4-988879b8bf-db6f16639f.zip and /dev/null differ diff --git a/.yarn/cache/@types-statuses-npm-2.0.4-c9c508f332-3a806c3b96.zip b/.yarn/cache/@types-statuses-npm-2.0.4-c9c508f332-3a806c3b96.zip new file mode 100644 index 00000000..63e42239 Binary files /dev/null and b/.yarn/cache/@types-statuses-npm-2.0.4-c9c508f332-3a806c3b96.zip differ diff --git a/.yarn/cache/@xmldom-xmldom-npm-0.8.10-c1bd991e61-4c136aec31.zip b/.yarn/cache/@xmldom-xmldom-npm-0.8.10-c1bd991e61-4c136aec31.zip deleted file mode 100644 index 0893734d..00000000 Binary files a/.yarn/cache/@xmldom-xmldom-npm-0.8.10-c1bd991e61-4c136aec31.zip and /dev/null differ diff --git a/.yarn/cache/@zxing-text-encoding-npm-0.9.0-8426ff59e9-c23b12aee7.zip b/.yarn/cache/@zxing-text-encoding-npm-0.9.0-8426ff59e9-c23b12aee7.zip deleted file mode 100644 index 8c1761bf..00000000 Binary files a/.yarn/cache/@zxing-text-encoding-npm-0.9.0-8426ff59e9-c23b12aee7.zip and /dev/null differ diff --git a/.yarn/cache/cookie-npm-0.4.2-7761894d5f-a00833c998.zip b/.yarn/cache/cookie-npm-0.4.2-7761894d5f-a00833c998.zip deleted file mode 100644 index 2a478448..00000000 Binary files a/.yarn/cache/cookie-npm-0.4.2-7761894d5f-a00833c998.zip and /dev/null differ diff --git a/.yarn/cache/headers-polyfill-npm-3.2.5-5873ac13a0-a3c4bdd661.zip b/.yarn/cache/headers-polyfill-npm-3.2.5-5873ac13a0-a3c4bdd661.zip deleted file mode 100644 index aef1e54c..00000000 Binary files a/.yarn/cache/headers-polyfill-npm-3.2.5-5873ac13a0-a3c4bdd661.zip and /dev/null differ diff --git a/.yarn/cache/headers-polyfill-npm-4.0.2-0cef9f97de-a95280ed58.zip b/.yarn/cache/headers-polyfill-npm-4.0.2-0cef9f97de-a95280ed58.zip new file mode 100644 index 00000000..a2f105f8 Binary files /dev/null and b/.yarn/cache/headers-polyfill-npm-4.0.2-0cef9f97de-a95280ed58.zip differ diff --git a/.yarn/cache/msw-npm-1.3.2-572bf57281-c2d4f7747f.zip b/.yarn/cache/msw-npm-1.3.2-572bf57281-c2d4f7747f.zip deleted file mode 100644 index 603ebaf8..00000000 Binary files a/.yarn/cache/msw-npm-1.3.2-572bf57281-c2d4f7747f.zip and /dev/null differ diff --git a/.yarn/cache/msw-npm-2.0.4-acf5a7539b-d0c5a76b74.zip b/.yarn/cache/msw-npm-2.0.4-acf5a7539b-d0c5a76b74.zip new file mode 100644 index 00000000..c3ddbfc8 Binary files /dev/null and b/.yarn/cache/msw-npm-2.0.4-acf5a7539b-d0c5a76b74.zip differ diff --git a/.yarn/cache/set-cookie-parser-npm-2.6.0-a7dd154236-bf11ebc594.zip b/.yarn/cache/set-cookie-parser-npm-2.6.0-a7dd154236-bf11ebc594.zip deleted file mode 100644 index af793cde..00000000 Binary files a/.yarn/cache/set-cookie-parser-npm-2.6.0-a7dd154236-bf11ebc594.zip and /dev/null differ diff --git a/.yarn/cache/strict-event-emitter-npm-0.2.8-e8b9131760-6ac06fe72a.zip b/.yarn/cache/strict-event-emitter-npm-0.2.8-e8b9131760-6ac06fe72a.zip deleted file mode 100644 index 5021fd68..00000000 Binary files a/.yarn/cache/strict-event-emitter-npm-0.2.8-e8b9131760-6ac06fe72a.zip and /dev/null differ diff --git a/.yarn/cache/strict-event-emitter-npm-0.4.6-b845d23c7d-4f4f290961.zip b/.yarn/cache/strict-event-emitter-npm-0.4.6-b845d23c7d-4f4f290961.zip deleted file mode 100644 index a9eeb047..00000000 Binary files a/.yarn/cache/strict-event-emitter-npm-0.4.6-b845d23c7d-4f4f290961.zip and /dev/null differ diff --git a/.yarn/cache/strict-event-emitter-npm-0.5.1-8414bf36b3-350480431b.zip b/.yarn/cache/strict-event-emitter-npm-0.5.1-8414bf36b3-350480431b.zip new file mode 100644 index 00000000..e770ed49 Binary files /dev/null and b/.yarn/cache/strict-event-emitter-npm-0.5.1-8414bf36b3-350480431b.zip differ diff --git a/.yarn/cache/web-encoding-npm-1.1.5-d5a3c7dc3d-2234a2b122.zip b/.yarn/cache/web-encoding-npm-1.1.5-d5a3c7dc3d-2234a2b122.zip deleted file mode 100644 index d8a67d1e..00000000 Binary files a/.yarn/cache/web-encoding-npm-1.1.5-d5a3c7dc3d-2234a2b122.zip and /dev/null differ diff --git a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/SetupServerApi-1855d9c6.d.ts b/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/SetupServerApi-1855d9c6.d.ts deleted file mode 100644 index 94a0efd6..00000000 --- a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/SetupServerApi-1855d9c6.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsomorphicResponse, BatchInterceptor, Interceptor, HttpRequestEventMap } from '@mswjs/interceptors'; -import { L as LifeCycleEventsMap, S as SetupApi, K as SetupServer, c as RequestHandler, o as SharedOptions } from './glossary-de6278a9.js'; - -type ServerLifecycleEventsMap = LifeCycleEventsMap; -declare class SetupServerApi extends SetupApi implements SetupServer { - protected readonly interceptor: BatchInterceptor>, HttpRequestEventMap>; - private resolvedOptions; - constructor(interceptors: Array<{ - new (): Interceptor; - }>, ...handlers: Array); - /** - * Subscribe to all requests that are using the interceptor object - */ - private init; - listen(options?: Partial): void; - printHandlers(): void; - close(): void; -} - -export { ServerLifecycleEventsMap as S, SetupServerApi as a }; diff --git a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/glossary-de6278a9.d.ts b/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/glossary-de6278a9.d.ts deleted file mode 100644 index 21759809..00000000 --- a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/glossary-de6278a9.d.ts +++ /dev/null @@ -1,385 +0,0 @@ -import { Emitter, EventMap } from 'strict-event-emitter'; -import { PartialDeep } from 'type-fest'; -import { RequestInit as RequestInit$1, IsomorphicRequest, IsomorphicResponse } from '@mswjs/interceptors'; -import { FlatHeadersObject, Headers } from 'headers-polyfill'; - -type HeadersObject = Record; -/** - * @see https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name - */ -type ForbiddenHeaderNames = 'cookie' | 'cookie2' | 'set-cookie' | 'set-cookie2'; -type ForbiddenHeaderError = `SafeResponseHeader: the '${HeaderName}' header cannot be set on the response. Please use the 'ctx.cookie()' function instead.`; -/** - * Sets one or multiple response headers. - * @example - * ctx.set('Content-Type', 'text/plain') - * ctx.set({ - * 'Accept': 'application/javascript', - * 'Content-Type': "text/plain" - * }) - * @see {@link https://mswjs.io/docs/api/context/set `ctx.set()`} - */ -declare function set(...args: N extends string ? Lowercase extends ForbiddenHeaderNames ? [ForbiddenHeaderError] : [N, string] : N extends HeadersObject ? Lowercase extends ForbiddenHeaderNames ? [ForbiddenHeaderError] : [N] : [N]): ResponseTransformer; - -type DelayMode = 'real' | 'infinite'; -/** - * Delays the response by the given duration (ms). - * @example - * res(ctx.delay(1200)) // delay response by 1200ms - * res(ctx.delay()) // emulate realistic server response time - * res(ctx.delay('infinite')) // delay response infinitely - * @see {@link https://mswjs.io/docs/api/context/delay `ctx.delay()`} - */ -declare const delay: (durationOrMode?: DelayMode | number) => ResponseTransformer; - -type RequestCache = 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; -type RequestMode = 'navigate' | 'same-origin' | 'no-cors' | 'cors'; -type RequestRedirect = 'follow' | 'error' | 'manual'; -type RequestDestination = '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'xslt' | 'worker'; -type RequestPriority = 'high' | 'low' | 'auto'; -type RequestReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; -interface MockedRequestInit extends RequestInit$1 { - id?: string; - cache?: RequestCache; - redirect?: RequestRedirect; - integrity?: string; - keepalive?: boolean; - mode?: RequestMode; - priority?: RequestPriority; - destination?: RequestDestination; - referrer?: string; - referrerPolicy?: RequestReferrerPolicy; - cookies?: Record; -} -declare class MockedRequest extends IsomorphicRequest { - readonly cache: RequestCache; - readonly cookies: Record; - readonly destination: RequestDestination; - readonly integrity: string; - readonly keepalive: boolean; - readonly mode: RequestMode; - readonly priority: RequestPriority; - readonly redirect: RequestRedirect; - readonly referrer: string; - readonly referrerPolicy: RequestReferrerPolicy; - constructor(url: URL, init?: MockedRequestInit); - /** - * Get parsed request body. The type is inferred from the content type. - * - * @deprecated - Use `req.text()`, `req.json()` or `req.arrayBuffer()` - * to read the request body as a plain text, JSON, or ArrayBuffer. - */ - get body(): RequestBody; - /** - * Bypass the intercepted request. - * This will make a call to the actual endpoint requested. - */ - passthrough(): MockedResponse; - private getCookies; -} - -/** - * Performs a bypassed request inside a request handler. - * @example - * const originalResponse = await ctx.fetch(req) - * @see {@link https://mswjs.io/docs/api/context/fetch `ctx.fetch()`} - */ -declare const fetch: (input: string | MockedRequest, requestInit?: RequestInit) => Promise; - -interface ResponseLookupResult { - handler?: RequestHandler; - publicRequest?: any; - parsedRequest?: any; - response?: MockedResponse; -} -interface ResponseResolutionContext { - baseUrl?: string; -} - -interface UnhandledRequestPrint { - warning(): void; - error(): void; -} -type UnhandledRequestCallback = (request: MockedRequest, print: UnhandledRequestPrint) => void; -type UnhandledRequestStrategy = 'bypass' | 'warn' | 'error' | UnhandledRequestCallback; - -interface SharedOptions { - /** - * Specifies how to react to a request that has no corresponding - * request handler. Warns on unhandled requests by default. - * - * @example worker.start({ onUnhandledRequest: 'bypass' }) - * @example worker.start({ onUnhandledRequest: 'warn' }) - * @example server.listen({ onUnhandledRequest: 'error' }) - */ - onUnhandledRequest?: UnhandledRequestStrategy; -} -interface LifeCycleEventsMap { - 'request:start': [MockedRequest]; - 'request:match': [MockedRequest]; - 'request:unhandled': [MockedRequest]; - 'request:end': [MockedRequest]; - 'response:mocked': [response: ResponseType, requestId: string]; - 'response:bypass': [response: ResponseType, requestId: string]; - unhandledException: [error: Error, request: MockedRequest]; - [key: string]: Array; -} -type LifeCycleEventEmitter> = Pick, 'on' | 'removeListener' | 'removeAllListeners'>; - -type WorkerLifecycleEventsMap = LifeCycleEventsMap; -type FindWorker = (scriptUrl: string, mockServiceWorkerUrl: string) => boolean; -interface StartOptions extends SharedOptions { - /** - * Service Worker registration options. - */ - serviceWorker?: { - /** - * Custom url to the worker script. - * @default "/mockServiceWorker.js" - */ - url?: string; - options?: RegistrationOptions; - }; - /** - * Disables the logging of captured requests - * into browser's console. - * @default false - */ - quiet?: boolean; - /** - * Defers any network requests until the Service Worker - * instance is activated. - * @default true - */ - waitUntilReady?: boolean; - /** - * A custom lookup function to find a Mock Service Worker in the list - * of all registered Service Workers on the page. - */ - findWorker?: FindWorker; -} -interface SerializedResponse { - status: number; - statusText: string; - headers: FlatHeadersObject; - body: BodyType; - delay?: number; -} -type StartReturnType = Promise; -type StopHandler = () => void; -interface SetupWorker { - /** - * Registers and activates the mock Service Worker. - * @see {@link https://mswjs.io/docs/api/setup-worker/start `worker.start()`} - */ - start: (options?: StartOptions) => StartReturnType; - /** - * Stops requests interception for the current client. - * @see {@link https://mswjs.io/docs/api/setup-worker/stop `worker.stop()`} - */ - stop: StopHandler; - /** - * Prepends given request handlers to the list of existing handlers. - * @param {RequestHandler[]} handlers List of runtime request handlers. - * @see {@link https://mswjs.io/docs/api/setup-worker/use `worker.use()`} - */ - use: (...handlers: RequestHandler[]) => void; - /** - * Marks all request handlers that respond using `res.once()` as unused. - * @see {@link https://mswjs.io/docs/api/setup-worker/restore-handlers `worker.restoreHandlers()`} - */ - restoreHandlers: () => void; - /** - * Resets request handlers to the initial list given to the `setupWorker` call, or to the explicit next request handlers list, if given. - * @param {RequestHandler[]} nextHandlers List of the new initial request handlers. - * @see {@link https://mswjs.io/docs/api/setup-worker/reset-handlers `worker.resetHandlers()`} - */ - resetHandlers: (...nextHandlers: RequestHandler[]) => void; - /** - * Returns a readonly list of currently active request handlers. - * @see {@link https://mswjs.io/docs/api/setup-worker/list-handlers `worker.listHandlers()`} - */ - listHandlers(): ReadonlyArray, any, MockedRequest>>; - /** - * Lists all active request handlers. - * @see {@link https://mswjs.io/docs/api/setup-worker/print-handlers `worker.printHandlers()`} - */ - printHandlers: () => void; - events: LifeCycleEventEmitter; -} - -type DefaultContext = { - status: typeof status; - set: typeof set; - delay: typeof delay; - fetch: typeof fetch; -}; -declare const defaultContext: DefaultContext; -type DefaultRequestMultipartBody = Record; -type DefaultBodyType = Record | DefaultRequestMultipartBody | string | number | boolean | null | undefined; -interface RequestHandlerDefaultInfo { - header: string; -} -interface RequestHandlerInternalInfo { - callFrame?: string; -} -type ContextMap = Record any>; -type ResponseResolverReturnType = ReturnType | undefined | void; -type MaybeAsyncResponseResolverReturnType = MaybePromise>; -type AsyncResponseResolverReturnType = MaybeAsyncResponseResolverReturnType | Generator, MaybeAsyncResponseResolverReturnType, MaybeAsyncResponseResolverReturnType>; -type ResponseResolver = (req: RequestType, res: ResponseComposition, context: ContextType) => AsyncResponseResolverReturnType>; -interface RequestHandlerOptions { - info: HandlerInfo; - resolver: ResponseResolver; - ctx?: ContextMap; -} -interface RequestHandlerExecutionResult { - handler: RequestHandler; - parsedResult: any; - request: PublicRequestType; - response?: MockedResponse; -} -declare abstract class RequestHandler { - info: HandlerInfo & RequestHandlerInternalInfo; - shouldSkip: boolean; - private ctx; - private resolverGenerator?; - private resolverGeneratorResult?; - protected resolver: ResponseResolver; - constructor(options: RequestHandlerOptions); - /** - * Determine if the captured request should be mocked. - */ - abstract predicate(request: MockedRequest, parsedResult: ParsedResult, resolutionContext?: ResponseResolutionContext): boolean; - /** - * Print out the successfully handled request. - */ - abstract log(request: Request, response: SerializedResponse, parsedResult: ParsedResult): void; - /** - * Parse the captured request to extract additional information from it. - * Parsed result is then exposed to other methods of this request handler. - */ - parse(_request: MockedRequest, _resolutionContext?: ResponseResolutionContext): ParsedResult; - /** - * Test if this handler matches the given request. - */ - test(request: MockedRequest, resolutionContext?: ResponseResolutionContext): boolean; - /** - * Derive the publicly exposed request (`req`) instance of the response resolver - * from the captured request and its parsed result. - */ - protected getPublicRequest(request: MockedRequest, _parsedResult: ParsedResult): PublicRequest; - markAsSkipped(shouldSkip?: boolean): void; - /** - * Execute this request handler and produce a mocked response - * using the given resolver function. - */ - run(request: MockedRequest, resolutionContext?: ResponseResolutionContext): Promise | null>; - private wrapResolver; - private createExecutionResult; -} - -type MaybePromise = ValueType | Promise; -/** - * Internal representation of a mocked response instance. - */ -interface MockedResponse { - body: BodyType; - status: number; - statusText: string; - headers: Headers; - once: boolean; - passthrough: boolean; - delay?: number; -} -type ResponseTransformer = (res: MockedResponse) => MaybePromise>; -type ResponseFunction = (...transformers: ResponseTransformer[]) => MaybePromise>; -type ResponseComposition = ResponseFunction & { - /** - * Respond using a given mocked response to the first captured request. - * Does not affect any subsequent captured requests. - */ - once: ResponseFunction; - networkError: (message: string) => void; -}; -declare const defaultResponse: Omit; -type ResponseCompositionOptions = { - defaultTransformers?: ResponseTransformer[]; - mockedResponseOverrides?: Partial; -}; -declare function createResponseComposition(responseOverrides?: Partial>, defaultTransformers?: ResponseTransformer[]): ResponseFunction; -declare const response: ResponseFunction & { - once: ResponseFunction; - networkError(message: string): never; -}; - -/** - * Sets a response status code and text. - * @example - * res(ctx.status(301)) - * res(ctx.status(400, 'Custom status text')) - * @see {@link https://mswjs.io/docs/api/context/status `ctx.status()`} - */ -declare const status: (statusCode: number, statusText?: string) => ResponseTransformer; - -/** - * Generic class for the mock API setup. - */ -declare abstract class SetupApi { - protected initialHandlers: ReadonlyArray; - protected currentHandlers: Array; - protected readonly emitter: Emitter; - protected readonly publicEmitter: Emitter; - readonly events: LifeCycleEventEmitter; - constructor(...initialHandlers: Array); - private validateHandlers; - protected dispose(): void; - use(...runtimeHandlers: Array): void; - restoreHandlers(): void; - resetHandlers(...nextHandlers: Array): void; - listHandlers(): ReadonlyArray, any, MockedRequest>>; - private createLifeCycleEvents; - abstract printHandlers(): void; -} - -type ServerLifecycleEventsMap = LifeCycleEventsMap; -interface SetupServer { - /** - * Starts requests interception based on the previously provided request handlers. - * @see {@link https://mswjs.io/docs/api/setup-server/listen `server.listen()`} - */ - listen(options?: PartialDeep): void; - /** - * Stops requests interception by restoring all augmented modules. - * @see {@link https://mswjs.io/docs/api/setup-server/close `server.close()`} - */ - close(): void; - /** - * Prepends given request handlers to the list of existing handlers. - * @see {@link https://mswjs.io/docs/api/setup-server/use `server.use()`} - */ - use(...handlers: RequestHandler[]): void; - /** - * Marks all request handlers that respond using `res.once()` as unused. - * @see {@link https://mswjs.io/docs/api/setup-server/restore-handlers `server.restore-handlers()`} - */ - restoreHandlers(): void; - /** - * Resets request handlers to the initial list given to the `setupServer` call, or to the explicit next request handlers list, if given. - * @see {@link https://mswjs.io/docs/api/setup-server/reset-handlers `server.reset-handlers()`} - */ - resetHandlers(...nextHandlers: RequestHandler[]): void; - /** - * Returns a readonly list of currently active request handlers. - * @see {@link https://mswjs.io/docs/api/setup-server/list-handlers `server.listHandlers()`} - */ - listHandlers(): ReadonlyArray, any, MockedRequest>>; - /** - * Lists all active request handlers. - * @see {@link https://mswjs.io/docs/api/setup-server/print-handlers `server.print-handlers()`} - */ - printHandlers(): void; - events: LifeCycleEventEmitter; -} - -export { AsyncResponseResolverReturnType as A, DelayMode as B, RequestCache as C, DefaultContext as D, RequestMode as E, RequestRedirect as F, RequestDestination as G, RequestPriority as H, RequestReferrerPolicy as I, MockedRequestInit as J, SetupServer as K, LifeCycleEventsMap as L, MockedRequest as M, ResponseTransformer as R, SetupApi as S, WorkerLifecycleEventsMap as W, set as a, SetupWorker as b, RequestHandler as c, delay as d, StartOptions as e, fetch as f, StartReturnType as g, DefaultBodyType as h, ResponseResolver as i, ResponseResolutionContext as j, SerializedResponse as k, RequestHandlerDefaultInfo as l, MockedResponse as m, ResponseLookupResult as n, SharedOptions as o, ServerLifecycleEventsMap as p, defaultResponse as q, response as r, status as s, createResponseComposition as t, defaultContext as u, ResponseResolverReturnType as v, DefaultRequestMultipartBody as w, ResponseComposition as x, ResponseCompositionOptions as y, ResponseFunction as z }; diff --git a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js b/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js deleted file mode 100644 index 84560924..00000000 --- a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js +++ /dev/null @@ -1,14289 +0,0 @@ -"use strict"; -var MockServiceWorker = (() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // node_modules/.pnpm/cookie@0.4.2/node_modules/cookie/index.js - var require_cookie = __commonJS({ - "node_modules/.pnpm/cookie@0.4.2/node_modules/cookie/index.js"(exports) { - "use strict"; - exports.parse = parse5; - exports.serialize = serialize2; - var decode = decodeURIComponent; - var encode = encodeURIComponent; - var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; - function parse5(str, options) { - if (typeof str !== "string") { - throw new TypeError("argument str must be a string"); - } - var obj = {}; - var opt = options || {}; - var pairs = str.split(";"); - var dec = opt.decode || decode; - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - var index = pair.indexOf("="); - if (index < 0) { - continue; - } - var key = pair.substring(0, index).trim(); - if (void 0 == obj[key]) { - var val = pair.substring(index + 1, pair.length).trim(); - if (val[0] === '"') { - val = val.slice(1, -1); - } - obj[key] = tryDecode(val, dec); - } - } - return obj; - } - function serialize2(name, val, options) { - var opt = options || {}; - var enc = opt.encode || encode; - if (typeof enc !== "function") { - throw new TypeError("option encode is invalid"); - } - if (!fieldContentRegExp.test(name)) { - throw new TypeError("argument name is invalid"); - } - var value = enc(val); - if (value && !fieldContentRegExp.test(value)) { - throw new TypeError("argument val is invalid"); - } - var str = name + "=" + value; - if (null != opt.maxAge) { - var maxAge = opt.maxAge - 0; - if (isNaN(maxAge) || !isFinite(maxAge)) { - throw new TypeError("option maxAge is invalid"); - } - str += "; Max-Age=" + Math.floor(maxAge); - } - if (opt.domain) { - if (!fieldContentRegExp.test(opt.domain)) { - throw new TypeError("option domain is invalid"); - } - str += "; Domain=" + opt.domain; - } - if (opt.path) { - if (!fieldContentRegExp.test(opt.path)) { - throw new TypeError("option path is invalid"); - } - str += "; Path=" + opt.path; - } - if (opt.expires) { - if (typeof opt.expires.toUTCString !== "function") { - throw new TypeError("option expires is invalid"); - } - str += "; Expires=" + opt.expires.toUTCString(); - } - if (opt.httpOnly) { - str += "; HttpOnly"; - } - if (opt.secure) { - str += "; Secure"; - } - if (opt.sameSite) { - var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite; - switch (sameSite) { - case true: - str += "; SameSite=Strict"; - break; - case "lax": - str += "; SameSite=Lax"; - break; - case "strict": - str += "; SameSite=Strict"; - break; - case "none": - str += "; SameSite=None"; - break; - default: - throw new TypeError("option sameSite is invalid"); - } - } - return str; - } - function tryDecode(str, decode2) { - try { - return decode2(str); - } catch (e) { - return str; - } - } - } - }); - - // node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/browser.js - var require_browser = __commonJS({ - "node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/browser.js"(exports, module) { - "use strict"; - var getGlobal = function() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); - }; - var globalObject = getGlobal(); - module.exports = exports = globalObject.fetch; - if (globalObject.fetch) { - exports.default = globalObject.fetch.bind(globalObject); - } - exports.Headers = globalObject.Headers; - exports.Request = globalObject.Request; - exports.Response = globalObject.Response; - } - }); - - // node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/until.js - var require_until = __commonJS({ - "node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/until.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.until = async (promise) => { - try { - const data2 = await promise().catch((error2) => { - throw error2; - }); - return [null, data2]; - } catch (error2) { - return [error2, null]; - } - }; - } - }); - - // node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/index.js - var require_lib = __commonJS({ - "node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var until_1 = require_until(); - exports.until = until_1.until; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/glossary.js - var require_glossary = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/glossary.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.IS_PATCHED_MODULE = void 0; - exports.IS_PATCHED_MODULE = Symbol("isPatchedModule"); - } - }); - - // node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js - var require_ms = __commonJS({ - "node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports, module) { - var s = 1e3; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === "string" && val.length > 0) { - return parse5(val); - } else if (type === "number" && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) - ); - }; - function parse5(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match2 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match2) { - return; - } - var n = parseFloat(match2[1]); - var type = (match2[2] || "ms").toLowerCase(); - switch (type) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * y; - case "weeks": - case "week": - case "w": - return n * w; - case "days": - case "day": - case "d": - return n * d; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * h; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * m; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * s; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - default: - return void 0; - } - } - function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + "d"; - } - if (msAbs >= h) { - return Math.round(ms / h) + "h"; - } - if (msAbs >= m) { - return Math.round(ms / m) + "m"; - } - if (msAbs >= s) { - return Math.round(ms / s) + "s"; - } - return ms + "ms"; - } - function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, "day"); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, "hour"); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, "minute"); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, "second"); - } - return ms + " ms"; - } - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); - } - } - }); - - // node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js - var require_common = __commonJS({ - "node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js"(exports, module) { - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require_ms(); - createDebug.destroy = destroy; - Object.keys(env).forEach((key) => { - createDebug[key] = env[key]; - }); - createDebug.names = []; - createDebug.skips = []; - createDebug.formatters = {}; - function selectColor(namespace) { - let hash = 0; - for (let i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; - } - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; - function debug(...args) { - if (!debug.enabled) { - return; - } - const self2 = debug; - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self2.diff = ms; - self2.prev = prevTime; - self2.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - if (typeof args[0] !== "string") { - args.unshift("%O"); - } - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match2, format2) => { - if (match2 === "%%") { - return "%"; - } - index++; - const formatter = createDebug.formatters[format2]; - if (typeof formatter === "function") { - const val = args[index]; - match2 = formatter.call(self2, val); - args.splice(index, 1); - index--; - } - return match2; - }); - createDebug.formatArgs.call(self2, args); - const logFn = self2.log || createDebug.log; - logFn.apply(self2, args); - } - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; - Object.defineProperty(debug, "enabled", { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } - return enabledCache; - }, - set: (v) => { - enableOverride = v; - } - }); - if (typeof createDebug.init === "function") { - createDebug.init(debug); - } - return debug; - } - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; - createDebug.names = []; - createDebug.skips = []; - let i; - const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); - const len = split.length; - for (i = 0; i < len; i++) { - if (!split[i]) { - continue; - } - namespaces = split[i].replace(/\*/g, ".*?"); - if (namespaces[0] === "-") { - createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$")); - } else { - createDebug.names.push(new RegExp("^" + namespaces + "$")); - } - } - } - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace) - ].join(","); - createDebug.enable(""); - return namespaces; - } - function enabled(name) { - if (name[name.length - 1] === "*") { - return true; - } - let i; - let len; - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - return false; - } - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); - } - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - function destroy() { - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - createDebug.enable(createDebug.load()); - return createDebug; - } - module.exports = setup; - } - }); - - // node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js - var require_browser2 = __commonJS({ - "node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module) { - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - exports.destroy = (() => { - let warned = false; - return () => { - if (!warned) { - warned = true; - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - }; - })(); - exports.colors = [ - "#0000CC", - "#0000FF", - "#0033CC", - "#0033FF", - "#0066CC", - "#0066FF", - "#0099CC", - "#0099FF", - "#00CC00", - "#00CC33", - "#00CC66", - "#00CC99", - "#00CCCC", - "#00CCFF", - "#3300CC", - "#3300FF", - "#3333CC", - "#3333FF", - "#3366CC", - "#3366FF", - "#3399CC", - "#3399FF", - "#33CC00", - "#33CC33", - "#33CC66", - "#33CC99", - "#33CCCC", - "#33CCFF", - "#6600CC", - "#6600FF", - "#6633CC", - "#6633FF", - "#66CC00", - "#66CC33", - "#9900CC", - "#9900FF", - "#9933CC", - "#9933FF", - "#99CC00", - "#99CC33", - "#CC0000", - "#CC0033", - "#CC0066", - "#CC0099", - "#CC00CC", - "#CC00FF", - "#CC3300", - "#CC3333", - "#CC3366", - "#CC3399", - "#CC33CC", - "#CC33FF", - "#CC6600", - "#CC6633", - "#CC9900", - "#CC9933", - "#CCCC00", - "#CCCC33", - "#FF0000", - "#FF0033", - "#FF0066", - "#FF0099", - "#FF00CC", - "#FF00FF", - "#FF3300", - "#FF3333", - "#FF3366", - "#FF3399", - "#FF33CC", - "#FF33FF", - "#FF6600", - "#FF6633", - "#FF9900", - "#FF9933", - "#FFCC00", - "#FFCC33" - ]; - function useColors() { - if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { - return true; - } - if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - function formatArgs(args) { - args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff); - if (!this.useColors) { - return; - } - const c = "color: " + this.color; - args.splice(1, 0, c, "color: inherit"); - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, (match2) => { - if (match2 === "%%") { - return; - } - index++; - if (match2 === "%c") { - lastC = index; - } - }); - args.splice(lastC, 0, c); - } - exports.log = console.debug || console.log || (() => { - }); - function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem("debug", namespaces); - } else { - exports.storage.removeItem("debug"); - } - } catch (error2) { - } - } - function load() { - let r; - try { - r = exports.storage.getItem("debug"); - } catch (error2) { - } - if (!r && typeof process !== "undefined" && "env" in process) { - r = process.env.DEBUG; - } - return r; - } - function localstorage() { - try { - return localStorage; - } catch (error2) { - } - } - module.exports = require_common()(exports); - var { formatters } = module.exports; - formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (error2) { - return "[UnexpectedJSONParseError]: " + error2.message; - } - }; - } - }); - - // node_modules/.pnpm/events@3.3.0/node_modules/events/events.js - var require_events = __commonJS({ - "node_modules/.pnpm/events@3.3.0/node_modules/events/events.js"(exports, module) { - "use strict"; - var R = typeof Reflect === "object" ? Reflect : null; - var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - }; - var ReflectOwnKeys; - if (R && typeof R.ownKeys === "function") { - ReflectOwnKeys = R.ownKeys; - } else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = function ReflectOwnKeys2(target) { - return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); - }; - } else { - ReflectOwnKeys = function ReflectOwnKeys2(target) { - return Object.getOwnPropertyNames(target); - }; - } - function ProcessEmitWarning(warning) { - if (console && console.warn) - console.warn(warning); - } - var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { - return value !== value; - }; - function EventEmitter() { - EventEmitter.init.call(this); - } - module.exports = EventEmitter; - module.exports.once = once; - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._eventsCount = 0; - EventEmitter.prototype._maxListeners = void 0; - var defaultMaxListeners = 10; - function checkListener(listener) { - if (typeof listener !== "function") { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } - } - Object.defineProperty(EventEmitter, "defaultMaxListeners", { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); - } - defaultMaxListeners = arg; - } - }); - EventEmitter.init = function() { - if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - } - this._maxListeners = this._maxListeners || void 0; - }; - EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); - } - this._maxListeners = n; - return this; - }; - function _getMaxListeners(that) { - if (that._maxListeners === void 0) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; - } - EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return _getMaxListeners(this); - }; - EventEmitter.prototype.emit = function emit(type) { - var args = []; - for (var i = 1; i < arguments.length; i++) - args.push(arguments[i]); - var doError = type === "error"; - var events = this._events; - if (events !== void 0) - doError = doError && events.error === void 0; - else if (!doError) - return false; - if (doError) { - var er; - if (args.length > 0) - er = args[0]; - if (er instanceof Error) { - throw er; - } - var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); - err.context = er; - throw err; - } - var handler = events[type]; - if (handler === void 0) - return false; - if (typeof handler === "function") { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - ReflectApply(listeners[i], this, args); - } - return true; - }; - function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - checkListener(listener); - events = target._events; - if (events === void 0) { - events = target._events = /* @__PURE__ */ Object.create(null); - target._eventsCount = 0; - } else { - if (events.newListener !== void 0) { - target.emit( - "newListener", - type, - listener.listener ? listener.listener : listener - ); - events = target._events; - } - existing = events[type]; - } - if (existing === void 0) { - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === "function") { - existing = events[type] = prepend ? [listener, existing] : [existing, listener]; - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - w.name = "MaxListenersExceededWarning"; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - return target; - } - EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.prependListener = function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) - return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } - } - function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: void 0, target, type, listener }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; - } - EventEmitter.prototype.once = function once2(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; - }; - EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - EventEmitter.prototype.removeListener = function removeListener(type, listener) { - var list, events, position, i, originalListener; - checkListener(listener); - events = this._events; - if (events === void 0) - return this; - list = events[type]; - if (list === void 0) - return this; - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = /* @__PURE__ */ Object.create(null); - else { - delete events[type]; - if (events.removeListener) - this.emit("removeListener", type, list.listener || listener); - } - } else if (typeof list !== "function") { - position = -1; - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - if (position < 0) - return this; - if (position === 0) - list.shift(); - else { - spliceOne(list, position); - } - if (list.length === 1) - events[type] = list[0]; - if (events.removeListener !== void 0) - this.emit("removeListener", type, originalListener || listener); - } - return this; - }; - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { - var listeners, events, i; - events = this._events; - if (events === void 0) - return this; - if (events.removeListener === void 0) { - if (arguments.length === 0) { - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== void 0) { - if (--this._eventsCount === 0) - this._events = /* @__PURE__ */ Object.create(null); - else - delete events[type]; - } - return this; - } - if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === "removeListener") - continue; - this.removeAllListeners(key); - } - this.removeAllListeners("removeListener"); - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - return this; - } - listeners = events[type]; - if (typeof listeners === "function") { - this.removeListener(type, listeners); - } else if (listeners !== void 0) { - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - return this; - }; - function _listeners(target, type, unwrap) { - var events = target._events; - if (events === void 0) - return []; - var evlistener = events[type]; - if (evlistener === void 0) - return []; - if (typeof evlistener === "function") - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); - } - EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); - }; - EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); - }; - EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === "function") { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } - }; - EventEmitter.prototype.listenerCount = listenerCount; - function listenerCount(type) { - var events = this._events; - if (events !== void 0) { - var evlistener = events[type]; - if (typeof evlistener === "function") { - return 1; - } else if (evlistener !== void 0) { - return evlistener.length; - } - } - return 0; - } - EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; - }; - function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; - } - function spliceOne(list, index) { - for (; index + 1 < list.length; index++) - list[index] = list[index + 1]; - list.pop(); - } - function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; - } - function once(emitter, name) { - return new Promise(function(resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - function resolver() { - if (typeof emitter.removeListener === "function") { - emitter.removeListener("error", errorListener); - } - resolve([].slice.call(arguments)); - } - ; - eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); - if (name !== "error") { - addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); - } - }); - } - function addErrorHandlerIfEventEmitter(emitter, handler, flags2) { - if (typeof emitter.on === "function") { - eventTargetAgnosticAddListener(emitter, "error", handler, flags2); - } - } - function eventTargetAgnosticAddListener(emitter, name, listener, flags2) { - if (typeof emitter.on === "function") { - if (flags2.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === "function") { - emitter.addEventListener(name, function wrapListener(arg) { - if (flags2.once) { - emitter.removeEventListener(name, wrapListener); - } - listener(arg); - }); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } - } - } - }); - - // node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/StrictEventEmitter.js - var require_StrictEventEmitter = __commonJS({ - "node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/StrictEventEmitter.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - var __spreadArrays = exports && exports.__spreadArrays || function() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) - s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - exports.__esModule = true; - exports.StrictEventEmitter = void 0; - var events_1 = require_events(); - var StrictEventEmitter = function(_super) { - __extends(StrictEventEmitter2, _super); - function StrictEventEmitter2() { - return _super.call(this) || this; - } - StrictEventEmitter2.prototype.on = function(event, listener) { - return _super.prototype.on.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.once = function(event, listener) { - return _super.prototype.once.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.off = function(event, listener) { - return _super.prototype.off.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.emit = function(event) { - var data2 = []; - for (var _i = 1; _i < arguments.length; _i++) { - data2[_i - 1] = arguments[_i]; - } - return _super.prototype.emit.apply(this, __spreadArrays([event.toString()], data2)); - }; - StrictEventEmitter2.prototype.addListener = function(event, listener) { - return _super.prototype.addListener.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.prependListener = function(event, listener) { - return _super.prototype.prependListener.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.prependOnceListener = function(event, listener) { - return _super.prototype.prependOnceListener.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.removeListener = function(event, listener) { - return _super.prototype.removeListener.call(this, event.toString(), listener); - }; - StrictEventEmitter2.prototype.removeAllListeners = function(event) { - if (event) { - return _super.prototype.removeAllListeners.call(this, event.toString()); - } - return _super.prototype.removeAllListeners.call(this); - }; - StrictEventEmitter2.prototype.eventNames = function() { - return _super.prototype.eventNames.call(this); - }; - StrictEventEmitter2.prototype.listeners = function(event) { - return _super.prototype.listeners.call(this, event.toString()); - }; - StrictEventEmitter2.prototype.rawListeners = function(event) { - return _super.prototype.rawListeners.call(this, event.toString()); - }; - StrictEventEmitter2.prototype.listenerCount = function(event) { - return _super.prototype.listenerCount.call(this, event.toString()); - }; - return StrictEventEmitter2; - }(events_1.EventEmitter); - exports.StrictEventEmitter = StrictEventEmitter; - } - }); - - // node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/index.js - var require_lib2 = __commonJS({ - "node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - exports.__esModule = true; - __exportStar(require_StrictEventEmitter(), exports); - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/nextTick.js - var require_nextTick = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/nextTick.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.nextTickAsync = exports.nextTick = void 0; - function nextTick(callback) { - setTimeout(callback, 0); - } - exports.nextTick = nextTick; - function nextTickAsync(callback) { - return new Promise(function(resolve) { - setTimeout(function() { - resolve(callback()); - }, 0); - }); - } - exports.nextTickAsync = nextTickAsync; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/AsyncEventEmitter.js - var require_AsyncEventEmitter = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/AsyncEventEmitter.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __generator = exports && exports.__generator || function(thisArg, body2) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - var __read = exports && exports.__read || function(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) - return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) - ar.push(r.value); - } catch (error2) { - e = { error: error2 }; - } finally { - try { - if (r && !r.done && (m = i["return"])) - m.call(i); - } finally { - if (e) - throw e.error; - } - } - return ar; - }; - var __spreadArray = exports && exports.__spreadArray || function(to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.AsyncEventEmitter = exports.AsyncEventEmitterReadyState = void 0; - var debug_1 = require_browser2(); - var strict_event_emitter_1 = require_lib2(); - var nextTick_1 = require_nextTick(); - var AsyncEventEmitterReadyState; - (function(AsyncEventEmitterReadyState2) { - AsyncEventEmitterReadyState2["ACTIVE"] = "ACTIVE"; - AsyncEventEmitterReadyState2["DEACTIVATED"] = "DEACTIVATED"; - })(AsyncEventEmitterReadyState = exports.AsyncEventEmitterReadyState || (exports.AsyncEventEmitterReadyState = {})); - var AsyncEventEmitter = function(_super) { - __extends(AsyncEventEmitter2, _super); - function AsyncEventEmitter2() { - var _this = _super.call(this) || this; - _this.log = debug_1.debug("async-event-emitter"); - _this.queue = /* @__PURE__ */ new Map(); - _this.readyState = AsyncEventEmitterReadyState.ACTIVE; - return _this; - } - AsyncEventEmitter2.prototype.on = function(event, listener) { - var _this = this; - var log = this.log.extend("on"); - log('adding "%s" listener...', event); - if (this.readyState === AsyncEventEmitterReadyState.DEACTIVATED) { - log("the emitter is destroyed, skipping!"); - return this; - } - return _super.prototype.on.call(this, event, function() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return __awaiter(_this, void 0, void 0, function() { - var queue; - var _this2 = this; - return __generator(this, function(_a2) { - queue = this.openListenerQueue(event); - log('awaiting the "%s" listener...', event); - queue.push({ - args, - done: new Promise(function(resolve, reject) { - return __awaiter(_this2, void 0, void 0, function() { - var error_1; - return __generator(this, function(_a3) { - switch (_a3.label) { - case 0: - _a3.trys.push([0, 2, , 3]); - return [4, listener.apply(void 0, __spreadArray([], __read(args)))]; - case 1: - _a3.sent(); - resolve(); - log('"%s" listener has resolved!', event); - return [3, 3]; - case 2: - error_1 = _a3.sent(); - log('"%s" listener has rejected!', error_1); - reject(error_1); - return [3, 3]; - case 3: - return [2]; - } - }); - }); - }) - }); - return [2]; - }); - }); - }); - }; - AsyncEventEmitter2.prototype.emit = function(event) { - var _this = this; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var log = this.log.extend("emit"); - log('emitting "%s" event...', event); - if (this.readyState === AsyncEventEmitterReadyState.DEACTIVATED) { - log("the emitter is destroyed, skipping!"); - return false; - } - this.openListenerQueue(event); - log('appending a one-time cleanup "%s" listener...', event); - this.once(event, function() { - nextTick_1.nextTick(function() { - _this.queue.delete(event); - log('cleaned up "%s" listeners queue!', event); - }); - }); - return _super.prototype.emit.apply(this, __spreadArray([event], __read(args))); - }; - AsyncEventEmitter2.prototype.untilIdle = function(event, filter) { - if (filter === void 0) { - filter = function() { - return true; - }; - } - return __awaiter(this, void 0, void 0, function() { - var listenersQueue; - var _this = this; - return __generator(this, function(_a2) { - switch (_a2.label) { - case 0: - listenersQueue = this.queue.get(event) || []; - return [4, Promise.all(listenersQueue.filter(filter).map(function(_a3) { - var done = _a3.done; - return done; - })).finally(function() { - _this.queue.delete(event); - })]; - case 1: - _a2.sent(); - return [2]; - } - }); - }); - }; - AsyncEventEmitter2.prototype.openListenerQueue = function(event) { - var log = this.log.extend("openListenerQueue"); - log('opening "%s" listeners queue...', event); - var queue = this.queue.get(event); - if (!queue) { - log("no queue found, creating one..."); - this.queue.set(event, []); - return []; - } - log("returning an exising queue:", queue); - return queue; - }; - AsyncEventEmitter2.prototype.removeAllListeners = function(event) { - var log = this.log.extend("removeAllListeners"); - log("event:", event); - if (event) { - this.queue.delete(event); - log('cleared the "%s" listeners queue!', event, this.queue.get(event)); - } else { - this.queue.clear(); - log("cleared the listeners queue!", this.queue); - } - return _super.prototype.removeAllListeners.call(this, event); - }; - AsyncEventEmitter2.prototype.activate = function() { - var log = this.log.extend("activate"); - this.readyState = AsyncEventEmitterReadyState.ACTIVE; - log("set state to:", this.readyState); - }; - AsyncEventEmitter2.prototype.deactivate = function() { - var log = this.log.extend("deactivate"); - log("removing all listeners..."); - this.removeAllListeners(); - this.readyState = AsyncEventEmitterReadyState.DEACTIVATED; - log("set state to:", this.readyState); - }; - return AsyncEventEmitter2; - }(strict_event_emitter_1.StrictEventEmitter); - exports.AsyncEventEmitter = AsyncEventEmitter; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/Interceptor.js - var require_Interceptor = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/Interceptor.js"(exports) { - "use strict"; - var __values = exports && exports.__values || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) - return m.call(o); - if (o && typeof o.length === "number") - return { - next: function() { - if (o && i >= o.length) - o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Interceptor = exports.InterceptorReadyState = exports.deleteGlobalSymbol = exports.getGlobalSymbol = void 0; - var debug_1 = require_browser2(); - var AsyncEventEmitter_1 = require_AsyncEventEmitter(); - var nextTick_1 = require_nextTick(); - function getGlobalSymbol(symbol) { - return globalThis[symbol] || void 0; - } - exports.getGlobalSymbol = getGlobalSymbol; - function setGlobalSymbol(symbol, value) { - globalThis[symbol] = value; - } - function deleteGlobalSymbol(symbol) { - delete globalThis[symbol]; - } - exports.deleteGlobalSymbol = deleteGlobalSymbol; - var InterceptorReadyState; - (function(InterceptorReadyState2) { - InterceptorReadyState2["IDLE"] = "IDLE"; - InterceptorReadyState2["APPLYING"] = "APPLYING"; - InterceptorReadyState2["APPLIED"] = "APPLIED"; - InterceptorReadyState2["DISPOSING"] = "DISPOSING"; - InterceptorReadyState2["DISPOSED"] = "DISPOSED"; - })(InterceptorReadyState = exports.InterceptorReadyState || (exports.InterceptorReadyState = {})); - var Interceptor2 = function() { - function Interceptor3(symbol) { - this.symbol = symbol; - this.readyState = InterceptorReadyState.IDLE; - this.emitter = new AsyncEventEmitter_1.AsyncEventEmitter(); - this.subscriptions = []; - this.log = debug_1.debug(symbol.description); - this.emitter.setMaxListeners(0); - this.log("constructing the interceptor..."); - } - Interceptor3.prototype.checkEnvironment = function() { - return true; - }; - Interceptor3.prototype.apply = function() { - var _this = this; - var log = this.log.extend("apply"); - log("applying the interceptor..."); - if (this.readyState === InterceptorReadyState.APPLIED) { - log("intercepted already applied!"); - return; - } - var shouldApply = this.checkEnvironment(); - if (!shouldApply) { - log("the interceptor cannot be applied in this environment!"); - return; - } - this.readyState = InterceptorReadyState.APPLYING; - this.emitter.activate(); - log("activated the emiter!", this.emitter.readyState); - var runningInstance = this.getInstance(); - if (runningInstance) { - log("found a running instance, reusing..."); - this.on = function(event, listener) { - log('proxying the "%s" listener', event); - runningInstance.emitter.addListener(event, listener); - _this.subscriptions.push(function() { - runningInstance.emitter.removeListener(event, listener); - log('removed proxied "%s" listener!', event); - }); - }; - nextTick_1.nextTick(function() { - _this.readyState = InterceptorReadyState.APPLIED; - }); - return; - } - log("no running instance found, setting up a new instance..."); - this.setup(); - this.setInstance(); - nextTick_1.nextTick(function() { - _this.readyState = InterceptorReadyState.APPLIED; - }); - }; - Interceptor3.prototype.setup = function() { - }; - Interceptor3.prototype.on = function(event, listener) { - var log = this.log.extend("on"); - if (this.readyState === InterceptorReadyState.DISPOSING || this.readyState === InterceptorReadyState.DISPOSED) { - log("cannot listen to events, already disposed!"); - return; - } - log('adding "%s" event listener:', event, listener.name); - this.emitter.on(event, listener); - }; - Interceptor3.prototype.dispose = function() { - var e_1, _a2; - var _this = this; - var log = this.log.extend("dispose"); - if (this.readyState === InterceptorReadyState.DISPOSED) { - log("cannot dispose, already disposed!"); - return; - } - log("disposing the interceptor..."); - this.readyState = InterceptorReadyState.DISPOSING; - if (!this.getInstance()) { - log("no interceptors running, skipping dispose..."); - return; - } - this.clearInstance(); - log("global symbol deleted:", getGlobalSymbol(this.symbol)); - if (this.subscriptions.length > 0) { - log("disposing of %d subscriptions...", this.subscriptions.length); - try { - for (var _b2 = __values(this.subscriptions), _c = _b2.next(); !_c.done; _c = _b2.next()) { - var dispose = _c.value; - dispose(); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_c && !_c.done && (_a2 = _b2.return)) - _a2.call(_b2); - } finally { - if (e_1) - throw e_1.error; - } - } - this.subscriptions = []; - log("disposed of all subscriptions!", this.subscriptions.length); - } - this.emitter.deactivate(); - log("destroyed the listener!"); - nextTick_1.nextTick(function() { - _this.readyState = InterceptorReadyState.DISPOSED; - }); - }; - Interceptor3.prototype.getInstance = function() { - var _a2; - var instance = getGlobalSymbol(this.symbol); - this.log("retrieved global instance:", (_a2 = instance === null || instance === void 0 ? void 0 : instance.constructor) === null || _a2 === void 0 ? void 0 : _a2.name); - return instance; - }; - Interceptor3.prototype.setInstance = function() { - setGlobalSymbol(this.symbol, this); - this.log("set global instance!", this.symbol.description); - }; - Interceptor3.prototype.clearInstance = function() { - deleteGlobalSymbol(this.symbol); - this.log("cleared global instance!", this.symbol.description); - }; - return Interceptor3; - }(); - exports.Interceptor = Interceptor2; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/BatchInterceptor.js - var require_BatchInterceptor = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/BatchInterceptor.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - var __values = exports && exports.__values || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) - return m.call(o); - if (o && typeof o.length === "number") - return { - next: function() { - if (o && i >= o.length) - o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.BatchInterceptor = void 0; - var Interceptor_1 = require_Interceptor(); - var BatchInterceptor2 = function(_super) { - __extends(BatchInterceptor3, _super); - function BatchInterceptor3(options) { - var _this = this; - BatchInterceptor3.symbol = Symbol(options.name); - _this = _super.call(this, BatchInterceptor3.symbol) || this; - _this.interceptors = options.interceptors; - return _this; - } - BatchInterceptor3.prototype.setup = function() { - var e_1, _a2; - var log = this.log.extend("setup"); - log("applying all %d interceptors...", this.interceptors.length); - var _loop_1 = function(interceptor2) { - log('applying "%s" interceptor...', interceptor2.constructor.name); - interceptor2.apply(); - log("adding interceptor dispose subscription"); - this_1.subscriptions.push(function() { - return interceptor2.dispose(); - }); - }; - var this_1 = this; - try { - for (var _b2 = __values(this.interceptors), _c = _b2.next(); !_c.done; _c = _b2.next()) { - var interceptor = _c.value; - _loop_1(interceptor); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_c && !_c.done && (_a2 = _b2.return)) - _a2.call(_b2); - } finally { - if (e_1) - throw e_1.error; - } - } - }; - BatchInterceptor3.prototype.on = function(event, listener) { - this.interceptors.forEach(function(interceptor) { - interceptor.on(event, listener); - }); - }; - return BatchInterceptor3; - }(Interceptor_1.Interceptor); - exports.BatchInterceptor = BatchInterceptor2; - } - }); - - // node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/lib/index.js - var require_lib3 = __commonJS({ - "node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/lib/index.js"(exports, module) { - function _array_like_to_array(arr, len) { - if (len == null || len > arr.length) - len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - function _array_with_holes(arr) { - if (Array.isArray(arr)) - return arr; - } - function _class_call_check(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _create_class(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } - } - function _iterable_to_array_limit(arr, i) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - if (_i == null) - return; - var _arr = []; - var _n = true; - var _d = false; - var _s, _e; - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; - } - } - return _arr; - } - function _non_iterable_rest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - function _sliced_to_array(arr, i) { - return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); - } - function _unsupported_iterable_to_array(o, minLen) { - if (!o) - return; - if (typeof o === "string") - return _array_like_to_array(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) - n = o.constructor.name; - if (n === "Map" || n === "Set") - return Array.from(n); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) - return _array_like_to_array(o, minLen); - } - function _ts_generator(thisArg, body2) { - var f, y, t, g, _ = { - label: 0, - sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, - trys: [], - ops: [] - }; - return g = { - next: verb(0), - "throw": verb(1), - "return": verb(2) - }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([ - n, - v - ]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [ - op[0] & 2, - t.value - ]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { - value: op[1], - done: false - }; - case 5: - _.label++; - y = op[1]; - op = [ - 0 - ]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [ - 6, - e - ]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { - value: op[0] ? op[1] : void 0, - done: true - }; - } - } - var __create3 = Object.create; - var __defProp3 = Object.defineProperty; - var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames3 = Object.getOwnPropertyNames; - var __getProtoOf3 = Object.getPrototypeOf; - var __hasOwnProp3 = Object.prototype.hasOwnProperty; - var __commonJS3 = function(cb, mod) { - return function __require() { - return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { - exports: {} - }).exports, mod), mod.exports; - }; - }; - var __export2 = function(target, all) { - for (var name in all) - __defProp3(target, name, { - get: all[name], - enumerable: true - }); - }; - var __copyProps3 = function(to, from, except, desc) { - if (from && typeof from === "object" || typeof from === "function") { - var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - try { - var _loop = function() { - var key = _step.value; - if (!__hasOwnProp3.call(to, key) && key !== except) - __defProp3(to, key, { - get: function() { - return from[key]; - }, - enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable - }); - }; - for (var _iterator = __getOwnPropNames3(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) - _loop(); - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - return to; - }; - var __toESM3 = function(mod, isNodeMode, target) { - return target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { - value: mod, - enumerable: true - }) : target, mod); - }; - var __toCommonJS2 = function(mod) { - return __copyProps3(__defProp3({}, "__esModule", { - value: true - }), mod); - }; - var require_set_cookie3 = __commonJS3({ - "node_modules/set-cookie-parser/lib/set-cookie.js": function(exports2, module2) { - "use strict"; - var isNonEmptyString = function isNonEmptyString2(str) { - return typeof str === "string" && !!str.trim(); - }; - var parseString = function parseString2(setCookieValue, options) { - var parts = setCookieValue.split(";").filter(isNonEmptyString); - var nameValuePairStr = parts.shift(); - var parsed = parseNameValuePair(nameValuePairStr); - var name = parsed.name; - var value = parsed.value; - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - try { - value = options.decodeValues ? decodeURIComponent(value) : value; - } catch (e) { - console.error("set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.", e); - } - var cookie2 = { - name, - value - }; - parts.forEach(function(part) { - var sides = part.split("="); - var key = sides.shift().trimLeft().toLowerCase(); - var value2 = sides.join("="); - if (key === "expires") { - cookie2.expires = new Date(value2); - } else if (key === "max-age") { - cookie2.maxAge = parseInt(value2, 10); - } else if (key === "secure") { - cookie2.secure = true; - } else if (key === "httponly") { - cookie2.httpOnly = true; - } else if (key === "samesite") { - cookie2.sameSite = value2; - } else { - cookie2[key] = value2; - } - }); - return cookie2; - }; - var parseNameValuePair = function parseNameValuePair2(nameValuePairStr) { - var name = ""; - var value = ""; - var nameValueArr = nameValuePairStr.split("="); - if (nameValueArr.length > 1) { - name = nameValueArr.shift(); - value = nameValueArr.join("="); - } else { - value = nameValuePairStr; - } - return { - name, - value - }; - }; - var parse5 = function parse6(input, options) { - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!input) { - if (!options.map) { - return []; - } else { - return {}; - } - } - if (input.headers) { - if (typeof input.headers.getSetCookie === "function") { - input = input.headers.getSetCookie(); - } else if (input.headers["set-cookie"]) { - input = input.headers["set-cookie"]; - } else { - var sch = input.headers[Object.keys(input.headers).find(function(key) { - return key.toLowerCase() === "set-cookie"; - })]; - if (!sch && input.headers.cookie && !options.silent) { - console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."); - } - input = sch; - } - } - if (!Array.isArray(input)) { - input = [ - input - ]; - } - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!options.map) { - return input.filter(isNonEmptyString).map(function(str) { - return parseString(str, options); - }); - } else { - var cookies = {}; - return input.filter(isNonEmptyString).reduce(function(cookies2, str) { - var cookie2 = parseString(str, options); - cookies2[cookie2.name] = cookie2; - return cookies2; - }, cookies); - } - }; - var splitCookiesString2 = function splitCookiesString22(cookiesString) { - if (Array.isArray(cookiesString)) { - return cookiesString; - } - if (typeof cookiesString !== "string") { - return []; - } - var cookiesStrings = []; - var pos = 0; - var start; - var ch; - var lastComma; - var nextStart; - var cookiesSeparatorFound; - function skipWhitespace() { - while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { - pos += 1; - } - return pos < cookiesString.length; - } - function notSpecialChar() { - ch = cookiesString.charAt(pos); - return ch !== "=" && ch !== ";" && ch !== ","; - } - while (pos < cookiesString.length) { - start = pos; - cookiesSeparatorFound = false; - while (skipWhitespace()) { - ch = cookiesString.charAt(pos); - if (ch === ",") { - lastComma = pos; - pos += 1; - skipWhitespace(); - nextStart = pos; - while (pos < cookiesString.length && notSpecialChar()) { - pos += 1; - } - if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { - cookiesSeparatorFound = true; - pos = nextStart; - cookiesStrings.push(cookiesString.substring(start, lastComma)); - start = pos; - } else { - pos = lastComma + 1; - } - } else { - pos += 1; - } - } - if (!cookiesSeparatorFound || pos >= cookiesString.length) { - cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); - } - } - return cookiesStrings; - }; - var defaultParseOptions = { - decodeValues: true, - map: false, - silent: false - }; - module2.exports = parse5; - module2.exports.parse = parse5; - module2.exports.parseString = parseString; - module2.exports.splitCookiesString = splitCookiesString2; - } - }); - var src_exports2 = {}; - __export2(src_exports2, { - Headers: function() { - return HeadersPolyfill2; - }, - flattenHeadersList: function() { - return flattenHeadersList; - }, - flattenHeadersObject: function() { - return flattenHeadersObject2; - }, - headersToList: function() { - return headersToList; - }, - headersToObject: function() { - return headersToObject2; - }, - headersToString: function() { - return headersToString; - }, - listToHeaders: function() { - return listToHeaders; - }, - objectToHeaders: function() { - return objectToHeaders2; - }, - reduceHeadersObject: function() { - return reduceHeadersObject2; - }, - stringToHeaders: function() { - return stringToHeaders2; - } - }); - module.exports = __toCommonJS2(src_exports2); - var import_set_cookie_parser2 = __toESM3(require_set_cookie3()); - var HEADERS_INVALID_CHARACTERS2 = /[^a-z0-9\-#$%&'*+.^_`|~]/i; - function normalizeHeaderName2(name) { - if (HEADERS_INVALID_CHARACTERS2.test(name) || name.trim() === "") { - throw new TypeError("Invalid character in header field name"); - } - return name.trim().toLowerCase(); - } - var charCodesToRemove2 = [ - String.fromCharCode(10), - String.fromCharCode(13), - String.fromCharCode(9), - String.fromCharCode(32) - ]; - var HEADER_VALUE_REMOVE_REGEXP2 = new RegExp("(^[".concat(charCodesToRemove2.join(""), "]|$[").concat(charCodesToRemove2.join(""), "])"), "g"); - function normalizeHeaderValue2(value) { - var nextValue = value.replace(HEADER_VALUE_REMOVE_REGEXP2, ""); - return nextValue; - } - function isValidHeaderName2(value) { - if (typeof value !== "string") { - return false; - } - if (value.length === 0) { - return false; - } - for (var i = 0; i < value.length; i++) { - var character = value.charCodeAt(i); - if (character > 127 || !isToken2(character)) { - return false; - } - } - return true; - } - function isToken2(value) { - return ![ - 127, - 32, - "(", - ")", - "<", - ">", - "@", - ",", - ";", - ":", - "\\", - '"', - "/", - "[", - "]", - "?", - "=", - "{", - "}" - ].includes(value); - } - function isValidHeaderValue2(value) { - if (typeof value !== "string") { - return false; - } - if (value.trim() !== value) { - return false; - } - for (var i = 0; i < value.length; i++) { - var character = value.charCodeAt(i); - if (character === 0 || character === 10 || character === 13) { - return false; - } - } - return true; - } - var NORMALIZED_HEADERS2 = Symbol("normalizedHeaders"); - var RAW_HEADER_NAMES2 = Symbol("rawHeaderNames"); - var HEADER_VALUE_DELIMITER2 = ", "; - var _a2; - var _b2; - var HeadersPolyfill2 = /* @__PURE__ */ function() { - "use strict"; - function HeadersPolyfill1(init) { - var _this = this; - _class_call_check(this, HeadersPolyfill1); - var _init; - this[_a2] = {}; - this[_b2] = /* @__PURE__ */ new Map(); - if ([ - "Headers", - "HeadersPolyfill" - ].includes((_init = init) === null || _init === void 0 ? void 0 : _init.constructor.name) || _instanceof(init, HeadersPolyfill2)) { - var initialHeaders = init; - initialHeaders.forEach(function(value, name) { - _this.append(name, value); - }, this); - } else if (Array.isArray(init)) { - init.forEach(function(param) { - var _param = _sliced_to_array(param, 2), name = _param[0], value = _param[1]; - _this.append(name, Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER2) : value); - }); - } else if (init) { - Object.getOwnPropertyNames(init).forEach(function(name) { - var value = init[name]; - _this.append(name, Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER2) : value); - }); - } - } - _create_class(HeadersPolyfill1, [ - { - key: (_a2 = NORMALIZED_HEADERS2, _b2 = RAW_HEADER_NAMES2, Symbol.iterator), - value: function value() { - return this.entries(); - } - }, - { - key: "keys", - value: function keys() { - var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, err; - return _ts_generator(this, function(_state) { - switch (_state.label) { - case 0: - _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - _state.label = 1; - case 1: - _state.trys.push([ - 1, - 6, - 7, - 8 - ]); - _iterator = this.entries()[Symbol.iterator](); - _state.label = 2; - case 2: - if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) - return [ - 3, - 5 - ]; - _step_value = _sliced_to_array(_step.value, 1), name = _step_value[0]; - return [ - 4, - name - ]; - case 3: - _state.sent(); - _state.label = 4; - case 4: - _iteratorNormalCompletion = true; - return [ - 3, - 2 - ]; - case 5: - return [ - 3, - 8 - ]; - case 6: - err = _state.sent(); - _didIteratorError = true; - _iteratorError = err; - return [ - 3, - 8 - ]; - case 7: - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - return [ - 7 - ]; - case 8: - return [ - 2 - ]; - } - }); - } - }, - { - key: "values", - value: function values() { - var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, value, err; - return _ts_generator(this, function(_state) { - switch (_state.label) { - case 0: - _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - _state.label = 1; - case 1: - _state.trys.push([ - 1, - 6, - 7, - 8 - ]); - _iterator = this.entries()[Symbol.iterator](); - _state.label = 2; - case 2: - if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) - return [ - 3, - 5 - ]; - _step_value = _sliced_to_array(_step.value, 2), value = _step_value[1]; - return [ - 4, - value - ]; - case 3: - _state.sent(); - _state.label = 4; - case 4: - _iteratorNormalCompletion = true; - return [ - 3, - 2 - ]; - case 5: - return [ - 3, - 8 - ]; - case 6: - err = _state.sent(); - _didIteratorError = true; - _iteratorError = err; - return [ - 3, - 8 - ]; - case 7: - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - return [ - 7 - ]; - case 8: - return [ - 2 - ]; - } - }); - } - }, - { - key: "entries", - value: function entries() { - var sortedKeys, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, name, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, value, err, err; - return _ts_generator(this, function(_state) { - switch (_state.label) { - case 0: - sortedKeys = Object.keys(this[NORMALIZED_HEADERS2]).sort(function(a, b) { - return a.localeCompare(b); - }); - _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - _state.label = 1; - case 1: - _state.trys.push([ - 1, - 15, - 16, - 17 - ]); - _iterator = sortedKeys[Symbol.iterator](); - _state.label = 2; - case 2: - if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) - return [ - 3, - 14 - ]; - name = _step.value; - if (!(name === "set-cookie")) - return [ - 3, - 11 - ]; - _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0; - _state.label = 3; - case 3: - _state.trys.push([ - 3, - 8, - 9, - 10 - ]); - _iterator1 = this.getSetCookie()[Symbol.iterator](); - _state.label = 4; - case 4: - if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) - return [ - 3, - 7 - ]; - value = _step1.value; - return [ - 4, - [ - name, - value - ] - ]; - case 5: - _state.sent(); - _state.label = 6; - case 6: - _iteratorNormalCompletion1 = true; - return [ - 3, - 4 - ]; - case 7: - return [ - 3, - 10 - ]; - case 8: - err = _state.sent(); - _didIteratorError1 = true; - _iteratorError1 = err; - return [ - 3, - 10 - ]; - case 9: - try { - if (!_iteratorNormalCompletion1 && _iterator1.return != null) { - _iterator1.return(); - } - } finally { - if (_didIteratorError1) { - throw _iteratorError1; - } - } - return [ - 7 - ]; - case 10: - return [ - 3, - 13 - ]; - case 11: - return [ - 4, - [ - name, - this.get(name) - ] - ]; - case 12: - _state.sent(); - _state.label = 13; - case 13: - _iteratorNormalCompletion = true; - return [ - 3, - 2 - ]; - case 14: - return [ - 3, - 17 - ]; - case 15: - err = _state.sent(); - _didIteratorError = true; - _iteratorError = err; - return [ - 3, - 17 - ]; - case 16: - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - return [ - 7 - ]; - case 17: - return [ - 2 - ]; - } - }); - } - }, - { - key: "has", - value: function has(name) { - if (!isValidHeaderName2(name)) { - throw new TypeError('Invalid header name "'.concat(name, '"')); - } - return this[NORMALIZED_HEADERS2].hasOwnProperty(normalizeHeaderName2(name)); - } - }, - { - key: "get", - value: function get(name) { - if (!isValidHeaderName2(name)) { - throw TypeError('Invalid header name "'.concat(name, '"')); - } - var _this_NORMALIZED_HEADERS_normalizeHeaderName; - return (_this_NORMALIZED_HEADERS_normalizeHeaderName = this[NORMALIZED_HEADERS2][normalizeHeaderName2(name)]) !== null && _this_NORMALIZED_HEADERS_normalizeHeaderName !== void 0 ? _this_NORMALIZED_HEADERS_normalizeHeaderName : null; - } - }, - { - key: "set", - value: function set2(name, value) { - if (!isValidHeaderName2(name) || !isValidHeaderValue2(value)) { - return; - } - var normalizedName = normalizeHeaderName2(name); - var normalizedValue = normalizeHeaderValue2(value); - this[NORMALIZED_HEADERS2][normalizedName] = normalizeHeaderValue2(normalizedValue); - this[RAW_HEADER_NAMES2].set(normalizedName, name); - } - }, - { - key: "append", - value: function append(name, value) { - if (!isValidHeaderName2(name) || !isValidHeaderValue2(value)) { - return; - } - var normalizedName = normalizeHeaderName2(name); - var normalizedValue = normalizeHeaderValue2(value); - var resolvedValue = this.has(normalizedName) ? "".concat(this.get(normalizedName), ", ").concat(normalizedValue) : normalizedValue; - this.set(name, resolvedValue); - } - }, - { - key: "delete", - value: function _delete(name) { - if (!isValidHeaderName2(name)) { - return; - } - if (!this.has(name)) { - return; - } - var normalizedName = normalizeHeaderName2(name); - delete this[NORMALIZED_HEADERS2][normalizedName]; - this[RAW_HEADER_NAMES2].delete(normalizedName); - } - }, - { - key: "all", - value: function all() { - return this[NORMALIZED_HEADERS2]; - } - }, - { - key: "raw", - value: function raw() { - var rawHeaders = {}; - var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - try { - for (var _iterator = this.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], value = _step_value[1]; - rawHeaders[this[RAW_HEADER_NAMES2].get(name)] = value; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - return rawHeaders; - } - }, - { - key: "forEach", - value: function forEach(callback, thisArg) { - var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; - try { - for (var _iterator = this.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], value = _step_value[1]; - callback.call(thisArg, value, name, this); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - }, - { - key: "getSetCookie", - value: function getSetCookie() { - var setCookieHeader = this.get("set-cookie"); - if (setCookieHeader === null) { - return []; - } - if (setCookieHeader === "") { - return [ - "" - ]; - } - return (0, import_set_cookie_parser2.splitCookiesString)(setCookieHeader); - } - } - ]); - return HeadersPolyfill1; - }(); - function headersToList(headers) { - var headersList = []; - headers.forEach(function(value, name) { - var resolvedValue = value.includes(",") ? value.split(",").map(function(value2) { - return value2.trim(); - }) : value; - headersList.push([ - name, - resolvedValue - ]); - }); - return headersList; - } - function headersToString(headers) { - var list = headersToList(headers); - var lines = list.map(function(param) { - var _param = _sliced_to_array(param, 2), name = _param[0], value = _param[1]; - var values = [].concat(value); - return "".concat(name, ": ").concat(values.join(", ")); - }); - return lines.join("\r\n"); - } - var singleValueHeaders2 = [ - "user-agent" - ]; - function headersToObject2(headers) { - var headersObject = {}; - headers.forEach(function(value, name) { - var isMultiValue = !singleValueHeaders2.includes(name.toLowerCase()) && value.includes(","); - headersObject[name] = isMultiValue ? value.split(",").map(function(s) { - return s.trim(); - }) : value; - }); - return headersObject; - } - function stringToHeaders2(str) { - var lines = str.trim().split(/[\r\n]+/); - return lines.reduce(function(headers, line) { - if (line.trim() === "") { - return headers; - } - var parts = line.split(": "); - var name = parts.shift(); - var value = parts.join(": "); - headers.append(name, value); - return headers; - }, new HeadersPolyfill2()); - } - function listToHeaders(list) { - var headers = new HeadersPolyfill2(); - list.forEach(function(param) { - var _param = _sliced_to_array(param, 2), name = _param[0], value = _param[1]; - var values = [].concat(value); - values.forEach(function(value2) { - headers.append(name, value2); - }); - }); - return headers; - } - function reduceHeadersObject2(headers, reducer, initialState) { - return Object.keys(headers).reduce(function(nextHeaders, name) { - return reducer(nextHeaders, name, headers[name]); - }, initialState); - } - function objectToHeaders2(headersObject) { - return reduceHeadersObject2(headersObject, function(headers, name, value) { - var values = [].concat(value).filter(Boolean); - values.forEach(function(value2) { - headers.append(name, value2); - }); - return headers; - }, new HeadersPolyfill2()); - } - function flattenHeadersList(list) { - return list.map(function(param) { - var _param = _sliced_to_array(param, 2), name = _param[0], values = _param[1]; - return [ - name, - [].concat(values).join(", ") - ]; - }); - } - function flattenHeadersObject2(headersObject) { - return reduceHeadersObject2(headersObject, function(headers, name, value) { - headers[name] = [].concat(value).join(", "); - return headers; - }, {}); - } - } - }); - - // node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.js - var require_lib4 = __commonJS({ - "node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.js"(exports, module) { - "use strict"; - var __defProp3 = Object.defineProperty; - var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames3 = Object.getOwnPropertyNames; - var __hasOwnProp3 = Object.prototype.hasOwnProperty; - var __export2 = (target, all) => { - for (var name in all) - __defProp3(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps3 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames3(from)) - if (!__hasOwnProp3.call(to, key) && key !== except) - __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod); - var src_exports2 = {}; - __export2(src_exports2, { - InvariantError: () => InvariantError2, - format: () => format2, - invariant: () => invariant3 - }); - module.exports = __toCommonJS2(src_exports2); - var POSITIONALS_EXP2 = /(%?)(%([sdjo]))/g; - function serializePositional2(positional, flag) { - switch (flag) { - case "s": - return positional; - case "d": - case "i": - return Number(positional); - case "j": - return JSON.stringify(positional); - case "o": { - if (typeof positional === "string") { - return positional; - } - const json2 = JSON.stringify(positional); - if (json2 === "{}" || json2 === "[]" || /^\[object .+?\]$/.test(json2)) { - return positional; - } - return json2; - } - } - } - function format2(message, ...positionals) { - if (positionals.length === 0) { - return message; - } - let positionalIndex = 0; - let formattedMessage = message.replace( - POSITIONALS_EXP2, - (match2, isEscaped, _, flag) => { - const positional = positionals[positionalIndex]; - const value = serializePositional2(positional, flag); - if (!isEscaped) { - positionalIndex++; - return value; - } - return match2; - } - ); - if (positionalIndex < positionals.length) { - formattedMessage += ` ${positionals.slice(positionalIndex).join(" ")}`; - } - formattedMessage = formattedMessage.replace(/%{2,2}/g, "%"); - return formattedMessage; - } - var STACK_FRAMES_TO_IGNORE2 = 2; - function cleanErrorStack2(error2) { - if (!error2.stack) { - return; - } - const nextStack = error2.stack.split("\n"); - nextStack.splice(1, STACK_FRAMES_TO_IGNORE2); - error2.stack = nextStack.join("\n"); - } - var InvariantError2 = class extends Error { - constructor(message, ...positionals) { - super(message); - this.message = message; - this.name = "Invariant Violation"; - this.message = format2(message, ...positionals); - cleanErrorStack2(this); - } - }; - var invariant3 = (predicate, message, ...positionals) => { - if (!predicate) { - throw new InvariantError2(message, ...positionals); - } - }; - invariant3.as = (ErrorConstructor, predicate, message, ...positionals) => { - if (!predicate) { - const isConstructor = ErrorConstructor.prototype.name != null; - const error2 = isConstructor ? new ErrorConstructor(format2(message, positionals)) : ErrorConstructor(format2(message, positionals)); - throw error2; - } - }; - } - }); - - // node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js - var require_shams = __commonJS({ - "node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js"(exports, module) { - "use strict"; - module.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; - } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; - } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; - } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; - } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } - } - return true; - }; - } - }); - - // node_modules/.pnpm/has-tostringtag@1.0.0/node_modules/has-tostringtag/shams.js - var require_shams2 = __commonJS({ - "node_modules/.pnpm/has-tostringtag@1.0.0/node_modules/has-tostringtag/shams.js"(exports, module) { - "use strict"; - var hasSymbols = require_shams(); - module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } - }); - - // node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js - var require_has_symbols = __commonJS({ - "node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; - } - return hasSymbolSham(); - }; - } - }); - - // node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js - var require_implementation = __commonJS({ - "node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var slice = Array.prototype.slice; - var toStr = Object.prototype.toString; - var funcType = "[object Function]"; - module.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - } - }; - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push("$" + i); - } - bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } - }); - - // node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js - var require_function_bind = __commonJS({ - "node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js"(exports, module) { - "use strict"; - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } - }); - - // node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js - var require_src = __commonJS({ - "node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js"(exports, module) { - "use strict"; - var bind = require_function_bind(); - module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - } - }); - - // node_modules/.pnpm/get-intrinsic@1.2.0/node_modules/get-intrinsic/index.js - var require_get_intrinsic = __commonJS({ - "node_modules/.pnpm/get-intrinsic@1.2.0/node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - var undefined2; - var $SyntaxError = SyntaxError; - var $Function = Function; - var $TypeError = TypeError; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = Object.getPrototypeOf || function(x) { - return x.__proto__; - }; - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array, - "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - try { - null.error; - } catch (e) { - errorProto = getProto(getProto(e)); - INTRINSICS["%Error.prototype%"] = errorProto; - } - var errorProto; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_src(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match2, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match2; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); - } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); - } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); - } - return void 0; - } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - return value; - }; - } - }); - - // node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/index.js - var require_call_bind = __commonJS({ - "node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/index.js"(exports, module) { - "use strict"; - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var $max = GetIntrinsic("%Math.max%"); - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = null; - } - } - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, "length"); - if (desc.configurable) { - $defineProperty( - func, - "length", - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module.exports, "apply", { value: applyBind }); - } else { - module.exports.apply = applyBind; - } - } - }); - - // node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/callBound.js - var require_callBound = __commonJS({ - "node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/callBound.js"(exports, module) { - "use strict"; - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } - }); - - // node_modules/.pnpm/is-arguments@1.1.1/node_modules/is-arguments/index.js - var require_is_arguments = __commonJS({ - "node_modules/.pnpm/is-arguments@1.1.1/node_modules/is-arguments/index.js"(exports, module) { - "use strict"; - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } - }); - - // node_modules/.pnpm/is-generator-function@1.0.10/node_modules/is-generator-function/index.js - var require_is_generator_function = __commonJS({ - "node_modules/.pnpm/is-generator-function@1.0.10/node_modules/is-generator-function/index.js"(exports, module) { - "use strict"; - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = require_shams2()(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) { - return false; - } - try { - return Function("return function*() {}")(); - } catch (e) { - } - }; - var GeneratorFunction; - module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== "function") { - return false; - } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; - } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === "[object GeneratorFunction]"; - } - if (!getProto) { - return false; - } - if (typeof GeneratorFunction === "undefined") { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; - } - return getProto(fn) === GeneratorFunction; - }; - } - }); - - // node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js - var require_is_callable = __commonJS({ - "node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js"(exports, module) { - "use strict"; - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; - } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; - } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; - } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var objectClass = "[object Object]"; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var ddaClass = "[object HTMLAllCollection]"; - var ddaClass2 = "[object HTML document.all class]"; - var ddaClass3 = "[object HTMLCollection]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var isIE68 = !(0 in [,]); - var isDDA = function isDocumentDotAll() { - return false; - }; - if (typeof document === "object") { - all = document.all; - if (toStr.call(all) === toStr.call(document.all)) { - isDDA = function isDocumentDotAll(value) { - if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) { - try { - var str = toStr.call(value); - return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null; - } catch (e) { - } - } - return false; - }; - } - } - var all; - module.exports = reflectApply ? function isCallable(value) { - if (isDDA(value)) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; - } - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } : function isCallable(value) { - if (isDDA(value)) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - if (hasToStringTag) { - return tryFunctionObject(value); - } - if (isES6ClassFn(value)) { - return false; - } - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) { - return false; - } - return tryFunctionObject(value); - }; - } - }); - - // node_modules/.pnpm/for-each@0.3.3/node_modules/for-each/index.js - var require_for_each = __commonJS({ - "node_modules/.pnpm/for-each@0.3.3/node_modules/for-each/index.js"(exports, module) { - "use strict"; - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach = function forEach2(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module.exports = forEach; - } - }); - - // node_modules/.pnpm/available-typed-arrays@1.0.5/node_modules/available-typed-arrays/index.js - var require_available_typed_arrays = __commonJS({ - "node_modules/.pnpm/available-typed-arrays@1.0.5/node_modules/available-typed-arrays/index.js"(exports, module) { - "use strict"; - var possibleNames = [ - "BigInt64Array", - "BigUint64Array", - "Float32Array", - "Float64Array", - "Int16Array", - "Int32Array", - "Int8Array", - "Uint16Array", - "Uint32Array", - "Uint8Array", - "Uint8ClampedArray" - ]; - var g = typeof globalThis === "undefined" ? global : globalThis; - module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } - }); - - // node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js - var require_gopd = __commonJS({ - "node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js"(exports, module) { - "use strict"; - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } - }); - - // node_modules/.pnpm/is-typed-array@1.1.10/node_modules/is-typed-array/index.js - var require_is_typed_array = __commonJS({ - "node_modules/.pnpm/is-typed-array@1.1.10/node_modules/is-typed-array/index.js"(exports, module) { - "use strict"; - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var gOPD = require_gopd(); - var g = typeof globalThis === "undefined" ? global : globalThis; - var typedArrays = availableTypedArrays(); - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function(getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - } - } - }); - return anyTrue; - }; - module.exports = function isTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { - return false; - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/.pnpm/which-typed-array@1.1.9/node_modules/which-typed-array/index.js - var require_which_typed_array = __commonJS({ - "node_modules/.pnpm/which-typed-array@1.1.9/node_modules/which-typed-array/index.js"(exports, module) { - "use strict"; - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var gOPD = require_gopd(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? global : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - if (typeof g[typedArray] === "function") { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function(getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) { - } - } - }); - return foundName; - }; - var isTypedArray = require_is_typed_array(); - module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js - var require_types = __commonJS({ - "node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js"(exports) { - "use strict"; - var isArgumentsObject = require_is_arguments(); - var isGeneratorFunction = require_is_generator_function(); - var whichTypedArray = require_which_typed_array(); - var isTypedArray = require_is_typed_array(); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = typeof BigInt !== "undefined"; - var SymbolSupported = typeof Symbol !== "undefined"; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) { - bigIntValue = uncurryThis(BigInt.prototype.valueOf); - } - var bigIntValue; - if (SymbolSupported) { - symbolValue = uncurryThis(Symbol.prototype.valueOf); - } - var symbolValue; - function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== "object") { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports.isArgumentsObject = isArgumentsObject; - exports.isGeneratorFunction = isGeneratorFunction; - exports.isTypedArray = isTypedArray; - function isPromise(input) { - return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; - } - exports.isPromise = isPromise; - function isArrayBufferView(value) { - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - return isTypedArray(value) || isDataView(value); - } - exports.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return whichTypedArray(value) === "Uint8Array"; - } - exports.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return whichTypedArray(value) === "Uint8ClampedArray"; - } - exports.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return whichTypedArray(value) === "Uint16Array"; - } - exports.isUint16Array = isUint16Array; - function isUint32Array(value) { - return whichTypedArray(value) === "Uint32Array"; - } - exports.isUint32Array = isUint32Array; - function isInt8Array(value) { - return whichTypedArray(value) === "Int8Array"; - } - exports.isInt8Array = isInt8Array; - function isInt16Array(value) { - return whichTypedArray(value) === "Int16Array"; - } - exports.isInt16Array = isInt16Array; - function isInt32Array(value) { - return whichTypedArray(value) === "Int32Array"; - } - exports.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return whichTypedArray(value) === "Float32Array"; - } - exports.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return whichTypedArray(value) === "Float64Array"; - } - exports.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return whichTypedArray(value) === "BigInt64Array"; - } - exports.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return whichTypedArray(value) === "BigUint64Array"; - } - exports.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return ObjectToString(value) === "[object Map]"; - } - isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); - function isMap(value) { - if (typeof Map === "undefined") { - return false; - } - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports.isMap = isMap; - function isSetToString(value) { - return ObjectToString(value) === "[object Set]"; - } - isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); - function isSet(value) { - if (typeof Set === "undefined") { - return false; - } - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports.isSet = isSet; - function isWeakMapToString(value) { - return ObjectToString(value) === "[object WeakMap]"; - } - isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); - function isWeakMap(value) { - if (typeof WeakMap === "undefined") { - return false; - } - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return ObjectToString(value) === "[object WeakSet]"; - } - isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return ObjectToString(value) === "[object ArrayBuffer]"; - } - isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if (typeof ArrayBuffer === "undefined") { - return false; - } - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return ObjectToString(value) === "[object DataView]"; - } - isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if (typeof DataView === "undefined") { - return false; - } - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports.isDataView = isDataView; - var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return ObjectToString(value) === "[object SharedArrayBuffer]"; - } - function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === "undefined") { - return false; - } - if (typeof isSharedArrayBufferToString.working === "undefined") { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - } - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return ObjectToString(value) === "[object AsyncFunction]"; - } - exports.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return ObjectToString(value) === "[object Map Iterator]"; - } - exports.isMapIterator = isMapIterator; - function isSetIterator(value) { - return ObjectToString(value) === "[object Set Iterator]"; - } - exports.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return ObjectToString(value) === "[object Generator]"; - } - exports.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === "[object WebAssembly.Module]"; - } - exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); - } - exports.isAnyArrayBuffer = isAnyArrayBuffer; - ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + " is not supported in userland"); - } - }); - }); - } - }); - - // node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js"(exports, module) { - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; - }; - } - }); - - // node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js - var require_inherits_browser = __commonJS({ - "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module) { - if (typeof Object.create === "function") { - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } - }; - } else { - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - var TempCtor = function() { - }; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - }; - } - } - }); - - // node_modules/.pnpm/util@0.12.5/node_modules/util/util.js - var require_util = __commonJS({ - "node_modules/.pnpm/util@0.12.5/node_modules/util/util.js"(exports) { - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect2(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject2(x)) { - str += " " + x; - } else { - str += " " + inspect2(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (typeof process !== "undefined" && process.noDeprecation === true) { - return fn; - } - if (typeof process === "undefined") { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); - debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); - } - var debugEnv; - exports.debuglog = function(set2) { - set2 = set2.toUpperCase(); - if (!debugs[set2]) { - if (debugEnvRegex.test(set2)) { - var pid = process.pid; - debugs[set2] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set2, pid, msg); - }; - } else { - debugs[set2] = function() { - }; - } - } - return debugs[set2]; - }; - function inspect2(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue2(ctx, obj, ctx.depth); - } - exports.inspect = inspect2; - inspect2.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] - }; - inspect2.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" - }; - function stylizeWithColor(str, styleType) { - var style = inspect2.styles[styleType]; - if (style) { - return "\x1B[" + inspect2.colors[style][0] + "m" + str + "\x1B[" + inspect2.colors[style][1] + "m"; - } else { - return str; - } - } - function stylizeNoColor(str, styleType) { - return str; - } - function arrayToHash(array) { - var hash = {}; - array.forEach(function(val, idx) { - hash[val] = true; - }); - return hash; - } - function formatValue2(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue2(ctx, ret, recurseTimes); - } - return ret; - } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); - } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } - } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; - } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; - } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); - } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); - } - if (isError(value)) { - base = " " + formatError(value); - } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } else { - return ctx.stylize("[Object]", "special"); - } - } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray2(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); - } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); - } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); - } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; - } - function formatArray2(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty( - ctx, - value, - recurseTimes, - visibleKeys, - String(i), - true - )); - } else { - output.push(""); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty( - ctx, - value, - recurseTimes, - visibleKeys, - key, - true - )); - } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); - } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = "[" + key + "]"; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue2(ctx, desc.value, null); - } else { - str = formatValue2(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").slice(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify("" + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); - name = ctx.stylize(name, "name"); - } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - exports.types = require_types(); - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject2(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - exports.types.isRegExp = isRegExp; - function isObject2(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject2; - function isDate(d) { - return isObject2(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - exports.types.isDate = isDate; - function isError(e) { - return isObject2(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - exports.types.isNativeError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); - }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject2(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; - }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; - exports.promisify = function promisify(original) { - if (typeof original !== "function") - throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== "function") { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; - } - function fn() { - var promiseResolve, promiseReject; - var promise = new Promise(function(resolve, reject) { - promiseResolve = resolve; - promiseReject = reject; - }); - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function(err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - return promise; - } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties( - fn, - getOwnPropertyDescriptors(original) - ); - }; - exports.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - if (!reason) { - var newReason = new Error("Promise was rejected with a falsy value"); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if (typeof original !== "function") { - throw new TypeError('The "original" argument must be of type Function'); - } - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - var maybeCb = args.pop(); - if (typeof maybeCb !== "function") { - throw new TypeError("The last argument must be of type Function"); - } - var self2 = this; - var cb = function() { - return maybeCb.apply(self2, arguments); - }; - original.apply(this, args).then( - function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, - function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - } - ); - } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties( - callbackified, - getOwnPropertyDescriptors(original) - ); - return callbackified; - } - exports.callbackify = callbackify; - } - }); - - // node_modules/.pnpm/web-encoding@1.1.5/node_modules/web-encoding/src/lib.js - var require_lib5 = __commonJS({ - "node_modules/.pnpm/web-encoding@1.1.5/node_modules/web-encoding/src/lib.js"(exports) { - "use strict"; - exports.TextEncoder = typeof TextEncoder !== "undefined" ? TextEncoder : require_util().TextEncoder; - exports.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : require_util().TextDecoder; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/bufferUtils.js - var require_bufferUtils = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/bufferUtils.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getArrayBuffer = exports.decodeBuffer = exports.encodeBuffer = void 0; - var web_encoding_1 = require_lib5(); - function encodeBuffer2(text2) { - var encoder = new web_encoding_1.TextEncoder(); - var encoded = encoder.encode(text2); - return getArrayBuffer(encoded); - } - exports.encodeBuffer = encodeBuffer2; - function decodeBuffer2(buffer, encoding) { - var decoder = new web_encoding_1.TextDecoder(encoding); - return decoder.decode(buffer); - } - exports.decodeBuffer = decodeBuffer2; - function getArrayBuffer(array) { - return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength); - } - exports.getArrayBuffer = getArrayBuffer; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/uuid.js - var require_uuid = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/uuid.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.uuidv4 = void 0; - function uuidv4() { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { - var r = Math.random() * 16 | 0; - var v = c == "x" ? r : r & 3 | 8; - return v.toString(16); - }); - } - exports.uuidv4 = uuidv4; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/IsomorphicRequest.js - var require_IsomorphicRequest = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/IsomorphicRequest.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __generator = exports && exports.__generator || function(thisArg, body2) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.IsomorphicRequest = void 0; - var headers_polyfill_1 = require_lib3(); - var outvariant_1 = require_lib4(); - var bufferUtils_1 = require_bufferUtils(); - var uuid_1 = require_uuid(); - var IsomorphicRequest2 = function() { - function IsomorphicRequest3(input, init) { - if (init === void 0) { - init = {}; - } - var defaultBody = new ArrayBuffer(0); - this._bodyUsed = false; - if (input instanceof IsomorphicRequest3) { - this.id = input.id; - this.url = input.url; - this.method = input.method; - this.headers = input.headers; - this.credentials = input.credentials; - this._body = input._body || defaultBody; - return; - } - this.id = uuid_1.uuidv4(); - this.url = input; - this.method = init.method || "GET"; - this.headers = new headers_polyfill_1.Headers(init.headers); - this.credentials = init.credentials || "same-origin"; - this._body = init.body || defaultBody; - } - Object.defineProperty(IsomorphicRequest3.prototype, "bodyUsed", { - get: function() { - return this._bodyUsed; - }, - enumerable: false, - configurable: true - }); - IsomorphicRequest3.prototype.text = function() { - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a2) { - outvariant_1.invariant(!this.bodyUsed, 'Failed to execute "text" on "IsomorphicRequest": body buffer already read'); - this._bodyUsed = true; - return [2, bufferUtils_1.decodeBuffer(this._body)]; - }); - }); - }; - IsomorphicRequest3.prototype.json = function() { - return __awaiter(this, void 0, void 0, function() { - var text2; - return __generator(this, function(_a2) { - outvariant_1.invariant(!this.bodyUsed, 'Failed to execute "json" on "IsomorphicRequest": body buffer already read'); - this._bodyUsed = true; - text2 = bufferUtils_1.decodeBuffer(this._body); - return [2, JSON.parse(text2)]; - }); - }); - }; - IsomorphicRequest3.prototype.arrayBuffer = function() { - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a2) { - outvariant_1.invariant(!this.bodyUsed, 'Failed to execute "arrayBuffer" on "IsomorphicRequest": body buffer already read'); - this._bodyUsed = true; - return [2, this._body]; - }); - }); - }; - IsomorphicRequest3.prototype.clone = function() { - return new IsomorphicRequest3(this); - }; - return IsomorphicRequest3; - }(); - exports.IsomorphicRequest = IsomorphicRequest2; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/createLazyCallback.js - var require_createLazyCallback = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/createLazyCallback.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __generator = exports && exports.__generator || function(thisArg, body2) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createLazyCallback = void 0; - function createLazyCallback(options) { - var _this = this; - if (options === void 0) { - options = {}; - } - var calledTimes = 0; - var autoResolveTimeout; - var remoteResolve; - var callPromise = new Promise(function(resolve) { - remoteResolve = resolve; - }).finally(function() { - clearTimeout(autoResolveTimeout); - }); - var fn = function() { - var _a2; - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (options.maxCalls && calledTimes >= options.maxCalls) { - (_a2 = options.maxCallsCallback) === null || _a2 === void 0 ? void 0 : _a2.call(options); - } - remoteResolve(args); - calledTimes++; - }; - fn.invoked = function() { - return __awaiter(_this, void 0, void 0, function() { - return __generator(this, function(_a2) { - autoResolveTimeout = setTimeout(function() { - remoteResolve([]); - }, 0); - return [2, callPromise]; - }); - }); - }; - return fn; - } - exports.createLazyCallback = createLazyCallback; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/InteractiveIsomorphicRequest.js - var require_InteractiveIsomorphicRequest = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/InteractiveIsomorphicRequest.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.InteractiveIsomorphicRequest = void 0; - var outvariant_1 = require_lib4(); - var IsomorphicRequest_1 = require_IsomorphicRequest(); - var createLazyCallback_1 = require_createLazyCallback(); - var InteractiveIsomorphicRequest = function(_super) { - __extends(InteractiveIsomorphicRequest2, _super); - function InteractiveIsomorphicRequest2(request) { - var _this = _super.call(this, request) || this; - _this.respondWith = createLazyCallback_1.createLazyCallback({ - maxCalls: 1, - maxCallsCallback: function() { - outvariant_1.invariant(false, 'Failed to respond to "%s %s" request: the "request" event has already been responded to.', _this.method, _this.url.href); - } - }); - return _this; - } - return InteractiveIsomorphicRequest2; - }(IsomorphicRequest_1.IsomorphicRequest); - exports.InteractiveIsomorphicRequest = InteractiveIsomorphicRequest; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/getCleanUrl.js - var require_getCleanUrl = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/getCleanUrl.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getCleanUrl = void 0; - function getCleanUrl2(url, isAbsolute) { - if (isAbsolute === void 0) { - isAbsolute = true; - } - return [isAbsolute && url.origin, url.pathname].filter(Boolean).join(""); - } - exports.getCleanUrl = getCleanUrl2; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/index.js - var require_lib6 = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.decodeBuffer = exports.encodeBuffer = exports.getCleanUrl = void 0; - __exportStar(require_glossary(), exports); - __exportStar(require_Interceptor(), exports); - __exportStar(require_BatchInterceptor(), exports); - __exportStar(require_IsomorphicRequest(), exports); - __exportStar(require_InteractiveIsomorphicRequest(), exports); - var getCleanUrl_1 = require_getCleanUrl(); - Object.defineProperty(exports, "getCleanUrl", { enumerable: true, get: function() { - return getCleanUrl_1.getCleanUrl; - } }); - var bufferUtils_1 = require_bufferUtils(); - Object.defineProperty(exports, "encodeBuffer", { enumerable: true, get: function() { - return bufferUtils_1.encodeBuffer; - } }); - Object.defineProperty(exports, "decodeBuffer", { enumerable: true, get: function() { - return bufferUtils_1.decodeBuffer; - } }); - } - }); - - // node_modules/.pnpm/set-cookie-parser@2.5.1/node_modules/set-cookie-parser/lib/set-cookie.js - var require_set_cookie2 = __commonJS({ - "node_modules/.pnpm/set-cookie-parser@2.5.1/node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) { - "use strict"; - var defaultParseOptions = { - decodeValues: true, - map: false, - silent: false - }; - function isNonEmptyString(str) { - return typeof str === "string" && !!str.trim(); - } - function parseString(setCookieValue, options) { - var parts = setCookieValue.split(";").filter(isNonEmptyString); - var nameValuePairStr = parts.shift(); - var parsed = parseNameValuePair(nameValuePairStr); - var name = parsed.name; - var value = parsed.value; - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - try { - value = options.decodeValues ? decodeURIComponent(value) : value; - } catch (e) { - console.error( - "set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.", - e - ); - } - var cookie2 = { - name, - value - }; - parts.forEach(function(part) { - var sides = part.split("="); - var key = sides.shift().trimLeft().toLowerCase(); - var value2 = sides.join("="); - if (key === "expires") { - cookie2.expires = new Date(value2); - } else if (key === "max-age") { - cookie2.maxAge = parseInt(value2, 10); - } else if (key === "secure") { - cookie2.secure = true; - } else if (key === "httponly") { - cookie2.httpOnly = true; - } else if (key === "samesite") { - cookie2.sameSite = value2; - } else { - cookie2[key] = value2; - } - }); - return cookie2; - } - function parseNameValuePair(nameValuePairStr) { - var name = ""; - var value = ""; - var nameValueArr = nameValuePairStr.split("="); - if (nameValueArr.length > 1) { - name = nameValueArr.shift(); - value = nameValueArr.join("="); - } else { - value = nameValuePairStr; - } - return { name, value }; - } - function parse5(input, options) { - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!input) { - if (!options.map) { - return []; - } else { - return {}; - } - } - if (input.headers && input.headers["set-cookie"]) { - input = input.headers["set-cookie"]; - } else if (input.headers) { - var sch = input.headers[Object.keys(input.headers).find(function(key) { - return key.toLowerCase() === "set-cookie"; - })]; - if (!sch && input.headers.cookie && !options.silent) { - console.warn( - "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning." - ); - } - input = sch; - } - if (!Array.isArray(input)) { - input = [input]; - } - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!options.map) { - return input.filter(isNonEmptyString).map(function(str) { - return parseString(str, options); - }); - } else { - var cookies = {}; - return input.filter(isNonEmptyString).reduce(function(cookies2, str) { - var cookie2 = parseString(str, options); - cookies2[cookie2.name] = cookie2; - return cookies2; - }, cookies); - } - } - function splitCookiesString(cookiesString) { - if (Array.isArray(cookiesString)) { - return cookiesString; - } - if (typeof cookiesString !== "string") { - return []; - } - var cookiesStrings = []; - var pos = 0; - var start; - var ch; - var lastComma; - var nextStart; - var cookiesSeparatorFound; - function skipWhitespace() { - while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { - pos += 1; - } - return pos < cookiesString.length; - } - function notSpecialChar() { - ch = cookiesString.charAt(pos); - return ch !== "=" && ch !== ";" && ch !== ","; - } - while (pos < cookiesString.length) { - start = pos; - cookiesSeparatorFound = false; - while (skipWhitespace()) { - ch = cookiesString.charAt(pos); - if (ch === ",") { - lastComma = pos; - pos += 1; - skipWhitespace(); - nextStart = pos; - while (pos < cookiesString.length && notSpecialChar()) { - pos += 1; - } - if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { - cookiesSeparatorFound = true; - pos = nextStart; - cookiesStrings.push(cookiesString.substring(start, lastComma)); - start = pos; - } else { - pos = lastComma + 1; - } - } else { - pos += 1; - } - } - if (!cookiesSeparatorFound || pos >= cookiesString.length) { - cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); - } - } - return cookiesStrings; - } - module.exports = parse5; - module.exports.parse = parse5; - module.exports.parseString = parseString; - module.exports.splitCookiesString = splitCookiesString; - } - }); - - // node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/store.js - var require_store = __commonJS({ - "node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/store.js"(exports) { - "use strict"; - var __rest = exports && exports.__rest || function(s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.store = exports.PERSISTENCY_KEY = void 0; - var set_cookie_parser_1 = require_set_cookie2(); - exports.PERSISTENCY_KEY = "MSW_COOKIE_STORE"; - function supportsLocalStorage() { - try { - if (localStorage == null) { - return false; - } - const testKey = exports.PERSISTENCY_KEY + "_test"; - localStorage.setItem(testKey, "test"); - localStorage.getItem(testKey); - localStorage.removeItem(testKey); - return true; - } catch (error2) { - return false; - } - } - var CookieStore = class { - constructor() { - this.store = /* @__PURE__ */ new Map(); - } - add(request, response2) { - if (request.credentials === "omit") { - return; - } - const requestUrl = new URL(request.url); - const responseCookies = response2.headers.get("set-cookie"); - if (!responseCookies) { - return; - } - const now = Date.now(); - const parsedResponseCookies = set_cookie_parser_1.parse(responseCookies).map((_a2) => { - var { maxAge } = _a2, cookie2 = __rest(_a2, ["maxAge"]); - return Object.assign(Object.assign({}, cookie2), { expires: maxAge === void 0 ? cookie2.expires : new Date(now + maxAge * 1e3), maxAge }); - }); - const prevCookies = this.store.get(requestUrl.origin) || /* @__PURE__ */ new Map(); - parsedResponseCookies.forEach((cookie2) => { - this.store.set(requestUrl.origin, prevCookies.set(cookie2.name, cookie2)); - }); - } - get(request) { - this.deleteExpiredCookies(); - const requestUrl = new URL(request.url); - const originCookies = this.store.get(requestUrl.origin) || /* @__PURE__ */ new Map(); - switch (request.credentials) { - case "include": { - if (typeof document === "undefined") { - return originCookies; - } - const documentCookies = set_cookie_parser_1.parse(document.cookie); - documentCookies.forEach((cookie2) => { - originCookies.set(cookie2.name, cookie2); - }); - return originCookies; - } - case "same-origin": { - return originCookies; - } - default: - return /* @__PURE__ */ new Map(); - } - } - getAll() { - this.deleteExpiredCookies(); - return this.store; - } - deleteAll(request) { - const requestUrl = new URL(request.url); - this.store.delete(requestUrl.origin); - } - clear() { - this.store.clear(); - } - hydrate() { - if (!supportsLocalStorage()) { - return; - } - const persistedCookies = localStorage.getItem(exports.PERSISTENCY_KEY); - if (!persistedCookies) { - return; - } - try { - const parsedCookies = JSON.parse(persistedCookies); - parsedCookies.forEach(([origin, cookies]) => { - this.store.set(origin, new Map(cookies.map((_a2) => { - var [token, _b2] = _a2, { expires } = _b2, cookie2 = __rest(_b2, ["expires"]); - return [ - token, - expires === void 0 ? cookie2 : Object.assign(Object.assign({}, cookie2), { expires: new Date(expires) }) - ]; - }))); - }); - } catch (error2) { - console.warn(` -[virtual-cookie] Failed to parse a stored cookie from the localStorage (key "${exports.PERSISTENCY_KEY}"). - -Stored value: -${localStorage.getItem(exports.PERSISTENCY_KEY)} - -Thrown exception: -${error2} - -Invalid value has been removed from localStorage to prevent subsequent failed parsing attempts.`); - localStorage.removeItem(exports.PERSISTENCY_KEY); - } - } - persist() { - if (!supportsLocalStorage()) { - return; - } - const serializedCookies = Array.from(this.store.entries()).map(([origin, cookies]) => { - return [origin, Array.from(cookies.entries())]; - }); - localStorage.setItem(exports.PERSISTENCY_KEY, JSON.stringify(serializedCookies)); - } - deleteExpiredCookies() { - const now = Date.now(); - this.store.forEach((originCookies, origin) => { - originCookies.forEach(({ expires, name }) => { - if (expires !== void 0 && expires.getTime() <= now) { - originCookies.delete(name); - } - }); - if (originCookies.size === 0) { - this.store.delete(origin); - } - }); - } - }; - exports.store = new CookieStore(); - } - }); - - // node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/index.js - var require_lib7 = __commonJS({ - "node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - __exportStar(require_store(), exports); - } - }); - - // node_modules/.pnpm/js-levenshtein@1.1.6/node_modules/js-levenshtein/index.js - var require_js_levenshtein = __commonJS({ - "node_modules/.pnpm/js-levenshtein@1.1.6/node_modules/js-levenshtein/index.js"(exports, module) { - "use strict"; - module.exports = function() { - function _min(d0, d1, d2, bx, ay) { - return d0 < d1 || d2 < d1 ? d0 > d2 ? d2 + 1 : d0 + 1 : bx === ay ? d1 : d1 + 1; - } - return function(a, b) { - if (a === b) { - return 0; - } - if (a.length > b.length) { - var tmp = a; - a = b; - b = tmp; - } - var la = a.length; - var lb = b.length; - while (la > 0 && a.charCodeAt(la - 1) === b.charCodeAt(lb - 1)) { - la--; - lb--; - } - var offset = 0; - while (offset < la && a.charCodeAt(offset) === b.charCodeAt(offset)) { - offset++; - } - la -= offset; - lb -= offset; - if (la === 0 || lb < 3) { - return lb; - } - var x = 0; - var y; - var d0; - var d1; - var d2; - var d3; - var dd; - var dy; - var ay; - var bx0; - var bx1; - var bx2; - var bx3; - var vector = []; - for (y = 0; y < la; y++) { - vector.push(y + 1); - vector.push(a.charCodeAt(offset + y)); - } - var len = vector.length - 1; - for (; x < lb - 3; ) { - bx0 = b.charCodeAt(offset + (d0 = x)); - bx1 = b.charCodeAt(offset + (d1 = x + 1)); - bx2 = b.charCodeAt(offset + (d2 = x + 2)); - bx3 = b.charCodeAt(offset + (d3 = x + 3)); - dd = x += 4; - for (y = 0; y < len; y += 2) { - dy = vector[y]; - ay = vector[y + 1]; - d0 = _min(dy, d0, d1, bx0, ay); - d1 = _min(d0, d1, d2, bx1, ay); - d2 = _min(d1, d2, d3, bx2, ay); - dd = _min(d2, d3, dd, bx3, ay); - vector[y] = dd; - d3 = d2; - d2 = d1; - d1 = d0; - d0 = dy; - } - } - for (; x < lb; ) { - bx0 = b.charCodeAt(offset + (d0 = x)); - dd = ++x; - for (y = 0; y < len; y += 2) { - dy = vector[y]; - vector[y] = dd = _min(dy, d0, dd, bx0, vector[y + 1]); - d0 = dy; - } - } - return dd; - }; - }(); - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/toIsoResponse.js - var require_toIsoResponse = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/toIsoResponse.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.toIsoResponse = void 0; - var headers_polyfill_1 = require_lib3(); - function toIsoResponse(response2) { - var _a2; - return { - status: (_a2 = response2.status) !== null && _a2 !== void 0 ? _a2 : 200, - statusText: response2.statusText || "OK", - headers: headers_polyfill_1.objectToHeaders(response2.headers || {}), - body: response2.body - }; - } - exports.toIsoResponse = toIsoResponse; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js - var require_fetch = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - var __assign = exports && exports.__assign || function() { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __generator = exports && exports.__generator || function(thisArg, body2) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - var __read = exports && exports.__read || function(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) - return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) - ar.push(r.value); - } catch (error2) { - e = { error: error2 }; - } finally { - try { - if (r && !r.done && (m = i["return"])) - m.call(i); - } finally { - if (e) - throw e.error; - } - } - return ar; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.FetchInterceptor = void 0; - var headers_polyfill_1 = require_lib3(); - var outvariant_1 = require_lib4(); - var until_1 = require_lib(); - var IsomorphicRequest_1 = require_IsomorphicRequest(); - var glossary_1 = require_glossary(); - var Interceptor_1 = require_Interceptor(); - var toIsoResponse_1 = require_toIsoResponse(); - var InteractiveIsomorphicRequest_1 = require_InteractiveIsomorphicRequest(); - var FetchInterceptor2 = function(_super) { - __extends(FetchInterceptor3, _super); - function FetchInterceptor3() { - return _super.call(this, FetchInterceptor3.symbol) || this; - } - FetchInterceptor3.prototype.checkEnvironment = function() { - return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined"; - }; - FetchInterceptor3.prototype.setup = function() { - var _this = this; - var pureFetch = globalThis.fetch; - outvariant_1.invariant(!pureFetch[glossary_1.IS_PATCHED_MODULE], 'Failed to patch the "fetch" module: already patched.'); - globalThis.fetch = function(input, init) { - return __awaiter(_this, void 0, void 0, function() { - var request, url, method, body2, requestUrl, isomorphicRequest, interactiveIsomorphicRequest, _a2, middlewareException, mockedResponse, error2, isomorphicResponse, response2; - var _this2 = this; - return __generator(this, function(_b2) { - switch (_b2.label) { - case 0: - request = new Request(input, init); - url = typeof input === "string" ? input : input.url; - method = request.method; - this.log("[%s] %s", method, url); - return [4, request.clone().arrayBuffer()]; - case 1: - body2 = _b2.sent(); - requestUrl = new URL(url, typeof location !== "undefined" ? location.origin : void 0); - isomorphicRequest = new IsomorphicRequest_1.IsomorphicRequest(requestUrl, { - body: body2, - method, - headers: new headers_polyfill_1.Headers(request.headers), - credentials: request.credentials - }); - interactiveIsomorphicRequest = new InteractiveIsomorphicRequest_1.InteractiveIsomorphicRequest(isomorphicRequest); - this.log("isomorphic request", interactiveIsomorphicRequest); - this.log('emitting the "request" event for %d listener(s)...', this.emitter.listenerCount("request")); - this.emitter.emit("request", interactiveIsomorphicRequest); - this.log("awaiting for the mocked response..."); - return [4, until_1.until(function() { - return __awaiter(_this2, void 0, void 0, function() { - var _a3, mockedResponse2; - return __generator(this, function(_b3) { - switch (_b3.label) { - case 0: - return [4, this.emitter.untilIdle("request", function(_a4) { - var _b4 = __read(_a4.args, 1), request2 = _b4[0]; - return request2.id === interactiveIsomorphicRequest.id; - })]; - case 1: - _b3.sent(); - this.log("all request listeners have been resolved!"); - return [4, interactiveIsomorphicRequest.respondWith.invoked()]; - case 2: - _a3 = __read.apply(void 0, [_b3.sent(), 1]), mockedResponse2 = _a3[0]; - this.log("event.respondWith called with:", mockedResponse2); - return [2, mockedResponse2]; - } - }); - }); - })]; - case 2: - _a2 = __read.apply(void 0, [_b2.sent(), 2]), middlewareException = _a2[0], mockedResponse = _a2[1]; - if (middlewareException) { - console.error(request.method + " " + request.url + " net::ERR_FAILED"); - error2 = Object.assign(new TypeError("Failed to fetch"), { - cause: middlewareException - }); - return [2, Promise.reject(error2)]; - } - if (mockedResponse) { - this.log("received mocked response:", mockedResponse); - isomorphicResponse = toIsoResponse_1.toIsoResponse(mockedResponse); - this.log("derived isomorphic response:", isomorphicResponse); - this.emitter.emit("response", interactiveIsomorphicRequest, isomorphicResponse); - response2 = new Response(mockedResponse.body, __assign(__assign({}, isomorphicResponse), { - headers: headers_polyfill_1.flattenHeadersObject(mockedResponse.headers || {}) - })); - Object.defineProperty(response2, "url", { - writable: false, - enumerable: true, - configurable: false, - value: interactiveIsomorphicRequest.url.href - }); - return [2, response2]; - } - this.log("no mocked response received!"); - return [2, pureFetch(request).then(function(response3) { - return __awaiter(_this2, void 0, void 0, function() { - var cloneResponse, _a3, _b3, _c; - return __generator(this, function(_d) { - switch (_d.label) { - case 0: - cloneResponse = response3.clone(); - this.log("original fetch performed", cloneResponse); - _b3 = (_a3 = this.emitter).emit; - _c = [ - "response", - interactiveIsomorphicRequest - ]; - return [4, normalizeFetchResponse(cloneResponse)]; - case 1: - _b3.apply(_a3, _c.concat([_d.sent()])); - return [2, response3]; - } - }); - }); - })]; - } - }); - }); - }; - Object.defineProperty(globalThis.fetch, glossary_1.IS_PATCHED_MODULE, { - enumerable: true, - configurable: true, - value: true - }); - this.subscriptions.push(function() { - Object.defineProperty(globalThis.fetch, glossary_1.IS_PATCHED_MODULE, { - value: void 0 - }); - globalThis.fetch = pureFetch; - _this.log('restored native "globalThis.fetch"!', globalThis.fetch.name); - }); - }; - FetchInterceptor3.symbol = Symbol("fetch"); - return FetchInterceptor3; - }(Interceptor_1.Interceptor); - exports.FetchInterceptor = FetchInterceptor2; - function normalizeFetchResponse(response2) { - return __awaiter(this, void 0, void 0, function() { - var _a2; - return __generator(this, function(_b2) { - switch (_b2.label) { - case 0: - _a2 = { - status: response2.status, - statusText: response2.statusText, - headers: headers_polyfill_1.objectToHeaders(headers_polyfill_1.headersToObject(response2.headers)) - }; - return [4, response2.text()]; - case 1: - return [2, (_a2.body = _b2.sent(), _a2)]; - } - }); - }); - } - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/conventions.js - var require_conventions = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/conventions.js"(exports) { - "use strict"; - function find(list, predicate, ac) { - if (ac === void 0) { - ac = Array.prototype; - } - if (list && typeof ac.find === "function") { - return ac.find.call(list, predicate); - } - for (var i = 0; i < list.length; i++) { - if (Object.prototype.hasOwnProperty.call(list, i)) { - var item = list[i]; - if (predicate.call(void 0, item, i, list)) { - return item; - } - } - } - } - function freeze(object, oc) { - if (oc === void 0) { - oc = Object; - } - return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object; - } - function assign(target, source) { - if (target === null || typeof target !== "object") { - throw new TypeError("target is not an object"); - } - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - return target; - } - var MIME_TYPE = freeze({ - HTML: "text/html", - isHTML: function(value) { - return value === MIME_TYPE.HTML; - }, - XML_APPLICATION: "application/xml", - XML_TEXT: "text/xml", - XML_XHTML_APPLICATION: "application/xhtml+xml", - XML_SVG_IMAGE: "image/svg+xml" - }); - var NAMESPACE = freeze({ - HTML: "http://www.w3.org/1999/xhtml", - isHTML: function(uri) { - return uri === NAMESPACE.HTML; - }, - SVG: "http://www.w3.org/2000/svg", - XML: "http://www.w3.org/XML/1998/namespace", - XMLNS: "http://www.w3.org/2000/xmlns/" - }); - exports.assign = assign; - exports.find = find; - exports.freeze = freeze; - exports.MIME_TYPE = MIME_TYPE; - exports.NAMESPACE = NAMESPACE; - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom.js - var require_dom = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom.js"(exports) { - var conventions = require_conventions(); - var find = conventions.find; - var NAMESPACE = conventions.NAMESPACE; - function notEmptyString(input) { - return input !== ""; - } - function splitOnASCIIWhitespace(input) { - return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []; - } - function orderedSetReducer(current, element) { - if (!current.hasOwnProperty(element)) { - current[element] = true; - } - return current; - } - function toOrderedSet(input) { - if (!input) - return []; - var list = splitOnASCIIWhitespace(input); - return Object.keys(list.reduce(orderedSetReducer, {})); - } - function arrayIncludes(list) { - return function(element) { - return list && list.indexOf(element) !== -1; - }; - } - function copy(src, dest) { - for (var p in src) { - if (Object.prototype.hasOwnProperty.call(src, p)) { - dest[p] = src[p]; - } - } - } - function _extends(Class, Super) { - var pt = Class.prototype; - if (!(pt instanceof Super)) { - let t2 = function() { - }; - var t = t2; - ; - t2.prototype = Super.prototype; - t2 = new t2(); - copy(pt, t2); - Class.prototype = pt = t2; - } - if (pt.constructor != Class) { - if (typeof Class != "function") { - console.error("unknown Class:" + Class); - } - pt.constructor = Class; - } - } - var NodeType = {}; - var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; - var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; - var TEXT_NODE = NodeType.TEXT_NODE = 3; - var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; - var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; - var ENTITY_NODE = NodeType.ENTITY_NODE = 6; - var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; - var COMMENT_NODE = NodeType.COMMENT_NODE = 8; - var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; - var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; - var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; - var NOTATION_NODE = NodeType.NOTATION_NODE = 12; - var ExceptionCode = {}; - var ExceptionMessage = {}; - var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1); - var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2); - var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3); - var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4); - var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5); - var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6); - var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7); - var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8); - var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9); - var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10); - var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11); - var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12); - var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13); - var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14); - var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15); - function DOMException(code, message) { - if (message instanceof Error) { - var error2 = message; - } else { - error2 = this; - Error.call(this, ExceptionMessage[code]); - this.message = ExceptionMessage[code]; - if (Error.captureStackTrace) - Error.captureStackTrace(this, DOMException); - } - error2.code = code; - if (message) - this.message = this.message + ": " + message; - return error2; - } - DOMException.prototype = Error.prototype; - copy(ExceptionCode, DOMException); - function NodeList() { - } - NodeList.prototype = { - length: 0, - item: function(index) { - return this[index] || null; - }, - toString: function(isHTML, nodeFilter) { - for (var buf = [], i = 0; i < this.length; i++) { - serializeToString(this[i], buf, isHTML, nodeFilter); - } - return buf.join(""); - }, - filter: function(predicate) { - return Array.prototype.filter.call(this, predicate); - }, - indexOf: function(item) { - return Array.prototype.indexOf.call(this, item); - } - }; - function LiveNodeList(node, refresh) { - this._node = node; - this._refresh = refresh; - _updateLiveList(this); - } - function _updateLiveList(list) { - var inc = list._node._inc || list._node.ownerDocument._inc; - if (list._inc != inc) { - var ls = list._refresh(list._node); - __set__(list, "length", ls.length); - copy(ls, list); - list._inc = inc; - } - } - LiveNodeList.prototype.item = function(i) { - _updateLiveList(this); - return this[i]; - }; - _extends(LiveNodeList, NodeList); - function NamedNodeMap() { - } - function _findNodeIndex(list, node) { - var i = list.length; - while (i--) { - if (list[i] === node) { - return i; - } - } - } - function _addNamedNode(el, list, newAttr, oldAttr) { - if (oldAttr) { - list[_findNodeIndex(list, oldAttr)] = newAttr; - } else { - list[list.length++] = newAttr; - } - if (el) { - newAttr.ownerElement = el; - var doc = el.ownerDocument; - if (doc) { - oldAttr && _onRemoveAttribute(doc, el, oldAttr); - _onAddAttribute(doc, el, newAttr); - } - } - } - function _removeNamedNode(el, list, attr) { - var i = _findNodeIndex(list, attr); - if (i >= 0) { - var lastIndex = list.length - 1; - while (i < lastIndex) { - list[i] = list[++i]; - } - list.length = lastIndex; - if (el) { - var doc = el.ownerDocument; - if (doc) { - _onRemoveAttribute(doc, el, attr); - attr.ownerElement = null; - } - } - } else { - throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr)); - } - } - NamedNodeMap.prototype = { - length: 0, - item: NodeList.prototype.item, - getNamedItem: function(key) { - var i = this.length; - while (i--) { - var attr = this[i]; - if (attr.nodeName == key) { - return attr; - } - } - }, - setNamedItem: function(attr) { - var el = attr.ownerElement; - if (el && el != this._ownerElement) { - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - var oldAttr = this.getNamedItem(attr.nodeName); - _addNamedNode(this._ownerElement, this, attr, oldAttr); - return oldAttr; - }, - setNamedItemNS: function(attr) { - var el = attr.ownerElement, oldAttr; - if (el && el != this._ownerElement) { - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName); - _addNamedNode(this._ownerElement, this, attr, oldAttr); - return oldAttr; - }, - removeNamedItem: function(key) { - var attr = this.getNamedItem(key); - _removeNamedNode(this._ownerElement, this, attr); - return attr; - }, - removeNamedItemNS: function(namespaceURI, localName) { - var attr = this.getNamedItemNS(namespaceURI, localName); - _removeNamedNode(this._ownerElement, this, attr); - return attr; - }, - getNamedItemNS: function(namespaceURI, localName) { - var i = this.length; - while (i--) { - var node = this[i]; - if (node.localName == localName && node.namespaceURI == namespaceURI) { - return node; - } - } - return null; - } - }; - function DOMImplementation() { - } - DOMImplementation.prototype = { - hasFeature: function(feature, version) { - return true; - }, - createDocument: function(namespaceURI, qualifiedName, doctype) { - var doc = new Document(); - doc.implementation = this; - doc.childNodes = new NodeList(); - doc.doctype = doctype || null; - if (doctype) { - doc.appendChild(doctype); - } - if (qualifiedName) { - var root = doc.createElementNS(namespaceURI, qualifiedName); - doc.appendChild(root); - } - return doc; - }, - createDocumentType: function(qualifiedName, publicId, systemId) { - var node = new DocumentType(); - node.name = qualifiedName; - node.nodeName = qualifiedName; - node.publicId = publicId || ""; - node.systemId = systemId || ""; - return node; - } - }; - function Node() { - } - Node.prototype = { - firstChild: null, - lastChild: null, - previousSibling: null, - nextSibling: null, - attributes: null, - parentNode: null, - childNodes: null, - ownerDocument: null, - nodeValue: null, - namespaceURI: null, - prefix: null, - localName: null, - insertBefore: function(newChild, refChild) { - return _insertBefore(this, newChild, refChild); - }, - replaceChild: function(newChild, oldChild) { - _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument); - if (oldChild) { - this.removeChild(oldChild); - } - }, - removeChild: function(oldChild) { - return _removeChild(this, oldChild); - }, - appendChild: function(newChild) { - return this.insertBefore(newChild, null); - }, - hasChildNodes: function() { - return this.firstChild != null; - }, - cloneNode: function(deep) { - return cloneNode(this.ownerDocument || this, this, deep); - }, - normalize: function() { - var child = this.firstChild; - while (child) { - var next = child.nextSibling; - if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) { - this.removeChild(next); - child.appendData(next.data); - } else { - child.normalize(); - child = next; - } - } - }, - isSupported: function(feature, version) { - return this.ownerDocument.implementation.hasFeature(feature, version); - }, - hasAttributes: function() { - return this.attributes.length > 0; - }, - lookupPrefix: function(namespaceURI) { - var el = this; - while (el) { - var map = el._nsMap; - if (map) { - for (var n in map) { - if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) { - return n; - } - } - } - el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; - } - return null; - }, - lookupNamespaceURI: function(prefix) { - var el = this; - while (el) { - var map = el._nsMap; - if (map) { - if (Object.prototype.hasOwnProperty.call(map, prefix)) { - return map[prefix]; - } - } - el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; - } - return null; - }, - isDefaultNamespace: function(namespaceURI) { - var prefix = this.lookupPrefix(namespaceURI); - return prefix == null; - } - }; - function _xmlEncoder(c) { - return c == "<" && "<" || c == ">" && ">" || c == "&" && "&" || c == '"' && """ || "&#" + c.charCodeAt() + ";"; - } - copy(NodeType, Node); - copy(NodeType, Node.prototype); - function _visitNode(node, callback) { - if (callback(node)) { - return true; - } - if (node = node.firstChild) { - do { - if (_visitNode(node, callback)) { - return true; - } - } while (node = node.nextSibling); - } - } - function Document() { - this.ownerDocument = this; - } - function _onAddAttribute(doc, el, newAttr) { - doc && doc._inc++; - var ns = newAttr.namespaceURI; - if (ns === NAMESPACE.XMLNS) { - el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value; - } - } - function _onRemoveAttribute(doc, el, newAttr, remove) { - doc && doc._inc++; - var ns = newAttr.namespaceURI; - if (ns === NAMESPACE.XMLNS) { - delete el._nsMap[newAttr.prefix ? newAttr.localName : ""]; - } - } - function _onUpdateChild(doc, el, newChild) { - if (doc && doc._inc) { - doc._inc++; - var cs = el.childNodes; - if (newChild) { - cs[cs.length++] = newChild; - } else { - var child = el.firstChild; - var i = 0; - while (child) { - cs[i++] = child; - child = child.nextSibling; - } - cs.length = i; - delete cs[cs.length]; - } - } - } - function _removeChild(parentNode, child) { - var previous = child.previousSibling; - var next = child.nextSibling; - if (previous) { - previous.nextSibling = next; - } else { - parentNode.firstChild = next; - } - if (next) { - next.previousSibling = previous; - } else { - parentNode.lastChild = previous; - } - child.parentNode = null; - child.previousSibling = null; - child.nextSibling = null; - _onUpdateChild(parentNode.ownerDocument, parentNode); - return child; - } - function hasValidParentNodeType(node) { - return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE); - } - function hasInsertableNodeType(node) { - return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE); - } - function isDocTypeNode(node) { - return node && node.nodeType === Node.DOCUMENT_TYPE_NODE; - } - function isElementNode(node) { - return node && node.nodeType === Node.ELEMENT_NODE; - } - function isTextNode(node) { - return node && node.nodeType === Node.TEXT_NODE; - } - function isElementInsertionPossible(doc, child) { - var parentChildNodes = doc.childNodes || []; - if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) { - return false; - } - var docTypeNode = find(parentChildNodes, isDocTypeNode); - return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); - } - function isElementReplacementPossible(doc, child) { - var parentChildNodes = doc.childNodes || []; - function hasElementChildThatIsNotChild(node) { - return isElementNode(node) && node !== child; - } - if (find(parentChildNodes, hasElementChildThatIsNotChild)) { - return false; - } - var docTypeNode = find(parentChildNodes, isDocTypeNode); - return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); - } - function assertPreInsertionValidity1to5(parent, node, child) { - if (!hasValidParentNodeType(parent)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType); - } - if (child && child.parentNode !== parent) { - throw new DOMException(NOT_FOUND_ERR, "child not in parent"); - } - if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) { - throw new DOMException( - HIERARCHY_REQUEST_ERR, - "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType - ); - } - } - function assertPreInsertionValidityInDocument(parent, node, child) { - var parentChildNodes = parent.childNodes || []; - var nodeChildNodes = node.childNodes || []; - if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { - var nodeChildElements = nodeChildNodes.filter(isElementNode); - if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); - } - if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); - } - } - if (isElementNode(node)) { - if (!isElementInsertionPossible(parent, child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); - } - } - if (isDocTypeNode(node)) { - if (find(parentChildNodes, isDocTypeNode)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); - } - var parentElementChild = find(parentChildNodes, isElementNode); - if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); - } - if (!child && parentElementChild) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present"); - } - } - } - function assertPreReplacementValidityInDocument(parent, node, child) { - var parentChildNodes = parent.childNodes || []; - var nodeChildNodes = node.childNodes || []; - if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { - var nodeChildElements = nodeChildNodes.filter(isElementNode); - if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); - } - if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); - } - } - if (isElementNode(node)) { - if (!isElementReplacementPossible(parent, child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); - } - } - if (isDocTypeNode(node)) { - let hasDoctypeChildThatIsNotChild2 = function(node2) { - return isDocTypeNode(node2) && node2 !== child; - }; - var hasDoctypeChildThatIsNotChild = hasDoctypeChildThatIsNotChild2; - if (find(parentChildNodes, hasDoctypeChildThatIsNotChild2)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); - } - var parentElementChild = find(parentChildNodes, isElementNode); - if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) { - throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); - } - } - } - function _insertBefore(parent, node, child, _inDocumentAssertion) { - assertPreInsertionValidity1to5(parent, node, child); - if (parent.nodeType === Node.DOCUMENT_NODE) { - (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child); - } - var cp = node.parentNode; - if (cp) { - cp.removeChild(node); - } - if (node.nodeType === DOCUMENT_FRAGMENT_NODE) { - var newFirst = node.firstChild; - if (newFirst == null) { - return node; - } - var newLast = node.lastChild; - } else { - newFirst = newLast = node; - } - var pre = child ? child.previousSibling : parent.lastChild; - newFirst.previousSibling = pre; - newLast.nextSibling = child; - if (pre) { - pre.nextSibling = newFirst; - } else { - parent.firstChild = newFirst; - } - if (child == null) { - parent.lastChild = newLast; - } else { - child.previousSibling = newLast; - } - do { - newFirst.parentNode = parent; - } while (newFirst !== newLast && (newFirst = newFirst.nextSibling)); - _onUpdateChild(parent.ownerDocument || parent, parent); - if (node.nodeType == DOCUMENT_FRAGMENT_NODE) { - node.firstChild = node.lastChild = null; - } - return node; - } - function _appendSingleChild(parentNode, newChild) { - if (newChild.parentNode) { - newChild.parentNode.removeChild(newChild); - } - newChild.parentNode = parentNode; - newChild.previousSibling = parentNode.lastChild; - newChild.nextSibling = null; - if (newChild.previousSibling) { - newChild.previousSibling.nextSibling = newChild; - } else { - parentNode.firstChild = newChild; - } - parentNode.lastChild = newChild; - _onUpdateChild(parentNode.ownerDocument, parentNode, newChild); - return newChild; - } - Document.prototype = { - nodeName: "#document", - nodeType: DOCUMENT_NODE, - doctype: null, - documentElement: null, - _inc: 1, - insertBefore: function(newChild, refChild) { - if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { - var child = newChild.firstChild; - while (child) { - var next = child.nextSibling; - this.insertBefore(child, refChild); - child = next; - } - return newChild; - } - _insertBefore(this, newChild, refChild); - newChild.ownerDocument = this; - if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) { - this.documentElement = newChild; - } - return newChild; - }, - removeChild: function(oldChild) { - if (this.documentElement == oldChild) { - this.documentElement = null; - } - return _removeChild(this, oldChild); - }, - replaceChild: function(newChild, oldChild) { - _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument); - newChild.ownerDocument = this; - if (oldChild) { - this.removeChild(oldChild); - } - if (isElementNode(newChild)) { - this.documentElement = newChild; - } - }, - importNode: function(importedNode, deep) { - return importNode(this, importedNode, deep); - }, - getElementById: function(id) { - var rtv = null; - _visitNode(this.documentElement, function(node) { - if (node.nodeType == ELEMENT_NODE) { - if (node.getAttribute("id") == id) { - rtv = node; - return true; - } - } - }); - return rtv; - }, - getElementsByClassName: function(classNames) { - var classNamesSet = toOrderedSet(classNames); - return new LiveNodeList(this, function(base) { - var ls = []; - if (classNamesSet.length > 0) { - _visitNode(base.documentElement, function(node) { - if (node !== base && node.nodeType === ELEMENT_NODE) { - var nodeClassNames = node.getAttribute("class"); - if (nodeClassNames) { - var matches = classNames === nodeClassNames; - if (!matches) { - var nodeClassNamesSet = toOrderedSet(nodeClassNames); - matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet)); - } - if (matches) { - ls.push(node); - } - } - } - }); - } - return ls; - }); - }, - createElement: function(tagName) { - var node = new Element(); - node.ownerDocument = this; - node.nodeName = tagName; - node.tagName = tagName; - node.localName = tagName; - node.childNodes = new NodeList(); - var attrs = node.attributes = new NamedNodeMap(); - attrs._ownerElement = node; - return node; - }, - createDocumentFragment: function() { - var node = new DocumentFragment(); - node.ownerDocument = this; - node.childNodes = new NodeList(); - return node; - }, - createTextNode: function(data2) { - var node = new Text(); - node.ownerDocument = this; - node.appendData(data2); - return node; - }, - createComment: function(data2) { - var node = new Comment(); - node.ownerDocument = this; - node.appendData(data2); - return node; - }, - createCDATASection: function(data2) { - var node = new CDATASection(); - node.ownerDocument = this; - node.appendData(data2); - return node; - }, - createProcessingInstruction: function(target, data2) { - var node = new ProcessingInstruction(); - node.ownerDocument = this; - node.tagName = node.target = target; - node.nodeValue = node.data = data2; - return node; - }, - createAttribute: function(name) { - var node = new Attr(); - node.ownerDocument = this; - node.name = name; - node.nodeName = name; - node.localName = name; - node.specified = true; - return node; - }, - createEntityReference: function(name) { - var node = new EntityReference(); - node.ownerDocument = this; - node.nodeName = name; - return node; - }, - createElementNS: function(namespaceURI, qualifiedName) { - var node = new Element(); - var pl = qualifiedName.split(":"); - var attrs = node.attributes = new NamedNodeMap(); - node.childNodes = new NodeList(); - node.ownerDocument = this; - node.nodeName = qualifiedName; - node.tagName = qualifiedName; - node.namespaceURI = namespaceURI; - if (pl.length == 2) { - node.prefix = pl[0]; - node.localName = pl[1]; - } else { - node.localName = qualifiedName; - } - attrs._ownerElement = node; - return node; - }, - createAttributeNS: function(namespaceURI, qualifiedName) { - var node = new Attr(); - var pl = qualifiedName.split(":"); - node.ownerDocument = this; - node.nodeName = qualifiedName; - node.name = qualifiedName; - node.namespaceURI = namespaceURI; - node.specified = true; - if (pl.length == 2) { - node.prefix = pl[0]; - node.localName = pl[1]; - } else { - node.localName = qualifiedName; - } - return node; - } - }; - _extends(Document, Node); - function Element() { - this._nsMap = {}; - } - Element.prototype = { - nodeType: ELEMENT_NODE, - hasAttribute: function(name) { - return this.getAttributeNode(name) != null; - }, - getAttribute: function(name) { - var attr = this.getAttributeNode(name); - return attr && attr.value || ""; - }, - getAttributeNode: function(name) { - return this.attributes.getNamedItem(name); - }, - setAttribute: function(name, value) { - var attr = this.ownerDocument.createAttribute(name); - attr.value = attr.nodeValue = "" + value; - this.setAttributeNode(attr); - }, - removeAttribute: function(name) { - var attr = this.getAttributeNode(name); - attr && this.removeAttributeNode(attr); - }, - appendChild: function(newChild) { - if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { - return this.insertBefore(newChild, null); - } else { - return _appendSingleChild(this, newChild); - } - }, - setAttributeNode: function(newAttr) { - return this.attributes.setNamedItem(newAttr); - }, - setAttributeNodeNS: function(newAttr) { - return this.attributes.setNamedItemNS(newAttr); - }, - removeAttributeNode: function(oldAttr) { - return this.attributes.removeNamedItem(oldAttr.nodeName); - }, - removeAttributeNS: function(namespaceURI, localName) { - var old = this.getAttributeNodeNS(namespaceURI, localName); - old && this.removeAttributeNode(old); - }, - hasAttributeNS: function(namespaceURI, localName) { - return this.getAttributeNodeNS(namespaceURI, localName) != null; - }, - getAttributeNS: function(namespaceURI, localName) { - var attr = this.getAttributeNodeNS(namespaceURI, localName); - return attr && attr.value || ""; - }, - setAttributeNS: function(namespaceURI, qualifiedName, value) { - var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); - attr.value = attr.nodeValue = "" + value; - this.setAttributeNode(attr); - }, - getAttributeNodeNS: function(namespaceURI, localName) { - return this.attributes.getNamedItemNS(namespaceURI, localName); - }, - getElementsByTagName: function(tagName) { - return new LiveNodeList(this, function(base) { - var ls = []; - _visitNode(base, function(node) { - if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) { - ls.push(node); - } - }); - return ls; - }); - }, - getElementsByTagNameNS: function(namespaceURI, localName) { - return new LiveNodeList(this, function(base) { - var ls = []; - _visitNode(base, function(node) { - if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) { - ls.push(node); - } - }); - return ls; - }); - } - }; - Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; - Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; - _extends(Element, Node); - function Attr() { - } - Attr.prototype.nodeType = ATTRIBUTE_NODE; - _extends(Attr, Node); - function CharacterData() { - } - CharacterData.prototype = { - data: "", - substringData: function(offset, count) { - return this.data.substring(offset, offset + count); - }, - appendData: function(text2) { - text2 = this.data + text2; - this.nodeValue = this.data = text2; - this.length = text2.length; - }, - insertData: function(offset, text2) { - this.replaceData(offset, 0, text2); - }, - appendChild: function(newChild) { - throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]); - }, - deleteData: function(offset, count) { - this.replaceData(offset, count, ""); - }, - replaceData: function(offset, count, text2) { - var start = this.data.substring(0, offset); - var end = this.data.substring(offset + count); - text2 = start + text2 + end; - this.nodeValue = this.data = text2; - this.length = text2.length; - } - }; - _extends(CharacterData, Node); - function Text() { - } - Text.prototype = { - nodeName: "#text", - nodeType: TEXT_NODE, - splitText: function(offset) { - var text2 = this.data; - var newText = text2.substring(offset); - text2 = text2.substring(0, offset); - this.data = this.nodeValue = text2; - this.length = text2.length; - var newNode = this.ownerDocument.createTextNode(newText); - if (this.parentNode) { - this.parentNode.insertBefore(newNode, this.nextSibling); - } - return newNode; - } - }; - _extends(Text, CharacterData); - function Comment() { - } - Comment.prototype = { - nodeName: "#comment", - nodeType: COMMENT_NODE - }; - _extends(Comment, CharacterData); - function CDATASection() { - } - CDATASection.prototype = { - nodeName: "#cdata-section", - nodeType: CDATA_SECTION_NODE - }; - _extends(CDATASection, CharacterData); - function DocumentType() { - } - DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; - _extends(DocumentType, Node); - function Notation() { - } - Notation.prototype.nodeType = NOTATION_NODE; - _extends(Notation, Node); - function Entity() { - } - Entity.prototype.nodeType = ENTITY_NODE; - _extends(Entity, Node); - function EntityReference() { - } - EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; - _extends(EntityReference, Node); - function DocumentFragment() { - } - DocumentFragment.prototype.nodeName = "#document-fragment"; - DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; - _extends(DocumentFragment, Node); - function ProcessingInstruction() { - } - ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; - _extends(ProcessingInstruction, Node); - function XMLSerializer() { - } - XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) { - return nodeSerializeToString.call(node, isHtml, nodeFilter); - }; - Node.prototype.toString = nodeSerializeToString; - function nodeSerializeToString(isHtml, nodeFilter) { - var buf = []; - var refNode = this.nodeType == 9 && this.documentElement || this; - var prefix = refNode.prefix; - var uri = refNode.namespaceURI; - if (uri && prefix == null) { - var prefix = refNode.lookupPrefix(uri); - if (prefix == null) { - var visibleNamespaces = [ - { namespace: uri, prefix: null } - ]; - } - } - serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces); - return buf.join(""); - } - function needNamespaceDefine(node, isHTML, visibleNamespaces) { - var prefix = node.prefix || ""; - var uri = node.namespaceURI; - if (!uri) { - return false; - } - if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) { - return false; - } - var i = visibleNamespaces.length; - while (i--) { - var ns = visibleNamespaces[i]; - if (ns.prefix === prefix) { - return ns.namespace !== uri; - } - } - return true; - } - function addSerializedAttribute(buf, qualifiedName, value) { - buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"'); - } - function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) { - if (!visibleNamespaces) { - visibleNamespaces = []; - } - if (nodeFilter) { - node = nodeFilter(node); - if (node) { - if (typeof node == "string") { - buf.push(node); - return; - } - } else { - return; - } - } - switch (node.nodeType) { - case ELEMENT_NODE: - var attrs = node.attributes; - var len = attrs.length; - var child = node.firstChild; - var nodeName = node.tagName; - isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML; - var prefixedNodeName = nodeName; - if (!isHTML && !node.prefix && node.namespaceURI) { - var defaultNS; - for (var ai = 0; ai < attrs.length; ai++) { - if (attrs.item(ai).name === "xmlns") { - defaultNS = attrs.item(ai).value; - break; - } - } - if (!defaultNS) { - for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) { - var namespace = visibleNamespaces[nsi]; - if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) { - defaultNS = namespace.namespace; - break; - } - } - } - if (defaultNS !== node.namespaceURI) { - for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) { - var namespace = visibleNamespaces[nsi]; - if (namespace.namespace === node.namespaceURI) { - if (namespace.prefix) { - prefixedNodeName = namespace.prefix + ":" + nodeName; - } - break; - } - } - } - } - buf.push("<", prefixedNodeName); - for (var i = 0; i < len; i++) { - var attr = attrs.item(i); - if (attr.prefix == "xmlns") { - visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value }); - } else if (attr.nodeName == "xmlns") { - visibleNamespaces.push({ prefix: "", namespace: attr.value }); - } - } - for (var i = 0; i < len; i++) { - var attr = attrs.item(i); - if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) { - var prefix = attr.prefix || ""; - var uri = attr.namespaceURI; - addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri); - visibleNamespaces.push({ prefix, namespace: uri }); - } - serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces); - } - if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) { - var prefix = node.prefix || ""; - var uri = node.namespaceURI; - addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri); - visibleNamespaces.push({ prefix, namespace: uri }); - } - if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) { - buf.push(">"); - if (isHTML && /^script$/i.test(nodeName)) { - while (child) { - if (child.data) { - buf.push(child.data); - } else { - serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); - } - child = child.nextSibling; - } - } else { - while (child) { - serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); - child = child.nextSibling; - } - } - buf.push(""); - } else { - buf.push("/>"); - } - return; - case DOCUMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - var child = node.firstChild; - while (child) { - serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); - child = child.nextSibling; - } - return; - case ATTRIBUTE_NODE: - return addSerializedAttribute(buf, node.name, node.value); - case TEXT_NODE: - return buf.push( - node.data.replace(/[<&>]/g, _xmlEncoder) - ); - case CDATA_SECTION_NODE: - return buf.push(""); - case COMMENT_NODE: - return buf.push(""); - case DOCUMENT_TYPE_NODE: - var pubid = node.publicId; - var sysid = node.systemId; - buf.push(""); - } else if (sysid && sysid != ".") { - buf.push(" SYSTEM ", sysid, ">"); - } else { - var sub = node.internalSubset; - if (sub) { - buf.push(" [", sub, "]"); - } - buf.push(">"); - } - return; - case PROCESSING_INSTRUCTION_NODE: - return buf.push(""); - case ENTITY_REFERENCE_NODE: - return buf.push("&", node.nodeName, ";"); - default: - buf.push("??", node.nodeName); - } - } - function importNode(doc, node, deep) { - var node2; - switch (node.nodeType) { - case ELEMENT_NODE: - node2 = node.cloneNode(false); - node2.ownerDocument = doc; - case DOCUMENT_FRAGMENT_NODE: - break; - case ATTRIBUTE_NODE: - deep = true; - break; - } - if (!node2) { - node2 = node.cloneNode(false); - } - node2.ownerDocument = doc; - node2.parentNode = null; - if (deep) { - var child = node.firstChild; - while (child) { - node2.appendChild(importNode(doc, child, deep)); - child = child.nextSibling; - } - } - return node2; - } - function cloneNode(doc, node, deep) { - var node2 = new node.constructor(); - for (var n in node) { - if (Object.prototype.hasOwnProperty.call(node, n)) { - var v = node[n]; - if (typeof v != "object") { - if (v != node2[n]) { - node2[n] = v; - } - } - } - } - if (node.childNodes) { - node2.childNodes = new NodeList(); - } - node2.ownerDocument = doc; - switch (node2.nodeType) { - case ELEMENT_NODE: - var attrs = node.attributes; - var attrs2 = node2.attributes = new NamedNodeMap(); - var len = attrs.length; - attrs2._ownerElement = node2; - for (var i = 0; i < len; i++) { - node2.setAttributeNode(cloneNode(doc, attrs.item(i), true)); - } - break; - ; - case ATTRIBUTE_NODE: - deep = true; - } - if (deep) { - var child = node.firstChild; - while (child) { - node2.appendChild(cloneNode(doc, child, deep)); - child = child.nextSibling; - } - } - return node2; - } - function __set__(object, key, value) { - object[key] = value; - } - try { - if (Object.defineProperty) { - let getTextContent2 = function(node) { - switch (node.nodeType) { - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - var buf = []; - node = node.firstChild; - while (node) { - if (node.nodeType !== 7 && node.nodeType !== 8) { - buf.push(getTextContent2(node)); - } - node = node.nextSibling; - } - return buf.join(""); - default: - return node.nodeValue; - } - }; - getTextContent = getTextContent2; - Object.defineProperty(LiveNodeList.prototype, "length", { - get: function() { - _updateLiveList(this); - return this.$$length; - } - }); - Object.defineProperty(Node.prototype, "textContent", { - get: function() { - return getTextContent2(this); - }, - set: function(data2) { - switch (this.nodeType) { - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - while (this.firstChild) { - this.removeChild(this.firstChild); - } - if (data2 || String(data2)) { - this.appendChild(this.ownerDocument.createTextNode(data2)); - } - break; - default: - this.data = data2; - this.value = data2; - this.nodeValue = data2; - } - } - }); - __set__ = function(object, key, value) { - object["$$" + key] = value; - }; - } - } catch (e) { - } - var getTextContent; - exports.DocumentType = DocumentType; - exports.DOMException = DOMException; - exports.DOMImplementation = DOMImplementation; - exports.Element = Element; - exports.Node = Node; - exports.NodeList = NodeList; - exports.XMLSerializer = XMLSerializer; - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/entities.js - var require_entities = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/entities.js"(exports) { - var freeze = require_conventions().freeze; - exports.XML_ENTITIES = freeze({ amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }); - exports.HTML_ENTITIES = freeze({ - lt: "<", - gt: ">", - amp: "&", - quot: '"', - apos: "'", - Agrave: "\xC0", - Aacute: "\xC1", - Acirc: "\xC2", - Atilde: "\xC3", - Auml: "\xC4", - Aring: "\xC5", - AElig: "\xC6", - Ccedil: "\xC7", - Egrave: "\xC8", - Eacute: "\xC9", - Ecirc: "\xCA", - Euml: "\xCB", - Igrave: "\xCC", - Iacute: "\xCD", - Icirc: "\xCE", - Iuml: "\xCF", - ETH: "\xD0", - Ntilde: "\xD1", - Ograve: "\xD2", - Oacute: "\xD3", - Ocirc: "\xD4", - Otilde: "\xD5", - Ouml: "\xD6", - Oslash: "\xD8", - Ugrave: "\xD9", - Uacute: "\xDA", - Ucirc: "\xDB", - Uuml: "\xDC", - Yacute: "\xDD", - THORN: "\xDE", - szlig: "\xDF", - agrave: "\xE0", - aacute: "\xE1", - acirc: "\xE2", - atilde: "\xE3", - auml: "\xE4", - aring: "\xE5", - aelig: "\xE6", - ccedil: "\xE7", - egrave: "\xE8", - eacute: "\xE9", - ecirc: "\xEA", - euml: "\xEB", - igrave: "\xEC", - iacute: "\xED", - icirc: "\xEE", - iuml: "\xEF", - eth: "\xF0", - ntilde: "\xF1", - ograve: "\xF2", - oacute: "\xF3", - ocirc: "\xF4", - otilde: "\xF5", - ouml: "\xF6", - oslash: "\xF8", - ugrave: "\xF9", - uacute: "\xFA", - ucirc: "\xFB", - uuml: "\xFC", - yacute: "\xFD", - thorn: "\xFE", - yuml: "\xFF", - nbsp: "\xA0", - iexcl: "\xA1", - cent: "\xA2", - pound: "\xA3", - curren: "\xA4", - yen: "\xA5", - brvbar: "\xA6", - sect: "\xA7", - uml: "\xA8", - copy: "\xA9", - ordf: "\xAA", - laquo: "\xAB", - not: "\xAC", - shy: "\xAD\xAD", - reg: "\xAE", - macr: "\xAF", - deg: "\xB0", - plusmn: "\xB1", - sup2: "\xB2", - sup3: "\xB3", - acute: "\xB4", - micro: "\xB5", - para: "\xB6", - middot: "\xB7", - cedil: "\xB8", - sup1: "\xB9", - ordm: "\xBA", - raquo: "\xBB", - frac14: "\xBC", - frac12: "\xBD", - frac34: "\xBE", - iquest: "\xBF", - times: "\xD7", - divide: "\xF7", - forall: "\u2200", - part: "\u2202", - exist: "\u2203", - empty: "\u2205", - nabla: "\u2207", - isin: "\u2208", - notin: "\u2209", - ni: "\u220B", - prod: "\u220F", - sum: "\u2211", - minus: "\u2212", - lowast: "\u2217", - radic: "\u221A", - prop: "\u221D", - infin: "\u221E", - ang: "\u2220", - and: "\u2227", - or: "\u2228", - cap: "\u2229", - cup: "\u222A", - "int": "\u222B", - there4: "\u2234", - sim: "\u223C", - cong: "\u2245", - asymp: "\u2248", - ne: "\u2260", - equiv: "\u2261", - le: "\u2264", - ge: "\u2265", - sub: "\u2282", - sup: "\u2283", - nsub: "\u2284", - sube: "\u2286", - supe: "\u2287", - oplus: "\u2295", - otimes: "\u2297", - perp: "\u22A5", - sdot: "\u22C5", - Alpha: "\u0391", - Beta: "\u0392", - Gamma: "\u0393", - Delta: "\u0394", - Epsilon: "\u0395", - Zeta: "\u0396", - Eta: "\u0397", - Theta: "\u0398", - Iota: "\u0399", - Kappa: "\u039A", - Lambda: "\u039B", - Mu: "\u039C", - Nu: "\u039D", - Xi: "\u039E", - Omicron: "\u039F", - Pi: "\u03A0", - Rho: "\u03A1", - Sigma: "\u03A3", - Tau: "\u03A4", - Upsilon: "\u03A5", - Phi: "\u03A6", - Chi: "\u03A7", - Psi: "\u03A8", - Omega: "\u03A9", - alpha: "\u03B1", - beta: "\u03B2", - gamma: "\u03B3", - delta: "\u03B4", - epsilon: "\u03B5", - zeta: "\u03B6", - eta: "\u03B7", - theta: "\u03B8", - iota: "\u03B9", - kappa: "\u03BA", - lambda: "\u03BB", - mu: "\u03BC", - nu: "\u03BD", - xi: "\u03BE", - omicron: "\u03BF", - pi: "\u03C0", - rho: "\u03C1", - sigmaf: "\u03C2", - sigma: "\u03C3", - tau: "\u03C4", - upsilon: "\u03C5", - phi: "\u03C6", - chi: "\u03C7", - psi: "\u03C8", - omega: "\u03C9", - thetasym: "\u03D1", - upsih: "\u03D2", - piv: "\u03D6", - OElig: "\u0152", - oelig: "\u0153", - Scaron: "\u0160", - scaron: "\u0161", - Yuml: "\u0178", - fnof: "\u0192", - circ: "\u02C6", - tilde: "\u02DC", - ensp: "\u2002", - emsp: "\u2003", - thinsp: "\u2009", - zwnj: "\u200C", - zwj: "\u200D", - lrm: "\u200E", - rlm: "\u200F", - ndash: "\u2013", - mdash: "\u2014", - lsquo: "\u2018", - rsquo: "\u2019", - sbquo: "\u201A", - ldquo: "\u201C", - rdquo: "\u201D", - bdquo: "\u201E", - dagger: "\u2020", - Dagger: "\u2021", - bull: "\u2022", - hellip: "\u2026", - permil: "\u2030", - prime: "\u2032", - Prime: "\u2033", - lsaquo: "\u2039", - rsaquo: "\u203A", - oline: "\u203E", - euro: "\u20AC", - trade: "\u2122", - larr: "\u2190", - uarr: "\u2191", - rarr: "\u2192", - darr: "\u2193", - harr: "\u2194", - crarr: "\u21B5", - lceil: "\u2308", - rceil: "\u2309", - lfloor: "\u230A", - rfloor: "\u230B", - loz: "\u25CA", - spades: "\u2660", - clubs: "\u2663", - hearts: "\u2665", - diams: "\u2666" - }); - exports.entityMap = exports.HTML_ENTITIES; - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/sax.js - var require_sax = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/sax.js"(exports) { - var NAMESPACE = require_conventions().NAMESPACE; - var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; - var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); - var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$"); - var S_TAG = 0; - var S_ATTR = 1; - var S_ATTR_SPACE = 2; - var S_EQ = 3; - var S_ATTR_NOQUOT_VALUE = 4; - var S_ATTR_END = 5; - var S_TAG_SPACE = 6; - var S_TAG_CLOSE = 7; - function ParseError(message, locator) { - this.message = message; - this.locator = locator; - if (Error.captureStackTrace) - Error.captureStackTrace(this, ParseError); - } - ParseError.prototype = new Error(); - ParseError.prototype.name = ParseError.name; - function XMLReader() { - } - XMLReader.prototype = { - parse: function(source, defaultNSMap, entityMap) { - var domBuilder = this.domBuilder; - domBuilder.startDocument(); - _copy(defaultNSMap, defaultNSMap = {}); - parse5( - source, - defaultNSMap, - entityMap, - domBuilder, - this.errorHandler - ); - domBuilder.endDocument(); - } - }; - function parse5(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { - function fixedFromCharCode(code) { - if (code > 65535) { - code -= 65536; - var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023); - return String.fromCharCode(surrogate1, surrogate2); - } else { - return String.fromCharCode(code); - } - } - function entityReplacer(a2) { - var k = a2.slice(1, -1); - if (Object.hasOwnProperty.call(entityMap, k)) { - return entityMap[k]; - } else if (k.charAt(0) === "#") { - return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x"))); - } else { - errorHandler.error("entity not found:" + a2); - return a2; - } - } - function appendText(end2) { - if (end2 > start) { - var xt = source.substring(start, end2).replace(/&#?\w+;/g, entityReplacer); - locator && position(start); - domBuilder.characters(xt, 0, end2 - start); - start = end2; - } - } - function position(p, m) { - while (p >= lineEnd && (m = linePattern.exec(source))) { - lineStart = m.index; - lineEnd = lineStart + m[0].length; - locator.lineNumber++; - } - locator.columnNumber = p - lineStart + 1; - } - var lineStart = 0; - var lineEnd = 0; - var linePattern = /.*(?:\r\n?|\n)|.*$/g; - var locator = domBuilder.locator; - var parseStack = [{ currentNSMap: defaultNSMapCopy }]; - var closeMap = {}; - var start = 0; - while (true) { - try { - var tagStart = source.indexOf("<", start); - if (tagStart < 0) { - if (!source.substr(start).match(/^\s*$/)) { - var doc = domBuilder.doc; - var text2 = doc.createTextNode(source.substr(start)); - doc.appendChild(text2); - domBuilder.currentElement = text2; - } - return; - } - if (tagStart > start) { - appendText(tagStart); - } - switch (source.charAt(tagStart + 1)) { - case "/": - var end = source.indexOf(">", tagStart + 3); - var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, ""); - var config = parseStack.pop(); - if (end < 0) { - tagName = source.substring(tagStart + 2).replace(/[\s<].*/, ""); - errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName); - end = tagStart + 1 + tagName.length; - } else if (tagName.match(/\s start) { - start = end; - } else { - appendText(Math.max(tagStart, start) + 1); - } - } - } - function copyLocator(f, t) { - t.lineNumber = f.lineNumber; - t.columnNumber = f.columnNumber; - return t; - } - function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) { - function addAttribute(qname, value2, startIndex) { - if (el.attributeNames.hasOwnProperty(qname)) { - errorHandler.fatalError("Attribute " + qname + " redefined"); - } - el.addValue( - qname, - value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer), - startIndex - ); - } - var attrName; - var value; - var p = ++start; - var s = S_TAG; - while (true) { - var c = source.charAt(p); - switch (c) { - case "=": - if (s === S_ATTR) { - attrName = source.slice(start, p); - s = S_EQ; - } else if (s === S_ATTR_SPACE) { - s = S_EQ; - } else { - throw new Error("attribute equal must after attrName"); - } - break; - case "'": - case '"': - if (s === S_EQ || s === S_ATTR) { - if (s === S_ATTR) { - errorHandler.warning('attribute value must after "="'); - attrName = source.slice(start, p); - } - start = p + 1; - p = source.indexOf(c, start); - if (p > 0) { - value = source.slice(start, p); - addAttribute(attrName, value, start - 1); - s = S_ATTR_END; - } else { - throw new Error("attribute value no end '" + c + "' match"); - } - } else if (s == S_ATTR_NOQUOT_VALUE) { - value = source.slice(start, p); - addAttribute(attrName, value, start); - errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!"); - start = p + 1; - s = S_ATTR_END; - } else { - throw new Error('attribute value must after "="'); - } - break; - case "/": - switch (s) { - case S_TAG: - el.setTagName(source.slice(start, p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - s = S_TAG_CLOSE; - el.closed = true; - case S_ATTR_NOQUOT_VALUE: - case S_ATTR: - case S_ATTR_SPACE: - break; - default: - throw new Error("attribute invalid close char('/')"); - } - break; - case "": - errorHandler.error("unexpected end of input"); - if (s == S_TAG) { - el.setTagName(source.slice(start, p)); - } - return p; - case ">": - switch (s) { - case S_TAG: - el.setTagName(source.slice(start, p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - break; - case S_ATTR_NOQUOT_VALUE: - case S_ATTR: - value = source.slice(start, p); - if (value.slice(-1) === "/") { - el.closed = true; - value = value.slice(0, -1); - } - case S_ATTR_SPACE: - if (s === S_ATTR_SPACE) { - value = attrName; - } - if (s == S_ATTR_NOQUOT_VALUE) { - errorHandler.warning('attribute "' + value + '" missed quot(")!'); - addAttribute(attrName, value, start); - } else { - if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) { - errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!'); - } - addAttribute(value, value, start); - } - break; - case S_EQ: - throw new Error("attribute value missed!!"); - } - return p; - case "\x80": - c = " "; - default: - if (c <= " ") { - switch (s) { - case S_TAG: - el.setTagName(source.slice(start, p)); - s = S_TAG_SPACE; - break; - case S_ATTR: - attrName = source.slice(start, p); - s = S_ATTR_SPACE; - break; - case S_ATTR_NOQUOT_VALUE: - var value = source.slice(start, p); - errorHandler.warning('attribute "' + value + '" missed quot(")!!'); - addAttribute(attrName, value, start); - case S_ATTR_END: - s = S_TAG_SPACE; - break; - } - } else { - switch (s) { - case S_ATTR_SPACE: - var tagName = el.tagName; - if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) { - errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!'); - } - addAttribute(attrName, attrName, start); - start = p; - s = S_ATTR; - break; - case S_ATTR_END: - errorHandler.warning('attribute space is required"' + attrName + '"!!'); - case S_TAG_SPACE: - s = S_ATTR; - start = p; - break; - case S_EQ: - s = S_ATTR_NOQUOT_VALUE; - start = p; - break; - case S_TAG_CLOSE: - throw new Error("elements closed character '/' and '>' must be connected to"); - } - } - } - p++; - } - } - function appendElement(el, domBuilder, currentNSMap) { - var tagName = el.tagName; - var localNSMap = null; - var i = el.length; - while (i--) { - var a = el[i]; - var qName = a.qName; - var value = a.value; - var nsp = qName.indexOf(":"); - if (nsp > 0) { - var prefix = a.prefix = qName.slice(0, nsp); - var localName = qName.slice(nsp + 1); - var nsPrefix = prefix === "xmlns" && localName; - } else { - localName = qName; - prefix = null; - nsPrefix = qName === "xmlns" && ""; - } - a.localName = localName; - if (nsPrefix !== false) { - if (localNSMap == null) { - localNSMap = {}; - _copy(currentNSMap, currentNSMap = {}); - } - currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; - a.uri = NAMESPACE.XMLNS; - domBuilder.startPrefixMapping(nsPrefix, value); - } - } - var i = el.length; - while (i--) { - a = el[i]; - var prefix = a.prefix; - if (prefix) { - if (prefix === "xml") { - a.uri = NAMESPACE.XML; - } - if (prefix !== "xmlns") { - a.uri = currentNSMap[prefix || ""]; - } - } - } - var nsp = tagName.indexOf(":"); - if (nsp > 0) { - prefix = el.prefix = tagName.slice(0, nsp); - localName = el.localName = tagName.slice(nsp + 1); - } else { - prefix = null; - localName = el.localName = tagName; - } - var ns = el.uri = currentNSMap[prefix || ""]; - domBuilder.startElement(ns, localName, tagName, el); - if (el.closed) { - domBuilder.endElement(ns, localName, tagName); - if (localNSMap) { - for (prefix in localNSMap) { - if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) { - domBuilder.endPrefixMapping(prefix); - } - } - } - } else { - el.currentNSMap = currentNSMap; - el.localNSMap = localNSMap; - return true; - } - } - function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) { - if (/^(?:script|textarea)$/i.test(tagName)) { - var elEndStart = source.indexOf("", elStartEnd); - var text2 = source.substring(elStartEnd + 1, elEndStart); - if (/[&<]/.test(text2)) { - if (/^script$/i.test(tagName)) { - domBuilder.characters(text2, 0, text2.length); - return elEndStart; - } - text2 = text2.replace(/&#?\w+;/g, entityReplacer); - domBuilder.characters(text2, 0, text2.length); - return elEndStart; - } - } - return elStartEnd + 1; - } - function fixSelfClosed(source, elStartEnd, tagName, closeMap) { - var pos = closeMap[tagName]; - if (pos == null) { - pos = source.lastIndexOf(""); - if (pos < elStartEnd) { - pos = source.lastIndexOf("", start + 4); - if (end > start) { - domBuilder.comment(source, start + 4, end - start - 4); - return end + 3; - } else { - errorHandler.error("Unclosed comment"); - return -1; - } - } else { - return -1; - } - default: - if (source.substr(start + 3, 6) == "CDATA[") { - var end = source.indexOf("]]>", start + 9); - domBuilder.startCDATA(); - domBuilder.characters(source, start + 9, end - start - 9); - domBuilder.endCDATA(); - return end + 3; - } - var matchs = split(source, start); - var len = matchs.length; - if (len > 1 && /!doctype/i.test(matchs[0][0])) { - var name = matchs[1][0]; - var pubid = false; - var sysid = false; - if (len > 3) { - if (/^public$/i.test(matchs[2][0])) { - pubid = matchs[3][0]; - sysid = len > 4 && matchs[4][0]; - } else if (/^system$/i.test(matchs[2][0])) { - sysid = matchs[3][0]; - } - } - var lastMatch = matchs[len - 1]; - domBuilder.startDTD(name, pubid, sysid); - domBuilder.endDTD(); - return lastMatch.index + lastMatch[0].length; - } - } - return -1; - } - function parseInstruction(source, start, domBuilder) { - var end = source.indexOf("?>", start); - if (end) { - var match2 = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); - if (match2) { - var len = match2[0].length; - domBuilder.processingInstruction(match2[1], match2[2]); - return end + 2; - } else { - return -1; - } - } - return -1; - } - function ElementAttributes() { - this.attributeNames = {}; - } - ElementAttributes.prototype = { - setTagName: function(tagName) { - if (!tagNamePattern.test(tagName)) { - throw new Error("invalid tagName:" + tagName); - } - this.tagName = tagName; - }, - addValue: function(qName, value, offset) { - if (!tagNamePattern.test(qName)) { - throw new Error("invalid attribute:" + qName); - } - this.attributeNames[qName] = this.length; - this[this.length++] = { qName, value, offset }; - }, - length: 0, - getLocalName: function(i) { - return this[i].localName; - }, - getLocator: function(i) { - return this[i].locator; - }, - getQName: function(i) { - return this[i].qName; - }, - getURI: function(i) { - return this[i].uri; - }, - getValue: function(i) { - return this[i].value; - } - }; - function split(source, start) { - var match2; - var buf = []; - var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; - reg.lastIndex = start; - reg.exec(source); - while (match2 = reg.exec(source)) { - buf.push(match2); - if (match2[1]) - return buf; - } - } - exports.XMLReader = XMLReader; - exports.ParseError = ParseError; - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom-parser.js - var require_dom_parser = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports) { - var conventions = require_conventions(); - var dom = require_dom(); - var entities = require_entities(); - var sax = require_sax(); - var DOMImplementation = dom.DOMImplementation; - var NAMESPACE = conventions.NAMESPACE; - var ParseError = sax.ParseError; - var XMLReader = sax.XMLReader; - function normalizeLineEndings(input) { - return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n"); - } - function DOMParser(options) { - this.options = options || { locator: {} }; - } - DOMParser.prototype.parseFromString = function(source, mimeType) { - var options = this.options; - var sax2 = new XMLReader(); - var domBuilder = options.domBuilder || new DOMHandler(); - var errorHandler = options.errorHandler; - var locator = options.locator; - var defaultNSMap = options.xmlns || {}; - var isHTML = /\/x?html?$/.test(mimeType); - var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES; - if (locator) { - domBuilder.setDocumentLocator(locator); - } - sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator); - sax2.domBuilder = options.domBuilder || domBuilder; - if (isHTML) { - defaultNSMap[""] = NAMESPACE.HTML; - } - defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML; - var normalize = options.normalizeLineEndings || normalizeLineEndings; - if (source && typeof source === "string") { - sax2.parse( - normalize(source), - defaultNSMap, - entityMap - ); - } else { - sax2.errorHandler.error("invalid doc source"); - } - return domBuilder.doc; - }; - function buildErrorHandler(errorImpl, domBuilder, locator) { - if (!errorImpl) { - if (domBuilder instanceof DOMHandler) { - return domBuilder; - } - errorImpl = domBuilder; - } - var errorHandler = {}; - var isCallback = errorImpl instanceof Function; - locator = locator || {}; - function build(key) { - var fn = errorImpl[key]; - if (!fn && isCallback) { - fn = errorImpl.length == 2 ? function(msg) { - errorImpl(key, msg); - } : errorImpl; - } - errorHandler[key] = fn && function(msg) { - fn("[xmldom " + key + "] " + msg + _locator(locator)); - } || function() { - }; - } - build("warning"); - build("error"); - build("fatalError"); - return errorHandler; - } - function DOMHandler() { - this.cdata = false; - } - function position(locator, node) { - node.lineNumber = locator.lineNumber; - node.columnNumber = locator.columnNumber; - } - DOMHandler.prototype = { - startDocument: function() { - this.doc = new DOMImplementation().createDocument(null, null, null); - if (this.locator) { - this.doc.documentURI = this.locator.systemId; - } - }, - startElement: function(namespaceURI, localName, qName, attrs) { - var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName || localName); - var len = attrs.length; - appendElement(this, el); - this.currentElement = el; - this.locator && position(this.locator, el); - for (var i = 0; i < len; i++) { - var namespaceURI = attrs.getURI(i); - var value = attrs.getValue(i); - var qName = attrs.getQName(i); - var attr = doc.createAttributeNS(namespaceURI, qName); - this.locator && position(attrs.getLocator(i), attr); - attr.value = attr.nodeValue = value; - el.setAttributeNode(attr); - } - }, - endElement: function(namespaceURI, localName, qName) { - var current = this.currentElement; - var tagName = current.tagName; - this.currentElement = current.parentNode; - }, - startPrefixMapping: function(prefix, uri) { - }, - endPrefixMapping: function(prefix) { - }, - processingInstruction: function(target, data2) { - var ins = this.doc.createProcessingInstruction(target, data2); - this.locator && position(this.locator, ins); - appendElement(this, ins); - }, - ignorableWhitespace: function(ch, start, length) { - }, - characters: function(chars, start, length) { - chars = _toString.apply(this, arguments); - if (chars) { - if (this.cdata) { - var charNode = this.doc.createCDATASection(chars); - } else { - var charNode = this.doc.createTextNode(chars); - } - if (this.currentElement) { - this.currentElement.appendChild(charNode); - } else if (/^\s*$/.test(chars)) { - this.doc.appendChild(charNode); - } - this.locator && position(this.locator, charNode); - } - }, - skippedEntity: function(name) { - }, - endDocument: function() { - this.doc.normalize(); - }, - setDocumentLocator: function(locator) { - if (this.locator = locator) { - locator.lineNumber = 0; - } - }, - comment: function(chars, start, length) { - chars = _toString.apply(this, arguments); - var comm = this.doc.createComment(chars); - this.locator && position(this.locator, comm); - appendElement(this, comm); - }, - startCDATA: function() { - this.cdata = true; - }, - endCDATA: function() { - this.cdata = false; - }, - startDTD: function(name, publicId, systemId) { - var impl = this.doc.implementation; - if (impl && impl.createDocumentType) { - var dt = impl.createDocumentType(name, publicId, systemId); - this.locator && position(this.locator, dt); - appendElement(this, dt); - this.doc.doctype = dt; - } - }, - warning: function(error2) { - console.warn("[xmldom warning] " + error2, _locator(this.locator)); - }, - error: function(error2) { - console.error("[xmldom error] " + error2, _locator(this.locator)); - }, - fatalError: function(error2) { - throw new ParseError(error2, this.locator); - } - }; - function _locator(l) { - if (l) { - return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]"; - } - } - function _toString(chars, start, length) { - if (typeof chars == "string") { - return chars.substr(start, length); - } else { - if (chars.length >= start + length || start) { - return new java.lang.String(chars, start, length) + ""; - } - return chars; - } - } - "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) { - DOMHandler.prototype[key] = function() { - return null; - }; - }); - function appendElement(hander, node) { - if (!hander.currentElement) { - hander.doc.appendChild(node); - } else { - hander.currentElement.appendChild(node); - } - } - exports.__DOMHandler = DOMHandler; - exports.normalizeLineEndings = normalizeLineEndings; - exports.DOMParser = DOMParser; - } - }); - - // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/index.js - var require_lib8 = __commonJS({ - "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/index.js"(exports) { - var dom = require_dom(); - exports.DOMImplementation = dom.DOMImplementation; - exports.XMLSerializer = dom.XMLSerializer; - exports.DOMParser = require_dom_parser().DOMParser; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/parseJson.js - var require_parseJson = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/utils/parseJson.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseJson = void 0; - function parseJson(data2) { - try { - var json2 = JSON.parse(data2); - return json2; - } catch (_) { - return null; - } - } - exports.parseJson = parseJson; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/utils/bufferFrom.js - var require_bufferFrom = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/utils/bufferFrom.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.bufferFrom = void 0; - function bufferFrom(init) { - var encodedString = encodeURIComponent(init); - var binaryString = encodedString.replace(/%([0-9A-F]{2})/g, function(_, char) { - return String.fromCharCode("0x" + char); - }); - var buffer = new Uint8Array(binaryString.length); - Array.prototype.forEach.call(binaryString, function(char, index) { - buffer[index] = char.charCodeAt(0); - }); - return buffer; - } - exports.bufferFrom = bufferFrom; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js - var require_EventPolyfill = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.EventPolyfill = void 0; - var EventPolyfill = function() { - function EventPolyfill2(type, options) { - this.AT_TARGET = 0; - this.BUBBLING_PHASE = 0; - this.CAPTURING_PHASE = 0; - this.NONE = 0; - this.type = ""; - this.srcElement = null; - this.currentTarget = null; - this.eventPhase = 0; - this.isTrusted = true; - this.composed = false; - this.cancelable = true; - this.defaultPrevented = false; - this.bubbles = true; - this.lengthComputable = true; - this.loaded = 0; - this.total = 0; - this.cancelBubble = false; - this.returnValue = true; - this.type = type; - this.target = (options === null || options === void 0 ? void 0 : options.target) || null; - this.currentTarget = (options === null || options === void 0 ? void 0 : options.currentTarget) || null; - this.timeStamp = Date.now(); - } - EventPolyfill2.prototype.composedPath = function() { - return []; - }; - EventPolyfill2.prototype.initEvent = function(type, bubbles, cancelable) { - this.type = type; - this.bubbles = !!bubbles; - this.cancelable = !!cancelable; - }; - EventPolyfill2.prototype.preventDefault = function() { - this.defaultPrevented = true; - }; - EventPolyfill2.prototype.stopPropagation = function() { - }; - EventPolyfill2.prototype.stopImmediatePropagation = function() { - }; - return EventPolyfill2; - }(); - exports.EventPolyfill = EventPolyfill; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js - var require_ProgressEventPolyfill = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ProgressEventPolyfill = void 0; - var EventPolyfill_1 = require_EventPolyfill(); - var ProgressEventPolyfill = function(_super) { - __extends(ProgressEventPolyfill2, _super); - function ProgressEventPolyfill2(type, init) { - var _this = _super.call(this, type) || this; - _this.lengthComputable = (init === null || init === void 0 ? void 0 : init.lengthComputable) || false; - _this.composed = (init === null || init === void 0 ? void 0 : init.composed) || false; - _this.loaded = (init === null || init === void 0 ? void 0 : init.loaded) || 0; - _this.total = (init === null || init === void 0 ? void 0 : init.total) || 0; - return _this; - } - return ProgressEventPolyfill2; - }(EventPolyfill_1.EventPolyfill); - exports.ProgressEventPolyfill = ProgressEventPolyfill; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/utils/createEvent.js - var require_createEvent = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/utils/createEvent.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createEvent = void 0; - var EventPolyfill_1 = require_EventPolyfill(); - var ProgressEventPolyfill_1 = require_ProgressEventPolyfill(); - var SUPPORTS_PROGRESS_EVENT = typeof ProgressEvent !== "undefined"; - function createEvent(target, type, init) { - var progressEvents = [ - "error", - "progress", - "loadstart", - "loadend", - "load", - "timeout", - "abort" - ]; - var ProgressEventClass = SUPPORTS_PROGRESS_EVENT ? ProgressEvent : ProgressEventPolyfill_1.ProgressEventPolyfill; - var event = progressEvents.includes(type) ? new ProgressEventClass(type, { - lengthComputable: true, - loaded: (init === null || init === void 0 ? void 0 : init.loaded) || 0, - total: (init === null || init === void 0 ? void 0 : init.total) || 0 - }) : new EventPolyfill_1.EventPolyfill(type, { - target, - currentTarget: target - }); - return event; - } - exports.createEvent = createEvent; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/XMLHttpRequestOverride.js - var require_XMLHttpRequestOverride = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/XMLHttpRequestOverride.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __generator = exports && exports.__generator || function(thisArg, body2) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) - throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) - throw new TypeError("Generator is already executing."); - while (_) - try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) - return t; - if (y = 0, t) - op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) - _.ops.pop(); - _.trys.pop(); - continue; - } - op = body2.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - var __values = exports && exports.__values || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) - return m.call(o); - if (o && typeof o.length === "number") - return { - next: function() { - if (o && i >= o.length) - o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - var __read = exports && exports.__read || function(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) - return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) - ar.push(r.value); - } catch (error2) { - e = { error: error2 }; - } finally { - try { - if (r && !r.done && (m = i["return"])) - m.call(i); - } finally { - if (e) - throw e.error; - } - } - return ar; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createXMLHttpRequestOverride = void 0; - var until_1 = require_lib(); - var headers_polyfill_1 = require_lib3(); - var xmldom_1 = require_lib8(); - var parseJson_1 = require_parseJson(); - var toIsoResponse_1 = require_toIsoResponse(); - var bufferFrom_1 = require_bufferFrom(); - var createEvent_1 = require_createEvent(); - var IsomorphicRequest_1 = require_IsomorphicRequest(); - var bufferUtils_1 = require_bufferUtils(); - var InteractiveIsomorphicRequest_1 = require_InteractiveIsomorphicRequest(); - var createXMLHttpRequestOverride = function(options) { - var _a2; - var XMLHttpRequest = options.XMLHttpRequest, emitter = options.emitter, log = options.log; - return _a2 = function() { - function XMLHttpRequestOverride() { - this._events = []; - this.log = log; - this.UNSENT = 0; - this.OPENED = 1; - this.HEADERS_RECEIVED = 2; - this.LOADING = 3; - this.DONE = 4; - this.onreadystatechange = null; - this.onabort = null; - this.onerror = null; - this.onload = null; - this.onloadend = null; - this.onloadstart = null; - this.onprogress = null; - this.ontimeout = null; - this.url = ""; - this.method = "GET"; - this.readyState = this.UNSENT; - this.withCredentials = false; - this.status = 200; - this.statusText = "OK"; - this.response = ""; - this.responseType = "text"; - this.responseText = ""; - this.responseXML = null; - this.responseURL = ""; - this.upload = {}; - this.timeout = 0; - this._requestHeaders = new headers_polyfill_1.Headers(); - this._responseHeaders = new headers_polyfill_1.Headers(); - } - XMLHttpRequestOverride.prototype.setReadyState = function(nextState) { - if (nextState === this.readyState) { - return; - } - this.log("readyState change %d -> %d", this.readyState, nextState); - this.readyState = nextState; - if (nextState !== this.UNSENT) { - this.log("triggering readystate change..."); - this.trigger("readystatechange"); - } - }; - XMLHttpRequestOverride.prototype.trigger = function(eventName, options2) { - var e_1, _a3; - this.log('trigger "%s" (%d)', eventName, this.readyState); - this.log('resolve listener for event "%s"', eventName); - var callback = this["on" + eventName]; - callback === null || callback === void 0 ? void 0 : callback.call(this, createEvent_1.createEvent(this, eventName, options2)); - try { - for (var _b2 = __values(this._events), _c = _b2.next(); !_c.done; _c = _b2.next()) { - var event_1 = _c.value; - if (event_1.name === eventName) { - log('calling mock event listener "%s" (%d)', eventName, this.readyState); - event_1.listener.call(this, createEvent_1.createEvent(this, eventName, options2)); - } - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_c && !_c.done && (_a3 = _b2.return)) - _a3.call(_b2); - } finally { - if (e_1) - throw e_1.error; - } - } - return this; - }; - XMLHttpRequestOverride.prototype.reset = function() { - this.log("reset"); - this.setReadyState(this.UNSENT); - this.status = 200; - this.statusText = "OK"; - this.response = null; - this.responseText = null; - this.responseXML = null; - this._requestHeaders = new headers_polyfill_1.Headers(); - this._responseHeaders = new headers_polyfill_1.Headers(); - }; - XMLHttpRequestOverride.prototype.open = function(method, url, async, user, password) { - if (async === void 0) { - async = true; - } - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a3) { - this.log = this.log.extend("request " + method + " " + url); - this.log("open", { method, url, async, user, password }); - this.reset(); - this.setReadyState(this.OPENED); - if (typeof url === "undefined") { - this.url = method; - this.method = "GET"; - } else { - this.url = url; - this.method = method; - this.async = async; - this.user = user; - this.password = password; - } - return [2]; - }); - }); - }; - XMLHttpRequestOverride.prototype.send = function(data2) { - var _this = this; - this.log("send %s %s", this.method, this.url); - var buffer; - if (typeof data2 === "string") { - buffer = bufferUtils_1.encodeBuffer(data2); - } else { - buffer = data2 || new ArrayBuffer(0); - } - var url; - try { - url = new URL(this.url); - } catch (error2) { - url = new URL(this.url, window.location.href); - } - this.log("request headers", this._requestHeaders); - var isomorphicRequest = new IsomorphicRequest_1.IsomorphicRequest(url, { - body: buffer, - method: this.method, - headers: this._requestHeaders, - credentials: this.withCredentials ? "include" : "omit" - }); - var interactiveIsomorphicRequest = new InteractiveIsomorphicRequest_1.InteractiveIsomorphicRequest(isomorphicRequest); - this.log('emitting the "request" event for %d listener(s)...', emitter.listenerCount("request")); - emitter.emit("request", interactiveIsomorphicRequest); - this.log("awaiting mocked response..."); - Promise.resolve(until_1.until(function() { - return __awaiter(_this, void 0, void 0, function() { - var _a3, mockedResponse; - return __generator(this, function(_b2) { - switch (_b2.label) { - case 0: - return [4, emitter.untilIdle("request", function(_a4) { - var _b3 = __read(_a4.args, 1), request = _b3[0]; - return request.id === interactiveIsomorphicRequest.id; - })]; - case 1: - _b2.sent(); - this.log("all request listeners have been resolved!"); - return [4, interactiveIsomorphicRequest.respondWith.invoked()]; - case 2: - _a3 = __read.apply(void 0, [_b2.sent(), 1]), mockedResponse = _a3[0]; - this.log("event.respondWith called with:", mockedResponse); - return [2, mockedResponse]; - } - }); - }); - })).then(function(_a3) { - var _b2, _c; - var _d = __read(_a3, 2), middlewareException = _d[0], mockedResponse = _d[1]; - if (middlewareException) { - _this.log("middleware function threw an exception!", middlewareException); - _this.trigger("error"); - _this.abort(); - return; - } - if (mockedResponse) { - _this.log("received mocked response", mockedResponse); - _this.trigger("loadstart"); - _this.status = (_b2 = mockedResponse.status) !== null && _b2 !== void 0 ? _b2 : 200; - _this.statusText = mockedResponse.statusText || "OK"; - _this._responseHeaders = mockedResponse.headers ? headers_polyfill_1.objectToHeaders(mockedResponse.headers) : new headers_polyfill_1.Headers(); - _this.log("set response status", _this.status, _this.statusText); - _this.log("set response headers", _this._responseHeaders); - _this.setReadyState(_this.HEADERS_RECEIVED); - _this.log("response type", _this.responseType); - _this.response = _this.getResponseBody(mockedResponse.body); - _this.responseURL = _this.url; - _this.responseText = mockedResponse.body || ""; - _this.responseXML = _this.getResponseXML(); - _this.log("set response body", _this.response); - if (mockedResponse.body && _this.response) { - _this.setReadyState(_this.LOADING); - var bodyBuffer = bufferFrom_1.bufferFrom(mockedResponse.body); - _this.trigger("progress", { - loaded: bodyBuffer.length, - total: bodyBuffer.length - }); - } - _this.setReadyState(_this.DONE); - _this.trigger("load"); - _this.trigger("loadend"); - emitter.emit("response", isomorphicRequest, toIsoResponse_1.toIsoResponse(mockedResponse)); - } else { - _this.log("no mocked response received!"); - var originalRequest_1 = new XMLHttpRequest(); - _this.log("opening an original request %s %s", _this.method, _this.url); - originalRequest_1.open(_this.method, _this.url, (_c = _this.async) !== null && _c !== void 0 ? _c : true, _this.user, _this.password); - originalRequest_1.addEventListener("load", function() { - _this.log('original "onload"'); - _this.status = originalRequest_1.status; - _this.statusText = originalRequest_1.statusText; - _this.responseURL = originalRequest_1.responseURL; - _this.responseType = originalRequest_1.responseType; - _this.response = originalRequest_1.response; - _this.responseText = originalRequest_1.responseText; - _this.responseXML = originalRequest_1.responseXML; - _this.log("set mock request readyState to DONE"); - _this.setReadyState(_this.DONE); - _this.log("received original response", _this.status, _this.statusText); - _this.log("original response body:", _this.response); - var responseHeaders = originalRequest_1.getAllResponseHeaders(); - _this.log("original response headers:\n", responseHeaders); - _this._responseHeaders = headers_polyfill_1.stringToHeaders(responseHeaders); - _this.log("original response headers (normalized)", _this._responseHeaders); - _this.log("original response finished"); - emitter.emit("response", isomorphicRequest, { - status: originalRequest_1.status, - statusText: originalRequest_1.statusText, - headers: _this._responseHeaders, - body: originalRequest_1.response - }); - }); - _this.propagateCallbacks(originalRequest_1); - _this.propagateListeners(originalRequest_1); - _this.propagateHeaders(originalRequest_1, _this._requestHeaders); - if (_this.async) { - originalRequest_1.timeout = _this.timeout; - } - _this.log("send", data2); - originalRequest_1.send(data2); - } - }); - }; - XMLHttpRequestOverride.prototype.abort = function() { - this.log("abort"); - if (this.readyState > this.UNSENT && this.readyState < this.DONE) { - this.setReadyState(this.UNSENT); - this.trigger("abort"); - } - }; - XMLHttpRequestOverride.prototype.dispatchEvent = function() { - return false; - }; - XMLHttpRequestOverride.prototype.setRequestHeader = function(name, value) { - this.log('set request header "%s" to "%s"', name, value); - this._requestHeaders.append(name, value); - }; - XMLHttpRequestOverride.prototype.getResponseHeader = function(name) { - this.log('get response header "%s"', name); - if (this.readyState < this.HEADERS_RECEIVED) { - this.log("cannot return a header: headers not received (state: %s)", this.readyState); - return null; - } - var headerValue = this._responseHeaders.get(name); - this.log('resolved response header "%s" to "%s"', name, headerValue, this._responseHeaders); - return headerValue; - }; - XMLHttpRequestOverride.prototype.getAllResponseHeaders = function() { - this.log("get all response headers"); - if (this.readyState < this.HEADERS_RECEIVED) { - this.log("cannot return headers: headers not received (state: %s)", this.readyState); - return ""; - } - return headers_polyfill_1.headersToString(this._responseHeaders); - }; - XMLHttpRequestOverride.prototype.addEventListener = function(name, listener) { - this.log("addEventListener", name, listener); - this._events.push({ - name, - listener - }); - }; - XMLHttpRequestOverride.prototype.removeEventListener = function(name, listener) { - this.log("removeEventListener", name, listener); - this._events = this._events.filter(function(storedEvent) { - return storedEvent.name !== name && storedEvent.listener !== listener; - }); - }; - XMLHttpRequestOverride.prototype.overrideMimeType = function() { - }; - XMLHttpRequestOverride.prototype.getResponseBody = function(body2) { - var textBody = body2 !== null && body2 !== void 0 ? body2 : ""; - this.log("coerced response body to", textBody); - switch (this.responseType) { - case "json": { - this.log("resolving response body as JSON"); - return parseJson_1.parseJson(textBody); - } - case "blob": { - var blobType = this.getResponseHeader("content-type") || "text/plain"; - this.log("resolving response body as Blob", { type: blobType }); - return new Blob([textBody], { - type: blobType - }); - } - case "arraybuffer": { - this.log("resolving response body as ArrayBuffer"); - var arrayBuffer = bufferFrom_1.bufferFrom(textBody); - return arrayBuffer; - } - default: - return textBody; - } - }; - XMLHttpRequestOverride.prototype.getResponseXML = function() { - var contentType = this.getResponseHeader("Content-Type"); - if (contentType === "application/xml" || contentType === "text/xml") { - return new xmldom_1.DOMParser().parseFromString(this.responseText, contentType); - } - return null; - }; - XMLHttpRequestOverride.prototype.propagateCallbacks = function(request) { - var e_2, _a3; - this.log("propagating request callbacks to the original request"); - var callbackNames = [ - "abort", - "onerror", - "ontimeout", - "onload", - "onloadstart", - "onloadend", - "onprogress", - "onreadystatechange" - ]; - try { - for (var callbackNames_1 = __values(callbackNames), callbackNames_1_1 = callbackNames_1.next(); !callbackNames_1_1.done; callbackNames_1_1 = callbackNames_1.next()) { - var callbackName = callbackNames_1_1.value; - var callback = this[callbackName]; - if (callback) { - request[callbackName] = this[callbackName]; - this.log('propagated the "%s" callback', callbackName, callback); - } - } - } catch (e_2_1) { - e_2 = { error: e_2_1 }; - } finally { - try { - if (callbackNames_1_1 && !callbackNames_1_1.done && (_a3 = callbackNames_1.return)) - _a3.call(callbackNames_1); - } finally { - if (e_2) - throw e_2.error; - } - } - request.onabort = this.abort; - request.onerror = this.onerror; - request.ontimeout = this.ontimeout; - request.onload = this.onload; - request.onloadstart = this.onloadstart; - request.onloadend = this.onloadend; - request.onprogress = this.onprogress; - request.onreadystatechange = this.onreadystatechange; - }; - XMLHttpRequestOverride.prototype.propagateListeners = function(request) { - this.log("propagating request listeners (%d) to the original request", this._events.length, this._events); - this._events.forEach(function(_a3) { - var name = _a3.name, listener = _a3.listener; - request.addEventListener(name, listener); - }); - }; - XMLHttpRequestOverride.prototype.propagateHeaders = function(request, headers) { - var _this = this; - this.log("propagating request headers to the original request", headers); - Object.entries(headers.raw()).forEach(function(_a3) { - var _b2 = __read(_a3, 2), name = _b2[0], value = _b2[1]; - _this.log('setting "%s" (%s) header on the original request', name, value); - request.setRequestHeader(name, value); - }); - }; - return XMLHttpRequestOverride; - }(), _a2.UNSENT = 0, _a2.OPENED = 1, _a2.HEADERS_RECEIVED = 2, _a2.LOADING = 3, _a2.DONE = 4, _a2; - }; - exports.createXMLHttpRequestOverride = createXMLHttpRequestOverride; - } - }); - - // node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/index.js - var require_XMLHttpRequest = __commonJS({ - "node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/lib/interceptors/XMLHttpRequest/index.js"(exports) { - "use strict"; - var __extends = exports && exports.__extends || function() { - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.XMLHttpRequestInterceptor = void 0; - var outvariant_1 = require_lib4(); - var glossary_1 = require_glossary(); - var Interceptor_1 = require_Interceptor(); - var XMLHttpRequestOverride_1 = require_XMLHttpRequestOverride(); - var XMLHttpRequestInterceptor2 = function(_super) { - __extends(XMLHttpRequestInterceptor3, _super); - function XMLHttpRequestInterceptor3() { - return _super.call(this, XMLHttpRequestInterceptor3.symbol) || this; - } - XMLHttpRequestInterceptor3.prototype.checkEnvironment = function() { - return typeof window !== "undefined" && typeof window.XMLHttpRequest !== "undefined"; - }; - XMLHttpRequestInterceptor3.prototype.setup = function() { - var log = this.log.extend("setup"); - log('patching "XMLHttpRequest" module...'); - var PureXMLHttpRequest = window.XMLHttpRequest; - outvariant_1.invariant(!PureXMLHttpRequest[glossary_1.IS_PATCHED_MODULE], 'Failed to patch the "XMLHttpRequest" module: already patched.'); - window.XMLHttpRequest = XMLHttpRequestOverride_1.createXMLHttpRequestOverride({ - XMLHttpRequest: PureXMLHttpRequest, - emitter: this.emitter, - log: this.log - }); - log('native "XMLHttpRequest" module patched!', window.XMLHttpRequest.name); - Object.defineProperty(window.XMLHttpRequest, glossary_1.IS_PATCHED_MODULE, { - enumerable: true, - configurable: true, - value: true - }); - this.subscriptions.push(function() { - Object.defineProperty(window.XMLHttpRequest, glossary_1.IS_PATCHED_MODULE, { - value: void 0 - }); - window.XMLHttpRequest = PureXMLHttpRequest; - log('native "XMLHttpRequest" module restored!', window.XMLHttpRequest.name); - }); - }; - XMLHttpRequestInterceptor3.symbol = Symbol("xhr"); - return XMLHttpRequestInterceptor3; - }(Interceptor_1.Interceptor); - exports.XMLHttpRequestInterceptor = XMLHttpRequestInterceptor2; - } - }); - - // node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/MemoryLeakError.js - var require_MemoryLeakError = __commonJS({ - "node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MemoryLeakError = void 0; - var MemoryLeakError = class extends Error { - constructor(emitter, type, count) { - super(`Possible EventEmitter memory leak detected. ${count} ${type.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`); - this.emitter = emitter; - this.type = type; - this.count = count; - this.name = "MaxListenersExceededWarning"; - } - }; - exports.MemoryLeakError = MemoryLeakError; - } - }); - - // node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/Emitter.js - var require_Emitter = __commonJS({ - "node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/Emitter.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Emitter = void 0; - var MemoryLeakError_1 = require_MemoryLeakError(); - var Emitter2 = class { - constructor() { - this.events = /* @__PURE__ */ new Map(); - this.maxListeners = Emitter2.defaultMaxListeners; - this.hasWarnedAboutPotentialMemoryLeak = false; - } - static listenerCount(emitter, eventName) { - return emitter.listenerCount(eventName); - } - _emitInternalEvent(internalEventName, eventName, listener) { - this.emit( - internalEventName, - ...[eventName, listener] - ); - } - _getListeners(eventName) { - return this.events.get(eventName) || []; - } - _removeListener(listeners, listener) { - const index = listeners.indexOf(listener); - if (index > -1) { - listeners.splice(index, 1); - } - return []; - } - _wrapOnceListener(eventName, listener) { - const onceListener = (...data2) => { - this.removeListener(eventName, onceListener); - listener.apply(this, data2); - }; - return onceListener; - } - setMaxListeners(maxListeners) { - this.maxListeners = maxListeners; - return this; - } - getMaxListeners() { - return this.maxListeners; - } - eventNames() { - return Array.from(this.events.keys()); - } - emit(eventName, ...data2) { - const listeners = this._getListeners(eventName); - listeners.forEach((listener) => { - listener.apply(this, data2); - }); - return listeners.length > 0; - } - addListener(eventName, listener) { - this._emitInternalEvent("newListener", eventName, listener); - const nextListeners = this._getListeners(eventName).concat(listener); - this.events.set(eventName, nextListeners); - if (this.maxListeners > 0 && this.listenerCount(eventName) > this.maxListeners && !this.hasWarnedAboutPotentialMemoryLeak) { - this.hasWarnedAboutPotentialMemoryLeak = true; - const memoryLeakWarning = new MemoryLeakError_1.MemoryLeakError(this, eventName, this.listenerCount(eventName)); - console.warn(memoryLeakWarning); - } - return this; - } - on(eventName, listener) { - return this.addListener(eventName, listener); - } - once(eventName, listener) { - return this.addListener(eventName, this._wrapOnceListener(eventName, listener)); - } - prependListener(eventName, listener) { - const listeners = this._getListeners(eventName); - if (listeners.length > 0) { - const nextListeners = [listener].concat(listeners); - this.events.set(eventName, nextListeners); - } else { - this.events.set(eventName, listeners.concat(listener)); - } - return this; - } - prependOnceListener(eventName, listener) { - return this.prependListener(eventName, this._wrapOnceListener(eventName, listener)); - } - removeListener(eventName, listener) { - const listeners = this._getListeners(eventName); - if (listeners.length > 0) { - this._removeListener(listeners, listener); - this.events.set(eventName, listeners); - this._emitInternalEvent("removeListener", eventName, listener); - } - return this; - } - off(eventName, listener) { - return this.removeListener(eventName, listener); - } - removeAllListeners(eventName) { - if (eventName) { - this.events.delete(eventName); - } else { - this.events.clear(); - } - return this; - } - listeners(eventName) { - return Array.from(this._getListeners(eventName)); - } - listenerCount(eventName) { - return this._getListeners(eventName).length; - } - rawListeners(eventName) { - return this.listeners(eventName); - } - }; - exports.Emitter = Emitter2; - Emitter2.defaultMaxListeners = 10; - } - }); - - // node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/index.js - var require_lib9 = __commonJS({ - "node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - __exportStar(require_Emitter(), exports); - __exportStar(require_MemoryLeakError(), exports); - } - }); - - // src/index.ts - var src_exports = {}; - __export(src_exports, { - GraphQLHandler: () => GraphQLHandler, - MockedRequest: () => MockedRequest, - RESTMethods: () => RESTMethods, - RequestHandler: () => RequestHandler, - RestHandler: () => RestHandler, - SetupApi: () => SetupApi, - SetupWorkerApi: () => SetupWorkerApi, - cleanUrl: () => cleanUrl, - compose: () => compose, - context: () => context_exports, - createResponseComposition: () => createResponseComposition, - defaultContext: () => defaultContext, - defaultResponse: () => defaultResponse, - graphql: () => graphql, - graphqlContext: () => graphqlContext, - handleRequest: () => handleRequest, - matchRequestUrl: () => matchRequestUrl, - response: () => response, - rest: () => rest, - restContext: () => restContext, - setupWorker: () => setupWorker - }); - - // src/context/index.ts - var context_exports = {}; - __export(context_exports, { - body: () => body, - cookie: () => cookie, - data: () => data, - delay: () => delay, - errors: () => errors, - extensions: () => extensions, - fetch: () => fetch, - json: () => json, - set: () => set, - status: () => status, - text: () => text, - xml: () => xml - }); - - // node_modules/.pnpm/statuses@2.0.1/node_modules/statuses/codes.json - var codes_default = { - "100": "Continue", - "101": "Switching Protocols", - "102": "Processing", - "103": "Early Hints", - "200": "OK", - "201": "Created", - "202": "Accepted", - "203": "Non-Authoritative Information", - "204": "No Content", - "205": "Reset Content", - "206": "Partial Content", - "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", - "300": "Multiple Choices", - "301": "Moved Permanently", - "302": "Found", - "303": "See Other", - "304": "Not Modified", - "305": "Use Proxy", - "307": "Temporary Redirect", - "308": "Permanent Redirect", - "400": "Bad Request", - "401": "Unauthorized", - "402": "Payment Required", - "403": "Forbidden", - "404": "Not Found", - "405": "Method Not Allowed", - "406": "Not Acceptable", - "407": "Proxy Authentication Required", - "408": "Request Timeout", - "409": "Conflict", - "410": "Gone", - "411": "Length Required", - "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", - "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", - "417": "Expectation Failed", - "418": "I'm a Teapot", - "421": "Misdirected Request", - "422": "Unprocessable Entity", - "423": "Locked", - "424": "Failed Dependency", - "425": "Too Early", - "426": "Upgrade Required", - "428": "Precondition Required", - "429": "Too Many Requests", - "431": "Request Header Fields Too Large", - "451": "Unavailable For Legal Reasons", - "500": "Internal Server Error", - "501": "Not Implemented", - "502": "Bad Gateway", - "503": "Service Unavailable", - "504": "Gateway Timeout", - "505": "HTTP Version Not Supported", - "506": "Variant Also Negotiates", - "507": "Insufficient Storage", - "508": "Loop Detected", - "509": "Bandwidth Limit Exceeded", - "510": "Not Extended", - "511": "Network Authentication Required" - }; - - // src/context/status.ts - var status = (statusCode, statusText) => { - return (res) => { - res.status = statusCode; - res.statusText = statusText || codes_default[String(statusCode)]; - return res; - }; - }; - - // node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/lib/index.mjs - var __create2 = Object.create; - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __getProtoOf2 = Object.getPrototypeOf; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __commonJS2 = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( - isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var require_set_cookie = __commonJS2({ - "node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) { - "use strict"; - var defaultParseOptions = { - decodeValues: true, - map: false, - silent: false - }; - function isNonEmptyString(str) { - return typeof str === "string" && !!str.trim(); - } - function parseString(setCookieValue, options) { - var parts = setCookieValue.split(";").filter(isNonEmptyString); - var nameValuePairStr = parts.shift(); - var parsed = parseNameValuePair(nameValuePairStr); - var name = parsed.name; - var value = parsed.value; - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - try { - value = options.decodeValues ? decodeURIComponent(value) : value; - } catch (e) { - console.error( - "set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.", - e - ); - } - var cookie2 = { - name, - value - }; - parts.forEach(function(part) { - var sides = part.split("="); - var key = sides.shift().trimLeft().toLowerCase(); - var value2 = sides.join("="); - if (key === "expires") { - cookie2.expires = new Date(value2); - } else if (key === "max-age") { - cookie2.maxAge = parseInt(value2, 10); - } else if (key === "secure") { - cookie2.secure = true; - } else if (key === "httponly") { - cookie2.httpOnly = true; - } else if (key === "samesite") { - cookie2.sameSite = value2; - } else { - cookie2[key] = value2; - } - }); - return cookie2; - } - function parseNameValuePair(nameValuePairStr) { - var name = ""; - var value = ""; - var nameValueArr = nameValuePairStr.split("="); - if (nameValueArr.length > 1) { - name = nameValueArr.shift(); - value = nameValueArr.join("="); - } else { - value = nameValuePairStr; - } - return { name, value }; - } - function parse5(input, options) { - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!input) { - if (!options.map) { - return []; - } else { - return {}; - } - } - if (input.headers) { - if (typeof input.headers.getSetCookie === "function") { - input = input.headers.getSetCookie(); - } else if (input.headers["set-cookie"]) { - input = input.headers["set-cookie"]; - } else { - var sch = input.headers[Object.keys(input.headers).find(function(key) { - return key.toLowerCase() === "set-cookie"; - })]; - if (!sch && input.headers.cookie && !options.silent) { - console.warn( - "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning." - ); - } - input = sch; - } - } - if (!Array.isArray(input)) { - input = [input]; - } - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!options.map) { - return input.filter(isNonEmptyString).map(function(str) { - return parseString(str, options); - }); - } else { - var cookies = {}; - return input.filter(isNonEmptyString).reduce(function(cookies2, str) { - var cookie2 = parseString(str, options); - cookies2[cookie2.name] = cookie2; - return cookies2; - }, cookies); - } - } - function splitCookiesString2(cookiesString) { - if (Array.isArray(cookiesString)) { - return cookiesString; - } - if (typeof cookiesString !== "string") { - return []; - } - var cookiesStrings = []; - var pos = 0; - var start; - var ch; - var lastComma; - var nextStart; - var cookiesSeparatorFound; - function skipWhitespace() { - while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { - pos += 1; - } - return pos < cookiesString.length; - } - function notSpecialChar() { - ch = cookiesString.charAt(pos); - return ch !== "=" && ch !== ";" && ch !== ","; - } - while (pos < cookiesString.length) { - start = pos; - cookiesSeparatorFound = false; - while (skipWhitespace()) { - ch = cookiesString.charAt(pos); - if (ch === ",") { - lastComma = pos; - pos += 1; - skipWhitespace(); - nextStart = pos; - while (pos < cookiesString.length && notSpecialChar()) { - pos += 1; - } - if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { - cookiesSeparatorFound = true; - pos = nextStart; - cookiesStrings.push(cookiesString.substring(start, lastComma)); - start = pos; - } else { - pos = lastComma + 1; - } - } else { - pos += 1; - } - } - if (!cookiesSeparatorFound || pos >= cookiesString.length) { - cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); - } - } - return cookiesStrings; - } - module.exports = parse5; - module.exports.parse = parse5; - module.exports.parseString = parseString; - module.exports.splitCookiesString = splitCookiesString2; - } - }); - var import_set_cookie_parser = __toESM2(require_set_cookie()); - var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i; - function normalizeHeaderName(name) { - if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === "") { - throw new TypeError("Invalid character in header field name"); - } - return name.trim().toLowerCase(); - } - var charCodesToRemove = [ - String.fromCharCode(10), - String.fromCharCode(13), - String.fromCharCode(9), - String.fromCharCode(32) - ]; - var HEADER_VALUE_REMOVE_REGEXP = new RegExp( - `(^[${charCodesToRemove.join("")}]|$[${charCodesToRemove.join("")}])`, - "g" - ); - function normalizeHeaderValue(value) { - const nextValue = value.replace(HEADER_VALUE_REMOVE_REGEXP, ""); - return nextValue; - } - function isValidHeaderName(value) { - if (typeof value !== "string") { - return false; - } - if (value.length === 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const character = value.charCodeAt(i); - if (character > 127 || !isToken(character)) { - return false; - } - } - return true; - } - function isToken(value) { - return ![ - 127, - 32, - "(", - ")", - "<", - ">", - "@", - ",", - ";", - ":", - "\\", - '"', - "/", - "[", - "]", - "?", - "=", - "{", - "}" - ].includes(value); - } - function isValidHeaderValue(value) { - if (typeof value !== "string") { - return false; - } - if (value.trim() !== value) { - return false; - } - for (let i = 0; i < value.length; i++) { - const character = value.charCodeAt(i); - if (character === 0 || character === 10 || character === 13) { - return false; - } - } - return true; - } - var NORMALIZED_HEADERS = Symbol("normalizedHeaders"); - var RAW_HEADER_NAMES = Symbol("rawHeaderNames"); - var HEADER_VALUE_DELIMITER = ", "; - var _a; - var _b; - var HeadersPolyfill = class { - constructor(init) { - this[_a] = {}; - this[_b] = /* @__PURE__ */ new Map(); - if (["Headers", "HeadersPolyfill"].includes(init == null ? void 0 : init.constructor.name) || init instanceof HeadersPolyfill) { - const initialHeaders = init; - initialHeaders.forEach((value, name) => { - this.append(name, value); - }, this); - } else if (Array.isArray(init)) { - init.forEach(([name, value]) => { - this.append( - name, - Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value - ); - }); - } else if (init) { - Object.getOwnPropertyNames(init).forEach((name) => { - const value = init[name]; - this.append( - name, - Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value - ); - }); - } - } - [(_a = NORMALIZED_HEADERS, _b = RAW_HEADER_NAMES, Symbol.iterator)]() { - return this.entries(); - } - *keys() { - for (const [name] of this.entries()) { - yield name; - } - } - *values() { - for (const [, value] of this.entries()) { - yield value; - } - } - *entries() { - let sortedKeys = Object.keys(this[NORMALIZED_HEADERS]).sort( - (a, b) => a.localeCompare(b) - ); - for (const name of sortedKeys) { - if (name === "set-cookie") { - for (const value of this.getSetCookie()) { - yield [name, value]; - } - } else { - yield [name, this.get(name)]; - } - } - } - has(name) { - if (!isValidHeaderName(name)) { - throw new TypeError(`Invalid header name "${name}"`); - } - return this[NORMALIZED_HEADERS].hasOwnProperty(normalizeHeaderName(name)); - } - get(name) { - var _a2; - if (!isValidHeaderName(name)) { - throw TypeError(`Invalid header name "${name}"`); - } - return (_a2 = this[NORMALIZED_HEADERS][normalizeHeaderName(name)]) != null ? _a2 : null; - } - set(name, value) { - if (!isValidHeaderName(name) || !isValidHeaderValue(value)) { - return; - } - const normalizedName = normalizeHeaderName(name); - const normalizedValue = normalizeHeaderValue(value); - this[NORMALIZED_HEADERS][normalizedName] = normalizeHeaderValue(normalizedValue); - this[RAW_HEADER_NAMES].set(normalizedName, name); - } - append(name, value) { - if (!isValidHeaderName(name) || !isValidHeaderValue(value)) { - return; - } - const normalizedName = normalizeHeaderName(name); - const normalizedValue = normalizeHeaderValue(value); - let resolvedValue = this.has(normalizedName) ? `${this.get(normalizedName)}, ${normalizedValue}` : normalizedValue; - this.set(name, resolvedValue); - } - delete(name) { - if (!isValidHeaderName(name)) { - return; - } - if (!this.has(name)) { - return; - } - const normalizedName = normalizeHeaderName(name); - delete this[NORMALIZED_HEADERS][normalizedName]; - this[RAW_HEADER_NAMES].delete(normalizedName); - } - all() { - return this[NORMALIZED_HEADERS]; - } - raw() { - const rawHeaders = {}; - for (const [name, value] of this.entries()) { - rawHeaders[this[RAW_HEADER_NAMES].get(name)] = value; - } - return rawHeaders; - } - forEach(callback, thisArg) { - for (const [name, value] of this.entries()) { - callback.call(thisArg, value, name, this); - } - } - getSetCookie() { - const setCookieHeader = this.get("set-cookie"); - if (setCookieHeader === null) { - return []; - } - if (setCookieHeader === "") { - return [""]; - } - return (0, import_set_cookie_parser.splitCookiesString)(setCookieHeader); - } - }; - var singleValueHeaders = ["user-agent"]; - function headersToObject(headers) { - const headersObject = {}; - headers.forEach((value, name) => { - const isMultiValue = !singleValueHeaders.includes(name.toLowerCase()) && value.includes(","); - headersObject[name] = isMultiValue ? value.split(",").map((s) => s.trim()) : value; - }); - return headersObject; - } - function stringToHeaders(str) { - const lines = str.trim().split(/[\r\n]+/); - return lines.reduce((headers, line) => { - if (line.trim() === "") { - return headers; - } - const parts = line.split(": "); - const name = parts.shift(); - const value = parts.join(": "); - headers.append(name, value); - return headers; - }, new HeadersPolyfill()); - } - function reduceHeadersObject(headers, reducer, initialState) { - return Object.keys(headers).reduce((nextHeaders, name) => { - return reducer(nextHeaders, name, headers[name]); - }, initialState); - } - function objectToHeaders(headersObject) { - return reduceHeadersObject( - headersObject, - (headers, name, value) => { - const values = [].concat(value).filter(Boolean); - values.forEach((value2) => { - headers.append(name, value2); - }); - return headers; - }, - new HeadersPolyfill() - ); - } - function flattenHeadersObject(headersObject) { - return reduceHeadersObject( - headersObject, - (headers, name, value) => { - headers[name] = [].concat(value).join(", "); - return headers; - }, - {} - ); - } - - // src/context/set.ts - function set(...args) { - return (res) => { - const [name, value] = args; - if (typeof name === "string") { - res.headers.append(name, value); - } else { - const headers = objectToHeaders(name); - headers.forEach((value2, name2) => { - res.headers.append(name2, value2); - }); - } - return res; - }; - } - - // src/context/cookie.ts - var cookieUtils = __toESM(require_cookie()); - var cookie = (name, value, options) => { - return (res) => { - const serializedCookie = cookieUtils.serialize(name, value, options); - res.headers.append("Set-Cookie", serializedCookie); - if (typeof document !== "undefined") { - document.cookie = serializedCookie; - } - return res; - }; - }; - - // src/context/body.ts - var body = (value) => { - return (res) => { - res.body = value; - return res; - }; - }; - - // src/utils/internal/jsonParse.ts - function jsonParse(value) { - try { - return JSON.parse(value); - } catch (error2) { - return void 0; - } - } - - // src/utils/internal/isObject.ts - function isObject(value) { - return value != null && typeof value === "object" && !Array.isArray(value); - } - - // src/utils/internal/mergeRight.ts - function mergeRight(left, right) { - return Object.entries(right).reduce((result, [key, rightValue]) => { - const leftValue = result[key]; - if (Array.isArray(leftValue) && Array.isArray(rightValue)) { - result[key] = leftValue.concat(rightValue); - return result; - } - if (isObject(leftValue) && isObject(rightValue)) { - result[key] = mergeRight(leftValue, rightValue); - return result; - } - result[key] = rightValue; - return result; - }, Object.assign({}, left)); - } - - // src/context/json.ts - var json = (body2) => { - return (res) => { - res.headers.set("Content-Type", "application/json"); - res.body = JSON.stringify(body2); - return res; - }; - }; - - // src/context/data.ts - var data = (payload) => { - return (res) => { - const prevBody = jsonParse(res.body) || {}; - const nextBody = mergeRight(prevBody, { data: payload }); - return json(nextBody)(res); - }; - }; - - // src/context/extensions.ts - var extensions = (payload) => { - return (res) => { - const prevBody = jsonParse(res.body) || {}; - const nextBody = mergeRight(prevBody, { extensions: payload }); - return json(nextBody)(res); - }; - }; - - // node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/lib/index.mjs - function isNodeProcess() { - if (typeof navigator !== "undefined" && navigator.product === "ReactNative") { - return true; - } - if (typeof process !== "undefined") { - const type = process.type; - if (type === "renderer" || type === "worker") { - return false; - } - return !!(process.versions && process.versions.node); - } - return false; - } - - // src/context/delay.ts - var SET_TIMEOUT_MAX_ALLOWED_INT = 2147483647; - var MIN_SERVER_RESPONSE_TIME = 100; - var MAX_SERVER_RESPONSE_TIME = 400; - var NODE_SERVER_RESPONSE_TIME = 5; - var getRandomServerResponseTime = () => { - if (isNodeProcess()) { - return NODE_SERVER_RESPONSE_TIME; - } - return Math.floor( - Math.random() * (MAX_SERVER_RESPONSE_TIME - MIN_SERVER_RESPONSE_TIME) + MIN_SERVER_RESPONSE_TIME - ); - }; - var delay = (durationOrMode) => { - return (res) => { - let delayTime; - if (typeof durationOrMode === "string") { - switch (durationOrMode) { - case "infinite": { - delayTime = SET_TIMEOUT_MAX_ALLOWED_INT; - break; - } - case "real": { - delayTime = getRandomServerResponseTime(); - break; - } - default: { - throw new Error( - `Failed to delay a response: unknown delay mode "${durationOrMode}". Please make sure you provide one of the supported modes ("real", "infinite") or a number to "ctx.delay".` - ); - } - } - } else if (typeof durationOrMode === "undefined") { - delayTime = getRandomServerResponseTime(); - } else { - if (durationOrMode > SET_TIMEOUT_MAX_ALLOWED_INT) { - throw new Error( - `Failed to delay a response: provided delay duration (${durationOrMode}) exceeds the maximum allowed duration for "setTimeout" (${SET_TIMEOUT_MAX_ALLOWED_INT}). This will cause the response to be returned immediately. Please use a number within the allowed range to delay the response by exact duration, or consider the "infinite" delay mode to delay the response indefinitely.` - ); - } - delayTime = durationOrMode; - } - res.delay = delayTime; - return res; - }; - }; - - // src/context/errors.ts - var errors = (errorsList) => { - return (res) => { - if (errorsList == null) { - return res; - } - const prevBody = jsonParse(res.body) || {}; - const nextBody = mergeRight(prevBody, { errors: errorsList }); - return json(nextBody)(res); - }; - }; - - // src/context/fetch.ts - var useFetch = isNodeProcess() ? (input, init) => Promise.resolve().then(() => __toESM(require_browser())).then( - ({ default: nodeFetch }) => nodeFetch(input, init) - ) : globalThis.fetch; - var augmentRequestInit = (requestInit) => { - const headers = new HeadersPolyfill(requestInit.headers); - headers.set("x-msw-bypass", "true"); - return { - ...requestInit, - headers: headers.all() - }; - }; - var createFetchRequestParameters = (input) => { - const { body: body2, method } = input; - const requestParameters = { - ...input, - body: void 0 - }; - if (["GET", "HEAD"].includes(method)) { - return requestParameters; - } - if (typeof body2 === "object" || typeof body2 === "number" || typeof body2 === "boolean") { - requestParameters.body = JSON.stringify(body2); - } else { - requestParameters.body = body2; - } - return requestParameters; - }; - var fetch = (input, requestInit = {}) => { - if (typeof input === "string") { - return useFetch(input, augmentRequestInit(requestInit)); - } - const requestParameters = createFetchRequestParameters(input); - const derivedRequestInit = augmentRequestInit(requestParameters); - return useFetch(input.url.href, derivedRequestInit); - }; - - // src/context/text.ts - var text = (body2) => { - return (res) => { - res.headers.set("Content-Type", "text/plain"); - res.body = body2; - return res; - }; - }; - - // src/context/xml.ts - var xml = (body2) => { - return (res) => { - res.headers.set("Content-Type", "text/xml"); - res.body = body2; - return res; - }; - }; - - // node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.mjs - var POSITIONALS_EXP = /(%?)(%([sdjo]))/g; - function serializePositional(positional, flag) { - switch (flag) { - case "s": - return positional; - case "d": - case "i": - return Number(positional); - case "j": - return JSON.stringify(positional); - case "o": { - if (typeof positional === "string") { - return positional; - } - const json2 = JSON.stringify(positional); - if (json2 === "{}" || json2 === "[]" || /^\[object .+?\]$/.test(json2)) { - return positional; - } - return json2; - } - } - } - function format(message, ...positionals) { - if (positionals.length === 0) { - return message; - } - let positionalIndex = 0; - let formattedMessage = message.replace( - POSITIONALS_EXP, - (match2, isEscaped, _, flag) => { - const positional = positionals[positionalIndex]; - const value = serializePositional(positional, flag); - if (!isEscaped) { - positionalIndex++; - return value; - } - return match2; - } - ); - if (positionalIndex < positionals.length) { - formattedMessage += ` ${positionals.slice(positionalIndex).join(" ")}`; - } - formattedMessage = formattedMessage.replace(/%{2,2}/g, "%"); - return formattedMessage; - } - var STACK_FRAMES_TO_IGNORE = 2; - function cleanErrorStack(error2) { - if (!error2.stack) { - return; - } - const nextStack = error2.stack.split("\n"); - nextStack.splice(1, STACK_FRAMES_TO_IGNORE); - error2.stack = nextStack.join("\n"); - } - var InvariantError = class extends Error { - constructor(message, ...positionals) { - super(message); - this.message = message; - this.name = "Invariant Violation"; - this.message = format(message, ...positionals); - cleanErrorStack(this); - } - }; - var invariant = (predicate, message, ...positionals) => { - if (!predicate) { - throw new InvariantError(message, ...positionals); - } - }; - invariant.as = (ErrorConstructor, predicate, message, ...positionals) => { - if (!predicate) { - const isConstructor = ErrorConstructor.prototype.name != null; - const error2 = isConstructor ? new ErrorConstructor(format(message, positionals)) : ErrorConstructor(format(message, positionals)); - throw error2; - } - }; - - // src/utils/internal/devUtils.ts - var LIBRARY_PREFIX = "[MSW]"; - function formatMessage(message, ...positionals) { - const interpolatedMessage = format(message, ...positionals); - return `${LIBRARY_PREFIX} ${interpolatedMessage}`; - } - function warn(message, ...positionals) { - console.warn(formatMessage(message, ...positionals)); - } - function error(message, ...positionals) { - console.error(formatMessage(message, ...positionals)); - } - var devUtils = { - formatMessage, - warn, - error - }; - - // src/utils/internal/checkGlobals.ts - function checkGlobals() { - invariant( - typeof URL !== "undefined", - devUtils.formatMessage( - `Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".` - ) - ); - } - - // src/setupWorker/start/createStartHandler.ts - var import_until4 = __toESM(require_lib()); - - // src/setupWorker/start/utils/getWorkerInstance.ts - var import_until = __toESM(require_lib()); - - // src/setupWorker/start/utils/getWorkerByRegistration.ts - function getWorkerByRegistration(registration, absoluteWorkerUrl, findWorker) { - const allStates = [ - registration.active, - registration.installing, - registration.waiting - ]; - const relevantStates = allStates.filter((state) => { - return state != null; - }); - const worker = relevantStates.find((worker2) => { - return findWorker(worker2.scriptURL, absoluteWorkerUrl); - }); - return worker || null; - } - - // src/utils/url/getAbsoluteWorkerUrl.ts - function getAbsoluteWorkerUrl(workerUrl) { - return new URL(workerUrl, location.href).href; - } - - // src/setupWorker/start/utils/getWorkerInstance.ts - var getWorkerInstance = async (url, options = {}, findWorker) => { - const absoluteWorkerUrl = getAbsoluteWorkerUrl(url); - const mockRegistrations = await navigator.serviceWorker.getRegistrations().then( - (registrations) => registrations.filter( - (registration) => getWorkerByRegistration(registration, absoluteWorkerUrl, findWorker) - ) - ); - if (!navigator.serviceWorker.controller && mockRegistrations.length > 0) { - location.reload(); - } - const [existingRegistration] = mockRegistrations; - if (existingRegistration) { - return existingRegistration.update().then(() => { - return [ - getWorkerByRegistration( - existingRegistration, - absoluteWorkerUrl, - findWorker - ), - existingRegistration - ]; - }); - } - const [error2, instance] = await (0, import_until.until)( - async () => { - const registration = await navigator.serviceWorker.register(url, options); - return [ - getWorkerByRegistration(registration, absoluteWorkerUrl, findWorker), - registration - ]; - } - ); - if (error2) { - const isWorkerMissing = error2.message.includes("(404)"); - if (isWorkerMissing) { - const scopeUrl = new URL((options == null ? void 0 : options.scope) || "/", location.href); - throw new Error( - devUtils.formatMessage(`Failed to register a Service Worker for scope ('${scopeUrl.href}') with script ('${absoluteWorkerUrl}'): Service Worker script does not exist at the given path. - -Did you forget to run "npx msw init "? - -Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`) - ); - } - throw new Error( - devUtils.formatMessage( - "Failed to register the Service Worker:\n\n%s", - error2.message - ) - ); - } - return instance; - }; - - // src/setupWorker/start/utils/printStartMessage.ts - function printStartMessage(args = {}) { - if (args.quiet) { - return; - } - const message = args.message || "Mocking enabled."; - console.groupCollapsed( - `%c${devUtils.formatMessage(message)}`, - "color:orangered;font-weight:bold;" - ); - console.log( - "%cDocumentation: %chttps://mswjs.io/docs", - "font-weight:bold", - "font-weight:normal" - ); - console.log("Found an issue? https://github.com/mswjs/msw/issues"); - if (args.workerUrl) { - console.log("Worker script URL:", args.workerUrl); - } - if (args.workerScope) { - console.log("Worker scope:", args.workerScope); - } - console.groupEnd(); - } - - // src/setupWorker/start/utils/enableMocking.ts - async function enableMocking(context, options) { - var _a2, _b2; - context.workerChannel.send("MOCK_ACTIVATE"); - await context.events.once("MOCKING_ENABLED"); - if (context.isMockingEnabled) { - devUtils.warn( - `Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.` - ); - return; - } - context.isMockingEnabled = true; - printStartMessage({ - quiet: options.quiet, - workerScope: (_a2 = context.registration) == null ? void 0 : _a2.scope, - workerUrl: (_b2 = context.worker) == null ? void 0 : _b2.scriptURL - }); - } - - // src/setupWorker/start/utils/createMessageChannel.ts - var WorkerChannel = class { - constructor(port) { - this.port = port; - } - postMessage(event, ...rest2) { - const [data2, transfer] = rest2; - this.port.postMessage({ type: event, data: data2 }, { transfer }); - } - }; - - // src/utils/NetworkError.ts - var NetworkError = class extends Error { - constructor(message) { - super(message); - this.name = "NetworkError"; - } - }; - - // src/utils/request/parseWorkerRequest.ts - var import_interceptors2 = __toESM(require_lib6()); - - // src/utils/request/MockedRequest.ts - var cookieUtils3 = __toESM(require_cookie()); - var import_cookies = __toESM(require_lib7()); - var import_interceptors = __toESM(require_lib6()); - var import_bufferUtils = __toESM(require_bufferUtils()); - - // src/utils/request/getRequestCookies.ts - var cookieUtils2 = __toESM(require_cookie()); - function getAllCookies() { - return cookieUtils2.parse(document.cookie); - } - function getRequestCookies(request) { - if (typeof document === "undefined" || typeof location === "undefined") { - return {}; - } - switch (request.credentials) { - case "same-origin": { - return location.origin === request.url.origin ? getAllCookies() : {}; - } - case "include": { - return getAllCookies(); - } - default: { - return {}; - } - } - } - - // src/utils/internal/parseMultipartData.ts - function parseContentHeaders(headersString) { - var _a2, _b2; - const headers = stringToHeaders(headersString); - const contentType = headers.get("content-type") || "text/plain"; - const disposition = headers.get("content-disposition"); - if (!disposition) { - throw new Error('"Content-Disposition" header is required.'); - } - const directives = disposition.split(";").reduce((acc, chunk) => { - const [name2, ...rest2] = chunk.trim().split("="); - acc[name2] = rest2.join("="); - return acc; - }, {}); - const name = (_a2 = directives.name) == null ? void 0 : _a2.slice(1, -1); - const filename = (_b2 = directives.filename) == null ? void 0 : _b2.slice(1, -1); - return { - name, - filename, - contentType - }; - } - function parseMultipartData(data2, headers) { - const contentType = headers == null ? void 0 : headers.get("content-type"); - if (!contentType) { - return void 0; - } - const [, ...directives] = contentType.split(/; */); - const boundary = directives.filter((d) => d.startsWith("boundary=")).map((s) => s.replace(/^boundary=/, ""))[0]; - if (!boundary) { - return void 0; - } - const boundaryRegExp = new RegExp(`--+${boundary}`); - const fields = data2.split(boundaryRegExp).filter((chunk) => chunk.startsWith("\r\n") && chunk.endsWith("\r\n")).map((chunk) => chunk.trimStart().replace(/\r\n$/, "")); - if (!fields.length) { - return void 0; - } - const parsedBody = {}; - try { - for (const field2 of fields) { - const [contentHeaders, ...rest2] = field2.split("\r\n\r\n"); - const contentBody = rest2.join("\r\n\r\n"); - const { contentType: contentType2, filename, name } = parseContentHeaders(contentHeaders); - const value = filename === void 0 ? contentBody : new File([contentBody], filename, { type: contentType2 }); - const parsedValue = parsedBody[name]; - if (parsedValue === void 0) { - parsedBody[name] = value; - } else if (Array.isArray(parsedValue)) { - parsedBody[name] = [...parsedValue, value]; - } else { - parsedBody[name] = [parsedValue, value]; - } - } - return parsedBody; - } catch (error2) { - return void 0; - } - } - - // src/utils/request/parseBody.ts - function parseBody(body2, headers) { - var _a2; - if (!body2) { - return body2; - } - const contentType = ((_a2 = headers == null ? void 0 : headers.get("content-type")) == null ? void 0 : _a2.toLowerCase()) || ""; - const hasMultipartContent = contentType.startsWith("multipart/form-data"); - if (hasMultipartContent && typeof body2 !== "object") { - return parseMultipartData(body2.toString(), headers) || body2; - } - const hasJsonContent = contentType.includes("json"); - if (hasJsonContent && typeof body2 !== "object") { - return jsonParse(body2.toString()) || body2; - } - return body2; - } - - // src/utils/internal/isStringEqual.ts - function isStringEqual(actual, expected) { - return actual.toLowerCase() === expected.toLowerCase(); - } - - // src/utils/request/MockedRequest.ts - var MockedRequest = class extends import_interceptors.IsomorphicRequest { - constructor(url, init = {}) { - super(url, init); - if (init.id) { - this.id = init.id; - } - this.cache = init.cache || "default"; - this.destination = init.destination || ""; - this.integrity = init.integrity || ""; - this.keepalive = init.keepalive || false; - this.mode = init.mode || "cors"; - this.priority = init.priority || "auto"; - this.redirect = init.redirect || "follow"; - this.referrer = init.referrer || ""; - this.referrerPolicy = init.referrerPolicy || "no-referrer"; - this.cookies = init.cookies || this.getCookies(); - } - get body() { - const text2 = (0, import_bufferUtils.decodeBuffer)(this["_body"]); - const body2 = parseBody(text2, this.headers); - if (isStringEqual(this.method, "GET") && body2 === "") { - return void 0; - } - return body2; - } - passthrough() { - return { - status: 101, - statusText: "Continue", - headers: new HeadersPolyfill(), - body: null, - passthrough: true, - once: false - }; - } - getCookies() { - var _a2; - const requestCookiesString = this.headers.get("cookie"); - const ownCookies = requestCookiesString ? cookieUtils3.parse(requestCookiesString) : {}; - import_cookies.store.hydrate(); - const cookiesFromStore = Array.from( - (_a2 = import_cookies.store.get({ ...this, url: this.url.href })) == null ? void 0 : _a2.entries() - ).reduce((cookies, [name, { value }]) => { - return Object.assign(cookies, { [name.trim()]: value }); - }, {}); - const cookiesFromDocument = getRequestCookies(this); - const forwardedCookies = { - ...cookiesFromDocument, - ...cookiesFromStore - }; - for (const [name, value] of Object.entries(forwardedCookies)) { - this.headers.append("cookie", `${name}=${value}`); - } - return { - ...forwardedCookies, - ...ownCookies - }; - } - }; - - // src/utils/request/parseWorkerRequest.ts - function parseWorkerRequest(rawRequest) { - const url = new URL(rawRequest.url); - const headers = new HeadersPolyfill(rawRequest.headers); - return new MockedRequest(url, { - ...rawRequest, - body: (0, import_interceptors2.encodeBuffer)(rawRequest.body || ""), - headers - }); - } - - // src/utils/handleRequest.ts - var import_until2 = __toESM(require_lib()); - - // src/utils/getResponse.ts - var getResponse = async (request, handlers, resolutionContext) => { - const relevantHandlers = handlers.filter((handler) => { - return handler.test(request, resolutionContext); - }); - if (relevantHandlers.length === 0) { - return { - handler: void 0, - response: void 0 - }; - } - const result = await relevantHandlers.reduce(async (executionResult, handler) => { - const previousResults = await executionResult; - if (!!(previousResults == null ? void 0 : previousResults.response)) { - return executionResult; - } - const result2 = await handler.run(request, resolutionContext); - if (result2 === null || result2.handler.shouldSkip) { - return null; - } - if (!result2.response) { - return { - request: result2.request, - handler: result2.handler, - response: void 0, - parsedResult: result2.parsedResult - }; - } - if (result2.response.once) { - handler.markAsSkipped(true); - } - return result2; - }, Promise.resolve(null)); - if (!result) { - return { - handler: void 0, - response: void 0 - }; - } - return { - handler: result.handler, - publicRequest: result.request, - parsedRequest: result.parsedResult, - response: result.response - }; - }; - - // src/utils/request/onUnhandledRequest.ts - var import_js_levenshtein = __toESM(require_js_levenshtein()); - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/devAssert.mjs - function devAssert(condition, message) { - const booleanCondition = Boolean(condition); - if (!booleanCondition) { - throw new Error(message); - } - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/isObjectLike.mjs - function isObjectLike(value) { - return typeof value == "object" && value !== null; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/invariant.mjs - function invariant2(condition, message) { - const booleanCondition = Boolean(condition); - if (!booleanCondition) { - throw new Error( - message != null ? message : "Unexpected invariant triggered." - ); - } - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/location.mjs - var LineRegExp = /\r\n|[\n\r]/g; - function getLocation(source, position) { - let lastLineStart = 0; - let line = 1; - for (const match2 of source.body.matchAll(LineRegExp)) { - typeof match2.index === "number" || invariant2(false); - if (match2.index >= position) { - break; - } - lastLineStart = match2.index + match2[0].length; - line += 1; - } - return { - line, - column: position + 1 - lastLineStart - }; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/printLocation.mjs - function printLocation(location2) { - return printSourceLocation( - location2.source, - getLocation(location2.source, location2.start) - ); - } - function printSourceLocation(source, sourceLocation) { - const firstLineColumnOffset = source.locationOffset.column - 1; - const body2 = "".padStart(firstLineColumnOffset) + source.body; - const lineIndex = sourceLocation.line - 1; - const lineOffset = source.locationOffset.line - 1; - const lineNum = sourceLocation.line + lineOffset; - const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; - const columnNum = sourceLocation.column + columnOffset; - const locationStr = `${source.name}:${lineNum}:${columnNum} -`; - const lines = body2.split(/\r\n|[\n\r]/g); - const locationLine = lines[lineIndex]; - if (locationLine.length > 120) { - const subLineIndex = Math.floor(columnNum / 80); - const subLineColumnNum = columnNum % 80; - const subLines = []; - for (let i = 0; i < locationLine.length; i += 80) { - subLines.push(locationLine.slice(i, i + 80)); - } - return locationStr + printPrefixedLines([ - [`${lineNum} |`, subLines[0]], - ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]), - ["|", "^".padStart(subLineColumnNum)], - ["|", subLines[subLineIndex + 1]] - ]); - } - return locationStr + printPrefixedLines([ - [`${lineNum - 1} |`, lines[lineIndex - 1]], - [`${lineNum} |`, locationLine], - ["|", "^".padStart(columnNum)], - [`${lineNum + 1} |`, lines[lineIndex + 1]] - ]); - } - function printPrefixedLines(lines) { - const existingLines = lines.filter(([_, line]) => line !== void 0); - const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); - return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n"); - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/GraphQLError.mjs - function toNormalizedOptions(args) { - const firstArg = args[0]; - if (firstArg == null || "kind" in firstArg || "length" in firstArg) { - return { - nodes: firstArg, - source: args[1], - positions: args[2], - path: args[3], - originalError: args[4], - extensions: args[5] - }; - } - return firstArg; - } - var GraphQLError = class extends Error { - constructor(message, ...rawArgs) { - var _this$nodes, _nodeLocations$, _ref; - const { nodes, source, positions, path, originalError, extensions: extensions2 } = toNormalizedOptions(rawArgs); - super(message); - this.name = "GraphQLError"; - this.path = path !== null && path !== void 0 ? path : void 0; - this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0; - this.nodes = undefinedIfEmpty( - Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0 - ); - const nodeLocations = undefinedIfEmpty( - (_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null) - ); - this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source; - this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start); - this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start)); - const originalExtensions = isObjectLike( - originalError === null || originalError === void 0 ? void 0 : originalError.extensions - ) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0; - this.extensions = (_ref = extensions2 !== null && extensions2 !== void 0 ? extensions2 : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null); - Object.defineProperties(this, { - message: { - writable: true, - enumerable: true - }, - name: { - enumerable: false - }, - nodes: { - enumerable: false - }, - source: { - enumerable: false - }, - positions: { - enumerable: false - }, - originalError: { - enumerable: false - } - }); - if (originalError !== null && originalError !== void 0 && originalError.stack) { - Object.defineProperty(this, "stack", { - value: originalError.stack, - writable: true, - configurable: true - }); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, GraphQLError); - } else { - Object.defineProperty(this, "stack", { - value: Error().stack, - writable: true, - configurable: true - }); - } - } - get [Symbol.toStringTag]() { - return "GraphQLError"; - } - toString() { - let output = this.message; - if (this.nodes) { - for (const node of this.nodes) { - if (node.loc) { - output += "\n\n" + printLocation(node.loc); - } - } - } else if (this.source && this.locations) { - for (const location2 of this.locations) { - output += "\n\n" + printSourceLocation(this.source, location2); - } - } - return output; - } - toJSON() { - const formattedError = { - message: this.message - }; - if (this.locations != null) { - formattedError.locations = this.locations; - } - if (this.path != null) { - formattedError.path = this.path; - } - if (this.extensions != null && Object.keys(this.extensions).length > 0) { - formattedError.extensions = this.extensions; - } - return formattedError; - } - }; - function undefinedIfEmpty(array) { - return array === void 0 || array.length === 0 ? void 0 : array; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/syntaxError.mjs - function syntaxError(source, position, description) { - return new GraphQLError(`Syntax Error: ${description}`, { - source, - positions: [position] - }); - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/ast.mjs - var Location = class { - constructor(startToken, endToken, source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - get [Symbol.toStringTag]() { - return "Location"; - } - toJSON() { - return { - start: this.start, - end: this.end - }; - } - }; - var Token = class { - constructor(kind, start, end, line, column, value) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = null; - this.next = null; - } - get [Symbol.toStringTag]() { - return "Token"; - } - toJSON() { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column - }; - } - }; - var QueryDocumentKeys = { - Name: [], - Document: ["definitions"], - OperationDefinition: [ - "name", - "variableDefinitions", - "directives", - "selectionSet" - ], - VariableDefinition: ["variable", "type", "defaultValue", "directives"], - Variable: ["name"], - SelectionSet: ["selections"], - Field: ["alias", "name", "arguments", "directives", "selectionSet"], - Argument: ["name", "value"], - FragmentSpread: ["name", "directives"], - InlineFragment: ["typeCondition", "directives", "selectionSet"], - FragmentDefinition: [ - "name", - "variableDefinitions", - "typeCondition", - "directives", - "selectionSet" - ], - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ["values"], - ObjectValue: ["fields"], - ObjectField: ["name", "value"], - Directive: ["name", "arguments"], - NamedType: ["name"], - ListType: ["type"], - NonNullType: ["type"], - SchemaDefinition: ["description", "directives", "operationTypes"], - OperationTypeDefinition: ["type"], - ScalarTypeDefinition: ["description", "name", "directives"], - ObjectTypeDefinition: [ - "description", - "name", - "interfaces", - "directives", - "fields" - ], - FieldDefinition: ["description", "name", "arguments", "type", "directives"], - InputValueDefinition: [ - "description", - "name", - "type", - "defaultValue", - "directives" - ], - InterfaceTypeDefinition: [ - "description", - "name", - "interfaces", - "directives", - "fields" - ], - UnionTypeDefinition: ["description", "name", "directives", "types"], - EnumTypeDefinition: ["description", "name", "directives", "values"], - EnumValueDefinition: ["description", "name", "directives"], - InputObjectTypeDefinition: ["description", "name", "directives", "fields"], - DirectiveDefinition: ["description", "name", "arguments", "locations"], - SchemaExtension: ["directives", "operationTypes"], - ScalarTypeExtension: ["name", "directives"], - ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], - InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], - UnionTypeExtension: ["name", "directives", "types"], - EnumTypeExtension: ["name", "directives", "values"], - InputObjectTypeExtension: ["name", "directives", "fields"] - }; - var kindValues = new Set(Object.keys(QueryDocumentKeys)); - var OperationTypeNode; - (function(OperationTypeNode2) { - OperationTypeNode2["QUERY"] = "query"; - OperationTypeNode2["MUTATION"] = "mutation"; - OperationTypeNode2["SUBSCRIPTION"] = "subscription"; - })(OperationTypeNode || (OperationTypeNode = {})); - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/directiveLocation.mjs - var DirectiveLocation; - (function(DirectiveLocation2) { - DirectiveLocation2["QUERY"] = "QUERY"; - DirectiveLocation2["MUTATION"] = "MUTATION"; - DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION"; - DirectiveLocation2["FIELD"] = "FIELD"; - DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION"; - DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD"; - DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT"; - DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION"; - DirectiveLocation2["SCHEMA"] = "SCHEMA"; - DirectiveLocation2["SCALAR"] = "SCALAR"; - DirectiveLocation2["OBJECT"] = "OBJECT"; - DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION"; - DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION"; - DirectiveLocation2["INTERFACE"] = "INTERFACE"; - DirectiveLocation2["UNION"] = "UNION"; - DirectiveLocation2["ENUM"] = "ENUM"; - DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE"; - DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT"; - DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION"; - })(DirectiveLocation || (DirectiveLocation = {})); - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/kinds.mjs - var Kind; - (function(Kind2) { - Kind2["NAME"] = "Name"; - Kind2["DOCUMENT"] = "Document"; - Kind2["OPERATION_DEFINITION"] = "OperationDefinition"; - Kind2["VARIABLE_DEFINITION"] = "VariableDefinition"; - Kind2["SELECTION_SET"] = "SelectionSet"; - Kind2["FIELD"] = "Field"; - Kind2["ARGUMENT"] = "Argument"; - Kind2["FRAGMENT_SPREAD"] = "FragmentSpread"; - Kind2["INLINE_FRAGMENT"] = "InlineFragment"; - Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition"; - Kind2["VARIABLE"] = "Variable"; - Kind2["INT"] = "IntValue"; - Kind2["FLOAT"] = "FloatValue"; - Kind2["STRING"] = "StringValue"; - Kind2["BOOLEAN"] = "BooleanValue"; - Kind2["NULL"] = "NullValue"; - Kind2["ENUM"] = "EnumValue"; - Kind2["LIST"] = "ListValue"; - Kind2["OBJECT"] = "ObjectValue"; - Kind2["OBJECT_FIELD"] = "ObjectField"; - Kind2["DIRECTIVE"] = "Directive"; - Kind2["NAMED_TYPE"] = "NamedType"; - Kind2["LIST_TYPE"] = "ListType"; - Kind2["NON_NULL_TYPE"] = "NonNullType"; - Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition"; - Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition"; - Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition"; - Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition"; - Kind2["FIELD_DEFINITION"] = "FieldDefinition"; - Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition"; - Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition"; - Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition"; - Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition"; - Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition"; - Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition"; - Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition"; - Kind2["SCHEMA_EXTENSION"] = "SchemaExtension"; - Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension"; - Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension"; - Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension"; - Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension"; - Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension"; - Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension"; - })(Kind || (Kind = {})); - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/characterClasses.mjs - function isWhiteSpace(code) { - return code === 9 || code === 32; - } - function isDigit(code) { - return code >= 48 && code <= 57; - } - function isLetter(code) { - return code >= 97 && code <= 122 || code >= 65 && code <= 90; - } - function isNameStart(code) { - return isLetter(code) || code === 95; - } - function isNameContinue(code) { - return isLetter(code) || isDigit(code) || code === 95; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/blockString.mjs - function dedentBlockStringLines(lines) { - var _firstNonEmptyLine2; - let commonIndent = Number.MAX_SAFE_INTEGER; - let firstNonEmptyLine = null; - let lastNonEmptyLine = -1; - for (let i = 0; i < lines.length; ++i) { - var _firstNonEmptyLine; - const line = lines[i]; - const indent = leadingWhitespace(line); - if (indent === line.length) { - continue; - } - firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i; - lastNonEmptyLine = i; - if (i !== 0 && indent < commonIndent) { - commonIndent = indent; - } - } - return lines.map((line, i) => i === 0 ? line : line.slice(commonIndent)).slice( - (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0, - lastNonEmptyLine + 1 - ); - } - function leadingWhitespace(str) { - let i = 0; - while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { - ++i; - } - return i; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/tokenKind.mjs - var TokenKind; - (function(TokenKind2) { - TokenKind2["SOF"] = ""; - TokenKind2["EOF"] = ""; - TokenKind2["BANG"] = "!"; - TokenKind2["DOLLAR"] = "$"; - TokenKind2["AMP"] = "&"; - TokenKind2["PAREN_L"] = "("; - TokenKind2["PAREN_R"] = ")"; - TokenKind2["SPREAD"] = "..."; - TokenKind2["COLON"] = ":"; - TokenKind2["EQUALS"] = "="; - TokenKind2["AT"] = "@"; - TokenKind2["BRACKET_L"] = "["; - TokenKind2["BRACKET_R"] = "]"; - TokenKind2["BRACE_L"] = "{"; - TokenKind2["PIPE"] = "|"; - TokenKind2["BRACE_R"] = "}"; - TokenKind2["NAME"] = "Name"; - TokenKind2["INT"] = "Int"; - TokenKind2["FLOAT"] = "Float"; - TokenKind2["STRING"] = "String"; - TokenKind2["BLOCK_STRING"] = "BlockString"; - TokenKind2["COMMENT"] = "Comment"; - })(TokenKind || (TokenKind = {})); - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/lexer.mjs - var Lexer = class { - constructor(source) { - const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0); - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - get [Symbol.toStringTag]() { - return "Lexer"; - } - advance() { - this.lastToken = this.token; - const token = this.token = this.lookahead(); - return token; - } - lookahead() { - let token = this.token; - if (token.kind !== TokenKind.EOF) { - do { - if (token.next) { - token = token.next; - } else { - const nextToken = readNextToken(this, token.end); - token.next = nextToken; - nextToken.prev = token; - token = nextToken; - } - } while (token.kind === TokenKind.COMMENT); - } - return token; - } - }; - function isPunctuatorTokenKind(kind) { - return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; - } - function isUnicodeScalarValue(code) { - return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111; - } - function isSupplementaryCodePoint(body2, location2) { - return isLeadingSurrogate(body2.charCodeAt(location2)) && isTrailingSurrogate(body2.charCodeAt(location2 + 1)); - } - function isLeadingSurrogate(code) { - return code >= 55296 && code <= 56319; - } - function isTrailingSurrogate(code) { - return code >= 56320 && code <= 57343; - } - function printCodePointAt(lexer2, location2) { - const code = lexer2.source.body.codePointAt(location2); - if (code === void 0) { - return TokenKind.EOF; - } else if (code >= 32 && code <= 126) { - const char = String.fromCodePoint(code); - return char === '"' ? `'"'` : `"${char}"`; - } - return "U+" + code.toString(16).toUpperCase().padStart(4, "0"); - } - function createToken(lexer2, kind, start, end, value) { - const line = lexer2.line; - const col = 1 + start - lexer2.lineStart; - return new Token(kind, start, end, line, col, value); - } - function readNextToken(lexer2, start) { - const body2 = lexer2.source.body; - const bodyLength = body2.length; - let position = start; - while (position < bodyLength) { - const code = body2.charCodeAt(position); - switch (code) { - case 65279: - case 9: - case 32: - case 44: - ++position; - continue; - case 10: - ++position; - ++lexer2.line; - lexer2.lineStart = position; - continue; - case 13: - if (body2.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - ++lexer2.line; - lexer2.lineStart = position; - continue; - case 35: - return readComment(lexer2, position); - case 33: - return createToken(lexer2, TokenKind.BANG, position, position + 1); - case 36: - return createToken(lexer2, TokenKind.DOLLAR, position, position + 1); - case 38: - return createToken(lexer2, TokenKind.AMP, position, position + 1); - case 40: - return createToken(lexer2, TokenKind.PAREN_L, position, position + 1); - case 41: - return createToken(lexer2, TokenKind.PAREN_R, position, position + 1); - case 46: - if (body2.charCodeAt(position + 1) === 46 && body2.charCodeAt(position + 2) === 46) { - return createToken(lexer2, TokenKind.SPREAD, position, position + 3); - } - break; - case 58: - return createToken(lexer2, TokenKind.COLON, position, position + 1); - case 61: - return createToken(lexer2, TokenKind.EQUALS, position, position + 1); - case 64: - return createToken(lexer2, TokenKind.AT, position, position + 1); - case 91: - return createToken(lexer2, TokenKind.BRACKET_L, position, position + 1); - case 93: - return createToken(lexer2, TokenKind.BRACKET_R, position, position + 1); - case 123: - return createToken(lexer2, TokenKind.BRACE_L, position, position + 1); - case 124: - return createToken(lexer2, TokenKind.PIPE, position, position + 1); - case 125: - return createToken(lexer2, TokenKind.BRACE_R, position, position + 1); - case 34: - if (body2.charCodeAt(position + 1) === 34 && body2.charCodeAt(position + 2) === 34) { - return readBlockString(lexer2, position); - } - return readString(lexer2, position); - } - if (isDigit(code) || code === 45) { - return readNumber(lexer2, position, code); - } - if (isNameStart(code)) { - return readName(lexer2, position); - } - throw syntaxError( - lexer2.source, - position, - code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body2, position) ? `Unexpected character: ${printCodePointAt(lexer2, position)}.` : `Invalid character: ${printCodePointAt(lexer2, position)}.` - ); - } - return createToken(lexer2, TokenKind.EOF, bodyLength, bodyLength); - } - function readComment(lexer2, start) { - const body2 = lexer2.source.body; - const bodyLength = body2.length; - let position = start + 1; - while (position < bodyLength) { - const code = body2.charCodeAt(position); - if (code === 10 || code === 13) { - break; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body2, position)) { - position += 2; - } else { - break; - } - } - return createToken( - lexer2, - TokenKind.COMMENT, - start, - position, - body2.slice(start + 1, position) - ); - } - function readNumber(lexer2, start, firstCode) { - const body2 = lexer2.source.body; - let position = start; - let code = firstCode; - let isFloat = false; - if (code === 45) { - code = body2.charCodeAt(++position); - } - if (code === 48) { - code = body2.charCodeAt(++position); - if (isDigit(code)) { - throw syntaxError( - lexer2.source, - position, - `Invalid number, unexpected digit after 0: ${printCodePointAt( - lexer2, - position - )}.` - ); - } - } else { - position = readDigits(lexer2, position, code); - code = body2.charCodeAt(position); - } - if (code === 46) { - isFloat = true; - code = body2.charCodeAt(++position); - position = readDigits(lexer2, position, code); - code = body2.charCodeAt(position); - } - if (code === 69 || code === 101) { - isFloat = true; - code = body2.charCodeAt(++position); - if (code === 43 || code === 45) { - code = body2.charCodeAt(++position); - } - position = readDigits(lexer2, position, code); - code = body2.charCodeAt(position); - } - if (code === 46 || isNameStart(code)) { - throw syntaxError( - lexer2.source, - position, - `Invalid number, expected digit but got: ${printCodePointAt( - lexer2, - position - )}.` - ); - } - return createToken( - lexer2, - isFloat ? TokenKind.FLOAT : TokenKind.INT, - start, - position, - body2.slice(start, position) - ); - } - function readDigits(lexer2, start, firstCode) { - if (!isDigit(firstCode)) { - throw syntaxError( - lexer2.source, - start, - `Invalid number, expected digit but got: ${printCodePointAt( - lexer2, - start - )}.` - ); - } - const body2 = lexer2.source.body; - let position = start + 1; - while (isDigit(body2.charCodeAt(position))) { - ++position; - } - return position; - } - function readString(lexer2, start) { - const body2 = lexer2.source.body; - const bodyLength = body2.length; - let position = start + 1; - let chunkStart = position; - let value = ""; - while (position < bodyLength) { - const code = body2.charCodeAt(position); - if (code === 34) { - value += body2.slice(chunkStart, position); - return createToken(lexer2, TokenKind.STRING, start, position + 1, value); - } - if (code === 92) { - value += body2.slice(chunkStart, position); - const escape = body2.charCodeAt(position + 1) === 117 ? body2.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer2, position) : readEscapedUnicodeFixedWidth(lexer2, position) : readEscapedCharacter(lexer2, position); - value += escape.value; - position += escape.size; - chunkStart = position; - continue; - } - if (code === 10 || code === 13) { - break; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body2, position)) { - position += 2; - } else { - throw syntaxError( - lexer2.source, - position, - `Invalid character within String: ${printCodePointAt( - lexer2, - position - )}.` - ); - } - } - throw syntaxError(lexer2.source, position, "Unterminated string."); - } - function readEscapedUnicodeVariableWidth(lexer2, position) { - const body2 = lexer2.source.body; - let point = 0; - let size = 3; - while (size < 12) { - const code = body2.charCodeAt(position + size++); - if (code === 125) { - if (size < 5 || !isUnicodeScalarValue(point)) { - break; - } - return { - value: String.fromCodePoint(point), - size - }; - } - point = point << 4 | readHexDigit(code); - if (point < 0) { - break; - } - } - throw syntaxError( - lexer2.source, - position, - `Invalid Unicode escape sequence: "${body2.slice( - position, - position + size - )}".` - ); - } - function readEscapedUnicodeFixedWidth(lexer2, position) { - const body2 = lexer2.source.body; - const code = read16BitHexCode(body2, position + 2); - if (isUnicodeScalarValue(code)) { - return { - value: String.fromCodePoint(code), - size: 6 - }; - } - if (isLeadingSurrogate(code)) { - if (body2.charCodeAt(position + 6) === 92 && body2.charCodeAt(position + 7) === 117) { - const trailingCode = read16BitHexCode(body2, position + 8); - if (isTrailingSurrogate(trailingCode)) { - return { - value: String.fromCodePoint(code, trailingCode), - size: 12 - }; - } - } - } - throw syntaxError( - lexer2.source, - position, - `Invalid Unicode escape sequence: "${body2.slice(position, position + 6)}".` - ); - } - function read16BitHexCode(body2, position) { - return readHexDigit(body2.charCodeAt(position)) << 12 | readHexDigit(body2.charCodeAt(position + 1)) << 8 | readHexDigit(body2.charCodeAt(position + 2)) << 4 | readHexDigit(body2.charCodeAt(position + 3)); - } - function readHexDigit(code) { - return code >= 48 && code <= 57 ? code - 48 : code >= 65 && code <= 70 ? code - 55 : code >= 97 && code <= 102 ? code - 87 : -1; - } - function readEscapedCharacter(lexer2, position) { - const body2 = lexer2.source.body; - const code = body2.charCodeAt(position + 1); - switch (code) { - case 34: - return { - value: '"', - size: 2 - }; - case 92: - return { - value: "\\", - size: 2 - }; - case 47: - return { - value: "/", - size: 2 - }; - case 98: - return { - value: "\b", - size: 2 - }; - case 102: - return { - value: "\f", - size: 2 - }; - case 110: - return { - value: "\n", - size: 2 - }; - case 114: - return { - value: "\r", - size: 2 - }; - case 116: - return { - value: " ", - size: 2 - }; - } - throw syntaxError( - lexer2.source, - position, - `Invalid character escape sequence: "${body2.slice( - position, - position + 2 - )}".` - ); - } - function readBlockString(lexer2, start) { - const body2 = lexer2.source.body; - const bodyLength = body2.length; - let lineStart = lexer2.lineStart; - let position = start + 3; - let chunkStart = position; - let currentLine = ""; - const blockLines = []; - while (position < bodyLength) { - const code = body2.charCodeAt(position); - if (code === 34 && body2.charCodeAt(position + 1) === 34 && body2.charCodeAt(position + 2) === 34) { - currentLine += body2.slice(chunkStart, position); - blockLines.push(currentLine); - const token = createToken( - lexer2, - TokenKind.BLOCK_STRING, - start, - position + 3, - dedentBlockStringLines(blockLines).join("\n") - ); - lexer2.line += blockLines.length - 1; - lexer2.lineStart = lineStart; - return token; - } - if (code === 92 && body2.charCodeAt(position + 1) === 34 && body2.charCodeAt(position + 2) === 34 && body2.charCodeAt(position + 3) === 34) { - currentLine += body2.slice(chunkStart, position); - chunkStart = position + 1; - position += 4; - continue; - } - if (code === 10 || code === 13) { - currentLine += body2.slice(chunkStart, position); - blockLines.push(currentLine); - if (code === 13 && body2.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - currentLine = ""; - chunkStart = position; - lineStart = position; - continue; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body2, position)) { - position += 2; - } else { - throw syntaxError( - lexer2.source, - position, - `Invalid character within String: ${printCodePointAt( - lexer2, - position - )}.` - ); - } - } - throw syntaxError(lexer2.source, position, "Unterminated string."); - } - function readName(lexer2, start) { - const body2 = lexer2.source.body; - const bodyLength = body2.length; - let position = start + 1; - while (position < bodyLength) { - const code = body2.charCodeAt(position); - if (isNameContinue(code)) { - ++position; - } else { - break; - } - } - return createToken( - lexer2, - TokenKind.NAME, - start, - position, - body2.slice(start, position) - ); - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/inspect.mjs - var MAX_ARRAY_LENGTH = 10; - var MAX_RECURSIVE_DEPTH = 2; - function inspect(value) { - return formatValue(value, []); - } - function formatValue(value, seenValues) { - switch (typeof value) { - case "string": - return JSON.stringify(value); - case "function": - return value.name ? `[function ${value.name}]` : "[function]"; - case "object": - return formatObjectValue(value, seenValues); - default: - return String(value); - } - } - function formatObjectValue(value, previouslySeenValues) { - if (value === null) { - return "null"; - } - if (previouslySeenValues.includes(value)) { - return "[Circular]"; - } - const seenValues = [...previouslySeenValues, value]; - if (isJSONable(value)) { - const jsonValue = value.toJSON(); - if (jsonValue !== value) { - return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - return formatObject(value, seenValues); - } - function isJSONable(value) { - return typeof value.toJSON === "function"; - } - function formatObject(object, seenValues) { - const entries = Object.entries(object); - if (entries.length === 0) { - return "{}"; - } - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return "[" + getObjectTag(object) + "]"; - } - const properties = entries.map( - ([key, value]) => key + ": " + formatValue(value, seenValues) - ); - return "{ " + properties.join(", ") + " }"; - } - function formatArray(array, seenValues) { - if (array.length === 0) { - return "[]"; - } - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return "[Array]"; - } - const len = Math.min(MAX_ARRAY_LENGTH, array.length); - const remaining = array.length - len; - const items = []; - for (let i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - if (remaining === 1) { - items.push("... 1 more item"); - } else if (remaining > 1) { - items.push(`... ${remaining} more items`); - } - return "[" + items.join(", ") + "]"; - } - function getObjectTag(object) { - const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, ""); - if (tag === "Object" && typeof object.constructor === "function") { - const name = object.constructor.name; - if (typeof name === "string" && name !== "") { - return name; - } - } - return tag; - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/instanceOf.mjs - var instanceOf = globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function instanceOf2(value, constructor) { - return value instanceof constructor; - } : function instanceOf3(value, constructor) { - if (value instanceof constructor) { - return true; - } - if (typeof value === "object" && value !== null) { - var _value$constructor; - const className = constructor.prototype[Symbol.toStringTag]; - const valueClassName = Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name; - if (className === valueClassName) { - const stringifiedValue = inspect(value); - throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`); - } - } - return false; - }; - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/source.mjs - var Source = class { - constructor(body2, name = "GraphQL request", locationOffset = { - line: 1, - column: 1 - }) { - typeof body2 === "string" || devAssert(false, `Body must be a string. Received: ${inspect(body2)}.`); - this.body = body2; - this.name = name; - this.locationOffset = locationOffset; - this.locationOffset.line > 0 || devAssert( - false, - "line in locationOffset is 1-indexed and must be positive." - ); - this.locationOffset.column > 0 || devAssert( - false, - "column in locationOffset is 1-indexed and must be positive." - ); - } - get [Symbol.toStringTag]() { - return "Source"; - } - }; - function isSource(source) { - return instanceOf(source, Source); - } - - // node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/parser.mjs - function parse3(source, options) { - const parser = new Parser(source, options); - return parser.parseDocument(); - } - var Parser = class { - constructor(source, options = {}) { - const sourceObj = isSource(source) ? source : new Source(source); - this._lexer = new Lexer(sourceObj); - this._options = options; - this._tokenCounter = 0; - } - parseName() { - const token = this.expectToken(TokenKind.NAME); - return this.node(token, { - kind: Kind.NAME, - value: token.value - }); - } - parseDocument() { - return this.node(this._lexer.token, { - kind: Kind.DOCUMENT, - definitions: this.many( - TokenKind.SOF, - this.parseDefinition, - TokenKind.EOF - ) - }); - } - parseDefinition() { - if (this.peek(TokenKind.BRACE_L)) { - return this.parseOperationDefinition(); - } - const hasDescription = this.peekDescription(); - const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token; - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case "schema": - return this.parseSchemaDefinition(); - case "scalar": - return this.parseScalarTypeDefinition(); - case "type": - return this.parseObjectTypeDefinition(); - case "interface": - return this.parseInterfaceTypeDefinition(); - case "union": - return this.parseUnionTypeDefinition(); - case "enum": - return this.parseEnumTypeDefinition(); - case "input": - return this.parseInputObjectTypeDefinition(); - case "directive": - return this.parseDirectiveDefinition(); - } - if (hasDescription) { - throw syntaxError( - this._lexer.source, - this._lexer.token.start, - "Unexpected description, descriptions are supported only on type definitions." - ); - } - switch (keywordToken.value) { - case "query": - case "mutation": - case "subscription": - return this.parseOperationDefinition(); - case "fragment": - return this.parseFragmentDefinition(); - case "extend": - return this.parseTypeSystemExtension(); - } - } - throw this.unexpected(keywordToken); - } - parseOperationDefinition() { - const start = this._lexer.token; - if (this.peek(TokenKind.BRACE_L)) { - return this.node(start, { - kind: Kind.OPERATION_DEFINITION, - operation: OperationTypeNode.QUERY, - name: void 0, - variableDefinitions: [], - directives: [], - selectionSet: this.parseSelectionSet() - }); - } - const operation = this.parseOperationType(); - let name; - if (this.peek(TokenKind.NAME)) { - name = this.parseName(); - } - return this.node(start, { - kind: Kind.OPERATION_DEFINITION, - operation, - name, - variableDefinitions: this.parseVariableDefinitions(), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - parseOperationType() { - const operationToken = this.expectToken(TokenKind.NAME); - switch (operationToken.value) { - case "query": - return OperationTypeNode.QUERY; - case "mutation": - return OperationTypeNode.MUTATION; - case "subscription": - return OperationTypeNode.SUBSCRIPTION; - } - throw this.unexpected(operationToken); - } - parseVariableDefinitions() { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseVariableDefinition, - TokenKind.PAREN_R - ); - } - parseVariableDefinition() { - return this.node(this._lexer.token, { - kind: Kind.VARIABLE_DEFINITION, - variable: this.parseVariable(), - type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), - defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0, - directives: this.parseConstDirectives() - }); - } - parseVariable() { - const start = this._lexer.token; - this.expectToken(TokenKind.DOLLAR); - return this.node(start, { - kind: Kind.VARIABLE, - name: this.parseName() - }); - } - parseSelectionSet() { - return this.node(this._lexer.token, { - kind: Kind.SELECTION_SET, - selections: this.many( - TokenKind.BRACE_L, - this.parseSelection, - TokenKind.BRACE_R - ) - }); - } - parseSelection() { - return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); - } - parseField() { - const start = this._lexer.token; - const nameOrAlias = this.parseName(); - let alias; - let name; - if (this.expectOptionalToken(TokenKind.COLON)) { - alias = nameOrAlias; - name = this.parseName(); - } else { - name = nameOrAlias; - } - return this.node(start, { - kind: Kind.FIELD, - alias, - name, - arguments: this.parseArguments(false), - directives: this.parseDirectives(false), - selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0 - }); - } - parseArguments(isConst) { - const item = isConst ? this.parseConstArgument : this.parseArgument; - return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); - } - parseArgument(isConst = false) { - const start = this._lexer.token; - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - return this.node(start, { - kind: Kind.ARGUMENT, - name, - value: this.parseValueLiteral(isConst) - }); - } - parseConstArgument() { - return this.parseArgument(true); - } - parseFragment() { - const start = this._lexer.token; - this.expectToken(TokenKind.SPREAD); - const hasTypeCondition = this.expectOptionalKeyword("on"); - if (!hasTypeCondition && this.peek(TokenKind.NAME)) { - return this.node(start, { - kind: Kind.FRAGMENT_SPREAD, - name: this.parseFragmentName(), - directives: this.parseDirectives(false) - }); - } - return this.node(start, { - kind: Kind.INLINE_FRAGMENT, - typeCondition: hasTypeCondition ? this.parseNamedType() : void 0, - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - parseFragmentDefinition() { - const start = this._lexer.token; - this.expectKeyword("fragment"); - if (this._options.allowLegacyFragmentVariables === true) { - return this.node(start, { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - variableDefinitions: this.parseVariableDefinitions(), - typeCondition: (this.expectKeyword("on"), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - return this.node(start, { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - typeCondition: (this.expectKeyword("on"), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - parseFragmentName() { - if (this._lexer.token.value === "on") { - throw this.unexpected(); - } - return this.parseName(); - } - parseValueLiteral(isConst) { - const token = this._lexer.token; - switch (token.kind) { - case TokenKind.BRACKET_L: - return this.parseList(isConst); - case TokenKind.BRACE_L: - return this.parseObject(isConst); - case TokenKind.INT: - this.advanceLexer(); - return this.node(token, { - kind: Kind.INT, - value: token.value - }); - case TokenKind.FLOAT: - this.advanceLexer(); - return this.node(token, { - kind: Kind.FLOAT, - value: token.value - }); - case TokenKind.STRING: - case TokenKind.BLOCK_STRING: - return this.parseStringLiteral(); - case TokenKind.NAME: - this.advanceLexer(); - switch (token.value) { - case "true": - return this.node(token, { - kind: Kind.BOOLEAN, - value: true - }); - case "false": - return this.node(token, { - kind: Kind.BOOLEAN, - value: false - }); - case "null": - return this.node(token, { - kind: Kind.NULL - }); - default: - return this.node(token, { - kind: Kind.ENUM, - value: token.value - }); - } - case TokenKind.DOLLAR: - if (isConst) { - this.expectToken(TokenKind.DOLLAR); - if (this._lexer.token.kind === TokenKind.NAME) { - const varName = this._lexer.token.value; - throw syntaxError( - this._lexer.source, - token.start, - `Unexpected variable "$${varName}" in constant value.` - ); - } else { - throw this.unexpected(token); - } - } - return this.parseVariable(); - default: - throw this.unexpected(); - } - } - parseConstValueLiteral() { - return this.parseValueLiteral(true); - } - parseStringLiteral() { - const token = this._lexer.token; - this.advanceLexer(); - return this.node(token, { - kind: Kind.STRING, - value: token.value, - block: token.kind === TokenKind.BLOCK_STRING - }); - } - parseList(isConst) { - const item = () => this.parseValueLiteral(isConst); - return this.node(this._lexer.token, { - kind: Kind.LIST, - values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R) - }); - } - parseObject(isConst) { - const item = () => this.parseObjectField(isConst); - return this.node(this._lexer.token, { - kind: Kind.OBJECT, - fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R) - }); - } - parseObjectField(isConst) { - const start = this._lexer.token; - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - return this.node(start, { - kind: Kind.OBJECT_FIELD, - name, - value: this.parseValueLiteral(isConst) - }); - } - parseDirectives(isConst) { - const directives = []; - while (this.peek(TokenKind.AT)) { - directives.push(this.parseDirective(isConst)); - } - return directives; - } - parseConstDirectives() { - return this.parseDirectives(true); - } - parseDirective(isConst) { - const start = this._lexer.token; - this.expectToken(TokenKind.AT); - return this.node(start, { - kind: Kind.DIRECTIVE, - name: this.parseName(), - arguments: this.parseArguments(isConst) - }); - } - parseTypeReference() { - const start = this._lexer.token; - let type; - if (this.expectOptionalToken(TokenKind.BRACKET_L)) { - const innerType = this.parseTypeReference(); - this.expectToken(TokenKind.BRACKET_R); - type = this.node(start, { - kind: Kind.LIST_TYPE, - type: innerType - }); - } else { - type = this.parseNamedType(); - } - if (this.expectOptionalToken(TokenKind.BANG)) { - return this.node(start, { - kind: Kind.NON_NULL_TYPE, - type - }); - } - return type; - } - parseNamedType() { - return this.node(this._lexer.token, { - kind: Kind.NAMED_TYPE, - name: this.parseName() - }); - } - peekDescription() { - return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); - } - parseDescription() { - if (this.peekDescription()) { - return this.parseStringLiteral(); - } - } - parseSchemaDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("schema"); - const directives = this.parseConstDirectives(); - const operationTypes = this.many( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R - ); - return this.node(start, { - kind: Kind.SCHEMA_DEFINITION, - description, - directives, - operationTypes - }); - } - parseOperationTypeDefinition() { - const start = this._lexer.token; - const operation = this.parseOperationType(); - this.expectToken(TokenKind.COLON); - const type = this.parseNamedType(); - return this.node(start, { - kind: Kind.OPERATION_TYPE_DEFINITION, - operation, - type - }); - } - parseScalarTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("scalar"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.SCALAR_TYPE_DEFINITION, - description, - name, - directives - }); - } - parseObjectTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("type"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - return this.node(start, { - kind: Kind.OBJECT_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields - }); - } - parseImplementsInterfaces() { - return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : []; - } - parseFieldsDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseFieldDefinition, - TokenKind.BRACE_R - ); - } - parseFieldDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.FIELD_DEFINITION, - description, - name, - arguments: args, - type, - directives - }); - } - parseArgumentDefs() { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseInputValueDef, - TokenKind.PAREN_R - ); - } - parseInputValueDef() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - let defaultValue; - if (this.expectOptionalToken(TokenKind.EQUALS)) { - defaultValue = this.parseConstValueLiteral(); - } - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.INPUT_VALUE_DEFINITION, - description, - name, - type, - defaultValue, - directives - }); - } - parseInterfaceTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("interface"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - return this.node(start, { - kind: Kind.INTERFACE_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields - }); - } - parseUnionTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("union"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const types = this.parseUnionMemberTypes(); - return this.node(start, { - kind: Kind.UNION_TYPE_DEFINITION, - description, - name, - directives, - types - }); - } - parseUnionMemberTypes() { - return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : []; - } - parseEnumTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("enum"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const values = this.parseEnumValuesDefinition(); - return this.node(start, { - kind: Kind.ENUM_TYPE_DEFINITION, - description, - name, - directives, - values - }); - } - parseEnumValuesDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseEnumValueDefinition, - TokenKind.BRACE_R - ); - } - parseEnumValueDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseEnumValueName(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.ENUM_VALUE_DEFINITION, - description, - name, - directives - }); - } - parseEnumValueName() { - if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") { - throw syntaxError( - this._lexer.source, - this._lexer.token.start, - `${getTokenDesc( - this._lexer.token - )} is reserved and cannot be used for an enum value.` - ); - } - return this.parseName(); - } - parseInputObjectTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("input"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const fields = this.parseInputFieldsDefinition(); - return this.node(start, { - kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, - description, - name, - directives, - fields - }); - } - parseInputFieldsDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseInputValueDef, - TokenKind.BRACE_R - ); - } - parseTypeSystemExtension() { - const keywordToken = this._lexer.lookahead(); - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case "schema": - return this.parseSchemaExtension(); - case "scalar": - return this.parseScalarTypeExtension(); - case "type": - return this.parseObjectTypeExtension(); - case "interface": - return this.parseInterfaceTypeExtension(); - case "union": - return this.parseUnionTypeExtension(); - case "enum": - return this.parseEnumTypeExtension(); - case "input": - return this.parseInputObjectTypeExtension(); - } - } - throw this.unexpected(keywordToken); - } - parseSchemaExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("schema"); - const directives = this.parseConstDirectives(); - const operationTypes = this.optionalMany( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R - ); - if (directives.length === 0 && operationTypes.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.SCHEMA_EXTENSION, - directives, - operationTypes - }); - } - parseScalarTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("scalar"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - if (directives.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.SCALAR_TYPE_EXTENSION, - name, - directives - }); - } - parseObjectTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("type"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.OBJECT_TYPE_EXTENSION, - name, - interfaces, - directives, - fields - }); - } - parseInterfaceTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("interface"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.INTERFACE_TYPE_EXTENSION, - name, - interfaces, - directives, - fields - }); - } - parseUnionTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("union"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const types = this.parseUnionMemberTypes(); - if (directives.length === 0 && types.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.UNION_TYPE_EXTENSION, - name, - directives, - types - }); - } - parseEnumTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("enum"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const values = this.parseEnumValuesDefinition(); - if (directives.length === 0 && values.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.ENUM_TYPE_EXTENSION, - name, - directives, - values - }); - } - parseInputObjectTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("input"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const fields = this.parseInputFieldsDefinition(); - if (directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, - name, - directives, - fields - }); - } - parseDirectiveDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("directive"); - this.expectToken(TokenKind.AT); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - const repeatable = this.expectOptionalKeyword("repeatable"); - this.expectKeyword("on"); - const locations = this.parseDirectiveLocations(); - return this.node(start, { - kind: Kind.DIRECTIVE_DEFINITION, - description, - name, - arguments: args, - repeatable, - locations - }); - } - parseDirectiveLocations() { - return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); - } - parseDirectiveLocation() { - const start = this._lexer.token; - const name = this.parseName(); - if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) { - return name; - } - throw this.unexpected(start); - } - node(startToken, node) { - if (this._options.noLocation !== true) { - node.loc = new Location( - startToken, - this._lexer.lastToken, - this._lexer.source - ); - } - return node; - } - peek(kind) { - return this._lexer.token.kind === kind; - } - expectToken(kind) { - const token = this._lexer.token; - if (token.kind === kind) { - this.advanceLexer(); - return token; - } - throw syntaxError( - this._lexer.source, - token.start, - `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.` - ); - } - expectOptionalToken(kind) { - const token = this._lexer.token; - if (token.kind === kind) { - this.advanceLexer(); - return true; - } - return false; - } - expectKeyword(value) { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this.advanceLexer(); - } else { - throw syntaxError( - this._lexer.source, - token.start, - `Expected "${value}", found ${getTokenDesc(token)}.` - ); - } - } - expectOptionalKeyword(value) { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this.advanceLexer(); - return true; - } - return false; - } - unexpected(atToken) { - const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; - return syntaxError( - this._lexer.source, - token.start, - `Unexpected ${getTokenDesc(token)}.` - ); - } - any(openKind, parseFn, closeKind) { - this.expectToken(openKind); - const nodes = []; - while (!this.expectOptionalToken(closeKind)) { - nodes.push(parseFn.call(this)); - } - return nodes; - } - optionalMany(openKind, parseFn, closeKind) { - if (this.expectOptionalToken(openKind)) { - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - return []; - } - many(openKind, parseFn, closeKind) { - this.expectToken(openKind); - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - delimitedMany(delimiterKind, parseFn) { - this.expectOptionalToken(delimiterKind); - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (this.expectOptionalToken(delimiterKind)); - return nodes; - } - advanceLexer() { - const { maxTokens } = this._options; - const token = this._lexer.advance(); - if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) { - ++this._tokenCounter; - if (this._tokenCounter > maxTokens) { - throw syntaxError( - this._lexer.source, - token.start, - `Document contains more that ${maxTokens} tokens. Parsing aborted.` - ); - } - } - } - }; - function getTokenDesc(token) { - const value = token.value; - return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ""); - } - function getTokenKindDesc(kind) { - return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; - } - - // src/utils/request/getPublicUrlFromRequest.ts - var getPublicUrlFromRequest = (request) => { - return request.referrer.startsWith(request.url.origin) ? request.url.pathname : new URL( - request.url.pathname, - `${request.url.protocol}//${request.url.host}` - ).href; - }; - - // src/utils/internal/parseGraphQLRequest.ts - function parseDocumentNode(node) { - var _a2; - const operationDef = node.definitions.find((def) => { - return def.kind === "OperationDefinition"; - }); - return { - operationType: operationDef == null ? void 0 : operationDef.operation, - operationName: (_a2 = operationDef == null ? void 0 : operationDef.name) == null ? void 0 : _a2.value - }; - } - function parseQuery(query) { - try { - const ast = parse3(query); - return parseDocumentNode(ast); - } catch (error2) { - return error2; - } - } - function extractMultipartVariables(variables, map, files) { - const operations = { variables }; - for (const [key, pathArray] of Object.entries(map)) { - if (!(key in files)) { - throw new Error(`Given files do not have a key '${key}' .`); - } - for (const dotPath of pathArray) { - const [lastPath, ...reversedPaths] = dotPath.split(".").reverse(); - const paths = reversedPaths.reverse(); - let target = operations; - for (const path of paths) { - if (!(path in target)) { - throw new Error(`Property '${paths}' is not in operations.`); - } - target = target[path]; - } - target[lastPath] = files[key]; - } - } - return operations.variables; - } - function getGraphQLInput(request) { - var _a2, _b2; - switch (request.method) { - case "GET": { - const query = request.url.searchParams.get("query"); - const variables = request.url.searchParams.get("variables") || ""; - return { - query, - variables: jsonParse(variables) - }; - } - case "POST": { - if ((_a2 = request.body) == null ? void 0 : _a2.query) { - const { query, variables } = request.body; - return { - query, - variables - }; - } - if ((_b2 = request.body) == null ? void 0 : _b2.operations) { - const { operations, map, ...files } = request.body; - const parsedOperations = jsonParse( - operations - ) || {}; - if (!parsedOperations.query) { - return null; - } - const parsedMap = jsonParse(map || "") || {}; - const variables = parsedOperations.variables ? extractMultipartVariables( - parsedOperations.variables, - parsedMap, - files - ) : {}; - return { - query: parsedOperations.query, - variables - }; - } - } - default: - return null; - } - } - function parseGraphQLRequest(request) { - const input = getGraphQLInput(request); - if (!input || !input.query) { - return void 0; - } - const { query, variables } = input; - const parsedResult = parseQuery(query); - if (parsedResult instanceof Error) { - const requestPublicUrl = getPublicUrlFromRequest(request); - throw new Error( - devUtils.formatMessage( - 'Failed to intercept a GraphQL request to "%s %s": cannot parse query. See the error message from the parser below.\n\n%s', - request.method, - requestPublicUrl, - parsedResult.message - ) - ); - } - return { - operationType: parsedResult.operationType, - operationName: parsedResult.operationName, - variables - }; - } - - // src/utils/logging/getStatusCodeColor.ts - function getStatusCodeColor(status2) { - if (status2 < 300) { - return "#69AB32" /* Success */; - } - if (status2 < 400) { - return "#F0BB4B" /* Warning */; - } - return "#E95F5D" /* Danger */; - } - - // src/utils/logging/getTimestamp.ts - function getTimestamp() { - const now = new Date(); - return [now.getHours(), now.getMinutes(), now.getSeconds()].map(String).map((chunk) => chunk.slice(0, 2)).map((chunk) => chunk.padStart(2, "0")).join(":"); - } - - // src/utils/logging/prepareRequest.ts - function prepareRequest(request) { - return { - ...request, - body: request.body, - headers: request.headers.all() - }; - } - - // src/utils/logging/prepareResponse.ts - function prepareResponse(res) { - const responseHeaders = objectToHeaders(res.headers); - const parsedBody = parseBody(res.body, responseHeaders); - return { - ...res, - body: parsedBody - }; - } - - // node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist.es2015/index.js - function lexer(str) { - var tokens = []; - var i = 0; - while (i < str.length) { - var char = str[i]; - if (char === "*" || char === "+" || char === "?") { - tokens.push({ type: "MODIFIER", index: i, value: str[i++] }); - continue; - } - if (char === "\\") { - tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] }); - continue; - } - if (char === "{") { - tokens.push({ type: "OPEN", index: i, value: str[i++] }); - continue; - } - if (char === "}") { - tokens.push({ type: "CLOSE", index: i, value: str[i++] }); - continue; - } - if (char === ":") { - var name = ""; - var j = i + 1; - while (j < str.length) { - var code = str.charCodeAt(j); - if (code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 95) { - name += str[j++]; - continue; - } - break; - } - if (!name) - throw new TypeError("Missing parameter name at ".concat(i)); - tokens.push({ type: "NAME", index: i, value: name }); - i = j; - continue; - } - if (char === "(") { - var count = 1; - var pattern = ""; - var j = i + 1; - if (str[j] === "?") { - throw new TypeError('Pattern cannot start with "?" at '.concat(j)); - } - while (j < str.length) { - if (str[j] === "\\") { - pattern += str[j++] + str[j++]; - continue; - } - if (str[j] === ")") { - count--; - if (count === 0) { - j++; - break; - } - } else if (str[j] === "(") { - count++; - if (str[j + 1] !== "?") { - throw new TypeError("Capturing groups are not allowed at ".concat(j)); - } - } - pattern += str[j++]; - } - if (count) - throw new TypeError("Unbalanced pattern at ".concat(i)); - if (!pattern) - throw new TypeError("Missing pattern at ".concat(i)); - tokens.push({ type: "PATTERN", index: i, value: pattern }); - i = j; - continue; - } - tokens.push({ type: "CHAR", index: i, value: str[i++] }); - } - tokens.push({ type: "END", index: i, value: "" }); - return tokens; - } - function parse4(str, options) { - if (options === void 0) { - options = {}; - } - var tokens = lexer(str); - var _a2 = options.prefixes, prefixes = _a2 === void 0 ? "./" : _a2; - var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?"); - var result = []; - var key = 0; - var i = 0; - var path = ""; - var tryConsume = function(type) { - if (i < tokens.length && tokens[i].type === type) - return tokens[i++].value; - }; - var mustConsume = function(type) { - var value2 = tryConsume(type); - if (value2 !== void 0) - return value2; - var _a3 = tokens[i], nextType = _a3.type, index = _a3.index; - throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type)); - }; - var consumeText = function() { - var result2 = ""; - var value2; - while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) { - result2 += value2; - } - return result2; - }; - while (i < tokens.length) { - var char = tryConsume("CHAR"); - var name = tryConsume("NAME"); - var pattern = tryConsume("PATTERN"); - if (name || pattern) { - var prefix = char || ""; - if (prefixes.indexOf(prefix) === -1) { - path += prefix; - prefix = ""; - } - if (path) { - result.push(path); - path = ""; - } - result.push({ - name: name || key++, - prefix, - suffix: "", - pattern: pattern || defaultPattern, - modifier: tryConsume("MODIFIER") || "" - }); - continue; - } - var value = char || tryConsume("ESCAPED_CHAR"); - if (value) { - path += value; - continue; - } - if (path) { - result.push(path); - path = ""; - } - var open = tryConsume("OPEN"); - if (open) { - var prefix = consumeText(); - var name_1 = tryConsume("NAME") || ""; - var pattern_1 = tryConsume("PATTERN") || ""; - var suffix = consumeText(); - mustConsume("CLOSE"); - result.push({ - name: name_1 || (pattern_1 ? key++ : ""), - pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1, - prefix, - suffix, - modifier: tryConsume("MODIFIER") || "" - }); - continue; - } - mustConsume("END"); - } - return result; - } - function match(str, options) { - var keys = []; - var re = pathToRegexp(str, keys, options); - return regexpToFunction(re, keys, options); - } - function regexpToFunction(re, keys, options) { - if (options === void 0) { - options = {}; - } - var _a2 = options.decode, decode = _a2 === void 0 ? function(x) { - return x; - } : _a2; - return function(pathname) { - var m = re.exec(pathname); - if (!m) - return false; - var path = m[0], index = m.index; - var params = /* @__PURE__ */ Object.create(null); - var _loop_1 = function(i2) { - if (m[i2] === void 0) - return "continue"; - var key = keys[i2 - 1]; - if (key.modifier === "*" || key.modifier === "+") { - params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) { - return decode(value, key); - }); - } else { - params[key.name] = decode(m[i2], key); - } - }; - for (var i = 1; i < m.length; i++) { - _loop_1(i); - } - return { path, index, params }; - }; - } - function escapeString(str) { - return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); - } - function flags(options) { - return options && options.sensitive ? "" : "i"; - } - function regexpToRegexp(path, keys) { - if (!keys) - return path; - var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g; - var index = 0; - var execResult = groupsRegex.exec(path.source); - while (execResult) { - keys.push({ - name: execResult[1] || index++, - prefix: "", - suffix: "", - modifier: "", - pattern: "" - }); - execResult = groupsRegex.exec(path.source); - } - return path; - } - function arrayToRegexp(paths, keys, options) { - var parts = paths.map(function(path) { - return pathToRegexp(path, keys, options).source; - }); - return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options)); - } - function stringToRegexp(path, keys, options) { - return tokensToRegexp(parse4(path, options), keys, options); - } - function tokensToRegexp(tokens, keys, options) { - if (options === void 0) { - options = {}; - } - var _a2 = options.strict, strict = _a2 === void 0 ? false : _a2, _b2 = options.start, start = _b2 === void 0 ? true : _b2, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) { - return x; - } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f; - var endsWithRe = "[".concat(escapeString(endsWith), "]|$"); - var delimiterRe = "[".concat(escapeString(delimiter), "]"); - var route = start ? "^" : ""; - for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { - var token = tokens_1[_i]; - if (typeof token === "string") { - route += escapeString(encode(token)); - } else { - var prefix = escapeString(encode(token.prefix)); - var suffix = escapeString(encode(token.suffix)); - if (token.pattern) { - if (keys) - keys.push(token); - if (prefix || suffix) { - if (token.modifier === "+" || token.modifier === "*") { - var mod = token.modifier === "*" ? "?" : ""; - route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod); - } else { - route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier); - } - } else { - if (token.modifier === "+" || token.modifier === "*") { - route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")"); - } else { - route += "(".concat(token.pattern, ")").concat(token.modifier); - } - } - } else { - route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier); - } - } - } - if (end) { - if (!strict) - route += "".concat(delimiterRe, "?"); - route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")"); - } else { - var endToken = tokens[tokens.length - 1]; - var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0; - if (!strict) { - route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?"); - } - if (!isEndDelimited) { - route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")"); - } - } - return new RegExp(route, flags(options)); - } - function pathToRegexp(path, keys, options) { - if (path instanceof RegExp) - return regexpToRegexp(path, keys); - if (Array.isArray(path)) - return arrayToRegexp(path, keys, options); - return stringToRegexp(path, keys, options); - } - - // src/utils/matching/matchRequestUrl.ts - var import_getCleanUrl = __toESM(require_getCleanUrl()); - - // src/utils/url/cleanUrl.ts - var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g; - function getSearchParams(path) { - return new URL(`/${path}`, "http://localhost").searchParams; - } - function cleanUrl(path) { - return path.replace(REDUNDANT_CHARACTERS_EXP, ""); - } - - // src/utils/url/isAbsoluteUrl.ts - function isAbsoluteUrl(url) { - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); - } - - // src/utils/url/getAbsoluteUrl.ts - function getAbsoluteUrl(path, baseUrl) { - if (isAbsoluteUrl(path)) { - return path; - } - if (path.startsWith("*")) { - return path; - } - const origin = baseUrl || typeof document !== "undefined" && document.baseURI; - return origin ? decodeURI(new URL(encodeURI(path), origin).href) : path; - } - - // src/utils/matching/normalizePath.ts - function normalizePath(path, baseUrl) { - if (path instanceof RegExp) { - return path; - } - const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl); - return cleanUrl(maybeAbsoluteUrl); - } - - // src/utils/matching/matchRequestUrl.ts - function coercePath(path) { - return path.replace( - /([:a-zA-Z_-]*)(\*{1,2})+/g, - (_, parameterName, wildcard) => { - const expression = "(.*)"; - if (!parameterName) { - return expression; - } - return parameterName.startsWith(":") ? `${parameterName}${wildcard}` : `${parameterName}${expression}`; - } - ).replace(/([^\/])(:)(?=\d+)/, "$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/, "$1\\$2"); - } - function matchRequestUrl(url, path, baseUrl) { - const normalizedPath = normalizePath(path, baseUrl); - const cleanPath = typeof normalizedPath === "string" ? coercePath(normalizedPath) : normalizedPath; - const cleanUrl2 = (0, import_getCleanUrl.getCleanUrl)(url); - const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl2); - const params = result && result.params || {}; - return { - matches: result !== false, - params - }; - } - - // src/utils/internal/compose.ts - function compose(...fns) { - return (...args) => { - return fns.reduceRight((leftFn, rightFn) => { - return leftFn instanceof Promise ? Promise.resolve(leftFn).then(rightFn) : rightFn(leftFn); - }, args[0]); - }; - } - - // src/response.ts - var defaultResponse = { - status: 200, - statusText: "OK", - body: null, - delay: 0, - once: false, - passthrough: false - }; - var defaultResponseTransformers = []; - function createResponseComposition(responseOverrides, defaultTransformers = defaultResponseTransformers) { - return async (...transformers) => { - const initialResponse = Object.assign( - {}, - defaultResponse, - { - headers: new HeadersPolyfill({ - "x-powered-by": "msw" - }) - }, - responseOverrides - ); - const resolvedTransformers = [ - ...defaultTransformers, - ...transformers - ].filter(Boolean); - const resolvedResponse = resolvedTransformers.length > 0 ? compose(...resolvedTransformers)(initialResponse) : initialResponse; - return resolvedResponse; - }; - } - var response = Object.assign(createResponseComposition(), { - once: createResponseComposition({ once: true }), - networkError(message) { - throw new NetworkError(message); - } - }); - - // src/utils/internal/getCallFrame.ts - var SOURCE_FRAME = /[\/\\]msw[\/\\]src[\/\\](.+)/; - var BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](umd|esm|iief|cjs)[\/\\]|^[^\/\\]*$/; - function getCallFrame(error2) { - const stack = error2.stack; - if (!stack) { - return; - } - const frames = stack.split("\n").slice(1); - const declarationFrame = frames.find((frame) => { - return !(SOURCE_FRAME.test(frame) || BUILD_FRAME.test(frame)); - }); - if (!declarationFrame) { - return; - } - const declarationPath = declarationFrame.replace(/\s*at [^()]*\(([^)]+)\)/, "$1").replace(/^@/, ""); - return declarationPath; - } - - // src/utils/internal/isIterable.ts - function isIterable(fn) { - if (!fn) { - return false; - } - return typeof fn[Symbol.iterator] == "function"; - } - - // src/handlers/RequestHandler.ts - var defaultContext = { - status, - set, - delay, - fetch - }; - var RequestHandler = class { - constructor(options) { - this.shouldSkip = false; - this.ctx = options.ctx || defaultContext; - this.resolver = options.resolver; - const callFrame = getCallFrame(new Error()); - this.info = { - ...options.info, - callFrame - }; - } - parse(_request, _resolutionContext) { - return null; - } - test(request, resolutionContext) { - return this.predicate( - request, - this.parse(request, resolutionContext), - resolutionContext - ); - } - getPublicRequest(request, _parsedResult) { - return request; - } - markAsSkipped(shouldSkip = true) { - this.shouldSkip = shouldSkip; - } - async run(request, resolutionContext) { - if (this.shouldSkip) { - return null; - } - const parsedResult = this.parse(request, resolutionContext); - const shouldIntercept = this.predicate( - request, - parsedResult, - resolutionContext - ); - if (!shouldIntercept) { - return null; - } - const publicRequest = this.getPublicRequest(request, parsedResult); - const executeResolver = this.wrapResolver(this.resolver); - const mockedResponse = await executeResolver( - publicRequest, - response, - this.ctx - ); - return this.createExecutionResult( - parsedResult, - publicRequest, - mockedResponse - ); - } - wrapResolver(resolver) { - return async (req, res, ctx) => { - const result = this.resolverGenerator || await resolver(req, res, ctx); - if (isIterable(result)) { - const { value, done } = result[Symbol.iterator]().next(); - const nextResponse = await value; - if (!nextResponse && done) { - return this.resolverGeneratorResult; - } - if (!this.resolverGenerator) { - this.resolverGenerator = result; - } - this.resolverGeneratorResult = nextResponse; - return nextResponse; - } - return result; - }; - } - createExecutionResult(parsedResult, request, response2) { - return { - handler: this, - parsedResult: parsedResult || null, - request, - response: response2 || null - }; - } - }; - - // src/handlers/RestHandler.ts - var RESTMethods = /* @__PURE__ */ ((RESTMethods2) => { - RESTMethods2["HEAD"] = "HEAD"; - RESTMethods2["GET"] = "GET"; - RESTMethods2["POST"] = "POST"; - RESTMethods2["PUT"] = "PUT"; - RESTMethods2["PATCH"] = "PATCH"; - RESTMethods2["OPTIONS"] = "OPTIONS"; - RESTMethods2["DELETE"] = "DELETE"; - return RESTMethods2; - })(RESTMethods || {}); - var restContext = { - ...defaultContext, - cookie, - body, - text, - json, - xml - }; - var RestRequest = class extends MockedRequest { - constructor(request, params) { - super(request.url, { - ...request, - body: request["_body"] - }); - this.params = params; - this.id = request.id; - } - }; - var RestHandler = class extends RequestHandler { - constructor(method, path, resolver) { - super({ - info: { - header: `${method} ${path}`, - path, - method - }, - ctx: restContext, - resolver - }); - this.checkRedundantQueryParameters(); - } - checkRedundantQueryParameters() { - const { method, path } = this.info; - if (path instanceof RegExp) { - return; - } - const url = cleanUrl(path); - if (url === path) { - return; - } - const searchParams = getSearchParams(path); - const queryParams = []; - searchParams.forEach((_, paramName) => { - queryParams.push(paramName); - }); - devUtils.warn( - `Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead and access query parameters in the response resolver function using "req.url.searchParams".` - ); - } - parse(request, resolutionContext) { - return matchRequestUrl( - request.url, - this.info.path, - resolutionContext == null ? void 0 : resolutionContext.baseUrl - ); - } - getPublicRequest(request, parsedResult) { - return new RestRequest(request, parsedResult.params || {}); - } - predicate(request, parsedResult) { - const matchesMethod = this.info.method instanceof RegExp ? this.info.method.test(request.method) : isStringEqual(this.info.method, request.method); - return matchesMethod && parsedResult.matches; - } - log(request, response2) { - const publicUrl = getPublicUrlFromRequest(request); - const loggedRequest = prepareRequest(request); - const loggedResponse = prepareResponse(response2); - const statusColor = getStatusCodeColor(response2.status); - console.groupCollapsed( - devUtils.formatMessage("%s %s %s (%c%s%c)"), - getTimestamp(), - request.method, - publicUrl, - `color:${statusColor}`, - `${response2.status} ${response2.statusText}`, - "color:inherit" - ); - console.log("Request", loggedRequest); - console.log("Handler:", this); - console.log("Response", loggedResponse); - console.groupEnd(); - } - }; - - // src/context/field.ts - var field = (fieldName, fieldValue) => { - return (res) => { - validateFieldName(fieldName); - const prevBody = jsonParse(res.body) || {}; - const nextBody = mergeRight(prevBody, { [fieldName]: fieldValue }); - return json(nextBody)(res); - }; - }; - function validateFieldName(fieldName) { - invariant( - fieldName.trim() !== "", - devUtils.formatMessage( - "Failed to set a custom field on a GraphQL response: field name cannot be empty." - ) - ); - invariant( - fieldName !== "data", - devUtils.formatMessage( - 'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.data()" instead?', - fieldName - ) - ); - invariant( - fieldName !== "errors", - devUtils.formatMessage( - 'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.errors()" instead?', - fieldName - ) - ); - invariant( - fieldName !== "extensions", - devUtils.formatMessage( - 'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.extensions()" instead?', - fieldName - ) - ); - } - - // src/utils/internal/tryCatch.ts - function tryCatch(fn, onException) { - try { - const result = fn(); - return result; - } catch (error2) { - onException == null ? void 0 : onException(error2); - } - } - - // src/handlers/GraphQLHandler.ts - var graphqlContext = { - ...defaultContext, - data, - extensions, - errors, - cookie, - field - }; - function isDocumentNode(value) { - if (value == null) { - return false; - } - return typeof value === "object" && "kind" in value && "definitions" in value; - } - var GraphQLRequest = class extends MockedRequest { - constructor(request, variables, operationName) { - super(request.url, { - ...request, - body: request["_body"] - }); - this.variables = variables; - this.operationName = operationName; - } - }; - var GraphQLHandler = class extends RequestHandler { - constructor(operationType, operationName, endpoint, resolver) { - let resolvedOperationName = operationName; - if (isDocumentNode(operationName)) { - const parsedNode = parseDocumentNode(operationName); - if (parsedNode.operationType !== operationType) { - throw new Error( - `Failed to create a GraphQL handler: provided a DocumentNode with a mismatched operation type (expected "${operationType}", but got "${parsedNode.operationType}").` - ); - } - if (!parsedNode.operationName) { - throw new Error( - `Failed to create a GraphQL handler: provided a DocumentNode with no operation name.` - ); - } - resolvedOperationName = parsedNode.operationName; - } - const header = operationType === "all" ? `${operationType} (origin: ${endpoint.toString()})` : `${operationType} ${resolvedOperationName} (origin: ${endpoint.toString()})`; - super({ - info: { - header, - operationType, - operationName: resolvedOperationName - }, - ctx: graphqlContext, - resolver - }); - this.endpoint = endpoint; - } - parse(request) { - return tryCatch( - () => parseGraphQLRequest(request), - (error2) => console.error(error2.message) - ); - } - getPublicRequest(request, parsedResult) { - var _a2, _b2; - return new GraphQLRequest( - request, - (_a2 = parsedResult == null ? void 0 : parsedResult.variables) != null ? _a2 : {}, - (_b2 = parsedResult == null ? void 0 : parsedResult.operationName) != null ? _b2 : "" - ); - } - predicate(request, parsedResult) { - if (!parsedResult) { - return false; - } - if (!parsedResult.operationName && this.info.operationType !== "all") { - const publicUrl = getPublicUrlFromRequest(request); - devUtils.warn(`Failed to intercept a GraphQL request at "${request.method} ${publicUrl}": anonymous GraphQL operations are not supported. - -Consider naming this operation or using "graphql.operation()" request handler to intercept GraphQL requests regardless of their operation name/type. Read more: https://mswjs.io/docs/api/graphql/operation `); - return false; - } - const hasMatchingUrl = matchRequestUrl(request.url, this.endpoint); - const hasMatchingOperationType = this.info.operationType === "all" || parsedResult.operationType === this.info.operationType; - const hasMatchingOperationName = this.info.operationName instanceof RegExp ? this.info.operationName.test(parsedResult.operationName || "") : parsedResult.operationName === this.info.operationName; - return hasMatchingUrl.matches && hasMatchingOperationType && hasMatchingOperationName; - } - log(request, response2, parsedRequest) { - const loggedRequest = prepareRequest(request); - const loggedResponse = prepareResponse(response2); - const statusColor = getStatusCodeColor(response2.status); - const requestInfo = (parsedRequest == null ? void 0 : parsedRequest.operationName) ? `${parsedRequest == null ? void 0 : parsedRequest.operationType} ${parsedRequest == null ? void 0 : parsedRequest.operationName}` : `anonymous ${parsedRequest == null ? void 0 : parsedRequest.operationType}`; - console.groupCollapsed( - devUtils.formatMessage("%s %s (%c%s%c)"), - getTimestamp(), - `${requestInfo}`, - `color:${statusColor}`, - `${response2.status} ${response2.statusText}`, - "color:inherit" - ); - console.log("Request:", loggedRequest); - console.log("Handler:", this); - console.log("Response:", loggedResponse); - console.groupEnd(); - } - }; - - // src/utils/request/onUnhandledRequest.ts - var MAX_MATCH_SCORE = 3; - var MAX_SUGGESTION_COUNT = 4; - var TYPE_MATCH_DELTA = 0.5; - function groupHandlersByType(handlers) { - return handlers.reduce( - (groups, handler) => { - if (handler instanceof RestHandler) { - groups.rest.push(handler); - } - if (handler instanceof GraphQLHandler) { - groups.graphql.push(handler); - } - return groups; - }, - { - rest: [], - graphql: [] - } - ); - } - function getRestHandlerScore() { - return (request, handler) => { - const { path, method } = handler.info; - if (path instanceof RegExp || method instanceof RegExp) { - return Infinity; - } - const hasSameMethod = isStringEqual(request.method, method); - const methodScoreDelta = hasSameMethod ? TYPE_MATCH_DELTA : 0; - const requestPublicUrl = getPublicUrlFromRequest(request); - const score = (0, import_js_levenshtein.default)(requestPublicUrl, path); - return score - methodScoreDelta; - }; - } - function getGraphQLHandlerScore(parsedQuery) { - return (_, handler) => { - if (typeof parsedQuery.operationName === "undefined") { - return Infinity; - } - const { operationType, operationName } = handler.info; - if (typeof operationName !== "string") { - return Infinity; - } - const hasSameOperationType = parsedQuery.operationType === operationType; - const operationTypeScoreDelta = hasSameOperationType ? TYPE_MATCH_DELTA : 0; - const score = (0, import_js_levenshtein.default)(parsedQuery.operationName, operationName); - return score - operationTypeScoreDelta; - }; - } - function getSuggestedHandler(request, handlers, getScore) { - const suggestedHandlers = handlers.reduce((suggestions, handler) => { - const score = getScore(request, handler); - return suggestions.concat([[score, handler]]); - }, []).sort(([leftScore], [rightScore]) => leftScore - rightScore).filter(([score]) => score <= MAX_MATCH_SCORE).slice(0, MAX_SUGGESTION_COUNT).map(([, handler]) => handler); - return suggestedHandlers; - } - function getSuggestedHandlersMessage(handlers) { - if (handlers.length > 1) { - return `Did you mean to request one of the following resources instead? - -${handlers.map((handler) => ` \u2022 ${handler.info.header}`).join("\n")}`; - } - return `Did you mean to request "${handlers[0].info.header}" instead?`; - } - function onUnhandledRequest(request, handlers, strategy = "warn") { - const parsedGraphQLQuery = tryCatch(() => parseGraphQLRequest(request)); - function generateHandlerSuggestion() { - const handlerGroups = groupHandlersByType(handlers); - const relevantHandlers = parsedGraphQLQuery ? handlerGroups.graphql : handlerGroups.rest; - const suggestedHandlers = getSuggestedHandler( - request, - relevantHandlers, - parsedGraphQLQuery ? getGraphQLHandlerScore(parsedGraphQLQuery) : getRestHandlerScore() - ); - return suggestedHandlers.length > 0 ? getSuggestedHandlersMessage(suggestedHandlers) : ""; - } - function generateUnhandledRequestMessage() { - const publicUrl = getPublicUrlFromRequest(request); - const requestHeader = parsedGraphQLQuery ? `${parsedGraphQLQuery.operationType} ${parsedGraphQLQuery.operationName} (${request.method} ${publicUrl})` : `${request.method} ${publicUrl}`; - const handlerSuggestion = generateHandlerSuggestion(); - const messageTemplate = [ - `captured a request without a matching request handler:`, - ` \u2022 ${requestHeader}`, - handlerSuggestion, - `If you still wish to intercept this unhandled request, please create a request handler for it. -Read more: https://mswjs.io/docs/getting-started/mocks` - ].filter(Boolean); - return messageTemplate.join("\n\n"); - } - function applyStrategy(strategy2) { - const message = generateUnhandledRequestMessage(); - switch (strategy2) { - case "error": { - devUtils.error("Error: %s", message); - throw new Error( - devUtils.formatMessage( - 'Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.' - ) - ); - } - case "warn": { - devUtils.warn("Warning: %s", message); - break; - } - case "bypass": - break; - default: - throw new Error( - devUtils.formatMessage( - 'Failed to react to an unhandled request: unknown strategy "%s". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.', - strategy2 - ) - ); - } - } - if (typeof strategy === "function") { - strategy(request, { - warning: applyStrategy.bind(null, "warn"), - error: applyStrategy.bind(null, "error") - }); - return; - } - applyStrategy(strategy); - } - - // src/utils/request/readResponseCookies.ts - var import_cookies2 = __toESM(require_lib7()); - function readResponseCookies(request, response2) { - import_cookies2.store.add({ ...request, url: request.url.toString() }, response2); - import_cookies2.store.persist(); - } - - // src/utils/handleRequest.ts - async function handleRequest(request, handlers, options, emitter, handleRequestOptions) { - var _a2, _b2, _c, _d, _e, _f; - emitter.emit("request:start", request); - if (request.headers.get("x-msw-bypass") === "true") { - emitter.emit("request:end", request); - (_a2 = handleRequestOptions == null ? void 0 : handleRequestOptions.onPassthroughResponse) == null ? void 0 : _a2.call(handleRequestOptions, request); - return; - } - const [lookupError, lookupResult] = await (0, import_until2.until)(() => { - return getResponse( - request, - handlers, - handleRequestOptions == null ? void 0 : handleRequestOptions.resolutionContext - ); - }); - if (lookupError) { - emitter.emit("unhandledException", lookupError, request); - throw lookupError; - } - const { handler, response: response2 } = lookupResult; - if (!handler) { - onUnhandledRequest(request, handlers, options.onUnhandledRequest); - emitter.emit("request:unhandled", request); - emitter.emit("request:end", request); - (_b2 = handleRequestOptions == null ? void 0 : handleRequestOptions.onPassthroughResponse) == null ? void 0 : _b2.call(handleRequestOptions, request); - return; - } - if (!response2) { - devUtils.warn( - `Expected response resolver to return a mocked response Object, but got %s. The original response is going to be used instead. - - \u2022 %s - %s`, - response2, - handler.info.header, - handler.info.callFrame - ); - emitter.emit("request:end", request); - (_c = handleRequestOptions == null ? void 0 : handleRequestOptions.onPassthroughResponse) == null ? void 0 : _c.call(handleRequestOptions, request); - return; - } - if (response2.passthrough) { - emitter.emit("request:end", request); - (_d = handleRequestOptions == null ? void 0 : handleRequestOptions.onPassthroughResponse) == null ? void 0 : _d.call(handleRequestOptions, request); - return; - } - readResponseCookies(request, response2); - emitter.emit("request:match", request); - const requiredLookupResult = lookupResult; - const transformedResponse = ((_e = handleRequestOptions == null ? void 0 : handleRequestOptions.transformResponse) == null ? void 0 : _e.call(handleRequestOptions, response2)) || response2; - (_f = handleRequestOptions == null ? void 0 : handleRequestOptions.onMockedResponse) == null ? void 0 : _f.call( - handleRequestOptions, - transformedResponse, - requiredLookupResult - ); - emitter.emit("request:end", request); - return transformedResponse; - } - - // src/utils/logging/serializeResponse.ts - async function serializeResponse(response2) { - return { - status: response2.status, - statusText: response2.statusText, - headers: flattenHeadersObject(headersToObject(response2.headers)), - body: await response2.clone().text() - }; - } - - // src/setupWorker/start/createRequestListener.ts - var createRequestListener = (context, options) => { - return async (event, message) => { - var _a2; - const messageChannel = new WorkerChannel(event.ports[0]); - const request = parseWorkerRequest(message.payload); - try { - await handleRequest( - request, - context.requestHandlers, - options, - context.emitter, - { - transformResponse, - onPassthroughResponse() { - messageChannel.postMessage("NOT_FOUND"); - }, - async onMockedResponse(response2, { handler, publicRequest, parsedRequest }) { - if (response2.body instanceof ReadableStream) { - throw new Error( - devUtils.formatMessage( - 'Failed to construct a mocked response with a "ReadableStream" body: mocked streams are not supported. Follow https://github.com/mswjs/msw/issues/1336 for more details.' - ) - ); - } - const responseInstance = new Response(response2.body, response2); - const responseForLogs = responseInstance.clone(); - const responseBodyBuffer = await responseInstance.arrayBuffer(); - const responseBody = response2.body == null ? null : responseBodyBuffer; - messageChannel.postMessage( - "MOCK_RESPONSE", - { - ...response2, - body: responseBody - }, - [responseBodyBuffer] - ); - if (!options.quiet) { - context.emitter.once("response:mocked", async () => { - handler.log( - publicRequest, - await serializeResponse(responseForLogs), - parsedRequest - ); - }); - } - } - } - ); - } catch (error2) { - if (error2 instanceof NetworkError) { - messageChannel.postMessage("NETWORK_ERROR", { - name: error2.name, - message: error2.message - }); - return; - } - if (error2 instanceof Error) { - devUtils.error( - `Uncaught exception in the request handler for "%s %s": - -%s - -This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses`, - request.method, - request.url, - (_a2 = error2.stack) != null ? _a2 : error2 - ); - messageChannel.postMessage("MOCK_RESPONSE", { - status: 500, - statusText: "Request Handler Error", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - name: error2.name, - message: error2.message, - stack: error2.stack - }) - }); - } - } - }; - }; - function transformResponse(response2) { - return { - status: response2.status, - statusText: response2.statusText, - headers: response2.headers.all(), - body: response2.body, - delay: response2.delay - }; - } - - // src/utils/internal/requestIntegrityCheck.ts - async function requestIntegrityCheck(context, serviceWorker) { - context.workerChannel.send("INTEGRITY_CHECK_REQUEST"); - const { payload: actualChecksum } = await context.events.once( - "INTEGRITY_CHECK_RESPONSE" - ); - if (actualChecksum !== "3d6b9f06410d179a7f7404d4bf4c3c70") { - throw new Error( - `Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"3d6b9f06410d179a7f7404d4bf4c3c70"}).` - ); - } - return serviceWorker; - } - - // src/utils/deferNetworkRequestsUntil.ts - var import_until3 = __toESM(require_lib()); - function deferNetworkRequestsUntil(predicatePromise) { - const originalXhrSend = window.XMLHttpRequest.prototype.send; - window.XMLHttpRequest.prototype.send = function(...args) { - (0, import_until3.until)(() => predicatePromise).then(() => { - window.XMLHttpRequest.prototype.send = originalXhrSend; - this.send(...args); - }); - }; - const originalFetch = window.fetch; - window.fetch = async (...args) => { - await (0, import_until3.until)(() => predicatePromise); - window.fetch = originalFetch; - return window.fetch(...args); - }; - } - - // src/setupWorker/start/createResponseListener.ts - function createResponseListener(context) { - return (_, message) => { - var _a2; - const { payload: responseJson } = message; - if ((_a2 = responseJson.type) == null ? void 0 : _a2.includes("opaque")) { - return; - } - const response2 = new Response(responseJson.body || null, responseJson); - const isMockedResponse = response2.headers.get("x-powered-by") === "msw"; - if (isMockedResponse) { - context.emitter.emit("response:mocked", response2, responseJson.requestId); - } else { - context.emitter.emit("response:bypass", response2, responseJson.requestId); - } - }; - } - - // src/setupWorker/start/utils/validateWorkerScope.ts - function validateWorkerScope(registration, options) { - if (!(options == null ? void 0 : options.quiet) && !location.href.startsWith(registration.scope)) { - devUtils.warn( - `Cannot intercept requests on this page because it's outside of the worker's scope ("${registration.scope}"). If you wish to mock API requests on this page, you must resolve this scope issue. - -- (Recommended) Register the worker at the root level ("/") of your application. -- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.` - ); - } - } - - // src/setupWorker/start/createStartHandler.ts - var createStartHandler = (context) => { - return function start(options, customOptions) { - const startWorkerInstance = async () => { - context.events.removeAllListeners(); - context.workerChannel.on( - "REQUEST", - createRequestListener(context, options) - ); - context.workerChannel.on("RESPONSE", createResponseListener(context)); - const instance = await getWorkerInstance( - options.serviceWorker.url, - options.serviceWorker.options, - options.findWorker - ); - const [worker, registration] = instance; - if (!worker) { - const missingWorkerMessage = (customOptions == null ? void 0 : customOptions.findWorker) ? devUtils.formatMessage( - `Failed to locate the Service Worker registration using a custom "findWorker" predicate. - -Please ensure that the custom predicate properly locates the Service Worker registration at "%s". -More details: https://mswjs.io/docs/api/setup-worker/start#findworker -`, - options.serviceWorker.url - ) : devUtils.formatMessage( - `Failed to locate the Service Worker registration. - -This most likely means that the worker script URL "%s" cannot resolve against the actual public hostname (%s). This may happen if your application runs behind a proxy, or has a dynamic hostname. - -Please consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`, - options.serviceWorker.url, - location.host - ); - throw new Error(missingWorkerMessage); - } - context.worker = worker; - context.registration = registration; - context.events.addListener(window, "beforeunload", () => { - if (worker.state !== "redundant") { - context.workerChannel.send("CLIENT_CLOSED"); - } - window.clearInterval(context.keepAliveInterval); - }); - const [integrityError] = await (0, import_until4.until)( - () => requestIntegrityCheck(context, worker) - ); - if (integrityError) { - devUtils.error(`Detected outdated Service Worker: ${integrityError.message} - -The mocking is still enabled, but it's highly recommended that you update your Service Worker by running: - -$ npx msw init - -This is necessary to ensure that the Service Worker is in sync with the library to guarantee its stability. -If this message still persists after updating, please report an issue: https://github.com/open-draft/msw/issues `); - } - context.keepAliveInterval = window.setInterval( - () => context.workerChannel.send("KEEPALIVE_REQUEST"), - 5e3 - ); - validateWorkerScope(registration, context.startOptions); - return registration; - }; - const workerRegistration = startWorkerInstance().then( - async (registration) => { - const pendingInstance = registration.installing || registration.waiting; - if (pendingInstance) { - await new Promise((resolve) => { - pendingInstance.addEventListener("statechange", () => { - if (pendingInstance.state === "activated") { - return resolve(); - } - }); - }); - } - await enableMocking(context, options).catch((error2) => { - throw new Error(`Failed to enable mocking: ${error2 == null ? void 0 : error2.message}`); - }); - return registration; - } - ); - if (options.waitUntilReady) { - deferNetworkRequestsUntil(workerRegistration); - } - return workerRegistration; - }; - }; - - // src/setupWorker/stop/utils/printStopMessage.ts - function printStopMessage(args = {}) { - if (args.quiet) { - return; - } - console.log( - `%c${devUtils.formatMessage("Mocking disabled.")}`, - "color:orangered;font-weight:bold;" - ); - } - - // src/setupWorker/stop/createStop.ts - var createStop = (context) => { - return function stop() { - var _a2; - if (!context.isMockingEnabled) { - devUtils.warn( - 'Found a redundant "worker.stop()" call. Note that stopping the worker while mocking already stopped has no effect. Consider removing this "worker.stop()" call.' - ); - return; - } - context.workerChannel.send("MOCK_DEACTIVATE"); - context.isMockingEnabled = false; - window.clearInterval(context.keepAliveInterval); - printStopMessage({ quiet: (_a2 = context.startOptions) == null ? void 0 : _a2.quiet }); - }; - }; - - // src/setupWorker/start/utils/prepareStartHandler.ts - var DEFAULT_START_OPTIONS = { - serviceWorker: { - url: "/mockServiceWorker.js", - options: null - }, - quiet: false, - waitUntilReady: true, - onUnhandledRequest: "warn", - findWorker(scriptURL, mockServiceWorkerUrl) { - return scriptURL === mockServiceWorkerUrl; - } - }; - - // src/setupWorker/start/createFallbackRequestListener.ts - var import_interceptors3 = __toESM(require_lib6()); - var import_fetch3 = __toESM(require_fetch()); - var import_XMLHttpRequest = __toESM(require_XMLHttpRequest()); - - // src/utils/request/createResponseFromIsomorphicResponse.ts - function createResponseFromIsomorphicResponse(response2) { - return new Response(response2.body, { - status: response2.status, - statusText: response2.statusText, - headers: response2.headers - }); - } - - // src/setupWorker/start/createFallbackRequestListener.ts - function createFallbackRequestListener(context, options) { - const interceptor = new import_interceptors3.BatchInterceptor({ - name: "fallback", - interceptors: [new import_fetch3.FetchInterceptor(), new import_XMLHttpRequest.XMLHttpRequestInterceptor()] - }); - interceptor.on("request", async (request) => { - const mockedRequest = new MockedRequest(request.url, { - ...request, - body: await request.arrayBuffer() - }); - const response2 = await handleRequest( - mockedRequest, - context.requestHandlers, - options, - context.emitter, - { - transformResponse(response3) { - return { - status: response3.status, - statusText: response3.statusText, - headers: response3.headers.all(), - body: response3.body, - delay: response3.delay - }; - }, - onMockedResponse(_, { handler, publicRequest, parsedRequest }) { - if (!options.quiet) { - context.emitter.once("response:mocked", async (response3) => { - handler.log( - publicRequest, - await serializeResponse(response3), - parsedRequest - ); - }); - } - } - } - ); - if (response2) { - request.respondWith(response2); - } - }); - interceptor.on("response", (request, response2) => { - if (!request.id) { - return; - } - const browserResponse = createResponseFromIsomorphicResponse(response2); - if (response2.headers.get("x-powered-by") === "msw") { - context.emitter.emit("response:mocked", browserResponse, request.id); - } else { - context.emitter.emit("response:bypass", browserResponse, request.id); - } - }); - interceptor.apply(); - return interceptor; - } - - // src/setupWorker/start/createFallbackStart.ts - function createFallbackStart(context) { - return async function start(options) { - context.fallbackInterceptor = createFallbackRequestListener( - context, - options - ); - printStartMessage({ - message: "Mocking enabled (fallback mode).", - quiet: options.quiet - }); - return void 0; - }; - } - - // src/setupWorker/stop/createFallbackStop.ts - function createFallbackStop(context) { - return function stop() { - var _a2, _b2; - (_a2 = context.fallbackInterceptor) == null ? void 0 : _a2.dispose(); - printStopMessage({ quiet: (_b2 = context.startOptions) == null ? void 0 : _b2.quiet }); - }; - } - - // src/SetupApi.ts - var import_strict_event_emitter = __toESM(require_lib9()); - - // src/utils/internal/pipeEvents.ts - function pipeEvents(source, destination) { - const rawEmit = source.emit; - if (rawEmit._isPiped) { - return; - } - source.emit = function(event, ...data2) { - destination.emit(event, ...data2); - return rawEmit.call(this, event, ...data2); - }; - source.emit._isPiped = true; - } - - // src/utils/internal/toReadonlyArray.ts - function toReadonlyArray(source) { - const clone = [...source]; - Object.freeze(clone); - return clone; - } - - // src/SetupApi.ts - var SetupApi = class { - constructor(...initialHandlers) { - this.validateHandlers(...initialHandlers); - this.initialHandlers = toReadonlyArray(initialHandlers); - this.currentHandlers = [...initialHandlers]; - this.emitter = new import_strict_event_emitter.Emitter(); - this.publicEmitter = new import_strict_event_emitter.Emitter(); - pipeEvents(this.emitter, this.publicEmitter); - this.events = this.createLifeCycleEvents(); - } - validateHandlers(...handlers) { - for (const handler of handlers) { - invariant( - !Array.isArray(handler), - devUtils.formatMessage( - 'Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.' - ), - this.constructor.name - ); - } - } - dispose() { - this.emitter.removeAllListeners(); - this.publicEmitter.removeAllListeners(); - } - use(...runtimeHandlers) { - this.currentHandlers.unshift(...runtimeHandlers); - } - restoreHandlers() { - this.currentHandlers.forEach((handler) => { - handler.markAsSkipped(false); - }); - } - resetHandlers(...nextHandlers) { - this.currentHandlers = nextHandlers.length > 0 ? [...nextHandlers] : [...this.initialHandlers]; - } - listHandlers() { - return toReadonlyArray(this.currentHandlers); - } - createLifeCycleEvents() { - return { - on: (...args) => { - return this.publicEmitter.on(...args); - }, - removeListener: (...args) => { - return this.publicEmitter.removeListener(...args); - }, - removeAllListeners: (...args) => { - return this.publicEmitter.removeAllListeners(...args); - } - }; - } - }; - - // src/setupWorker/setupWorker.ts - var SetupWorkerApi = class extends SetupApi { - constructor(...handlers) { - super(...handlers); - this.startHandler = null; - this.stopHandler = null; - invariant( - !isNodeProcess(), - devUtils.formatMessage( - "Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead." - ) - ); - this.listeners = []; - this.context = this.createWorkerContext(); - } - createWorkerContext() { - const context = { - isMockingEnabled: false, - startOptions: null, - worker: null, - registration: null, - requestHandlers: this.currentHandlers, - emitter: this.emitter, - workerChannel: { - on: (eventType, callback) => { - this.context.events.addListener( - navigator.serviceWorker, - "message", - (event) => { - if (event.source !== this.context.worker) { - return; - } - const message = event.data; - if (!message) { - return; - } - if (message.type === eventType) { - callback(event, message); - } - } - ); - }, - send: (type) => { - var _a2; - (_a2 = this.context.worker) == null ? void 0 : _a2.postMessage(type); - } - }, - events: { - addListener: (target, eventType, callback) => { - target.addEventListener(eventType, callback); - this.listeners.push({ eventType, target, callback }); - return () => { - target.removeEventListener(eventType, callback); - }; - }, - removeAllListeners: () => { - for (const { target, eventType, callback } of this.listeners) { - target.removeEventListener(eventType, callback); - } - this.listeners = []; - }, - once: (eventType) => { - const bindings = []; - return new Promise((resolve, reject) => { - const handleIncomingMessage = (event) => { - try { - const message = event.data; - if (message.type === eventType) { - resolve(message); - } - } catch (error2) { - reject(error2); - } - }; - bindings.push( - this.context.events.addListener( - navigator.serviceWorker, - "message", - handleIncomingMessage - ), - this.context.events.addListener( - navigator.serviceWorker, - "messageerror", - reject - ) - ); - }).finally(() => { - bindings.forEach((unbind) => unbind()); - }); - } - }, - useFallbackMode: !("serviceWorker" in navigator) || location.protocol === "file:" - }; - Object.defineProperties(context, { - requestHandlers: { - get: () => this.currentHandlers - } - }); - this.startHandler = context.useFallbackMode ? createFallbackStart(context) : createStartHandler(context); - this.stopHandler = context.useFallbackMode ? createFallbackStop(context) : createStop(context); - return context; - } - async start(options = {}) { - this.context.startOptions = mergeRight( - DEFAULT_START_OPTIONS, - options - ); - return await this.startHandler(this.context.startOptions, options); - } - printHandlers() { - const handlers = this.listHandlers(); - handlers.forEach((handler) => { - const { header, callFrame } = handler.info; - const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]"; - console.groupCollapsed(`${pragma} ${header}`); - if (callFrame) { - console.log(`Declaration: ${callFrame}`); - } - console.log("Handler:", handler); - console.groupEnd(); - }); - } - stop() { - super.dispose(); - this.context.events.removeAllListeners(); - this.context.emitter.removeAllListeners(); - this.stopHandler(); - } - }; - function setupWorker(...handlers) { - return new SetupWorkerApi(...handlers); - } - - // src/rest.ts - function createRestHandler(method) { - return (path, resolver) => { - return new RestHandler(method, path, resolver); - }; - } - var rest = { - all: createRestHandler(/.+/), - head: createRestHandler("HEAD" /* HEAD */), - get: createRestHandler("GET" /* GET */), - post: createRestHandler("POST" /* POST */), - put: createRestHandler("PUT" /* PUT */), - delete: createRestHandler("DELETE" /* DELETE */), - patch: createRestHandler("PATCH" /* PATCH */), - options: createRestHandler("OPTIONS" /* OPTIONS */) - }; - - // src/graphql.ts - function createScopedGraphQLHandler(operationType, url) { - return (operationName, resolver) => { - return new GraphQLHandler( - operationType, - operationName, - url, - resolver - ); - }; - } - function createGraphQLOperationHandler(url) { - return (resolver) => { - return new GraphQLHandler( - "all", - new RegExp(".*"), - url, - resolver - ); - }; - } - var standardGraphQLHandlers = { - operation: createGraphQLOperationHandler("*"), - query: createScopedGraphQLHandler("query", "*"), - mutation: createScopedGraphQLHandler("mutation", "*") - }; - function createGraphQLLink(url) { - return { - operation: createGraphQLOperationHandler(url), - query: createScopedGraphQLHandler("query", url), - mutation: createScopedGraphQLHandler("mutation", url) - }; - } - var graphql = { - ...standardGraphQLHandlers, - link: createGraphQLLink - }; - - // src/index.ts - checkGlobals(); - return __toCommonJS(src_exports); -})(); -/*! - * cookie - * Copyright(c) 2012-2014 Roman Shtylman - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js.map b/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js.map deleted file mode 100644 index 10337e6a..00000000 --- a/.yarn/unplugged/msw-virtual-db9a3b0eff/node_modules/msw/lib/iife/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../node_modules/.pnpm/cookie@0.4.2/node_modules/cookie/index.js","../../node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/browser.js","../../node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/until.js","../../node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/index.js","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/glossary.ts","../../node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js","../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js","../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js","../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js","../../node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/StrictEventEmitter.js","../../node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/index.js","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/nextTick.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/AsyncEventEmitter.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/Interceptor.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/BatchInterceptor.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/node_modules/set-cookie-parser/lib/set-cookie.js","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/index.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/Headers.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/normalizeHeaderName.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/normalizeHeaderValue.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/isValidHeaderName.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/isValidHeaderValue.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToList.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToString.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToObject.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/stringToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/listToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/reduceHeadersObject.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/objectToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/flattenHeadersList.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/flattenHeadersObject.ts","../../node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/src/index.ts","../../node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/src/format.ts","../../node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/src/invariant.ts","../../node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js","../../node_modules/.pnpm/has-tostringtag@1.0.0/node_modules/has-tostringtag/shams.js","../../node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js","../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js","../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js","../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js","../../node_modules/.pnpm/get-intrinsic@1.2.0/node_modules/get-intrinsic/index.js","../../node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/index.js","../../node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/callBound.js","../../node_modules/.pnpm/is-arguments@1.1.1/node_modules/is-arguments/index.js","../../node_modules/.pnpm/is-generator-function@1.0.10/node_modules/is-generator-function/index.js","../../node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js","../../node_modules/.pnpm/for-each@0.3.3/node_modules/for-each/index.js","../../node_modules/.pnpm/available-typed-arrays@1.0.5/node_modules/available-typed-arrays/index.js","../../node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js","../../node_modules/.pnpm/is-typed-array@1.1.10/node_modules/is-typed-array/index.js","../../node_modules/.pnpm/which-typed-array@1.1.9/node_modules/which-typed-array/index.js","../../node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js","../../node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js","../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js","../../node_modules/.pnpm/util@0.12.5/node_modules/util/util.js","../../node_modules/.pnpm/web-encoding@1.1.5/node_modules/web-encoding/src/lib.js","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/bufferUtils.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/uuid.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/IsomorphicRequest.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/createLazyCallback.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/InteractiveIsomorphicRequest.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/getCleanUrl.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/index.ts","../../node_modules/.pnpm/set-cookie-parser@2.5.1/node_modules/set-cookie-parser/lib/set-cookie.js","../../node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/store.js","../../node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/index.js","../../node_modules/.pnpm/js-levenshtein@1.1.6/node_modules/js-levenshtein/index.js","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/toIsoResponse.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/fetch/index.ts","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/conventions.js","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom.js","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/entities.js","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/sax.js","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/dom-parser.js","../../node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/index.js","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/utils/parseJson.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/utils/bufferFrom.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/polyfills/EventPolyfill.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/utils/createEvent.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestOverride.ts","../../node_modules/.pnpm/@mswjs+interceptors@0.17.10/node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/index.ts","../../node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/MemoryLeakError.js","../../node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/Emitter.js","../../node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/index.js","../../src/index.ts","../../src/context/index.ts","../../src/context/status.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/node_modules/set-cookie-parser/lib/set-cookie.js","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/Headers.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/normalizeHeaderName.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/normalizeHeaderValue.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/isValidHeaderName.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/utils/isValidHeaderValue.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToList.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToString.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/headersToObject.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/stringToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/listToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/reduceHeadersObject.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/objectToHeaders.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/flattenHeadersList.ts","../../node_modules/.pnpm/headers-polyfill@3.2.5/node_modules/headers-polyfill/src/transformers/flattenHeadersObject.ts","../../src/context/set.ts","../../src/context/cookie.ts","../../src/context/body.ts","../../src/utils/internal/jsonParse.ts","../../src/utils/internal/isObject.ts","../../src/utils/internal/mergeRight.ts","../../src/context/json.ts","../../src/context/data.ts","../../src/context/extensions.ts","../../node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/src/index.ts","../../src/context/delay.ts","../../src/context/errors.ts","../../src/context/fetch.ts","../../src/context/text.ts","../../src/context/xml.ts","../../node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/src/format.ts","../../node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/src/invariant.ts","../../src/utils/internal/devUtils.ts","../../src/utils/internal/checkGlobals.ts","../../src/setupWorker/start/createStartHandler.ts","../../src/setupWorker/start/utils/getWorkerInstance.ts","../../src/setupWorker/start/utils/getWorkerByRegistration.ts","../../src/utils/url/getAbsoluteWorkerUrl.ts","../../src/setupWorker/start/utils/printStartMessage.ts","../../src/setupWorker/start/utils/enableMocking.ts","../../src/setupWorker/start/utils/createMessageChannel.ts","../../src/utils/NetworkError.ts","../../src/utils/request/parseWorkerRequest.ts","../../src/utils/request/MockedRequest.ts","../../src/utils/request/getRequestCookies.ts","../../src/utils/internal/parseMultipartData.ts","../../src/utils/request/parseBody.ts","../../src/utils/internal/isStringEqual.ts","../../src/utils/handleRequest.ts","../../src/utils/getResponse.ts","../../src/utils/request/onUnhandledRequest.ts","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/devAssert.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/isObjectLike.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/invariant.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/location.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/printLocation.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/GraphQLError.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/syntaxError.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/ast.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/directiveLocation.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/kinds.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/characterClasses.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/blockString.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/tokenKind.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/lexer.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/inspect.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/instanceOf.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/source.mjs","../../node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/parser.mjs","../../src/utils/request/getPublicUrlFromRequest.ts","../../src/utils/internal/parseGraphQLRequest.ts","../../src/utils/logging/getStatusCodeColor.ts","../../src/utils/logging/getTimestamp.ts","../../src/utils/logging/prepareRequest.ts","../../src/utils/logging/prepareResponse.ts","../../node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/src/index.ts","../../src/utils/matching/matchRequestUrl.ts","../../src/utils/url/cleanUrl.ts","../../src/utils/url/isAbsoluteUrl.ts","../../src/utils/url/getAbsoluteUrl.ts","../../src/utils/matching/normalizePath.ts","../../src/utils/internal/compose.ts","../../src/response.ts","../../src/utils/internal/getCallFrame.ts","../../src/utils/internal/isIterable.ts","../../src/handlers/RequestHandler.ts","../../src/handlers/RestHandler.ts","../../src/context/field.ts","../../src/utils/internal/tryCatch.ts","../../src/handlers/GraphQLHandler.ts","../../src/utils/request/readResponseCookies.ts","../../src/utils/logging/serializeResponse.ts","../../src/setupWorker/start/createRequestListener.ts","../../src/utils/internal/requestIntegrityCheck.ts","../../src/utils/deferNetworkRequestsUntil.ts","../../src/setupWorker/start/createResponseListener.ts","../../src/setupWorker/start/utils/validateWorkerScope.ts","../../src/setupWorker/stop/utils/printStopMessage.ts","../../src/setupWorker/stop/createStop.ts","../../src/setupWorker/start/utils/prepareStartHandler.ts","../../src/setupWorker/start/createFallbackRequestListener.ts","../../src/utils/request/createResponseFromIsomorphicResponse.ts","../../src/setupWorker/start/createFallbackStart.ts","../../src/setupWorker/stop/createFallbackStop.ts","../../src/SetupApi.ts","../../src/utils/internal/pipeEvents.ts","../../src/utils/internal/toReadonlyArray.ts","../../src/setupWorker/setupWorker.ts","../../src/rest.ts","../../src/graphql.ts"],"sourcesContent":["/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar decode = decodeURIComponent;\nvar encode = encodeURIComponent;\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var pairs = str.split(';')\n var dec = opt.decode || decode;\n\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n var index = pair.indexOf('=')\n\n // skip things that don't look like key=value\n if (index < 0) {\n continue;\n }\n\n var key = pair.substring(0, index).trim()\n\n // only assign once\n if (undefined == obj[key]) {\n var val = pair.substring(index + 1, pair.length).trim()\n\n // quoted values\n if (val[0] === '\"') {\n val = val.slice(1, -1)\n }\n\n obj[key] = tryDecode(val, dec);\n }\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid')\n }\n\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (typeof opt.expires.toUTCString !== 'function') {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n case 'none':\n str += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","\"use strict\";\n\n// ref: https://github.com/tc39/proposal-global\nvar getGlobal = function () {\n\t// the only reliable means to get the global object is\n\t// `Function('return this')()`\n\t// However, this causes CSP violations in Chrome apps.\n\tif (typeof self !== 'undefined') { return self; }\n\tif (typeof window !== 'undefined') { return window; }\n\tif (typeof global !== 'undefined') { return global; }\n\tthrow new Error('unable to locate global object');\n}\n\nvar globalObject = getGlobal();\n\nmodule.exports = exports = globalObject.fetch;\n\n// Needed for TypeScript and Webpack.\nif (globalObject.fetch) {\n\texports.default = globalObject.fetch.bind(globalObject);\n}\n\nexports.Headers = globalObject.Headers;\nexports.Request = globalObject.Request;\nexports.Response = globalObject.Response;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Gracefully handles a given Promise factory.\n * @example\n * cosnt [error, data] = await until(() => asyncAction())\n */\nexports.until = async (promise) => {\n try {\n const data = await promise().catch((error) => {\n throw error;\n });\n return [null, data];\n }\n catch (error) {\n return [error, null];\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar until_1 = require(\"./until\");\nexports.until = until_1.until;\n",null,"/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nexports.__esModule = true;\nexports.StrictEventEmitter = void 0;\nvar events_1 = require(\"events\");\nvar StrictEventEmitter = /** @class */ (function (_super) {\n __extends(StrictEventEmitter, _super);\n function StrictEventEmitter() {\n return _super.call(this) || this;\n }\n StrictEventEmitter.prototype.on = function (event, listener) {\n return _super.prototype.on.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.once = function (event, listener) {\n return _super.prototype.once.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.off = function (event, listener) {\n return _super.prototype.off.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.emit = function (event) {\n var data = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n data[_i - 1] = arguments[_i];\n }\n return _super.prototype.emit.apply(this, __spreadArrays([event.toString()], data));\n };\n StrictEventEmitter.prototype.addListener = function (event, listener) {\n return _super.prototype.addListener.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.prependListener = function (event, listener) {\n return _super.prototype.prependListener.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.prependOnceListener = function (event, listener) {\n return _super.prototype.prependOnceListener.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.removeListener = function (event, listener) {\n return _super.prototype.removeListener.call(this, event.toString(), listener);\n };\n StrictEventEmitter.prototype.removeAllListeners = function (event) {\n if (event) {\n return _super.prototype.removeAllListeners.call(this, event.toString());\n }\n return _super.prototype.removeAllListeners.call(this);\n };\n StrictEventEmitter.prototype.eventNames = function () {\n return _super.prototype.eventNames.call(this);\n };\n StrictEventEmitter.prototype.listeners = function (event) {\n return _super.prototype.listeners.call(this, event.toString());\n };\n StrictEventEmitter.prototype.rawListeners = function (event) {\n return _super.prototype.rawListeners.call(this, event.toString());\n };\n StrictEventEmitter.prototype.listenerCount = function (event) {\n return _super.prototype.listenerCount.call(this, event.toString());\n };\n return StrictEventEmitter;\n}(events_1.EventEmitter));\nexports.StrictEventEmitter = StrictEventEmitter;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nexports.__esModule = true;\n__exportStar(require(\"./StrictEventEmitter\"), exports);\n",null,null,null,null,"\"use strict\";\n\nvar defaultParseOptions = {\n decodeValues: true,\n map: false,\n silent: false,\n};\n\nfunction isNonEmptyString(str) {\n return typeof str === \"string\" && !!str.trim();\n}\n\nfunction parseString(setCookieValue, options) {\n var parts = setCookieValue.split(\";\").filter(isNonEmptyString);\n\n var nameValuePairStr = parts.shift();\n var parsed = parseNameValuePair(nameValuePairStr);\n var name = parsed.name;\n var value = parsed.value;\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n try {\n value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value\n } catch (e) {\n console.error(\n \"set-cookie-parser encountered an error while decoding a cookie with value '\" +\n value +\n \"'. Set options.decodeValues to false to disable this feature.\",\n e\n );\n }\n\n var cookie = {\n name: name,\n value: value,\n };\n\n parts.forEach(function (part) {\n var sides = part.split(\"=\");\n var key = sides.shift().trimLeft().toLowerCase();\n var value = sides.join(\"=\");\n if (key === \"expires\") {\n cookie.expires = new Date(value);\n } else if (key === \"max-age\") {\n cookie.maxAge = parseInt(value, 10);\n } else if (key === \"secure\") {\n cookie.secure = true;\n } else if (key === \"httponly\") {\n cookie.httpOnly = true;\n } else if (key === \"samesite\") {\n cookie.sameSite = value;\n } else {\n cookie[key] = value;\n }\n });\n\n return cookie;\n}\n\nfunction parseNameValuePair(nameValuePairStr) {\n // Parses name-value-pair according to rfc6265bis draft\n\n var name = \"\";\n var value = \"\";\n var nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift();\n value = nameValueArr.join(\"=\"); // everything after the first =, joined by a \"=\" if there was more than one part\n } else {\n value = nameValuePairStr;\n }\n\n return { name: name, value: value };\n}\n\nfunction parse(input, options) {\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!input) {\n if (!options.map) {\n return [];\n } else {\n return {};\n }\n }\n\n if (input.headers) {\n if (typeof input.headers.getSetCookie === \"function\") {\n // for fetch responses - they combine headers of the same type in the headers array,\n // but getSetCookie returns an uncombined array\n input = input.headers.getSetCookie();\n } else if (input.headers[\"set-cookie\"]) {\n // fast-path for node.js (which automatically normalizes header names to lower-case\n input = input.headers[\"set-cookie\"];\n } else {\n // slow-path for other environments - see #25\n var sch =\n input.headers[\n Object.keys(input.headers).find(function (key) {\n return key.toLowerCase() === \"set-cookie\";\n })\n ];\n // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36\n if (!sch && input.headers.cookie && !options.silent) {\n console.warn(\n \"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.\"\n );\n }\n input = sch;\n }\n }\n if (!Array.isArray(input)) {\n input = [input];\n }\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!options.map) {\n return input.filter(isNonEmptyString).map(function (str) {\n return parseString(str, options);\n });\n } else {\n var cookies = {};\n return input.filter(isNonEmptyString).reduce(function (cookies, str) {\n var cookie = parseString(str, options);\n cookies[cookie.name] = cookie;\n return cookies;\n }, cookies);\n }\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n\n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nfunction splitCookiesString(cookiesString) {\n if (Array.isArray(cookiesString)) {\n return cookiesString;\n }\n if (typeof cookiesString !== \"string\") {\n return [];\n }\n\n var cookiesStrings = [];\n var pos = 0;\n var start;\n var ch;\n var lastComma;\n var nextStart;\n var cookiesSeparatorFound;\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1;\n }\n return pos < cookiesString.length;\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos);\n\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n }\n\n while (pos < cookiesString.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(cookiesString.substring(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length));\n }\n }\n\n return cookiesStrings;\n}\n\nmodule.exports = parse;\nmodule.exports.parse = parse;\nmodule.exports.parseString = parseString;\nmodule.exports.splitCookiesString = splitCookiesString;\n","export { default as Headers } from './Headers'\n\nexport { headersToString } from './transformers/headersToString'\nexport { headersToList } from './transformers/headersToList'\nexport { headersToObject } from './transformers/headersToObject'\nexport { stringToHeaders } from './transformers/stringToHeaders'\nexport { listToHeaders } from './transformers/listToHeaders'\nexport { objectToHeaders } from './transformers/objectToHeaders'\n\nexport { reduceHeadersObject } from './transformers/reduceHeadersObject'\nexport { flattenHeadersList } from './transformers/flattenHeadersList'\nexport { flattenHeadersObject } from './transformers/flattenHeadersObject'\n\n/* Typings */\nexport {\n HeadersList,\n FlatHeadersList,\n HeadersObject,\n FlatHeadersObject,\n} from './glossary'\n","import { splitCookiesString } from 'set-cookie-parser'\nimport { HeadersList, HeadersObject } from './glossary'\nimport { normalizeHeaderName } from './utils/normalizeHeaderName'\nimport { normalizeHeaderValue } from './utils/normalizeHeaderValue'\nimport { isValidHeaderName } from './utils/isValidHeaderName'\nimport { isValidHeaderValue } from './utils/isValidHeaderValue'\n\nconst NORMALIZED_HEADERS: unique symbol = Symbol('normalizedHeaders')\nconst RAW_HEADER_NAMES: unique symbol = Symbol('rawHeaderNames')\nconst HEADER_VALUE_DELIMITER = ', ' as const\n\nexport default class HeadersPolyfill {\n // Normalized header {\"name\":\"a, b\"} storage.\n private [NORMALIZED_HEADERS]: Record = {}\n\n // Keeps the mapping between the raw header name\n // and the normalized header name to ease the lookup.\n private [RAW_HEADER_NAMES]: Map = new Map()\n\n constructor(init?: HeadersInit | HeadersObject | HeadersList) {\n /**\n * @note Cannot check if the `init` is an instance of the `Headers`\n * because that class is only defined in the browser.\n */\n if (\n ['Headers', 'HeadersPolyfill'].includes(init?.constructor.name) ||\n init instanceof HeadersPolyfill\n ) {\n const initialHeaders = init as Headers\n initialHeaders.forEach((value, name) => {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(init)) {\n init.forEach(([name, value]) => {\n this.append(\n name,\n Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value\n )\n })\n } else if (init) {\n Object.getOwnPropertyNames(init).forEach((name) => {\n const value = init[name]\n this.append(\n name,\n Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value\n )\n })\n }\n }\n\n [Symbol.iterator]() {\n return this.entries()\n }\n\n *keys(): IterableIterator {\n for (const [name] of this.entries()) {\n yield name\n }\n }\n\n *values(): IterableIterator {\n for (const [, value] of this.entries()) {\n yield value\n }\n }\n\n *entries(): IterableIterator<[string, string]> {\n // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine\n let sortedKeys = Object.keys(this[NORMALIZED_HEADERS]).sort((a, b) =>\n a.localeCompare(b)\n )\n for (const name of sortedKeys) {\n if (name === 'set-cookie') {\n for (const value of this.getSetCookie()) {\n yield [name, value]\n }\n } else {\n yield [name, this.get(name)]\n }\n }\n }\n\n /**\n * Returns a boolean stating whether a `Headers` object contains a certain header.\n */\n has(name: string): boolean {\n if (!isValidHeaderName(name)) {\n throw new TypeError(`Invalid header name \"${name}\"`)\n }\n\n return this[NORMALIZED_HEADERS].hasOwnProperty(normalizeHeaderName(name))\n }\n\n /**\n * Returns a `ByteString` sequence of all the values of a header with a given name.\n */\n get(name: string): string | null {\n if (!isValidHeaderName(name)) {\n throw TypeError(`Invalid header name \"${name}\"`)\n }\n\n return this[NORMALIZED_HEADERS][normalizeHeaderName(name)] ?? null\n }\n\n /**\n * Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n */\n set(name: string, value: string): void {\n if (!isValidHeaderName(name) || !isValidHeaderValue(value)) {\n return\n }\n\n const normalizedName = normalizeHeaderName(name)\n const normalizedValue = normalizeHeaderValue(value)\n\n this[NORMALIZED_HEADERS][normalizedName] =\n normalizeHeaderValue(normalizedValue)\n this[RAW_HEADER_NAMES].set(normalizedName, name)\n }\n\n /**\n * Appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n */\n append(name: string, value: string): void {\n if (!isValidHeaderName(name) || !isValidHeaderValue(value)) {\n return\n }\n\n const normalizedName = normalizeHeaderName(name)\n const normalizedValue = normalizeHeaderValue(value)\n\n let resolvedValue = this.has(normalizedName)\n ? `${this.get(normalizedName)}, ${normalizedValue}`\n : normalizedValue\n\n this.set(name, resolvedValue)\n }\n\n /**\n * Deletes a header from the `Headers` object.\n */\n delete(name: string): void {\n if (!isValidHeaderName(name)) {\n return\n }\n\n if (!this.has(name)) {\n return\n }\n\n const normalizedName = normalizeHeaderName(name)\n delete this[NORMALIZED_HEADERS][normalizedName]\n this[RAW_HEADER_NAMES].delete(normalizedName)\n }\n\n /**\n * Returns the object of all the normalized headers.\n */\n all(): Record {\n return this[NORMALIZED_HEADERS]\n }\n\n /**\n * Returns the object of all the raw headers.\n */\n raw(): Record {\n const rawHeaders: Record = {}\n\n for (const [name, value] of this.entries()) {\n rawHeaders[this[RAW_HEADER_NAMES].get(name)] = value\n }\n\n return rawHeaders\n }\n\n /**\n * Traverses the `Headers` object,\n * calling the given callback for each header.\n */\n forEach(\n callback: (\n this: ThisArg,\n value: string,\n name: string,\n parent: this\n ) => void,\n thisArg?: ThisArg\n ) {\n for (const [name, value] of this.entries()) {\n callback.call(thisArg, value, name, this)\n }\n }\n\n /**\n * Returns an array containing the values\n * of all Set-Cookie headers associated\n * with a response\n */\n getSetCookie(): string[] {\n const setCookieHeader = this.get('set-cookie')\n\n if (setCookieHeader === null) {\n return []\n }\n\n if (setCookieHeader === '') {\n return ['']\n }\n\n return splitCookiesString(setCookieHeader)\n }\n}\n","const HEADERS_INVALID_CHARACTERS = /[^a-z0-9\\-#$%&'*+.^_`|~]/i\n\nexport function normalizeHeaderName(name: string): string {\n if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === '') {\n throw new TypeError('Invalid character in header field name')\n }\n\n return name.trim().toLowerCase()\n}\n","const charCodesToRemove = [\n String.fromCharCode(0x0a),\n String.fromCharCode(0x0d),\n String.fromCharCode(0x09),\n String.fromCharCode(0x20),\n]\n\nconst HEADER_VALUE_REMOVE_REGEXP = new RegExp(\n `(^[${charCodesToRemove.join('')}]|$[${charCodesToRemove.join('')}])`,\n 'g'\n)\n\n/**\n * Normalize the given header value.\n * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize\n */\nexport function normalizeHeaderValue(value: string): string {\n const nextValue = value.replace(HEADER_VALUE_REMOVE_REGEXP, '')\n return nextValue\n}\n","/**\n * Validate the given header name.\n * @see https://fetch.spec.whatwg.org/#header-name\n */\nexport function isValidHeaderName(value: unknown) {\n if (typeof value !== 'string') {\n return false\n }\n\n if (value.length === 0) {\n return false\n }\n\n for (let i = 0; i < value.length; i++) {\n const character = value.charCodeAt(i)\n\n if (character > 0x7f || !isToken(character)) {\n return false\n }\n }\n\n return true\n}\n\nfunction isToken(value: string | number): boolean {\n return ![\n 0x7f,\n 0x20,\n '(',\n ')',\n '<',\n '>',\n '@',\n ',',\n ';',\n ':',\n '\\\\',\n '\"',\n '/',\n '[',\n ']',\n '?',\n '=',\n '{',\n '}',\n ].includes(value)\n}\n","/**\n * Validate the given header value.\n * @see https://fetch.spec.whatwg.org/#header-value\n */\nexport function isValidHeaderValue(value: unknown): boolean {\n if (typeof value !== 'string') {\n return false\n }\n\n if (value.trim() !== value) {\n return false\n }\n\n for (let i = 0; i < value.length; i++) {\n const character = value.charCodeAt(i)\n\n if (\n // NUL.\n character === 0x00 ||\n // HTTP newline bytes.\n character === 0x0a ||\n character === 0x0d\n ) {\n return false\n }\n }\n\n return true\n}\n","import { HeadersList } from '../glossary'\n\nexport function headersToList(headers: Headers): HeadersList {\n const headersList: HeadersList = []\n\n headers.forEach((value, name) => {\n const resolvedValue = value.includes(',')\n ? value.split(',').map((value) => value.trim())\n : value\n\n headersList.push([name, resolvedValue])\n })\n\n return headersList\n}\n","import { headersToList } from './headersToList'\n\n/**\n * Converts a given `Headers` instance to its string representation.\n */\nexport function headersToString(headers: Headers): string {\n const list = headersToList(headers)\n const lines = list.map(([name, value]) => {\n const values = ([] as string[]).concat(value)\n return `${name}: ${values.join(', ')}`\n })\n\n return lines.join('\\r\\n')\n}\n","import { HeadersObject } from '../glossary'\n\n// List of headers that cannot have multiple values,\n// while potentially having a comma in their single value.\nconst singleValueHeaders = ['user-agent']\n\n/**\n * Converts a given `Headers` instance into a plain object.\n * Respects headers with multiple values.\n */\nexport function headersToObject(headers: Headers): HeadersObject {\n const headersObject: HeadersObject = {}\n\n headers.forEach((value, name) => {\n const isMultiValue =\n !singleValueHeaders.includes(name.toLowerCase()) && value.includes(',')\n headersObject[name] = isMultiValue\n ? value.split(',').map((s) => s.trim())\n : value\n })\n\n return headersObject\n}\n","import HeadersPolyfill from '../Headers'\n\n/**\n * Converts a string representation of headers (i.e. from XMLHttpRequest)\n * to a new `Headers` instance.\n */\nexport function stringToHeaders(str: string): HeadersPolyfill {\n const lines = str.trim().split(/[\\r\\n]+/)\n\n return lines.reduce((headers, line) => {\n if (line.trim() === '') {\n return headers\n }\n\n const parts = line.split(': ')\n const name = parts.shift()\n const value = parts.join(': ')\n headers.append(name, value)\n\n return headers\n }, new HeadersPolyfill())\n}\n","import HeadersPolyfill from '../Headers'\nimport { HeadersList } from '../glossary'\n\nexport function listToHeaders(list: HeadersList): HeadersPolyfill {\n const headers = new HeadersPolyfill()\n\n list.forEach(([name, value]) => {\n const values = ([] as string[]).concat(value)\n\n values.forEach((value) => {\n headers.append(name, value)\n })\n })\n\n return headers\n}\n","import { HeadersObject } from '../glossary'\n\n/**\n * Reduces given headers object instnace.\n */\nexport function reduceHeadersObject(\n headers: HeadersObject,\n reducer: (headers: R, name: string, value: string | string[]) => R,\n initialState: R\n): R {\n return Object.keys(headers).reduce((nextHeaders, name) => {\n return reducer(nextHeaders, name, headers[name])\n }, initialState)\n}\n","import HeadersPolyfill from '../Headers'\nimport { reduceHeadersObject } from './reduceHeadersObject'\n\n/**\n * Converts a given headers object to a new `Headers` instance.\n */\nexport function objectToHeaders(\n headersObject: Record\n): HeadersPolyfill {\n return reduceHeadersObject(\n headersObject,\n (headers, name, value) => {\n const values = ([] as string[]).concat(value).filter(Boolean)\n\n values.forEach((value) => {\n headers.append(name, value)\n })\n\n return headers\n },\n new HeadersPolyfill()\n )\n}\n","import { HeadersList, FlatHeadersList } from '../glossary'\n\nexport function flattenHeadersList(list: HeadersList): FlatHeadersList {\n return list.map(([name, values]) => {\n return [name, ([] as string[]).concat(values).join(', ')]\n })\n}\n","import { HeadersObject, FlatHeadersObject } from '../glossary'\nimport { reduceHeadersObject } from './reduceHeadersObject'\n\nexport function flattenHeadersObject(\n headersObject: HeadersObject\n): FlatHeadersObject {\n return reduceHeadersObject(\n headersObject,\n (headers, name, value) => {\n headers[name] = ([] as string[]).concat(value).join(', ')\n return headers\n },\n {}\n )\n}\n","export * from './invariant'\nexport * from './format'\n","const POSITIONALS_EXP = /(%?)(%([sdjo]))/g\n\nfunction serializePositional(positional: any, flag: string): any {\n switch (flag) {\n // Strings.\n case 's':\n return positional\n\n // Digits.\n case 'd':\n case 'i':\n return Number(positional)\n\n // JSON.\n case 'j':\n return JSON.stringify(positional)\n\n // Objects.\n case 'o': {\n // Preserve stings to prevent extra quotes around them.\n if (typeof positional === 'string') {\n return positional\n }\n\n const json = JSON.stringify(positional)\n\n // If the positional isn't serializable, return it as-is.\n if (json === '{}' || json === '[]' || /^\\[object .+?\\]$/.test(json)) {\n return positional\n }\n\n return json\n }\n }\n}\n\nexport function format(message: string, ...positionals: any[]): string {\n if (positionals.length === 0) {\n return message\n }\n\n let positionalIndex = 0\n let formattedMessage = message.replace(\n POSITIONALS_EXP,\n (match, isEscaped, _, flag) => {\n const positional = positionals[positionalIndex]\n const value = serializePositional(positional, flag)\n\n if (!isEscaped) {\n positionalIndex++\n return value\n }\n\n return match\n }\n )\n\n // Append unresolved positionals to string as-is.\n if (positionalIndex < positionals.length) {\n formattedMessage += ` ${positionals.slice(positionalIndex).join(' ')}`\n }\n\n formattedMessage = formattedMessage.replace(/%{2,2}/g, '%')\n\n return formattedMessage\n}\n","import { format } from './format'\n\nconst STACK_FRAMES_TO_IGNORE = 2\n\n/**\n * Remove the \"outvariant\" package trace from the given error.\n * This scopes down the error stack to the relevant parts\n * when used in other applications.\n */\nfunction cleanErrorStack(error: Error): void {\n if (!error.stack) {\n return\n }\n\n const nextStack = error.stack.split('\\n')\n nextStack.splice(1, STACK_FRAMES_TO_IGNORE)\n error.stack = nextStack.join('\\n')\n}\n\nexport class InvariantError extends Error {\n name = 'Invariant Violation'\n\n constructor(public readonly message: string, ...positionals: any[]) {\n super(message)\n this.message = format(message, ...positionals)\n cleanErrorStack(this)\n }\n}\n\nexport interface CustomErrorConstructor {\n new (message: string): Error\n}\n\nexport interface CustomErrorFactory {\n (message: string): Error\n}\n\nexport type CustomError = CustomErrorConstructor | CustomErrorFactory\n\ntype Invariant = {\n (\n predicate: unknown,\n message: string,\n ...positionals: any[]\n ): asserts predicate\n\n as(\n ErrorConstructor: CustomError,\n predicate: unknown,\n message: string,\n ...positionals: unknown[]\n ): asserts predicate\n}\n\nexport const invariant: Invariant = (\n predicate,\n message,\n ...positionals\n): asserts predicate => {\n if (!predicate) {\n throw new InvariantError(message, ...positionals)\n }\n}\n\ninvariant.as = (ErrorConstructor, predicate, message, ...positionals) => {\n if (!predicate) {\n const isConstructor = ErrorConstructor.prototype.name != null\n\n const error: Error = isConstructor\n ? // @ts-ignore\n new ErrorConstructor(format(message, positionals))\n : // @ts-ignore\n ErrorConstructor(format(message, positionals))\n\n throw error\n }\n}\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\ntry {\n\tnull.error; // eslint-disable-line no-unused-expressions\n} catch (e) {\n\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\tvar errorProto = getProto(getProto(e));\n\tINTRINSICS['%Error.prototype%'] = errorProto;\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\nvar fnToStr = Function.prototype.toString;\nvar reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;\nvar badArrayLike;\nvar isCallableMarker;\nif (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {\n\ttry {\n\t\tbadArrayLike = Object.defineProperty({}, 'length', {\n\t\t\tget: function () {\n\t\t\t\tthrow isCallableMarker;\n\t\t\t}\n\t\t});\n\t\tisCallableMarker = {};\n\t\t// eslint-disable-next-line no-throw-literal\n\t\treflectApply(function () { throw 42; }, null, badArrayLike);\n\t} catch (_) {\n\t\tif (_ !== isCallableMarker) {\n\t\t\treflectApply = null;\n\t\t}\n\t}\n} else {\n\treflectApply = null;\n}\n\nvar constructorRegex = /^\\s*class\\b/;\nvar isES6ClassFn = function isES6ClassFunction(value) {\n\ttry {\n\t\tvar fnStr = fnToStr.call(value);\n\t\treturn constructorRegex.test(fnStr);\n\t} catch (e) {\n\t\treturn false; // not a function\n\t}\n};\n\nvar tryFunctionObject = function tryFunctionToStr(value) {\n\ttry {\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tfnToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar objectClass = '[object Object]';\nvar fnClass = '[object Function]';\nvar genClass = '[object GeneratorFunction]';\nvar ddaClass = '[object HTMLAllCollection]'; // IE 11\nvar ddaClass2 = '[object HTML document.all class]';\nvar ddaClass3 = '[object HTMLCollection]'; // IE 9-10\nvar hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`\n\nvar isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing\n\nvar isDDA = function isDocumentDotAll() { return false; };\nif (typeof document === 'object') {\n\t// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly\n\tvar all = document.all;\n\tif (toStr.call(all) === toStr.call(document.all)) {\n\t\tisDDA = function isDocumentDotAll(value) {\n\t\t\t/* globals document: false */\n\t\t\t// in IE 6-8, typeof document.all is \"object\" and it's truthy\n\t\t\tif ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {\n\t\t\t\ttry {\n\t\t\t\t\tvar str = toStr.call(value);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tstr === ddaClass\n\t\t\t\t\t\t|| str === ddaClass2\n\t\t\t\t\t\t|| str === ddaClass3 // opera 12.16\n\t\t\t\t\t\t|| str === objectClass // IE 6-8\n\t\t\t\t\t) && value('') == null; // eslint-disable-line eqeqeq\n\t\t\t\t} catch (e) { /**/ }\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t}\n}\n\nmodule.exports = reflectApply\n\t? function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\ttry {\n\t\t\treflectApply(value, null, badArrayLike);\n\t\t} catch (e) {\n\t\t\tif (e !== isCallableMarker) { return false; }\n\t\t}\n\t\treturn !isES6ClassFn(value) && tryFunctionObject(value);\n\t}\n\t: function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\tif (hasToStringTag) { return tryFunctionObject(value); }\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tvar strClass = toStr.call(value);\n\t\tif (strClass !== fnClass && strClass !== genClass && !(/^\\[object HTML/).test(strClass)) { return false; }\n\t\treturn tryFunctionObject(value);\n\t};\n","'use strict';\n\nvar isCallable = require('is-callable');\n\nvar toStr = Object.prototype.toString;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n};\n\nvar forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n};\n\nvar forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n};\n\nvar forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n};\n\nmodule.exports = forEach;\n","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\n\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar gOPD = require('gopd');\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\nvar gOPD = require('gopd');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').slice(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.slice(1, -1);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","\"use strict\"\n\nexports.TextEncoder =\n typeof TextEncoder !== \"undefined\" ? TextEncoder : require(\"util\").TextEncoder\n\nexports.TextDecoder =\n typeof TextDecoder !== \"undefined\" ? TextDecoder : require(\"util\").TextDecoder\n",null,null,null,null,null,null,null,"\"use strict\";\n\nvar defaultParseOptions = {\n decodeValues: true,\n map: false,\n silent: false,\n};\n\nfunction isNonEmptyString(str) {\n return typeof str === \"string\" && !!str.trim();\n}\n\nfunction parseString(setCookieValue, options) {\n var parts = setCookieValue.split(\";\").filter(isNonEmptyString);\n\n var nameValuePairStr = parts.shift();\n var parsed = parseNameValuePair(nameValuePairStr);\n var name = parsed.name;\n var value = parsed.value;\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n try {\n value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value\n } catch (e) {\n console.error(\n \"set-cookie-parser encountered an error while decoding a cookie with value '\" +\n value +\n \"'. Set options.decodeValues to false to disable this feature.\",\n e\n );\n }\n\n var cookie = {\n name: name,\n value: value,\n };\n\n parts.forEach(function (part) {\n var sides = part.split(\"=\");\n var key = sides.shift().trimLeft().toLowerCase();\n var value = sides.join(\"=\");\n if (key === \"expires\") {\n cookie.expires = new Date(value);\n } else if (key === \"max-age\") {\n cookie.maxAge = parseInt(value, 10);\n } else if (key === \"secure\") {\n cookie.secure = true;\n } else if (key === \"httponly\") {\n cookie.httpOnly = true;\n } else if (key === \"samesite\") {\n cookie.sameSite = value;\n } else {\n cookie[key] = value;\n }\n });\n\n return cookie;\n}\n\nfunction parseNameValuePair(nameValuePairStr) {\n // Parses name-value-pair according to rfc6265bis draft\n\n var name = \"\";\n var value = \"\";\n var nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift();\n value = nameValueArr.join(\"=\"); // everything after the first =, joined by a \"=\" if there was more than one part\n } else {\n value = nameValuePairStr;\n }\n\n return { name: name, value: value };\n}\n\nfunction parse(input, options) {\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!input) {\n if (!options.map) {\n return [];\n } else {\n return {};\n }\n }\n\n if (input.headers && input.headers[\"set-cookie\"]) {\n // fast-path for node.js (which automatically normalizes header names to lower-case\n input = input.headers[\"set-cookie\"];\n } else if (input.headers) {\n // slow-path for other environments - see #25\n var sch =\n input.headers[\n Object.keys(input.headers).find(function (key) {\n return key.toLowerCase() === \"set-cookie\";\n })\n ];\n // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36\n if (!sch && input.headers.cookie && !options.silent) {\n console.warn(\n \"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.\"\n );\n }\n input = sch;\n }\n if (!Array.isArray(input)) {\n input = [input];\n }\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!options.map) {\n return input.filter(isNonEmptyString).map(function (str) {\n return parseString(str, options);\n });\n } else {\n var cookies = {};\n return input.filter(isNonEmptyString).reduce(function (cookies, str) {\n var cookie = parseString(str, options);\n cookies[cookie.name] = cookie;\n return cookies;\n }, cookies);\n }\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n\n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nfunction splitCookiesString(cookiesString) {\n if (Array.isArray(cookiesString)) {\n return cookiesString;\n }\n if (typeof cookiesString !== \"string\") {\n return [];\n }\n\n var cookiesStrings = [];\n var pos = 0;\n var start;\n var ch;\n var lastComma;\n var nextStart;\n var cookiesSeparatorFound;\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1;\n }\n return pos < cookiesString.length;\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos);\n\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n }\n\n while (pos < cookiesString.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(cookiesString.substring(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length));\n }\n }\n\n return cookiesStrings;\n}\n\nmodule.exports = parse;\nmodule.exports.parse = parse;\nmodule.exports.parseString = parseString;\nmodule.exports.splitCookiesString = splitCookiesString;\n","\"use strict\";\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.store = exports.PERSISTENCY_KEY = void 0;\nconst set_cookie_parser_1 = require(\"set-cookie-parser\");\nexports.PERSISTENCY_KEY = 'MSW_COOKIE_STORE';\nfunction supportsLocalStorage() {\n try {\n if (localStorage == null) {\n return false;\n }\n const testKey = exports.PERSISTENCY_KEY + '_test';\n localStorage.setItem(testKey, 'test');\n localStorage.getItem(testKey);\n localStorage.removeItem(testKey);\n return true;\n }\n catch (error) {\n return false;\n }\n}\nclass CookieStore {\n constructor() {\n this.store = new Map();\n }\n /**\n * Sets the given request cookies into the store.\n * Respects the `request.credentials` policy.\n */\n add(request, response) {\n if (request.credentials === 'omit') {\n return;\n }\n const requestUrl = new URL(request.url);\n const responseCookies = response.headers.get('set-cookie');\n if (!responseCookies) {\n return;\n }\n const now = Date.now();\n const parsedResponseCookies = set_cookie_parser_1.parse(responseCookies).map((_a) => {\n var { maxAge } = _a, cookie = __rest(_a, [\"maxAge\"]);\n return (Object.assign(Object.assign({}, cookie), { expires: maxAge === undefined ? cookie.expires : new Date(now + maxAge * 1000), maxAge }));\n });\n const prevCookies = this.store.get(requestUrl.origin) || new Map();\n parsedResponseCookies.forEach((cookie) => {\n this.store.set(requestUrl.origin, prevCookies.set(cookie.name, cookie));\n });\n }\n /**\n * Returns cookies relevant to the given request\n * and its `request.credentials` policy.\n */\n get(request) {\n this.deleteExpiredCookies();\n const requestUrl = new URL(request.url);\n const originCookies = this.store.get(requestUrl.origin) || new Map();\n switch (request.credentials) {\n case 'include': {\n // Support running this method in Node.js.\n if (typeof document === 'undefined') {\n return originCookies;\n }\n const documentCookies = set_cookie_parser_1.parse(document.cookie);\n documentCookies.forEach((cookie) => {\n originCookies.set(cookie.name, cookie);\n });\n return originCookies;\n }\n case 'same-origin': {\n return originCookies;\n }\n default:\n return new Map();\n }\n }\n /**\n * Returns a collection of all stored cookies.\n */\n getAll() {\n this.deleteExpiredCookies();\n return this.store;\n }\n /**\n * Deletes all cookies associated with the given request.\n */\n deleteAll(request) {\n const requestUrl = new URL(request.url);\n this.store.delete(requestUrl.origin);\n }\n /**\n * Clears the entire cookie store.\n */\n clear() {\n this.store.clear();\n }\n /**\n * Hydrates the virtual cookie store from the `localStorage` if defined.\n */\n hydrate() {\n if (!supportsLocalStorage()) {\n return;\n }\n const persistedCookies = localStorage.getItem(exports.PERSISTENCY_KEY);\n if (!persistedCookies) {\n return;\n }\n try {\n const parsedCookies = JSON.parse(persistedCookies);\n parsedCookies.forEach(([origin, cookies]) => {\n this.store.set(origin, new Map(cookies.map((_a) => {\n var [token, _b] = _a, { expires } = _b, cookie = __rest(_b, [\"expires\"]);\n return [\n token,\n expires === undefined\n ? cookie\n : Object.assign(Object.assign({}, cookie), { expires: new Date(expires) }),\n ];\n })));\n });\n }\n catch (error) {\n console.warn(`\n[virtual-cookie] Failed to parse a stored cookie from the localStorage (key \"${exports.PERSISTENCY_KEY}\").\n\nStored value:\n${localStorage.getItem(exports.PERSISTENCY_KEY)}\n\nThrown exception:\n${error}\n\nInvalid value has been removed from localStorage to prevent subsequent failed parsing attempts.`);\n localStorage.removeItem(exports.PERSISTENCY_KEY);\n }\n }\n /**\n * Persists the current virtual cookies into the `localStorage` if defined,\n * so they are available on the next page load.\n */\n persist() {\n if (!supportsLocalStorage()) {\n return;\n }\n const serializedCookies = Array.from(this.store.entries()).map(([origin, cookies]) => {\n return [origin, Array.from(cookies.entries())];\n });\n localStorage.setItem(exports.PERSISTENCY_KEY, JSON.stringify(serializedCookies));\n }\n deleteExpiredCookies() {\n const now = Date.now();\n this.store.forEach((originCookies, origin) => {\n originCookies.forEach(({ expires, name }) => {\n if (expires !== undefined && expires.getTime() <= now) {\n originCookies.delete(name);\n }\n });\n if (originCookies.size === 0) {\n this.store.delete(origin);\n }\n });\n }\n}\nexports.store = new CookieStore();\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./store\"), exports);\n","'use strict';\nmodule.exports = (function()\n{\n function _min(d0, d1, d2, bx, ay)\n {\n return d0 < d1 || d2 < d1\n ? d0 > d2\n ? d2 + 1\n : d0 + 1\n : bx === ay\n ? d1\n : d1 + 1;\n }\n\n return function(a, b)\n {\n if (a === b) {\n return 0;\n }\n\n if (a.length > b.length) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n var la = a.length;\n var lb = b.length;\n\n while (la > 0 && (a.charCodeAt(la - 1) === b.charCodeAt(lb - 1))) {\n la--;\n lb--;\n }\n\n var offset = 0;\n\n while (offset < la && (a.charCodeAt(offset) === b.charCodeAt(offset))) {\n offset++;\n }\n\n la -= offset;\n lb -= offset;\n\n if (la === 0 || lb < 3) {\n return lb;\n }\n\n var x = 0;\n var y;\n var d0;\n var d1;\n var d2;\n var d3;\n var dd;\n var dy;\n var ay;\n var bx0;\n var bx1;\n var bx2;\n var bx3;\n\n var vector = [];\n\n for (y = 0; y < la; y++) {\n vector.push(y + 1);\n vector.push(a.charCodeAt(offset + y));\n }\n\n var len = vector.length - 1;\n\n for (; x < lb - 3;) {\n bx0 = b.charCodeAt(offset + (d0 = x));\n bx1 = b.charCodeAt(offset + (d1 = x + 1));\n bx2 = b.charCodeAt(offset + (d2 = x + 2));\n bx3 = b.charCodeAt(offset + (d3 = x + 3));\n dd = (x += 4);\n for (y = 0; y < len; y += 2) {\n dy = vector[y];\n ay = vector[y + 1];\n d0 = _min(dy, d0, d1, bx0, ay);\n d1 = _min(d0, d1, d2, bx1, ay);\n d2 = _min(d1, d2, d3, bx2, ay);\n dd = _min(d2, d3, dd, bx3, ay);\n vector[y] = dd;\n d3 = d2;\n d2 = d1;\n d1 = d0;\n d0 = dy;\n }\n }\n\n for (; x < lb;) {\n bx0 = b.charCodeAt(offset + (d0 = x));\n dd = ++x;\n for (y = 0; y < len; y += 2) {\n dy = vector[y];\n vector[y] = dd = _min(dy, d0, dd, bx0, vector[y + 1]);\n d0 = dy;\n }\n }\n\n return dd;\n };\n})();\n\n",null,null,"'use strict'\n\n/**\n * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.\n *\n * Works with anything that has a `length` property and index access properties, including NodeList.\n *\n * @template {unknown} T\n * @param {Array | ({length:number, [number]: T})} list\n * @param {function (item: T, index: number, list:Array | ({length:number, [number]: T})):boolean} predicate\n * @param {Partial>?} ac `Array.prototype` by default,\n * \t\t\t\tallows injecting a custom implementation in tests\n * @returns {T | undefined}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find\n */\nfunction find(list, predicate, ac) {\n\tif (ac === undefined) {\n\t\tac = Array.prototype;\n\t}\n\tif (list && typeof ac.find === 'function') {\n\t\treturn ac.find.call(list, predicate);\n\t}\n\tfor (var i = 0; i < list.length; i++) {\n\t\tif (Object.prototype.hasOwnProperty.call(list, i)) {\n\t\t\tvar item = list[i];\n\t\t\tif (predicate.call(undefined, item, i, list)) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * \"Shallow freezes\" an object to render it immutable.\n * Uses `Object.freeze` if available,\n * otherwise the immutability is only in the type.\n *\n * Is used to create \"enum like\" objects.\n *\n * @template T\n * @param {T} object the object to freeze\n * @param {Pick = Object} oc `Object` by default,\n * \t\t\t\tallows to inject custom object constructor for tests\n * @returns {Readonly}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n */\nfunction freeze(object, oc) {\n\tif (oc === undefined) {\n\t\toc = Object\n\t}\n\treturn oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object\n}\n\n/**\n * Since we can not rely on `Object.assign` we provide a simplified version\n * that is sufficient for our needs.\n *\n * @param {Object} target\n * @param {Object | null | undefined} source\n *\n * @returns {Object} target\n * @throws TypeError if target is not an object\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign\n */\nfunction assign(target, source) {\n\tif (target === null || typeof target !== 'object') {\n\t\tthrow new TypeError('target is not an object')\n\t}\n\tfor (var key in source) {\n\t\tif (Object.prototype.hasOwnProperty.call(source, key)) {\n\t\t\ttarget[key] = source[key]\n\t\t}\n\t}\n\treturn target\n}\n\n/**\n * All mime types that are allowed as input to `DOMParser.parseFromString`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec\n * @see DOMParser.prototype.parseFromString\n */\nvar MIME_TYPE = freeze({\n\t/**\n\t * `text/html`, the only mime type that triggers treating an XML document as HTML.\n\t *\n\t * @see DOMParser.SupportedType.isHTML\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec\n\t */\n\tHTML: 'text/html',\n\n\t/**\n\t * Helper method to check a mime type if it indicates an HTML document\n\t *\n\t * @param {string} [value]\n\t * @returns {boolean}\n\t *\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring \t */\n\tisHTML: function (value) {\n\t\treturn value === MIME_TYPE.HTML\n\t},\n\n\t/**\n\t * `application/xml`, the standard mime type for XML documents.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_APPLICATION: 'application/xml',\n\n\t/**\n\t * `text/html`, an alias for `application/xml`.\n\t *\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303\n\t * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_TEXT: 'text/xml',\n\n\t/**\n\t * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,\n\t * but is parsed as an XML document.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec\n\t * @see https://en.wikipedia.org/wiki/XHTML Wikipedia\n\t */\n\tXML_XHTML_APPLICATION: 'application/xhtml+xml',\n\n\t/**\n\t * `image/svg+xml`,\n\t *\n\t * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration\n\t * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1\n\t * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia\n\t */\n\tXML_SVG_IMAGE: 'image/svg+xml',\n})\n\n/**\n * Namespaces that are used in this code base.\n *\n * @see http://www.w3.org/TR/REC-xml-names\n */\nvar NAMESPACE = freeze({\n\t/**\n\t * The XHTML namespace.\n\t *\n\t * @see http://www.w3.org/1999/xhtml\n\t */\n\tHTML: 'http://www.w3.org/1999/xhtml',\n\n\t/**\n\t * Checks if `uri` equals `NAMESPACE.HTML`.\n\t *\n\t * @param {string} [uri]\n\t *\n\t * @see NAMESPACE.HTML\n\t */\n\tisHTML: function (uri) {\n\t\treturn uri === NAMESPACE.HTML\n\t},\n\n\t/**\n\t * The SVG namespace.\n\t *\n\t * @see http://www.w3.org/2000/svg\n\t */\n\tSVG: 'http://www.w3.org/2000/svg',\n\n\t/**\n\t * The `xml:` namespace.\n\t *\n\t * @see http://www.w3.org/XML/1998/namespace\n\t */\n\tXML: 'http://www.w3.org/XML/1998/namespace',\n\n\t/**\n\t * The `xmlns:` namespace\n\t *\n\t * @see https://www.w3.org/2000/xmlns/\n\t */\n\tXMLNS: 'http://www.w3.org/2000/xmlns/',\n})\n\nexports.assign = assign;\nexports.find = find;\nexports.freeze = freeze;\nexports.MIME_TYPE = MIME_TYPE;\nexports.NAMESPACE = NAMESPACE;\n","var conventions = require(\"./conventions\");\n\nvar find = conventions.find;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty\n * @param {string} input\n * @returns {boolean}\n */\nfunction notEmptyString (input) {\n\treturn input !== ''\n}\n/**\n * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace\n * @see https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * @param {string} input\n * @returns {string[]} (can be empty)\n */\nfunction splitOnASCIIWhitespace(input) {\n\t// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE\n\treturn input ? input.split(/[\\t\\n\\f\\r ]+/).filter(notEmptyString) : []\n}\n\n/**\n * Adds element as a key to current if it is not already present.\n *\n * @param {Record} current\n * @param {string} element\n * @returns {Record}\n */\nfunction orderedSetReducer (current, element) {\n\tif (!current.hasOwnProperty(element)) {\n\t\tcurrent[element] = true;\n\t}\n\treturn current;\n}\n\n/**\n * @see https://infra.spec.whatwg.org/#ordered-set\n * @param {string} input\n * @returns {string[]}\n */\nfunction toOrderedSet(input) {\n\tif (!input) return [];\n\tvar list = splitOnASCIIWhitespace(input);\n\treturn Object.keys(list.reduce(orderedSetReducer, {}))\n}\n\n/**\n * Uses `list.indexOf` to implement something like `Array.prototype.includes`,\n * which we can not rely on being available.\n *\n * @param {any[]} list\n * @returns {function(any): boolean}\n */\nfunction arrayIncludes (list) {\n\treturn function(element) {\n\t\treturn list && list.indexOf(element) !== -1;\n\t}\n}\n\nfunction copy(src,dest){\n\tfor(var p in src){\n\t\tif (Object.prototype.hasOwnProperty.call(src, p)) {\n\t\t\tdest[p] = src[p];\n\t\t}\n\t}\n}\n\n/**\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*((?:.*\\{\\s*?[\\r\\n][\\s\\S]*?^})|\\S.*?(?=[;\\r\\n]));?\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*(\\S.*?(?=[;\\r\\n]));?\n */\nfunction _extends(Class,Super){\n\tvar pt = Class.prototype;\n\tif(!(pt instanceof Super)){\n\t\tfunction t(){};\n\t\tt.prototype = Super.prototype;\n\t\tt = new t();\n\t\tcopy(pt,t);\n\t\tClass.prototype = pt = t;\n\t}\n\tif(pt.constructor != Class){\n\t\tif(typeof Class != 'function'){\n\t\t\tconsole.error(\"unknown Class:\"+Class)\n\t\t}\n\t\tpt.constructor = Class\n\t}\n}\n\n// Node Types\nvar NodeType = {}\nvar ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = NodeType.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = NodeType.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = NodeType.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = NodeType.NOTATION_NODE = 12;\n\n// ExceptionCode\nvar ExceptionCode = {}\nvar ExceptionMessage = {};\nvar INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]=\"Index size error\"),1);\nvar DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]=\"DOMString size error\"),2);\nvar HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]=\"Hierarchy request error\"),3);\nvar WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]=\"Wrong document\"),4);\nvar INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]=\"Invalid character\"),5);\nvar NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]=\"No data allowed\"),6);\nvar NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]=\"No modification allowed\"),7);\nvar NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]=\"Not found\"),8);\nvar NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]=\"Not supported\"),9);\nvar INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]=\"Attribute in use\"),10);\n//level2\nvar INVALID_STATE_ERR \t= ExceptionCode.INVALID_STATE_ERR \t= ((ExceptionMessage[11]=\"Invalid state\"),11);\nvar SYNTAX_ERR \t= ExceptionCode.SYNTAX_ERR \t= ((ExceptionMessage[12]=\"Syntax error\"),12);\nvar INVALID_MODIFICATION_ERR \t= ExceptionCode.INVALID_MODIFICATION_ERR \t= ((ExceptionMessage[13]=\"Invalid modification\"),13);\nvar NAMESPACE_ERR \t= ExceptionCode.NAMESPACE_ERR \t= ((ExceptionMessage[14]=\"Invalid namespace\"),14);\nvar INVALID_ACCESS_ERR \t= ExceptionCode.INVALID_ACCESS_ERR \t= ((ExceptionMessage[15]=\"Invalid access\"),15);\n\n/**\n * DOM Level 2\n * Object DOMException\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html\n */\nfunction DOMException(code, message) {\n\tif(message instanceof Error){\n\t\tvar error = message;\n\t}else{\n\t\terror = this;\n\t\tError.call(this, ExceptionMessage[code]);\n\t\tthis.message = ExceptionMessage[code];\n\t\tif(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);\n\t}\n\terror.code = code;\n\tif(message) this.message = this.message + \": \" + message;\n\treturn error;\n};\nDOMException.prototype = Error.prototype;\ncopy(ExceptionCode,DOMException)\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n */\nfunction NodeList() {\n};\nNodeList.prototype = {\n\t/**\n\t * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.\n\t * @standard level1\n\t */\n\tlength:0,\n\t/**\n\t * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.\n\t * @standard level1\n\t * @param index unsigned long\n\t * Index into the collection.\n\t * @return Node\n\t * \tThe node at the indexth position in the NodeList, or null if that is not a valid index.\n\t */\n\titem: function(index) {\n\t\treturn this[index] || null;\n\t},\n\ttoString:function(isHTML,nodeFilter){\n\t\tfor(var buf = [], i = 0;i=0){\n\t\tvar lastIndex = list.length-1\n\t\twhile(i0 || key == 'xmlns'){\n//\t\t\treturn null;\n//\t\t}\n\t\t//console.log()\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar attr = this[i];\n\t\t\t//console.log(attr.nodeName,key)\n\t\t\tif(attr.nodeName == key){\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t}\n\t},\n\tsetNamedItem: function(attr) {\n\t\tvar el = attr.ownerElement;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItem(attr.nodeName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\t/* returns Node */\n\tsetNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR\n\t\tvar el = attr.ownerElement, oldAttr;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\toldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/* returns Node */\n\tremoveNamedItem: function(key) {\n\t\tvar attr = this.getNamedItem(key);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\n\n\t},// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR\n\n\t//for level2\n\tremoveNamedItemNS:function(namespaceURI,localName){\n\t\tvar attr = this.getNamedItemNS(namespaceURI,localName);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\t},\n\tgetNamedItemNS: function(namespaceURI, localName) {\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar node = this[i];\n\t\t\tif(node.localName == localName && node.namespaceURI == namespaceURI){\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n};\n\n/**\n * The DOMImplementation interface represents an object providing methods\n * which are not dependent on any particular document.\n * Such an object is returned by the `Document.implementation` property.\n *\n * __The individual methods describe the differences compared to the specs.__\n *\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN\n * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core\n * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core\n * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard\n */\nfunction DOMImplementation() {\n}\n\nDOMImplementation.prototype = {\n\t/**\n\t * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.\n\t * The different implementations fairly diverged in what kind of features were reported.\n\t * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.\n\t *\n\t * @deprecated It is deprecated and modern browsers return true in all cases.\n\t *\n\t * @param {string} feature\n\t * @param {string} [version]\n\t * @returns {boolean} always true\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN\n\t * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard\n\t */\n\thasFeature: function(feature, version) {\n\t\t\treturn true;\n\t},\n\t/**\n\t * Creates an XML Document object of the specified type with its document element.\n\t *\n\t * __It behaves slightly different from the description in the living standard__:\n\t * - There is no interface/class `XMLDocument`, it returns a `Document` instance.\n\t * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string|null} namespaceURI\n\t * @param {string} qualifiedName\n\t * @param {DocumentType=null} doctype\n\t * @returns {Document}\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocument: function(namespaceURI, qualifiedName, doctype){\n\t\tvar doc = new Document();\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tdoc.doctype = doctype || null;\n\t\tif (doctype){\n\t\t\tdoc.appendChild(doctype);\n\t\t}\n\t\tif (qualifiedName){\n\t\t\tvar root = doc.createElementNS(namespaceURI, qualifiedName);\n\t\t\tdoc.appendChild(root);\n\t\t}\n\t\treturn doc;\n\t},\n\t/**\n\t * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.\n\t *\n\t * __This behavior is slightly different from the in the specs__:\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string} qualifiedName\n\t * @param {string} [publicId]\n\t * @param {string} [systemId]\n\t * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation\n\t * \t\t\t\t or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocumentType: function(qualifiedName, publicId, systemId){\n\t\tvar node = new DocumentType();\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId || '';\n\t\tnode.systemId = systemId || '';\n\n\t\treturn node;\n\t}\n};\n\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n */\n\nfunction Node() {\n};\n\nNode.prototype = {\n\tfirstChild : null,\n\tlastChild : null,\n\tpreviousSibling : null,\n\tnextSibling : null,\n\tattributes : null,\n\tparentNode : null,\n\tchildNodes : null,\n\townerDocument : null,\n\tnodeValue : null,\n\tnamespaceURI : null,\n\tprefix : null,\n\tlocalName : null,\n\t// Modified in DOM Level 2:\n\tinsertBefore:function(newChild, refChild){//raises\n\t\treturn _insertBefore(this,newChild,refChild);\n\t},\n\treplaceChild:function(newChild, oldChild){//raises\n\t\t_insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument);\n\t\tif(oldChild){\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\tremoveChild:function(oldChild){\n\t\treturn _removeChild(this,oldChild);\n\t},\n\tappendChild:function(newChild){\n\t\treturn this.insertBefore(newChild,null);\n\t},\n\thasChildNodes:function(){\n\t\treturn this.firstChild != null;\n\t},\n\tcloneNode:function(deep){\n\t\treturn cloneNode(this.ownerDocument||this,this,deep);\n\t},\n\t// Modified in DOM Level 2:\n\tnormalize:function(){\n\t\tvar child = this.firstChild;\n\t\twhile(child){\n\t\t\tvar next = child.nextSibling;\n\t\t\tif(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){\n\t\t\t\tthis.removeChild(next);\n\t\t\t\tchild.appendData(next.data);\n\t\t\t}else{\n\t\t\t\tchild.normalize();\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t}\n\t},\n \t// Introduced in DOM Level 2:\n\tisSupported:function(feature, version){\n\t\treturn this.ownerDocument.implementation.hasFeature(feature,version);\n\t},\n // Introduced in DOM Level 2:\n hasAttributes:function(){\n \treturn this.attributes.length>0;\n },\n\t/**\n\t * Look up the prefix associated to the given namespace URI, starting from this node.\n\t * **The default namespace declarations are ignored by this method.**\n\t * See Namespace Prefix Lookup for details on the algorithm used by this method.\n\t *\n\t * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._\n\t *\n\t * @param {string | null} namespaceURI\n\t * @returns {string | null}\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo\n\t * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix\n\t * @see https://github.com/xmldom/xmldom/issues/322\n\t */\n lookupPrefix:function(namespaceURI){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tfor(var n in map){\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {\n\t\t\t\t\t\t\treturn n;\n\t\t\t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n lookupNamespaceURI:function(prefix){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tif(Object.prototype.hasOwnProperty.call(map, prefix)){\n \t\t\t\treturn map[prefix] ;\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n isDefaultNamespace:function(namespaceURI){\n \tvar prefix = this.lookupPrefix(namespaceURI);\n \treturn prefix == null;\n }\n};\n\n\nfunction _xmlEncoder(c){\n\treturn c == '<' && '<' ||\n c == '>' && '>' ||\n c == '&' && '&' ||\n c == '\"' && '"' ||\n '&#'+c.charCodeAt()+';'\n}\n\n\ncopy(NodeType,Node);\ncopy(NodeType,Node.prototype);\n\n/**\n * @param callback return true for continue,false for break\n * @return boolean true: break visit;\n */\nfunction _visitNode(node,callback){\n\tif(callback(node)){\n\t\treturn true;\n\t}\n\tif(node = node.firstChild){\n\t\tdo{\n\t\t\tif(_visitNode(node,callback)){return true}\n }while(node=node.nextSibling)\n }\n}\n\n\n\nfunction Document(){\n\tthis.ownerDocument = this;\n}\n\nfunction _onAddAttribute(doc,el,newAttr){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tel._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value\n\t}\n}\n\nfunction _onRemoveAttribute(doc,el,newAttr,remove){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tdelete el._nsMap[newAttr.prefix?newAttr.localName:'']\n\t}\n}\n\n/**\n * Updates `el.childNodes`, updating the indexed items and it's `length`.\n * Passing `newChild` means it will be appended.\n * Otherwise it's assumed that an item has been removed,\n * and `el.firstNode` and it's `.nextSibling` are used\n * to walk the current list of child nodes.\n *\n * @param {Document} doc\n * @param {Node} el\n * @param {Node} [newChild]\n * @private\n */\nfunction _onUpdateChild (doc, el, newChild) {\n\tif(doc && doc._inc){\n\t\tdoc._inc++;\n\t\t//update childNodes\n\t\tvar cs = el.childNodes;\n\t\tif (newChild) {\n\t\t\tcs[cs.length++] = newChild;\n\t\t} else {\n\t\t\tvar child = el.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tcs[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tcs.length = i;\n\t\t\tdelete cs[cs.length];\n\t\t}\n\t}\n}\n\n/**\n * Removes the connections between `parentNode` and `child`\n * and any existing `child.previousSibling` or `child.nextSibling`.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n *\n * @param {Node} parentNode\n * @param {Node} child\n * @returns {Node} the child that was removed.\n * @private\n */\nfunction _removeChild (parentNode, child) {\n\tvar previous = child.previousSibling;\n\tvar next = child.nextSibling;\n\tif (previous) {\n\t\tprevious.nextSibling = next;\n\t} else {\n\t\tparentNode.firstChild = next;\n\t}\n\tif (next) {\n\t\tnext.previousSibling = previous;\n\t} else {\n\t\tparentNode.lastChild = previous;\n\t}\n\tchild.parentNode = null;\n\tchild.previousSibling = null;\n\tchild.nextSibling = null;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\treturn child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasValidParentNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE)\n\t);\n}\n\n/**\n * Returns `true` if `node` can be inserted according to it's `nodeType`.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(isElementNode(node) ||\n\t\t\tisTextNode(node) ||\n\t\t\tisDocTypeNode(node) ||\n\t\t\tnode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||\n\t\t\tnode.nodeType === Node.COMMENT_NODE ||\n\t\t\tnode.nodeType === Node.PROCESSING_INSTRUCTION_NODE)\n\t);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isDocTypeNode(node) {\n\treturn node && node.nodeType === Node.DOCUMENT_TYPE_NODE;\n}\n\n/**\n * Returns true if the node is an element\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isElementNode(node) {\n\treturn node && node.nodeType === Node.ELEMENT_NODE;\n}\n/**\n * Returns true if `node` is a text node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isTextNode(node) {\n\treturn node && node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Document} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementInsertionPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\tif (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Node} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementReplacementPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\n\tfunction hasElementChildThatIsNotChild(node) {\n\t\treturn isElementNode(node) && node !== child;\n\t}\n\n\tif (find(parentChildNodes, hasElementChildThatIsNotChild)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * @private\n * Steps 1-5 of the checks before inserting and before replacing a child are the same.\n *\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidity1to5(parent, node, child) {\n\t// 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a \"HierarchyRequestError\" DOMException.\n\tif (!hasValidParentNodeType(parent)) {\n\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);\n\t}\n\t// 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a \"HierarchyRequestError\" DOMException.\n\t// not implemented!\n\t// 3. If `child` is non-null and its parent is not `parent`, then throw a \"NotFoundError\" DOMException.\n\tif (child && child.parentNode !== parent) {\n\t\tthrow new DOMException(NOT_FOUND_ERR, 'child not in parent');\n\t}\n\tif (\n\t\t// 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a \"HierarchyRequestError\" DOMException.\n\t\t!hasInsertableNodeType(node) ||\n\t\t// 5. If either `node` is a Text node and `parent` is a document,\n\t\t// the sax parser currently adds top level text nodes, this will be fixed in 0.9.0\n\t\t// || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)\n\t\t// or `node` is a doctype and `parent` is not a document, then throw a \"HierarchyRequestError\" DOMException.\n\t\t(isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE)\n\t) {\n\t\tthrow new DOMException(\n\t\t\tHIERARCHY_REQUEST_ERR,\n\t\t\t'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType\n\t\t);\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If node has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child,\n\t\t// `child` is a doctype, or `child` is non-null and a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child, `child` is a doctype,\n\t\t// or `child` is non-null and a doctype is following `child`.\n\t\tif (!isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\t// `parent` has a doctype child,\n\t\tif (find(parentChildNodes, isDocTypeNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// `child` is non-null and an element is preceding `child`,\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t\t// or `child` is null and `parent` has an element child.\n\t\tif (!child && parentElementChild) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreReplacementValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If `node` has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (!isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\tfunction hasDoctypeChildThatIsNotChild(node) {\n\t\t\treturn isDocTypeNode(node) && node !== child;\n\t\t}\n\n\t\t// `parent` has a doctype child that is not `child`,\n\t\tif (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// or an element is preceding `child`.\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction _insertBefore(parent, node, child, _inDocumentAssertion) {\n\t// To ensure pre-insertion validity of a node into a parent before a child, run these steps:\n\tassertPreInsertionValidity1to5(parent, node, child);\n\n\t// If parent is a document, and any of the statements below, switched on the interface node implements,\n\t// are true, then throw a \"HierarchyRequestError\" DOMException.\n\tif (parent.nodeType === Node.DOCUMENT_NODE) {\n\t\t(_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);\n\t}\n\n\tvar cp = node.parentNode;\n\tif(cp){\n\t\tcp.removeChild(node);//remove and update\n\t}\n\tif(node.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\tvar newFirst = node.firstChild;\n\t\tif (newFirst == null) {\n\t\t\treturn node;\n\t\t}\n\t\tvar newLast = node.lastChild;\n\t}else{\n\t\tnewFirst = newLast = node;\n\t}\n\tvar pre = child ? child.previousSibling : parent.lastChild;\n\n\tnewFirst.previousSibling = pre;\n\tnewLast.nextSibling = child;\n\n\n\tif(pre){\n\t\tpre.nextSibling = newFirst;\n\t}else{\n\t\tparent.firstChild = newFirst;\n\t}\n\tif(child == null){\n\t\tparent.lastChild = newLast;\n\t}else{\n\t\tchild.previousSibling = newLast;\n\t}\n\tdo{\n\t\tnewFirst.parentNode = parent;\n\t}while(newFirst !== newLast && (newFirst= newFirst.nextSibling))\n\t_onUpdateChild(parent.ownerDocument||parent, parent);\n\t//console.log(parent.lastChild.nextSibling == null)\n\tif (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnode.firstChild = node.lastChild = null;\n\t}\n\treturn node;\n}\n\n/**\n * Appends `newChild` to `parentNode`.\n * If `newChild` is already connected to a `parentNode` it is first removed from it.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n * @param {Node} parentNode\n * @param {Node} newChild\n * @returns {Node}\n * @private\n */\nfunction _appendSingleChild (parentNode, newChild) {\n\tif (newChild.parentNode) {\n\t\tnewChild.parentNode.removeChild(newChild);\n\t}\n\tnewChild.parentNode = parentNode;\n\tnewChild.previousSibling = parentNode.lastChild;\n\tnewChild.nextSibling = null;\n\tif (newChild.previousSibling) {\n\t\tnewChild.previousSibling.nextSibling = newChild;\n\t} else {\n\t\tparentNode.firstChild = newChild;\n\t}\n\tparentNode.lastChild = newChild;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode, newChild);\n\treturn newChild;\n}\n\nDocument.prototype = {\n\t//implementation : null,\n\tnodeName : '#document',\n\tnodeType : DOCUMENT_NODE,\n\t/**\n\t * The DocumentType node of the document.\n\t *\n\t * @readonly\n\t * @type DocumentType\n\t */\n\tdoctype : null,\n\tdocumentElement : null,\n\t_inc : 1,\n\n\tinsertBefore : function(newChild, refChild){//raises\n\t\tif(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){\n\t\t\tvar child = newChild.firstChild;\n\t\t\twhile(child){\n\t\t\t\tvar next = child.nextSibling;\n\t\t\t\tthis.insertBefore(child,refChild);\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t\treturn newChild;\n\t\t}\n\t\t_insertBefore(this, newChild, refChild);\n\t\tnewChild.ownerDocument = this;\n\t\tif (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\n\t\treturn newChild;\n\t},\n\tremoveChild : function(oldChild){\n\t\tif(this.documentElement == oldChild){\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn _removeChild(this,oldChild);\n\t},\n\treplaceChild: function (newChild, oldChild) {\n\t\t//raises\n\t\t_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n\t\tnewChild.ownerDocument = this;\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t\tif (isElementNode(newChild)) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\t},\n\t// Introduced in DOM Level 2:\n\timportNode : function(importedNode,deep){\n\t\treturn importNode(this,importedNode,deep);\n\t},\n\t// Introduced in DOM Level 2:\n\tgetElementById :\tfunction(id){\n\t\tvar rtv = null;\n\t\t_visitNode(this.documentElement,function(node){\n\t\t\tif(node.nodeType == ELEMENT_NODE){\n\t\t\t\tif(node.getAttribute('id') == id){\n\t\t\t\t\trtv = node;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\treturn rtv;\n\t},\n\n\t/**\n\t * The `getElementsByClassName` method of `Document` interface returns an array-like object\n\t * of all child elements which have **all** of the given class name(s).\n\t *\n\t * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.\n\t *\n\t *\n\t * Warning: This is a live LiveNodeList.\n\t * Changes in the DOM will reflect in the array as the changes occur.\n\t * If an element selected by this array no longer qualifies for the selector,\n\t * it will automatically be removed. Be aware of this for iteration purposes.\n\t *\n\t * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName\n\t * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname\n\t */\n\tgetElementsByClassName: function(classNames) {\n\t\tvar classNamesSet = toOrderedSet(classNames)\n\t\treturn new LiveNodeList(this, function(base) {\n\t\t\tvar ls = [];\n\t\t\tif (classNamesSet.length > 0) {\n\t\t\t\t_visitNode(base.documentElement, function(node) {\n\t\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t\tvar nodeClassNames = node.getAttribute('class')\n\t\t\t\t\t\t// can be null if the attribute does not exist\n\t\t\t\t\t\tif (nodeClassNames) {\n\t\t\t\t\t\t\t// before splitting and iterating just compare them for the most common case\n\t\t\t\t\t\t\tvar matches = classNames === nodeClassNames;\n\t\t\t\t\t\t\tif (!matches) {\n\t\t\t\t\t\t\t\tvar nodeClassNamesSet = toOrderedSet(nodeClassNames)\n\t\t\t\t\t\t\t\tmatches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(matches) {\n\t\t\t\t\t\t\t\tls.push(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn ls;\n\t\t});\n\t},\n\n\t//document factory method:\n\tcreateElement :\tfunction(tagName){\n\t\tvar node = new Element();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = tagName;\n\t\tnode.tagName = tagName;\n\t\tnode.localName = tagName;\n\t\tnode.childNodes = new NodeList();\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\tcreateDocumentFragment :\tfunction(){\n\t\tvar node = new DocumentFragment();\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\tcreateTextNode :\tfunction(data){\n\t\tvar node = new Text();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateComment :\tfunction(data){\n\t\tvar node = new Comment();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateCDATASection :\tfunction(data){\n\t\tvar node = new CDATASection();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateProcessingInstruction :\tfunction(target,data){\n\t\tvar node = new ProcessingInstruction();\n\t\tnode.ownerDocument = this;\n\t\tnode.tagName = node.target = target;\n\t\tnode.nodeValue= node.data = data;\n\t\treturn node;\n\t},\n\tcreateAttribute :\tfunction(name){\n\t\tvar node = new Attr();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.name = name;\n\t\tnode.nodeName\t= name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\tcreateEntityReference :\tfunction(name){\n\t\tvar node = new EntityReference();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.nodeName\t= name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateElementNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Element();\n\t\tvar pl = qualifiedName.split(':');\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tnode.childNodes = new NodeList();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.tagName = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateAttributeNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Attr();\n\t\tvar pl = qualifiedName.split(':');\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tnode.specified = true;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\treturn node;\n\t}\n};\n_extends(Document,Node);\n\n\nfunction Element() {\n\tthis._nsMap = {};\n};\nElement.prototype = {\n\tnodeType : ELEMENT_NODE,\n\thasAttribute : function(name){\n\t\treturn this.getAttributeNode(name)!=null;\n\t},\n\tgetAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr && attr.value || '';\n\t},\n\tgetAttributeNode : function(name){\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\tsetAttribute : function(name, value){\n\t\tvar attr = this.ownerDocument.createAttribute(name);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tremoveAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name)\n\t\tattr && this.removeAttributeNode(attr);\n\t},\n\n\t//four real opeartion method\n\tappendChild:function(newChild){\n\t\tif(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\t\treturn this.insertBefore(newChild,null);\n\t\t}else{\n\t\t\treturn _appendSingleChild(this,newChild);\n\t\t}\n\t},\n\tsetAttributeNode : function(newAttr){\n\t\treturn this.attributes.setNamedItem(newAttr);\n\t},\n\tsetAttributeNodeNS : function(newAttr){\n\t\treturn this.attributes.setNamedItemNS(newAttr);\n\t},\n\tremoveAttributeNode : function(oldAttr){\n\t\t//console.log(this == oldAttr.ownerElement)\n\t\treturn this.attributes.removeNamedItem(oldAttr.nodeName);\n\t},\n\t//get real attribute name,and remove it by removeAttributeNode\n\tremoveAttributeNS : function(namespaceURI, localName){\n\t\tvar old = this.getAttributeNodeNS(namespaceURI, localName);\n\t\told && this.removeAttributeNode(old);\n\t},\n\n\thasAttributeNS : function(namespaceURI, localName){\n\t\treturn this.getAttributeNodeNS(namespaceURI, localName)!=null;\n\t},\n\tgetAttributeNS : function(namespaceURI, localName){\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr && attr.value || '';\n\t},\n\tsetAttributeNS : function(namespaceURI, qualifiedName, value){\n\t\tvar attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tgetAttributeNodeNS : function(namespaceURI, localName){\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\tgetElementsByTagName : function(tagName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\t\t});\n\t},\n\tgetElementsByTagNameNS : function(namespaceURI, localName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\n\t\t});\n\t}\n};\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n\n_extends(Element,Node);\nfunction Attr() {\n};\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr,Node);\n\n\nfunction CharacterData() {\n};\nCharacterData.prototype = {\n\tdata : '',\n\tsubstringData : function(offset, count) {\n\t\treturn this.data.substring(offset, offset+count);\n\t},\n\tappendData: function(text) {\n\t\ttext = this.data+text;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t},\n\tinsertData: function(offset,text) {\n\t\tthis.replaceData(offset,0,text);\n\n\t},\n\tappendChild:function(newChild){\n\t\tthrow new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])\n\t},\n\tdeleteData: function(offset, count) {\n\t\tthis.replaceData(offset,count,\"\");\n\t},\n\treplaceData: function(offset, count, text) {\n\t\tvar start = this.data.substring(0,offset);\n\t\tvar end = this.data.substring(offset+count);\n\t\ttext = start + text + end;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t}\n}\n_extends(CharacterData,Node);\nfunction Text() {\n};\nText.prototype = {\n\tnodeName : \"#text\",\n\tnodeType : TEXT_NODE,\n\tsplitText : function(offset) {\n\t\tvar text = this.data;\n\t\tvar newText = text.substring(offset);\n\t\ttext = text.substring(0, offset);\n\t\tthis.data = this.nodeValue = text;\n\t\tthis.length = text.length;\n\t\tvar newNode = this.ownerDocument.createTextNode(newText);\n\t\tif(this.parentNode){\n\t\t\tthis.parentNode.insertBefore(newNode, this.nextSibling);\n\t\t}\n\t\treturn newNode;\n\t}\n}\n_extends(Text,CharacterData);\nfunction Comment() {\n};\nComment.prototype = {\n\tnodeName : \"#comment\",\n\tnodeType : COMMENT_NODE\n}\n_extends(Comment,CharacterData);\n\nfunction CDATASection() {\n};\nCDATASection.prototype = {\n\tnodeName : \"#cdata-section\",\n\tnodeType : CDATA_SECTION_NODE\n}\n_extends(CDATASection,CharacterData);\n\n\nfunction DocumentType() {\n};\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType,Node);\n\nfunction Notation() {\n};\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation,Node);\n\nfunction Entity() {\n};\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity,Node);\n\nfunction EntityReference() {\n};\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference,Node);\n\nfunction DocumentFragment() {\n};\nDocumentFragment.prototype.nodeName =\t\"#document-fragment\";\nDocumentFragment.prototype.nodeType =\tDOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment,Node);\n\n\nfunction ProcessingInstruction() {\n}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction,Node);\nfunction XMLSerializer(){}\nXMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){\n\treturn nodeSerializeToString.call(node,isHtml,nodeFilter);\n}\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(isHtml,nodeFilter){\n\tvar buf = [];\n\tvar refNode = this.nodeType == 9 && this.documentElement || this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif(uri && prefix == null){\n\t\t//console.log(prefix)\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif(prefix == null){\n\t\t\t//isHTML = true;\n\t\t\tvar visibleNamespaces=[\n\t\t\t{namespace:uri,prefix:null}\n\t\t\t//{namespace:uri,prefix:''}\n\t\t\t]\n\t\t}\n\t}\n\tserializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);\n\t//console.log('###',this.nodeType,uri,prefix,buf.join(''))\n\treturn buf.join('');\n}\n\nfunction needNamespaceDefine(node, isHTML, visibleNamespaces) {\n\tvar prefix = node.prefix || '';\n\tvar uri = node.namespaceURI;\n\t// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,\n\t// and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :\n\t// > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.\n\t// in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)\n\t// and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :\n\t// > [...] Furthermore, the attribute value [...] must not be an empty string.\n\t// so serializing empty namespace value like xmlns:ds=\"\" would produce an invalid XML document.\n\tif (!uri) {\n\t\treturn false;\n\t}\n\tif (prefix === \"xml\" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {\n\t\treturn false;\n\t}\n\n\tvar i = visibleNamespaces.length\n\twhile (i--) {\n\t\tvar ns = visibleNamespaces[i];\n\t\t// get namespace prefix\n\t\tif (ns.prefix === prefix) {\n\t\t\treturn ns.namespace !== uri;\n\t\t}\n\t}\n\treturn true;\n}\n/**\n * Well-formed constraint: No < in Attribute Values\n * > The replacement text of any entity referred to directly or indirectly\n * > in an attribute value must not contain a <.\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n *\n * Literal whitespace other than space that appear in attribute values\n * are serialized as their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces)\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n\tbuf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"')\n}\n\nfunction serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){\n\tif (!visibleNamespaces) {\n\t\tvisibleNamespaces = [];\n\t}\n\n\tif(nodeFilter){\n\t\tnode = nodeFilter(node);\n\t\tif(node){\n\t\t\tif(typeof node == 'string'){\n\t\t\t\tbuf.push(node);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\t\t//buf.sort.apply(attrs, attributeSorter);\n\t}\n\n\tswitch(node.nodeType){\n\tcase ELEMENT_NODE:\n\t\tvar attrs = node.attributes;\n\t\tvar len = attrs.length;\n\t\tvar child = node.firstChild;\n\t\tvar nodeName = node.tagName;\n\n\t\tisHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML\n\n\t\tvar prefixedNodeName = nodeName\n\t\tif (!isHTML && !node.prefix && node.namespaceURI) {\n\t\t\tvar defaultNS\n\t\t\t// lookup current default ns from `xmlns` attribute\n\t\t\tfor (var ai = 0; ai < attrs.length; ai++) {\n\t\t\t\tif (attrs.item(ai).name === 'xmlns') {\n\t\t\t\t\tdefaultNS = attrs.item(ai).value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!defaultNS) {\n\t\t\t\t// lookup current default ns in visibleNamespaces\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tdefaultNS = namespace.namespace\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (defaultNS !== node.namespaceURI) {\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tif (namespace.prefix) {\n\t\t\t\t\t\t\tprefixedNodeName = namespace.prefix + ':' + nodeName\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbuf.push('<', prefixedNodeName);\n\n\t\tfor(var i=0;i');\n\t\t\t//if is cdata child node\n\t\t\tif(isHTML && /^script$/i.test(nodeName)){\n\t\t\t\twhile(child){\n\t\t\t\t\tif(child.data){\n\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t}\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}else\n\t\t\t{\n\t\t\t\twhile(child){\n\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.push('');\n\t\t}else{\n\t\t\tbuf.push('/>');\n\t\t}\n\t\t// remove added visible namespaces\n\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\treturn;\n\tcase DOCUMENT_NODE:\n\tcase DOCUMENT_FRAGMENT_NODE:\n\t\tvar child = node.firstChild;\n\t\twhile(child){\n\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t\treturn;\n\tcase ATTRIBUTE_NODE:\n\t\treturn addSerializedAttribute(buf, node.name, node.value);\n\tcase TEXT_NODE:\n\t\t/**\n\t\t * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n\t\t * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.\n\t\t * If they are needed elsewhere, they must be escaped using either numeric character references or the strings\n\t\t * `&` and `<` respectively.\n\t\t * The right angle bracket (>) may be represented using the string \" > \", and must, for compatibility,\n\t\t * be escaped using either `>` or a character reference when it appears in the string `]]>` in content,\n\t\t * when that string is not marking the end of a CDATA section.\n\t\t *\n\t\t * In the content of elements, character data is any string of characters\n\t\t * which does not contain the start-delimiter of any markup\n\t\t * and does not include the CDATA-section-close delimiter, `]]>`.\n\t\t *\n\t\t * @see https://www.w3.org/TR/xml/#NT-CharData\n\t\t * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n\t\t */\n\t\treturn buf.push(node.data\n\t\t\t.replace(/[<&>]/g,_xmlEncoder)\n\t\t);\n\tcase CDATA_SECTION_NODE:\n\t\treturn buf.push( '');\n\tcase COMMENT_NODE:\n\t\treturn buf.push( \"\");\n\tcase DOCUMENT_TYPE_NODE:\n\t\tvar pubid = node.publicId;\n\t\tvar sysid = node.systemId;\n\t\tbuf.push('');\n\t\t}else if(sysid && sysid!='.'){\n\t\t\tbuf.push(' SYSTEM ', sysid, '>');\n\t\t}else{\n\t\t\tvar sub = node.internalSubset;\n\t\t\tif(sub){\n\t\t\t\tbuf.push(\" [\",sub,\"]\");\n\t\t\t}\n\t\t\tbuf.push(\">\");\n\t\t}\n\t\treturn;\n\tcase PROCESSING_INSTRUCTION_NODE:\n\t\treturn buf.push( \"\");\n\tcase ENTITY_REFERENCE_NODE:\n\t\treturn buf.push( '&',node.nodeName,';');\n\t//case ENTITY_NODE:\n\t//case NOTATION_NODE:\n\tdefault:\n\t\tbuf.push('??',node.nodeName);\n\t}\n}\nfunction importNode(doc,node,deep){\n\tvar node2;\n\tswitch (node.nodeType) {\n\tcase ELEMENT_NODE:\n\t\tnode2 = node.cloneNode(false);\n\t\tnode2.ownerDocument = doc;\n\t\t//var attrs = node2.attributes;\n\t\t//var len = attrs.length;\n\t\t//for(var i=0;i', lt:'<', quot:'\"'})\n\n/**\n * A map of currently 241 entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see XML_ENTITIES\n * @see DOMParser.parseFromString\n * @see DOMImplementation.prototype.createHTMLDocument\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec\n * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names\n * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n Agrave: \"À\",\n Aacute: \"Á\",\n Acirc: \"Â\",\n Atilde: \"Ã\",\n Auml: \"Ä\",\n Aring: \"Å\",\n AElig: \"Æ\",\n Ccedil: \"Ç\",\n Egrave: \"È\",\n Eacute: \"É\",\n Ecirc: \"Ê\",\n Euml: \"Ë\",\n Igrave: \"Ì\",\n Iacute: \"Í\",\n Icirc: \"Î\",\n Iuml: \"Ï\",\n ETH: \"Ð\",\n Ntilde: \"Ñ\",\n Ograve: \"Ò\",\n Oacute: \"Ó\",\n Ocirc: \"Ô\",\n Otilde: \"Õ\",\n Ouml: \"Ö\",\n Oslash: \"Ø\",\n Ugrave: \"Ù\",\n Uacute: \"Ú\",\n Ucirc: \"Û\",\n Uuml: \"Ü\",\n Yacute: \"Ý\",\n THORN: \"Þ\",\n szlig: \"ß\",\n agrave: \"à\",\n aacute: \"á\",\n acirc: \"â\",\n atilde: \"ã\",\n auml: \"ä\",\n aring: \"å\",\n aelig: \"æ\",\n ccedil: \"ç\",\n egrave: \"è\",\n eacute: \"é\",\n ecirc: \"ê\",\n euml: \"ë\",\n igrave: \"ì\",\n iacute: \"í\",\n icirc: \"î\",\n iuml: \"ï\",\n eth: \"ð\",\n ntilde: \"ñ\",\n ograve: \"ò\",\n oacute: \"ó\",\n ocirc: \"ô\",\n otilde: \"õ\",\n ouml: \"ö\",\n oslash: \"ø\",\n ugrave: \"ù\",\n uacute: \"ú\",\n ucirc: \"û\",\n uuml: \"ü\",\n yacute: \"ý\",\n thorn: \"þ\",\n yuml: \"ÿ\",\n nbsp: \"\\u00a0\",\n iexcl: \"¡\",\n cent: \"¢\",\n pound: \"£\",\n curren: \"¤\",\n yen: \"¥\",\n brvbar: \"¦\",\n sect: \"§\",\n uml: \"¨\",\n copy: \"©\",\n ordf: \"ª\",\n laquo: \"«\",\n not: \"¬\",\n shy: \"­­\",\n reg: \"®\",\n macr: \"¯\",\n deg: \"°\",\n plusmn: \"±\",\n sup2: \"²\",\n sup3: \"³\",\n acute: \"´\",\n micro: \"µ\",\n para: \"¶\",\n middot: \"·\",\n cedil: \"¸\",\n sup1: \"¹\",\n ordm: \"º\",\n raquo: \"»\",\n frac14: \"¼\",\n frac12: \"½\",\n frac34: \"¾\",\n iquest: \"¿\",\n times: \"×\",\n divide: \"÷\",\n forall: \"∀\",\n part: \"∂\",\n exist: \"∃\",\n empty: \"∅\",\n nabla: \"∇\",\n isin: \"∈\",\n notin: \"∉\",\n ni: \"∋\",\n prod: \"∏\",\n sum: \"∑\",\n minus: \"−\",\n lowast: \"∗\",\n radic: \"√\",\n prop: \"∝\",\n infin: \"∞\",\n ang: \"∠\",\n and: \"∧\",\n or: \"∨\",\n cap: \"∩\",\n cup: \"∪\",\n 'int': \"∫\",\n there4: \"∴\",\n sim: \"∼\",\n cong: \"≅\",\n asymp: \"≈\",\n ne: \"≠\",\n equiv: \"≡\",\n le: \"≤\",\n ge: \"≥\",\n sub: \"⊂\",\n sup: \"⊃\",\n nsub: \"⊄\",\n sube: \"⊆\",\n supe: \"⊇\",\n oplus: \"⊕\",\n otimes: \"⊗\",\n perp: \"⊥\",\n sdot: \"⋅\",\n Alpha: \"Α\",\n Beta: \"Β\",\n Gamma: \"Γ\",\n Delta: \"Δ\",\n Epsilon: \"Ε\",\n Zeta: \"Ζ\",\n Eta: \"Η\",\n Theta: \"Θ\",\n Iota: \"Ι\",\n Kappa: \"Κ\",\n Lambda: \"Λ\",\n Mu: \"Μ\",\n Nu: \"Ν\",\n Xi: \"Ξ\",\n Omicron: \"Ο\",\n Pi: \"Π\",\n Rho: \"Ρ\",\n Sigma: \"Σ\",\n Tau: \"Τ\",\n Upsilon: \"Υ\",\n Phi: \"Φ\",\n Chi: \"Χ\",\n Psi: \"Ψ\",\n Omega: \"Ω\",\n alpha: \"α\",\n beta: \"β\",\n gamma: \"γ\",\n delta: \"δ\",\n epsilon: \"ε\",\n zeta: \"ζ\",\n eta: \"η\",\n theta: \"θ\",\n iota: \"ι\",\n kappa: \"κ\",\n lambda: \"λ\",\n mu: \"μ\",\n nu: \"ν\",\n xi: \"ξ\",\n omicron: \"ο\",\n pi: \"π\",\n rho: \"ρ\",\n sigmaf: \"ς\",\n sigma: \"σ\",\n tau: \"τ\",\n upsilon: \"υ\",\n phi: \"φ\",\n chi: \"χ\",\n psi: \"ψ\",\n omega: \"ω\",\n thetasym: \"ϑ\",\n upsih: \"ϒ\",\n piv: \"ϖ\",\n OElig: \"Œ\",\n oelig: \"œ\",\n Scaron: \"Š\",\n scaron: \"š\",\n Yuml: \"Ÿ\",\n fnof: \"ƒ\",\n circ: \"ˆ\",\n tilde: \"˜\",\n ensp: \" \",\n emsp: \" \",\n thinsp: \" \",\n zwnj: \"‌\",\n zwj: \"‍\",\n lrm: \"‎\",\n rlm: \"‏\",\n ndash: \"–\",\n mdash: \"—\",\n lsquo: \"‘\",\n rsquo: \"’\",\n sbquo: \"‚\",\n ldquo: \"“\",\n rdquo: \"”\",\n bdquo: \"„\",\n dagger: \"†\",\n Dagger: \"‡\",\n bull: \"•\",\n hellip: \"…\",\n permil: \"‰\",\n prime: \"′\",\n Prime: \"″\",\n lsaquo: \"‹\",\n rsaquo: \"›\",\n oline: \"‾\",\n euro: \"€\",\n trade: \"™\",\n larr: \"←\",\n uarr: \"↑\",\n rarr: \"→\",\n darr: \"↓\",\n harr: \"↔\",\n crarr: \"↵\",\n lceil: \"⌈\",\n rceil: \"⌉\",\n lfloor: \"⌊\",\n rfloor: \"⌋\",\n loz: \"◊\",\n spades: \"♠\",\n clubs: \"♣\",\n hearts: \"♥\",\n diams: \"♦\"\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES\n","var NAMESPACE = require(\"./conventions\").NAMESPACE;\n\n//[4] \tNameStartChar\t ::= \t\":\" | [A-Z] | \"_\" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n//[4a] \tNameChar\t ::= \tNameStartChar | \"-\" | \".\" | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]\n//[5] \tName\t ::= \tNameStartChar (NameChar)*\nvar nameStartChar = /[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]///\\u10000-\\uEFFFF\nvar nameChar = new RegExp(\"[\\\\-\\\\.0-9\"+nameStartChar.source.slice(1,-1)+\"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]\");\nvar tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\\:'+nameStartChar.source+nameChar.source+'*)?$');\n//var tagNamePattern = /^[a-zA-Z_][\\w\\-\\.]*(?:\\:[a-zA-Z_][\\w\\-\\.]*)?$/\n//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')\n\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\nvar S_TAG = 0;//tag name offerring\nvar S_ATTR = 1;//attr name offerring\nvar S_ATTR_SPACE=2;//attr name end and space offer\nvar S_EQ = 3;//=space?\nvar S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)\nvar S_ATTR_END = 5;//attr value end and no space(quot end)\nvar S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)\nvar S_TAG_CLOSE = 7;//closed el\n\n/**\n * Creates an error that will not be caught by XMLReader aka the SAX parser.\n *\n * @param {string} message\n * @param {any?} locator Optional, can provide details about the location in the source\n * @constructor\n */\nfunction ParseError(message, locator) {\n\tthis.message = message\n\tthis.locator = locator\n\tif(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);\n}\nParseError.prototype = new Error();\nParseError.prototype.name = ParseError.name\n\nfunction XMLReader(){\n\n}\n\nXMLReader.prototype = {\n\tparse:function(source,defaultNSMap,entityMap){\n\t\tvar domBuilder = this.domBuilder;\n\t\tdomBuilder.startDocument();\n\t\t_copy(defaultNSMap ,defaultNSMap = {})\n\t\tparse(source,defaultNSMap,entityMap,\n\t\t\t\tdomBuilder,this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t}\n}\nfunction parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){\n\tfunction fixedFromCharCode(code) {\n\t\t// String.prototype.fromCharCode does not supports\n\t\t// > 2 bytes unicode chars directly\n\t\tif (code > 0xffff) {\n\t\t\tcode -= 0x10000;\n\t\t\tvar surrogate1 = 0xd800 + (code >> 10)\n\t\t\t\t, surrogate2 = 0xdc00 + (code & 0x3ff);\n\n\t\t\treturn String.fromCharCode(surrogate1, surrogate2);\n\t\t} else {\n\t\t\treturn String.fromCharCode(code);\n\t\t}\n\t}\n\tfunction entityReplacer(a){\n\t\tvar k = a.slice(1,-1);\n\t\tif (Object.hasOwnProperty.call(entityMap, k)) {\n\t\t\treturn entityMap[k];\n\t\t}else if(k.charAt(0) === '#'){\n\t\t\treturn fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))\n\t\t}else{\n\t\t\terrorHandler.error('entity not found:'+a);\n\t\t\treturn a;\n\t\t}\n\t}\n\tfunction appendText(end){//has some bugs\n\t\tif(end>start){\n\t\t\tvar xt = source.substring(start,end).replace(/&#?\\w+;/g,entityReplacer);\n\t\t\tlocator&&position(start);\n\t\t\tdomBuilder.characters(xt,0,end-start);\n\t\t\tstart = end\n\t\t}\n\t}\n\tfunction position(p,m){\n\t\twhile(p>=lineEnd && (m = linePattern.exec(source))){\n\t\t\tlineStart = m.index;\n\t\t\tlineEnd = lineStart + m[0].length;\n\t\t\tlocator.lineNumber++;\n\t\t\t//console.log('line++:',locator,startPos,endPos)\n\t\t}\n\t\tlocator.columnNumber = p-lineStart+1;\n\t}\n\tvar lineStart = 0;\n\tvar lineEnd = 0;\n\tvar linePattern = /.*(?:\\r\\n?|\\n)|.*$/g\n\tvar locator = domBuilder.locator;\n\n\tvar parseStack = [{currentNSMap:defaultNSMapCopy}]\n\tvar closeMap = {};\n\tvar start = 0;\n\twhile(true){\n\t\ttry{\n\t\t\tvar tagStart = source.indexOf('<',start);\n\t\t\tif(tagStart<0){\n\t\t\t\tif(!source.substr(start).match(/^\\s*$/)){\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t \t\t\tvar text = doc.createTextNode(source.substr(start));\n\t \t\t\tdoc.appendChild(text);\n\t \t\t\tdomBuilder.currentElement = text;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(tagStart>start){\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch(source.charAt(tagStart+1)){\n\t\t\tcase '/':\n\t\t\t\tvar end = source.indexOf('>',tagStart+3);\n\t\t\t\tvar tagName = source.substring(tagStart + 2, end).replace(/[ \\t\\n\\r]+$/g, '');\n\t\t\t\tvar config = parseStack.pop();\n\t\t\t\tif(end<0){\n\n\t \t\ttagName = source.substring(tagStart+2).replace(/[\\s<].*/,'');\n\t \t\terrorHandler.error(\"end tag name: \"+tagName+' is not complete:'+config.tagName);\n\t \t\tend = tagStart+1+tagName.length;\n\t \t}else if(tagName.match(/\\s\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tend = parseInstruction(source,tagStart,domBuilder);\n\t\t\t\tbreak;\n\t\t\tcase '!':// start){\n\t\t\tstart = end;\n\t\t}else{\n\t\t\t//TODO: 这里有可能sax回退,有位置错误风险\n\t\t\tappendText(Math.max(tagStart,start)+1);\n\t\t}\n\t}\n}\nfunction copyLocator(f,t){\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);\n * @return end of the elementStartPart(end of elementEndPart for selfClosed el)\n */\nfunction parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){\n\n\t/**\n\t * @param {string} qname\n\t * @param {string} value\n\t * @param {number} startIndex\n\t */\n\tfunction addAttribute(qname, value, startIndex) {\n\t\tif (el.attributeNames.hasOwnProperty(qname)) {\n\t\t\terrorHandler.fatalError('Attribute ' + qname + ' redefined')\n\t\t}\n\t\tel.addValue(\n\t\t\tqname,\n\t\t\t// @see https://www.w3.org/TR/xml/#AVNormalize\n\t\t\t// since the xmldom sax parser does not \"interpret\" DTD the following is not implemented:\n\t\t\t// - recursive replacement of (DTD) entity references\n\t\t\t// - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA\n\t\t\tvalue.replace(/[\\t\\n\\r]/g, ' ').replace(/&#?\\w+;/g, entityReplacer),\n\t\t\tstartIndex\n\t\t)\n\t}\n\tvar attrName;\n\tvar value;\n\tvar p = ++start;\n\tvar s = S_TAG;//status\n\twhile(true){\n\t\tvar c = source.charAt(p);\n\t\tswitch(c){\n\t\tcase '=':\n\t\t\tif(s === S_ATTR){//attrName\n\t\t\t\tattrName = source.slice(start,p);\n\t\t\t\ts = S_EQ;\n\t\t\t}else if(s === S_ATTR_SPACE){\n\t\t\t\ts = S_EQ;\n\t\t\t}else{\n\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '\\'':\n\t\tcase '\"':\n\t\t\tif(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t){//equal\n\t\t\t\tif(s === S_ATTR){\n\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"')\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t}\n\t\t\t\tstart = p+1;\n\t\t\t\tp = source.indexOf(c,start)\n\t\t\t\tif(p>0){\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start-1);\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t}else{\n\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\tthrow new Error('attribute value no end \\''+c+'\\' match');\n\t\t\t\t}\n\t\t\t}else if(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed start quot('+c+')!!');\n\t\t\t\tstart = p+1;\n\t\t\t\ts = S_ATTR_END\n\t\t\t}else{\n\t\t\t\t//fatalError: no equal before\n\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '/':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\ts =S_TAG_CLOSE;\n\t\t\t\tel.closed = true;\n\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\tcase S_ATTR:\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tbreak;\n\t\t\t//case S_EQ:\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"attribute invalid close char('/')\") // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase ''://end document\n\t\t\terrorHandler.error('unexpected end of input');\n\t\t\tif(s == S_TAG){\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\t}\n\t\t\treturn p;\n\t\tcase '>':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\tbreak;//normal\n\t\t\tcase S_ATTR_NOQUOT_VALUE://Compatible state\n\t\t\tcase S_ATTR:\n\t\t\t\tvalue = source.slice(start,p);\n\t\t\t\tif(value.slice(-1) === '/'){\n\t\t\t\t\tel.closed = true;\n\t\t\t\t\tvalue = value.slice(0,-1)\n\t\t\t\t}\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tif(s === S_ATTR_SPACE){\n\t\t\t\t\tvalue = attrName;\n\t\t\t\t}\n\t\t\t\tif(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\t}else{\n\t\t\t\t\tif(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed value!! \"'+value+'\" instead!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(value, value, start)\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase S_EQ:\n\t\t\t\tthrow new Error('attribute value missed!!');\n\t\t\t}\n//\t\t\tconsole.log(tagName,tagNamePattern,tagNamePattern.test(tagName))\n\t\t\treturn p;\n\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\tcase '\\u0080':\n\t\t\tc = ' ';\n\t\tdefault:\n\t\t\tif(c<= ' '){//space\n\t\t\t\tswitch(s){\n\t\t\t\tcase S_TAG:\n\t\t\t\t\tel.setTagName(source.slice(start,p));//tagName\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR:\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t//case S_EQ:\n\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t//\tvoid();break;\n\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t//ignore warning\n\t\t\t\t}\n\t\t\t}else{//not space\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\tswitch(s){\n\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tvar tagName = el.tagName;\n\t\t\t\t\tif (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed value!! \"'+attrName+'\" instead2!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\tstart = p;\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\terrorHandler.warning('attribute space is required\"'+attrName+'\"!!')\n\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_EQ:\n\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t}\n\t\t\t}\n\t\t}//end outer switch\n\t\t//console.log('p++',p)\n\t\tp++;\n\t}\n}\n/**\n * @return true if has new namespace define\n */\nfunction appendElement(el,domBuilder,currentNSMap){\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\n\t//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\tvar i = el.length;\n\twhile(i--){\n\t\tvar a = el[i];\n\t\tvar qName = a.qName;\n\t\tvar value = a.value;\n\t\tvar nsp = qName.indexOf(':');\n\t\tif(nsp>0){\n\t\t\tvar prefix = a.prefix = qName.slice(0,nsp);\n\t\t\tvar localName = qName.slice(nsp+1);\n\t\t\tvar nsPrefix = prefix === 'xmlns' && localName\n\t\t}else{\n\t\t\tlocalName = qName;\n\t\t\tprefix = null\n\t\t\tnsPrefix = qName === 'xmlns' && ''\n\t\t}\n\t\t//can not set prefix,because prefix !== ''\n\t\ta.localName = localName ;\n\t\t//prefix == null for no ns prefix attribute\n\t\tif(nsPrefix !== false){//hack!!\n\t\t\tif(localNSMap == null){\n\t\t\t\tlocalNSMap = {}\n\t\t\t\t//console.log(currentNSMap,0)\n\t\t\t\t_copy(currentNSMap,currentNSMap={})\n\t\t\t\t//console.log(currentNSMap,1)\n\t\t\t}\n\t\t\tcurrentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;\n\t\t\ta.uri = NAMESPACE.XMLNS\n\t\t\tdomBuilder.startPrefixMapping(nsPrefix, value)\n\t\t}\n\t}\n\tvar i = el.length;\n\twhile(i--){\n\t\ta = el[i];\n\t\tvar prefix = a.prefix;\n\t\tif(prefix){//no prefix attribute has no namespace\n\t\t\tif(prefix === 'xml'){\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}if(prefix !== 'xmlns'){\n\t\t\t\ta.uri = currentNSMap[prefix || '']\n\n\t\t\t\t//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}\n\t\t\t}\n\t\t}\n\t}\n\tvar nsp = tagName.indexOf(':');\n\tif(nsp>0){\n\t\tprefix = el.prefix = tagName.slice(0,nsp);\n\t\tlocalName = el.localName = tagName.slice(nsp+1);\n\t}else{\n\t\tprefix = null;//important!!\n\t\tlocalName = el.localName = tagName;\n\t}\n\t//no prefix element has default namespace\n\tvar ns = el.uri = currentNSMap[prefix || ''];\n\tdomBuilder.startElement(ns,localName,tagName,el);\n\t//endPrefixMapping and startPrefixMapping have not any help for dom builder\n\t//localNSMap = null\n\tif(el.closed){\n\t\tdomBuilder.endElement(ns,localName,tagName);\n\t\tif(localNSMap){\n\t\t\tfor (prefix in localNSMap) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}else{\n\t\tel.currentNSMap = currentNSMap;\n\t\tel.localNSMap = localNSMap;\n\t\t//parseStack.push(el);\n\t\treturn true;\n\t}\n}\nfunction parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){\n\tif(/^(?:script|textarea)$/i.test(tagName)){\n\t\tvar elEndStart = source.indexOf('',elStartEnd);\n\t\tvar text = source.substring(elStartEnd+1,elEndStart);\n\t\tif(/[&<]/.test(text)){\n\t\t\tif(/^script$/i.test(tagName)){\n\t\t\t\t//if(!/\\]\\]>/.test(text)){\n\t\t\t\t\t//lexHandler.startCDATA();\n\t\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\t\t//lexHandler.endCDATA();\n\t\t\t\t\treturn elEndStart;\n\t\t\t\t//}\n\t\t\t}//}else{//text area\n\t\t\t\ttext = text.replace(/&#?\\w+;/g,entityReplacer);\n\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\treturn elEndStart;\n\t\t\t//}\n\n\t\t}\n\t}\n\treturn elStartEnd+1;\n}\nfunction fixSelfClosed(source,elStartEnd,tagName,closeMap){\n\t//if(tagName in closeMap){\n\tvar pos = closeMap[tagName];\n\tif(pos == null){\n\t\t//console.log(tagName)\n\t\tpos = source.lastIndexOf('')\n\t\tif(pos',start+4);\n\t\t\t//append comment source.substring(4,end)//